def docx_docx_iter_block_items(parent: DOCX_CONTAINER_TYPE) \
        -> Iterator[DOCX_BLOCK_ITEM_TYPE]:
    # only called if docx loaded
    """
    Iterate through items of a DOCX file.

    See https://github.com/python-openxml/python-docx/issues/40.

    Yield each paragraph and table child within ``parent``, in document order.
    Each returned value is an instance of either :class:`Table` or
    :class:`Paragraph`. ``parent`` would most commonly be a reference to a main
    :class:`Document` object, but also works for a :class:`_Cell` object, which
    itself can contain paragraphs and tables.

    NOTE: uses internals of the ``python-docx`` (``docx``) library; subject to
    change; this version works with ``docx==0.8.5``.
    """
    if isinstance(parent, docx.document.Document):
        parent_elm = parent.element.body
    elif isinstance(parent, docx.table._Cell):
        parent_elm = parent._tc
    else:
        raise ValueError("something's not right")

    for child in parent_elm.iterchildren():
        if isinstance(child, docx.oxml.text.paragraph.CT_P):
            yield docx.text.paragraph.Paragraph(child, parent)
        elif isinstance(child, docx.oxml.table.CT_Tbl):
            yield docx.table.Table(child, parent)
def docx_docx_iter_block_items ( parent : DOCX_CONTAINER_TYPE ) -> Iterator [ DOCX_BLOCK_ITEM_TYPE ] : if isinstance ( parent , docx . document . Document ) : parent_elm = parent . element . body elif isinstance ( parent , docx . table . _Cell ) : parent_elm = parent . _tc else : raise ValueError ( "something's not right" ) for child in parent_elm . iterchildren ( ) : if isinstance ( child , docx . oxml . text . paragraph . CT_P ) : yield docx . text . paragraph . Paragraph ( child , parent ) elif isinstance ( child , docx . oxml . table . CT_Tbl ) : yield docx . table . Table ( child , parent )
Iterate through items of a DOCX file.

    See https://github.com/python-openxml/python-docx/issues/40.

    Yield each paragraph and table child within ``parent``, in document order.
    Each returned value is an instance of either :class:`Table` or
    :class:`Paragraph`. ``parent`` would most commonly be a reference to a main
    :class:`Document` object, but also works for a :class:`_Cell` object, which
    itself can contain paragraphs and tables.

    NOTE: uses internals of the ``python-docx`` (``docx``) library; subject to
    change; this version works with ``docx==0.8.5``.