;i UdZddlmZddlmZmZddlmZddlm Z ddl m Z ddl m Z ddlmZer0dd lmZdd lmZdd lmZdd lmZdd lmZddl mZddlmZddlmZdZde d<Gdde Z!d S)zBlock item container, used by body, cell, header, etc. Block level items are things like paragraph and table, although there are a few other specialized ones like structured document tags. ) annotations) TYPE_CHECKINGIterator) TypeAlias)CT_Tbl)CT_P) StoryChild ParagraphN) CT_Comment)CT_Body) CT_HdrFtr)CT_Tc)Length)ParagraphStyleTablez(CT_Body | CT_Comment | CT_HdrFtr | CT_TcrBlockItemElementcpeZdZdZdfd ZdddZddZd dZedZ edZ dZ xZ S)!BlockItemContaineraBase class for proxy objects that can contain block items. These containers include _Body, _Cell, header, footer, footnote, endnote, comment, and text box objects. Provides the shared functionality to add a block item like a paragraph or table. elementrparentt.ProvidesStoryPartcftt||||_dS)N)superr__init___element)selfrr __class__s AC:\PYTHON\MyICR_Workspace\venv\Lib\site-packages\docx/blkcntnr.pyrzBlockItemContainer.__init__)s-  $''00888 Ntextstrstylestr | ParagraphStyle | Nonereturnr cn|}|r|||||_|S)a>Return paragraph newly added to the end of the content in this container. The paragraph has `text` in a single run if present, and is given paragraph style `style`. If `style` is |None|, no paragraph style is applied, which has the same effect as applying the 'Normal' style. )_add_paragraphadd_runr%)rr#r% paragraphs r add_paragraphz BlockItemContainer.add_paragraph-sD''))  $   d # # #  #IOr!rowsintcolswidthrrcddlm}tj|||}|j||||S)zReturn table of `width` having `rows` rows and `cols` columns. The table is appended appended at the end of the content in this container. `width` is evenly distributed between the table columns. rr) docx.tablerrnew_tblr _insert_tbl)rr-r/r0rtbls r add_tablezBlockItemContainer.add_table=sQ %$$$$$nT4// !!#&&&uS$r!Iterator[Paragraph | Table]c#Kddlm}|jjD]5}t |t rt ||n |||V6dS)zIGenerate each `Paragraph` or `Table` in this container in document order.rrN)r2rrinner_content_elements isinstancerr )rrrs r iter_inner_contentz%BlockItemContainer.iter_inner_contentJsu$$$$$$}; d dG/9'4/H/Hb9Wd+++eeT[]aNbNb c c c c d dr!c4fdjjDS)zcA list containing the paragraphs in this container, in document order. Read-only. c0g|]}t|Sr ).0prs r z1BlockItemContainer.paragraphs..Ws#@@@q !T""@@@r!)rp_lstrs`r paragraphszBlockItemContainer.paragraphsQs% A@@@DM,?@@@@r!cDddlmfdjjDS)z_A list containing the tables in this container, in document order. Read-only. rrc(g|]}|Sr>r>)r?r5rrs r rAz-BlockItemContainer.tables..as%BBBSc4  BBBr!)r2rrtbl_lst)rrs`@r tableszBlockItemContainer.tablesYs: %$$$$$BBBBBDM,ABBBBr!cPt|j|S)zIReturn paragraph newly added to the end of the content in this container.)r radd_prCs r r)z!BlockItemContainer._add_paragraphcs ,,..555r!)rrrr)r"N)r#r$r%r&r'r )r-r.r/r.r0rr'r)r'r7) __name__ __module__ __qualname____doc__rr,r6r;propertyrDrHr) __classcell__)rs@r rr!s           ddddAAXACCXC6666666r!r)"rN __future__rtypingrrtyping_extensionsrdocx.oxml.tablerdocx.oxml.text.paragraphr docx.sharedr docx.text.paragraphr docx.typestypestdocx.oxml.commentsr docx.oxml.documentr docx.oxml.sectionrrrdocx.styles.stylerr2rr__annotations__rr>r!r r`s #"""""********''''''""""""))))))""""""))))))!------******++++++%%%%%%""""""000000      HHHHHD6D6D6D6D6D6D6D6D6D6r!