+
    iJ                    J   R t ^ RIHt ^ RIHtHtHt ^ RIHtH	t	H
t
 ^ RIHt ^ RIHtHt ^ RIHt ^ RIHt ^ RIHtHtHtHtHt ^ R	IHt ^ R
IHtHtHtH t H!t!H"t"H#t# ^ RI$H%t%H&t&H't' ]'       d   ^ RIH(t( ^ RI)H*t* ^ RIH+t+H,t, ^ RI-H.t.  ! R R]4      t/ ! R R]4      t0 ! R R]4      t1 ! R R]4      t2 ! R R]4      t3 ! R R]4      t4 ! R R]4      t5 ! R R]4      t6 ! R  R!]4      t7 ! R" R#]4      t8 ! R$ R%]4      t9 ! R& R']4      t: ! R( R)]4      t; ! R* R+]4      t<R,# )-z"Custom element classes for tables.)annotations)TYPE_CHECKINGCallablecast)WD_CELL_VERTICAL_ALIGNMENTWD_ROW_HEIGHT_RULEWD_TABLE_DIRECTION)InvalidSpanError)nsdeclsqn)	parse_xml)CT_DecimalNumber)ST_MergeST_TblLayoutTypeST_TblWidthST_TwipsMeasureXsdInt)CT_P)BaseOxmlElementOneAndOnlyOne	OneOrMoreOptionalAttributeRequiredAttribute
ZeroOrMore	ZeroOrOne)EmuLengthTwips)WD_TABLE_ALIGNMENT)WD_ALIGN_PARAGRAPH)CT_OnOff	CT_String)CT_Jcc                  T    ] tR t^&t$ Rt]! R]4      tR]R&   ]! R]	4      t
R]R&   RtR	# )
	CT_HeightzBUsed for `w:trHeight` to specify a row height and row height rule.w:valLength | Nonevalzw:hRuleWD_ROW_HEIGHT_RULE | NonehRule N)__name__
__module____qualname____firstlineno____doc__r   r   r'   __annotations__r   r)   __static_attributes__r*       V/Users/agent/.openclaw/workspace/.venv/lib/python3.14/site-packages/docx/oxml/table.pyr$   r$   &   s5    L*C  (9%(E$ r2   r$   c                  n   ] tR t^1t$ RtR]R&   R]R&   R]R&   R]R&   ]! R	4      tR
]R&   ]! R4      tR]R&   ]	! R4      t
]R R l4       t]R R l4       tR R lt]R R l4       t]R R l4       t]P"                  R R l4       t]R 4       t]P"                  R R l4       tR R  ltR! R" ltR# tR$tR%# )&CT_Rowz``<w:tr>`` element.zCallable[[], CT_Tc]add_tczCallable[[], CT_TrPr]get_or_add_trPr	_add_trPrzlist[CT_Tc]tc_lstz	w:tblPrExzCT_TblPrEx | NonetblPrExzw:trPrzCT_TrPr | NonetrPrzw:tcc                   V ^8  d   QhRR/#    returnintr*   )formats   "r3   __annotate__CT_Row.__annotate__@   s      C r2   c                >    V P                   pVf   ^ # VP                  # zCThe number of unpopulated layout-grid cells at the end of this row.)r;   
grid_afterselfr;   s   & r3   rF   CT_Row.grid_after?   s     yy<r2   c                   V ^8  d   QhRR/# r=   r*   )rA   s   "r3   rB   rC   H   s        S  r2   c                >    V P                   pVf   ^ # VP                  # zEThe number of unpopulated layout-grid cells at the start of this row.)r;   grid_beforerG   s   & r3   rM   CT_Row.grid_beforeG   s!     yy<r2   c                    V ^8  d   QhRRRR/# )r>   grid_offsetr@   r?   CT_Tcr*   )rA   s   "r3   rB   rC   O   s     J JS JU Jr2   c                    WP                   ,
          pV P                   F)  pV^ 8  d    M!V^ 8X  d   Vu # W#P                  ,          pK+  	  \        RV 24      h)zThe `tc` element in this tr at exact `grid offset`.

Raises ValueError when this `w:tr` contains no `w:tc` with exact starting `grid_offset`.
zno `tc` element at grid_offset=)rM   r9   	grid_span
ValueError)rH   rP   remaining_offsettcs   &&  r3   tc_at_grid_offsetCT_Row.tc_at_grid_offsetO   s]     ')9)99++B!#1$	 ,  :;-HIIr2   c                   V ^8  d   QhRR/# r=   r*   )rA   s   "r3   rB   rC   e   s     & & &r2   c                t    \        \        V P                  4       4      pVP                  P	                  V 4      # )z?Index of this `w:tr` element within its parent `w:tbl` element.)r   CT_Tbl	getparenttr_lstindex)rH   tbls   & r3   tr_idxCT_Row.tr_idxd   s,     64>>+,zz%%r2   c                   V ^8  d   QhRR/# r>   r?   r(   r*   )rA   s   "r3   rB   rC   k   s     # # 9 #r2   c                >    V P                   pVf   R# VP                  # )zFThe value of `./w:trPr/w:trHeight/@w:hRule`, or |None| if not present.N)r;   trHeight_hRulerG   s   & r3   re   CT_Row.trHeight_hRulej   s!     yy<"""r2   c                   V ^8  d   QhRR/# r>   valuer(   r*   )rA   s   "r3   rB   rC   s   s     $ $$= $r2   c                	2    V P                  4       pWn        R # N)r7   re   rH   ri   r;   s   && r3   re   rf   r   s    ##%#r2   c                >    V P                   pVf   R# VP                  # )zHReturn the value of `w:trPr/w:trHeight@w:val`, or |None| if not present.N)r;   trHeight_valrG   s   & r3   rn   CT_Row.trHeight_valw   s!     yy<   r2   c                   V ^8  d   QhRR/# r>   ri   r&   r*   )rA   s   "r3   rB   rC      s     " "- "r2   c                	2    V P                  4       pWn        R # rk   )r7   rn   rl   s   && r3   rn   ro      s    ##%!r2   c                   V ^8  d   QhRR/# )r>   r:   
CT_TblPrExr*   )rA   s   "r3   rB   rC      s        z  r2   c                	*    V P                  ^ V4       R# )    Ninsert)rH   r:   s   &&r3   _insert_tblPrExCT_Row._insert_tblPrEx   s    Awr2   c                   V ^8  d   QhRR/# )r>   r;   CT_TrPrr*   )rA   s   "r3   rB   rC      s     ! ! !r2   c                	p    V P                   pVe   VP                  V4       R # V P                  ^ V4       R # rk   )r:   addnextrx   )rH   r;   r:   s   && r3   _insert_trPrCT_Row._insert_trPr   s+    ,,OOD!KK4 r2   c                	*    \         P                  4       # rk   )rQ   newrH   s   &r3   _new_tcCT_Row._new_tc   s    yy{r2   r*   N)r+   r,   r-   r.   r/   r0   r   r:   r;   r   rV   propertyrF   rM   rW   r`   re   setterrn   ry   r   r   r1   r*   r2   r3   r5   r5   1   s    **$$!*;!7G7$X.D..	F	B     J* & &
 # # $ $ ! ! " " !r2   r5   c                  x   ] tR t^t$ RtR]R&   R]R&   ]! R4      tR]R&   ]! R	4      tR
]R&   ]	! R4      t
]R R l4       t]P                  R R l4       t]R 4       tR t]R R l4       t]R R l4       t]P                  R R l4       t]R R l4       t]R R l4       t]R R l4       t]R R  l4       tR!tR"# )#r[   z``<w:tbl>`` element.zCallable[[], CT_Row]add_trzlist[CT_Row]r]   zw:tblPrCT_TblPrtblPrz	w:tblGrid
CT_TblGridtblGridzw:trc                   V ^8  d   QhRR/# )r>   r?   zbool | Noner*   )rA   s   "r3   rB   CT_Tbl.__annotate__   s       r2   c                R    V P                   P                  pVf   R# VP                  # )zValue of `./w:tblPr/w:bidiVisual/@w:val` or |None| if not present.

Controls whether table cells are displayed right-to-left or left-to-right.
N)r   
bidiVisualr'   )rH   r   s   & r3   bidiVisual_valCT_Tbl.bidiVisual_val   s&     ZZ**
~~r2   c                   V ^8  d   QhRR/# )r>   ri   zWD_TABLE_DIRECTION | Noner*   )rA   s   "r3   rB   r      s     < <$= <r2   c                	    V P                   pVf   VP                  4        R # \        V4      VP                  4       n        R # rk   )r   _remove_bidiVisualboolget_or_add_bidiVisualr'   )rH   ri   r   s   && r3   r   r      s1    

=$$&04UE'')-r2   c                @    \        V P                  P                  4      # )z)The number of grid columns in this table.)lenr   gridCol_lstr   s   &r3   	col_countCT_Tbl.col_count   s     4<<++,,r2   c              #  b   "   V P                    F  pVP                   F  pVx  K	  	  K  	  R# 5i)zGenerate each of the `w:tc` elements in this table, left to right and top to
bottom.

Each cell in the first row is generated, followed by each cell in the second
row, etc.
N)r]   r9   )rH   trrV   s   &  r3   iter_tcsCT_Tbl.iter_tcs   s(      ++Bii   s   -/c               (    V ^8  d   QhRRRRRRRR/# )r>   rowsr@   colswidthr   r?   r[   r*   )rA   s   "r3   rB   r      s.     H H3 Hc H& HV Hr2   c           
     T    \        \        \        V P                  WV4      4      4      # )zxReturn a new `w:tbl` element having `rows` rows and `cols` columns.

`width` is distributed evenly between the columns.
)r   r[   r   _tbl_xml)clsr   r   r   s   &&&&r3   new_tblCT_Tbl.new_tbl   s!     FIcll4u&EFGGr2   c                   V ^8  d   QhRR/# r>   r?   
str | Noner*   )rA   s   "r3   rB   r      s      j r2   c                R    V P                   P                  pVf   R# VP                  # )zH`w:tblPr/w:tblStyle/@w:val` (a table style id) or |None| if not present.N)r   tblStyler'   rH   r   s   & r3   tblStyle_valCT_Tbl.tblStyle_val   s&     ::&&||r2   c                    V ^8  d   QhRRRR/# )r>   styleIdr   r?   Noner*   )rA   s   "r3   rB   r      s     	, 	,J 	,4 	,r2   c                r    V P                   pVP                  4        Vf   R# WP                  4       n        R# )zSet the value of `w:tblPr/w:tblStyle/@w:val` (a table style id) to `styleId`.

If `styleId` is None, remove the `w:tblStyle` element.
N)r   _remove_tblStyle_add_tblStyler'   )rH   r   r   s   && r3   r   r      s0     

 ?$+!r2   c               (    V ^8  d   QhRRRRRRRR/# )r>   r   r@   r   r   r   r?   strr*   )rA   s   "r3   rB   r      s(     
 
C 
s 
6 
c 
r2   c           	     	    V^ 8  d   \        W2,          4      M
\        ^ 4      pR\        R4       RV P                  W$4       V P                  WV4       R2# )rv   z<w:tbl wz>
  <w:tblPr>
    <w:tblW w:type="auto" w:w="0"/>
    <w:tblLook w:firstColumn="1" w:firstRow="1"
               w:lastColumn="0" w:lastRow="0" w:noHBand="0"
               w:noVBand="1" w:val="04A0"/>
  </w:tblPr>
z	</w:tbl>
)r   r
   _tblGrid_xml_trs_xml)r   r   r   r   	col_widths   &&&& r3   r   CT_Tbl._tbl_xml   s[    *.(C&A	gcl^ $ 01||D	23		
r2   c               $    V ^8  d   QhRRRRRR/# r>   r   r@   r   r   r?   r   r*   )rA   s   "r3   rB   r      s!      S V  r2   c                	t    R p\        V4       F  pVRVP                  ,          ,          pK  	  VR,          pV# )z  <w:tblGrid>
z    <w:gridCol w:w="%d"/>
z  </w:tblGrid>
)rangetwips)r   r   r   xml_s   &&&  r3   r   CT_Tbl._tblGrid_xml   s:    y!A09??BBC "!!
r2   c               (    V ^8  d   QhRRRRRRRR/# )r>   	row_countr@   r   r   r   r?   r   r*   )rA   s   "r3   rB   r      s.     X X X X XC Xr2   c                	:    R V P                  W#4       R2V,          # )z	  <w:tr>
z
  </w:tr>
)_tcs_xml)r   r   r   r   s   &&&&r3   r   CT_Tbl._trs_xml   s     CLL>?{KiWWr2   c               $    V ^8  d   QhRRRRRR/# r   r*   )rA   s   "r3   rB   r      s!        C r2   c                	0    R VP                    R2V,          # )z;    <w:tc>
      <w:tcPr>
        <w:tcW w:type="dxa" w:w="z-"/>
      </w:tcPr>
      <w:p/>
    </w:tc>
)r   )r   r   r   s   &&&r3   r   CT_Tbl._tcs_xml   s+    009/@ A  	r2   r*   N)r+   r,   r-   r.   r/   r0   r   r   r   r   r   r   r   r   r   r   classmethodr   r   r   r   r   r   r1   r*   r2   r3   r[   r[      s     #I.E8.'4GZ4	F	B  < < - -	 H H   	, 	, 
 
   X X  r2   r[   c                  D    ] tR tRt$ RtR]R&   R]R&   ]! RRR7      tR	tR
# )r   i  zi`w:tblGrid` element.

Child of `w:tbl`, holds `w:gridCol> elements that define column count, width, etc.
zCallable[[], CT_TblGridCol]add_gridColzlist[CT_TblGridCol]r   z	w:gridCol
successorsr*   N)zw:tblGridChange)	r+   r,   r-   r.   r/   r0   r   gridColr1   r*   r2   r3   r   r     s"    
 -,$$1EFGr2   r   c                  N    ] tR tRt$ Rt]! R]4      tR]R&   ]	R R l4       t
RtR	# )
CT_TblGridColi  zB`w:gridCol` element, child of `w:tblGrid`, defines a table column.w:wr&   r   c                   V ^8  d   QhRR/# r=   r*   )rA   s   "r3   rB   CT_TblGridCol.__annotate__  s     / /S /r2   c                t    \        \        V P                  4       4      pVP                  P	                  V 4      # )zHIndex of this `w:gridCol` element within its parent `w:tblGrid` element.)r   r   r\   r   r^   )rH   r   s   & r3   gridCol_idxCT_TblGridCol.gridCol_idx  s.     z4>>#34""((..r2   r*   N)r+   r,   r-   r.   r/   r   r   r   r0   r   r   r1   r*   r2   r3   r   r     s/    L(A}  / /r2   r   c                  8    ] tR tRt$ Rt]! R]4      tR]R&   Rt	R# )CT_TblLayoutTypei  zu`w:tblLayout` element.

Specifies whether column widths are fixed or can be automatically adjusted based on
content.
w:typer   typer*   N)
r+   r,   r-   r.   r/   r   r   r   r0   r1   r*   r2   r3   r   r     s      )"D* r2   r   c                     ] tR tRt$ RtR]R&   R]R&   R]R&   R	]R
&   R]R&   R]R&   R]R&   R-t]! R]R,          R7      tR]R&   ]! R]R,          R7      t	R]R&   ]! R]R,          R7      t
R]R&   ]! R]R,          R7      tR]R&   A]R  R! l4       t]P                  R" R# l4       t]R$ R% l4       t]P                  R& R' l4       t]R( 4       t]P                  R) R* l4       tR+tR,# ).r   i)  zy``<w:tblPr>`` element, child of ``<w:tbl>``, holds child elements that define
table properties such as style and borders.zCallable[[], CT_OnOff]r   zCallable[[], CT_Jc]get_or_add_jczCallable[[], CT_TblLayoutType]get_or_add_tblLayoutzCallable[[], CT_String]r   Callable[[], None]r   
_remove_jcr   
w:tblStylew:bidiVisualw:jcw:tblLayout:   NNr   zCT_String | Noner      NNzCT_OnOff | Noner      NNzCT_Jc | Nonejc:   NNzCT_TblLayoutType | None	tblLayoutc                   V ^8  d   QhRR/# )r>   r?   WD_TABLE_ALIGNMENT | Noner*   )rA   s   "r3   rB   CT_TblPr.__annotate__X  s     9 94 9r2   c                R    V P                   pVf   R# \        RVP                  4      # )zAHorizontal alignment of table, |None| if `./w:jc` is not present.Nr   )r   r   r'   )rH   r   s   & r3   	alignmentCT_TblPr.alignmentW  s'     WW:/88r2   c                   V ^8  d   QhRR/# )r>   ri   r   r*   )rA   s   "r3   rB   r   `  s     3 38 3r2   c                	t    V P                  4        Vf   R # V P                  4       p\        RV4      Vn        R # )Nr   )r   r   r   r'   )rH   ri   r   s   && r3   r   r   _  s1    =!*E2r2   c                   V ^8  d   QhRR/# r>   r?   r   r*   )rA   s   "r3   rB   r   h  s     H H Hr2   c                D    V P                   pVf   R# VP                  R8g  # )zW|False| when there is a `w:tblLayout` child with `@w:type="fixed"`.

Otherwise |True|.
Tfixed)r   r   )rH   r   s   & r3   autofitCT_TblPr.autofitg  s&     NN	 (tGinn.GGr2   c                   V ^8  d   QhRR/# )r>   ri   r   r*   )rA   s   "r3   rB   r   q  s     9 9T 9r2   c                	V    V P                  4       pV'       d
   R Vn        R# RVn        R# )r   r   N)r   r   )rH   ri   r   s   && r3   r   r  p  s    --/	&+		r2   c                >    V P                   pVf   R# VP                  # )zaReturn the value of the ``val`` attribute of the ``<w:tblStyle>`` child or
|None| if not present.N)r   r'   r   s   & r3   styleCT_TblPr.styleu  s      ==||r2   c                   V ^8  d   QhRR/# r>   ri   r   r*   )rA   s   "r3   rB   r     s     ) ): )r2   c                	Z    V P                  4        Vf   R # WP                  4       n        R # rk   )r   r   r'   rH   ri   s   &&r3   r  r  ~  s%    =#( r2   r*   N)r   zw:tblpPrzw:tblOverlapr   zw:tblStyleRowBandSizezw:tblStyleColBandSizezw:tblWr   w:tblCellSpacingzw:tblIndzw:tblBordersw:shdr   zw:tblCellMarz	w:tblLookzw:tblCaptionzw:tblDescriptionzw:tblPrChange)r+   r,   r-   r.   r/   r0   _tag_seqr   r   r   r   r   r   r   r   r   r  r1   r*   r2   r3   r   r   )  s7   3 21&&88****""((H( "+""H  #,8B<#J  !8B<B  *3(3-*I&  	9 9 3 3 H H ^^9 9   \\) )r2   r   c                      ] tR tRtRtRtR# )rt   i  z`w:tblPrEx` element, exceptions to table-properties.

Applied at a lower level, like a `w:tr` to modify the appearance. Possibly used when
two tables are merged. For more see:
http://officeopenxml.com/WPtablePropertyExceptions.php
r*   N)r+   r,   r-   r.   r/   r1   r*   r2   r3   rt   rt     s    r2   rt   c                      ] tR tRt$ Rt]! R]4      tR]R&   ]! R]	4      t
]R R l4       t]P                  R	 R
 l4       tRtR# )CT_TblWidthi  zJUsed for `w:tblW` and `w:tcW` and others, specifies a table-related width.r   r@   r   r   c                   V ^8  d   QhRR/# r>   r?   r&   r*   )rA   s   "r3   rB   CT_TblWidth.__annotate__  s      } r2   c                R    V P                   R8w  d   R# \        V P                  4      # )z>EMU length indicated by the combined `w:w` and `w:type` attrs.dxaN)r   r   r   r   s   &r3   r   CT_TblWidth.width  s!     99TVV}r2   c                   V ^8  d   QhRR/# r>   ri   r   r*   )rA   s   "r3   rB   r    s     " "6 "r2   c                	H    R V n         \        V4      P                  V n        R# )r  N)r   r   r   r   r
  s   &&r3   r   r    s    	U!!r2   )r   r   N)r+   r,   r-   r.   r/   r   r   r   r0   r   r   r   r   r   r1   r*   r2   r3   r  r    sN    T
 uf-As-X{3D  \\" "r2   r  c                  :   ] tR tRt$ RtR]R&   R]R&   R]R&   R	]R
&   R]R&   R]R&   ]! R4      tR]R&   ]! R4      t	]! R4      t
]R R l4       tR t]R R l4       t]R R l4       t]P                   R R l4       t]R R l4       tR t]R R  l4       tR! R" lt]R# R$ l4       t]R% R& l4       t]R' R( l4       t]R) R* l4       t]P                   R+ R, l4       t]R- R. l4       t]P                   R/ R0 l4       tR1 R2 ltRWR4 R5 lltR6 R7 lt]R8 R9 l4       tR: R; ltR< R= lt ]R> R? l4       t!R@ t"RA t#RB RC lt$RD RE lt%RF RG lt&]RH RI l4       t']RJ RK l4       t(]RL RM l4       t)]RN RO l4       t*]RP RQ l4       t+]RR RS l4       t,]RT RU l4       t-RVt.R3# )XrQ   i  z`w:tc` table cell element.zCallable[[], CT_P]add_pzCallable[[], CT_TcPr]get_or_add_tcPrz
list[CT_P]p_lstzlist[CT_Tbl]tbl_lstzCallable[[CT_Tbl], CT_Tbl]_insert_tbl_new_pzw:tcPrzCT_TcPr | NonetcPrw:pw:tblc                   V ^8  d   QhRR/# r=   r*   )rA   s   "r3   rB   CT_Tc.__annotate__  s     
  
  
 r2   c                    V P                   e<   V P                  pVe,   VP                   \        P                  8X  d   VP                  # V P
                  ^,           # )zThe row index that marks the bottom extent of the vertical span of this cell.

This is one greater than the index of the bottom-most row of the span, similar
to how a slice of the cell's rows would be specified.
)vMerge	_tc_belowr   CONTINUEbottom_tr_idx)rH   tc_belows   & r3   r*  CT_Tc.bottom  sG     ;;"~~H#8;L;L(L&||ar2   c                X    V P                  R4       F  pV P                  V4       K  	  R# )a  Remove all content elements, preserving `w:tcPr` element if present.

Note that this leaves the `w:tc` element in an invalid state because it doesn't
contain at least one block-level element. It's up to the caller to add a
`w:p`child element as the last content element.
z./*[not(self::w:tcPr)]N)xpathremove)rH   es   & r3   clear_contentCT_Tc.clear_content  s#     45AKKN 6r2   c                   V ^8  d   QhRR/# r=   r*   )rA   s   "r3   rB   r%    s     	5 	5S 	5r2   c                    V P                   P                  p\        R V P                  R4       4       4      pW,           # )zsStarting offset of `tc` in the layout-grid columns of its table.

A cell in the leftmost grid-column has offset 0.
c              3  8   "   T F  qP                   x  K  	  R # 5irk   )rS   ).0rV   s   & r3   	<genexpr>$CT_Tc.grid_offset.<locals>.<genexpr>  s      &
#JRLL#Js   z./preceding-sibling::w:tc)_trrM   sumr/  )rH   rM   preceding_tc_grid_spanss   &  r3   rP   CT_Tc.grid_offset  s@     hh**"% &
#'::.I#J&
 #
 44r2   c                   V ^8  d   QhRR/# r=   r*   )rA   s   "r3   rB   r%    s     5 53 5r2   c                >    V P                   pVf   ^# VP                  # )zjThe integer number of columns this cell spans.

Determined by ./w:tcPr/w:gridSpan/@val, it defaults to 1.
)r!  rS   rH   r!  s   & r3   rS   CT_Tc.grid_span  s      yyLq4dnn4r2   c                   V ^8  d   QhRR/# r>   ri   r@   r*   )rA   s   "r3   rB   r%    s      s r2   c                	2    V P                  4       pWn        R # rk   )r  rS   rH   ri   r!  s   && r3   rS   rA    s    ##%r2   c                   V ^8  d   QhRR/# )r>   r?   zlist[CT_P | CT_Tbl]r*   )rA   s   "r3   rB   r%    s     - -(; -r2   c                $    V P                  R4      # )zGenerate all `w:p` and `w:tbl` elements in this document-body.

Elements appear in document order. Elements shaded by nesting in a `w:ins` or
other "wrapper" element will not be included.
z./w:p | ./w:tblr/  r   s   &r3   inner_content_elementsCT_Tc.inner_content_elements  s     zz+,,r2   c              #     "   \        R4      \        R4      \        R4      3pV  F  pVP                  V9   g   K  Vx  K  	  R# 5i)zhGenerate a reference to each of the block-level content elements in this
cell, in the order they appear.r"  r#  zw:sdtN)r   tag)rH   block_item_tagschilds   &  r3   iter_block_itemsCT_Tc.iter_block_items  s:      e9bk2g;?EyyO+ s
   4A
Ac                   V ^8  d   QhRR/# r=   r*   )rA   s   "r3   rB   r%    s        c  r2   c                    V P                   # )z?The grid column index at which this ``<w:tc>`` element appears.)rP   r   s   &r3   left
CT_Tc.left  s     r2   c                    V ^8  d   QhRRRR/# )r>   other_tcrQ   r?   r*   )rA   s   "r3   rB   r%    s     	 	e 	 	r2   c                    V P                  V4      w  r#rEV P                  P                  V,          P                  V4      pVP	                  WT4       V# )zReturn top-left `w:tc` element of a new span.

Span is formed by merging the rectangular region defined by using this tc
element and `other_tc` as diagonal corners.
)_span_dimensions_tblr]   rW   _grow_to)rH   rV  toprS  heightr   top_tcs   &&     r3   mergeCT_Tc.merge  sI     $(#8#8#B 6!!#&88>&r2   c                   V ^8  d   QhRR/# r>   r?   rQ   r*   )rA   s   "r3   rB   r%    s     O OE Or2   c           	     T    \        \        \        R\        R4      ,          4      4      # )zUA new `w:tc` element, containing an empty paragraph as the required EG_BlockLevelElt.z<w:tc %s><w:p/></w:tc>r   )r   rQ   r   r
   )r   s   &r3   r   	CT_Tc.new  s      E9%=%LMNNr2   c                   V ^8  d   QhRR/# r=   r*   )rA   s   "r3   rB   r%    s     1 1s 1r2   c                <    V P                   V P                  ,           # )zThe grid column index that marks the right-side extent of the horizontal span
of this cell.

This is one greater than the index of the right-most column of the span, similar
to how a slice of the cell's columns would be specified.
)rP   rS   r   s   &r3   rightCT_Tc.right  s     $..00r2   c                   V ^8  d   QhRR/# r=   r*   )rA   s   "r3   rB   r%    s     " "S "r2   c                    V P                   e    V P                   \        P                  8X  d   V P                  # V P                  P
                  # )z9The top-most row index in the vertical span of this cell.)r'  r   RESTARTr+  	_tc_abover[  r   s   &r3   r[  	CT_Tc.top  s9     ;;$++1A1A"A<<~~!!!r2   c                   V ^8  d   QhRR/# r   r*   )rA   s   "r3   rB   r%    s      
 r2   c                >    V P                   pVf   R# VP                  # )zCValue of ./w:tcPr/w:vMerge/@val, |None| if w:vMerge is not present.N)r!  
vMerge_valr@  s   & r3   r'  CT_Tc.vMerge  s     yy<r2   c                   V ^8  d   QhRR/# r  r*   )rA   s   "r3   rB   r%  &  s        J  r2   c                	2    V P                  4       pWn        R # rk   )r  ro  rE  s   && r3   r'  rp  %  s    ##%r2   c                   V ^8  d   QhRR/# r  r*   )rA   s   "r3   rB   r%  +  s      } r2   c                >    V P                   pVf   R# VP                  # )zDEMU length represented in `./w:tcPr/w:tcW` or |None| if not present.N)r!  r   r@  s   & r3   r   CT_Tc.width*  s     yy<zzr2   c                   V ^8  d   QhRR/# r  r*   )rA   s   "r3   rB   r%  3  s      6 r2   c                	2    V P                  4       pWn        R # rk   )r  r   rE  s   && r3   r   ru  2  s    ##%
r2   c                   V ^8  d   QhRR/# r>   rV  rQ   r*   )rA   s   "r3   rB   r%  7  s     = =e =r2   c                    V P                   '       dB   VP                   '       d.   \        V P                   VP                   ,           4      V n         R# R# R# )zyAdd the width of `other_tc` to this cell.

Does nothing if either this tc or `other_tc` does not have a specified width.
N)r   r   )rH   rV  s   &&r3   _add_width_ofCT_Tc._add_width_of7  s5    
 :::(...

X^^ ;<DJ ):r2   Nc               $    V ^8  d   QhRRRRRR/# )r>   r   r@   r\  r]  CT_Tc | Noner*   )rA   s   "r3   rB   r%  ?  s!     9 9c 93 9 9r2   c                   a a R VV 3R llpVf   S MTpS P                  WV! V4      4       S^8  d/   S P                  pVf   Q hVP                  VS^,
          V4       R# R# )zGrow this cell to `width` grid columns and `height` rows.

This is accomplished by expanding horizontal spans and creating continuation
cells to form vertical spans.
c                   V ^8  d   QhRR/# )r>   r]  rQ   r*   )rA   s   "r3   rB   $CT_Tc._grow_to.<locals>.__annotate__F  s     	 	u 	r2   c                b   < V SJd   \         P                  # S^8X  d   R# \         P                  # r   N)r   r)  rj  )r]  r\  rH   s   &r3   ro  "CT_Tc._grow_to.<locals>.vMerge_valF  s@     % !! Q; 
 %%r2   N)_span_to_widthr(  rZ  )rH   r   r\  r]  ro  r,  s   f&f&  r3   rZ  CT_Tc._grow_to?  sf    	 	  VE:f+=>A:~~H'''eVaZ8 r2   c                    V ^8  d   QhRRRR/# )r>   r!  CT_TcPrr?   r*   )rA   s   "r3   rB   r%  V  s       W r2   c                *    V P                  ^ V4       V# )z#Override default `._insert_tcPr()`.rw   r@  s   &&r3   _insert_tcPrCT_Tc._insert_tcPrV  s     	Atr2   c                   V ^8  d   QhRR/# r   r*   )rA   s   "r3   rB   r%  ^  s     I I4 Ir2   c                    \        V P                  4       4      p\        V4      ^8  d   R# V^ ,          p\        V\        4      ;'       d    \        VP
                  4      ^ 8H  # )z=True if this cell contains only a single empty `w:p` element.F)listrO  r   
isinstancer   r_lst)rH   block_items	only_items   &  r3   	_is_emptyCT_Tc._is_empty]  sU     40023{a  N	)T*HHs9??/Cq/HHr2   c                   V ^8  d   QhRR/# ry  r*   )rA   s   "r3   rB   r%  h  s     # # #r2   c                    WJ d   R# V P                   '       d   R# VP                  4        V P                  4        F  pVP                  V4       K  	  V P                  V P	                  4       4       R# )zhAppend the content of this cell to `other_tc`.

Leaves this cell with a single empty ``<w:p>`` element.
N)r  _remove_trailing_empty_prO  appendr   )rH   rV  block_elements   && r3   _move_content_toCT_Tc._move_content_toh  sX    
 >>>))+!224MOOM* 5 	DKKM"r2   c                   V ^8  d   QhRR/# )r>   r?   r   r*   )rA   s   "r3   rB   r%  x  s     
 
$ 
r2   c                	    \        R 4      h)zDuse CT_Tbl.new_tbl() to add a new table, specifying rows and columns)NotImplementedErrorr   s   &r3   _new_tblCT_Tc._new_tblx  s    !R
 	
r2   c                   V ^8  d   QhRR/# r>   r?   r~  r*   )rA   s   "r3   rB   r%  ~  s     ; ;, ;r2   c                J    V P                  R4      pV'       d
   V^ ,          # R# )zwThe `w:tc` element immediately following this one in this row, or |None| if
this is the last `w:tc` element in the row.z./following-sibling::w:tcNrH  )rH   following_tcss   & r3   _next_tcCT_Tc._next_tc}  s%     

#>?#0}Q:d:r2   c                T    V P                  4       pVf   Q hVP                  V 4       R# )z-Remove this `w:tc` element from the XML tree.N)r\   r0  )rH   parent_elements   & r3   _removeCT_Tc._remove  s(    ))))d#r2   c                    \        V P                  4       4      pVR,          p\        V\        4      '       g   R# Tp\	        VP
                  4      ^ 8  d   R# V P                  V4       R# )zJRemove last content element from this cell if it's an empty `w:p` element.N)r  rO  r  r   r   r  r0  )rH   r  last_content_elmps   &   r3   r  CT_Tc._remove_trailing_empty_p  sS    40023&r?*D11qww<!Ar2   c                    V ^8  d   QhRRRR/# )r>   rV  rQ   r?   ztuple[int, int, int, int]r*   )rA   s   "r3   rB   r%    s     5 5 53L 5r2   c                \   R R lpR R lpV! W4       V! W4       \        V P                  VP                  4      p\        V P                  VP                  4      p\        V P                  VP                  4      p\        V P
                  VP
                  4      pWEWd,
          Wu,
          3# )zReturn a (top, left, height, width) 4-tuple specifying the extents of the
merged cell formed by using this tc and `other_tc` as opposite corner
extents.c                    V ^8  d   QhRRRR/# r>   arQ   br*   )rA   s   "r3   rB   ,CT_Tc._span_dimensions.<locals>.__annotate__  s     	I 	I5 	IU 	Ir2   c                   V P                   VP                   8X  d'   V P                  VP                  8w  d   \        R 4      hV P                  VP                  8X  d)   V P                  VP                  8w  d   \        R 4      hR# R# zrequested span not rectangularNr[  r*  r	   rS  rf  )r  r  s   &&r3   raise_on_inverted_L3CT_Tc._span_dimensions.<locals>.raise_on_inverted_L  s_    uu~!((ahh"6&'GHHvvAGGqww$6&'GHH %7r2   c                    V ^8  d   QhRRRR/# r  r*   )rA   s   "r3   rB   r    s     	I 	I5 	IU 	Ir2   c                   V P                   VP                   8  d   W3MW3w  r#VP                   VP                   8  d'   VP                  VP                  8  d   \        R 4      hV P                  VP                  8  d   W3MW3w  rCVP                  VP                  8  d)   VP                  VP                  8  d   \        R 4      hR# R# r  r  )r  r  top_mostother	left_mosts   &&   r3   raise_on_tee_shaped3CT_Tc._span_dimensions.<locals>.raise_on_tee_shaped  s    ()qfA6OH||eii'HOOell,J&'GHH)*!&&vqfI~~

*y/L&'GHH 0M*r2   )minr[  rS  maxr*  rf  )rH   rV  r  r  r[  rS  r*  rf  s   &&      r3   rX  CT_Tc._span_dimensions  s    
	I	I 	D+D+$((HLL)499hmm,T[[(//2DJJ/&,44r2   c               $    V ^8  d   QhRRRRRR/# )r>   
grid_widthr@   r]  rQ   r'  r   r*   )rA   s   "r3   rB   r%    s!       e Z r2   c                |    V P                  V4       V P                  V8  d   V P                  W4       K$  W0n        R# )aF  Incorporate `w:tc` elements to the right until this cell spans `grid_width`.

Incorporated `w:tc` elements are removed (replaced by gridSpan value).

Raises |ValueError| if `grid_width` cannot be exactly achieved, such as when a
merged cell would drive the span width greater than `grid_width` or if not
enough grid columns are available to make this cell that wide. All content from
incorporated cells is appended to `top_tc`. The val attribute of the vMerge
element on the single remaining cell is set to `vMerge`. If `vMerge` is |None|,
the vMerge element is removed if present.
N)r  rS   _swallow_next_tcr'  )rH   r  r]  r'  s   &&&&r3   r  CT_Tc._span_to_width  s1     	f%nnz)!!*5r2   c                    V ^8  d   QhRRRR/# )r>   r  r@   r]  rQ   r*   )rA   s   "r3   rB   r%    s      3  r2   c                   a a R VV 3R llpS P                   pV! V4       Vf   Q hVP                  V4       S P                  V4       S ;P                  VP                  ,          un        VP	                  4        R# )a  Extend the horizontal span of this `w:tc` element to incorporate the
following `w:tc` element in the row and then delete that following `w:tc`
element.

Any content in the following `w:tc` element is appended to the content of
`top_tc`. The width of the following `w:tc` element is added to this one, if
present. Raises |InvalidSpanError| if the width of the resulting cell is greater
than `grid_width` or if there is no next `<w:tc>` element in the row.
c                   V ^8  d   QhRR/# )r>   next_tcr~  r*   )rA   s   "r3   rB   ,CT_Tc._swallow_next_tc.<locals>.__annotate__  s     	B 	Bl 	Br2   c                   < V f   \        R4      hSP                  V P                  ,           S8  d   \        R4      hR # )Nznot enough grid columnszspan is not rectangular)r	   rS   )r  r  rH   s   &r3   raise_on_invalid_swallow8CT_Tc._swallow_next_tc.<locals>.raise_on_invalid_swallow  s<    &'@AA~~ 1 11J>&'@AA ?r2   N)r  r  r{  rS   r  )rH   r  r]  r  r  s   ff&  r3   r  CT_Tc._swallow_next_tc  sh    	B 	B -- )"""  (7#'+++r2   c                   V ^8  d   QhRR/# )r>   r?   r[   r*   )rA   s   "r3   rB   r%    s     N Nf Nr2   c                N    \        \        V P                  R4      ^ ,          4      # )z+The tbl element this tc element appears in.z./ancestor::w:tbl[position()=1])r   r[   r/  r   s   &r3   rY  
CT_Tc._tbl  s      FDJJ'HI!LMMr2   c                   V ^8  d   QhRR/# ra  r*   )rA   s   "r3   rB   r%    s     B B5 Br2   c                L    V P                   P                  V P                  4      # )zAThe `w:tc` element immediately above this one in its grid column.)	_tr_aboverW   rP   r   s   &r3   rk  CT_Tc._tc_above  s     ~~//0@0@AAr2   c                   V ^8  d   QhRR/# r  r*   )rA   s   "r3   rB   r%    s     < << <r2   c                \    V P                   pVf   R# VP                  V P                  4      # )z=The tc element immediately below this one in its grid column.N)	_tr_belowrW   rP   )rH   tr_belows   & r3   r(  CT_Tc._tc_below  s-     >>))$*:*:;;r2   c                   V ^8  d   QhRR/# r>   r?   r5   r*   )rA   s   "r3   rB   r%    s     M MV Mr2   c                N    \        \        V P                  R4      ^ ,          4      # )z*The tr element this tc element appears in.z./ancestor::w:tr[position()=1])r   r5   r/  r   s   &r3   r:  	CT_Tc._tr  s      FDJJ'GHKLLr2   c                   V ^8  d   QhRR/# r  r*   )rA   s   "r3   rB   r%    s      6 r2   c                \    V P                  R4      pV'       g   \        R4      hV^ ,          # )zThe tr element prior in sequence to the tr this cell appears in.

Raises |ValueError| if called on a cell in the top-most row.
z9./ancestor::w:tr[position()=1]/preceding-sibling::w:tr[1]zno tr above topmost tr in w:tbl)r/  rT   )rH   	tr_abovess   & r3   r  CT_Tc._tr_above  s,     JJZ[	>??|r2   c                   V ^8  d   QhRR/# )r>   r?   zCT_Row | Noner*   )rA   s   "r3   rB   r%     s      = r2   c                    V P                   P                  pVP                  V P                  4      p W^,           ,          #   \         d     R# i ; i)zrThe tr element next in sequence after the tr this cell appears in, or |None|
if this cell appears in the last row.N)rY  r]   r^   r:  
IndexError)rH   r]   r`   s   &  r3   r  CT_Tc._tr_below  sI     !!dhh'	1*%% 		s   A AAc                   V ^8  d   QhRR/# r=   r*   )rA   s   "r3   rB   r%    s     0 0 0r2   c                `    V P                   P                  P                  V P                  4      # )z;The row index of the tr element this tc element appears in.)rY  r]   r^   r:  r   s   &r3   r+  CT_Tc._tr_idx
  s#     yy%%dhh//r2   )r'  r   rk   )/r+   r,   r-   r.   r/   r0   r   r!  r   r  r_   r   r*  r2  rP   rS   r   rI  rO  rS  r^  r   r   rf  r[  r'  r   r{  rZ  r  r  r  r  r  r  r  rX  r  r  rY  rk  r(  r:  r  r  r+  r1   r*   r2   r3   rQ   rQ     s]   $**++ %X.D..%A
G
C
  
 	 	5 	5 5 5   - -    	 O O 1 1 " "   ]]      \\ =9. I I# 

 ; ;$	5<"2 N N B B < < M M     0 0r2   rQ   c                     ] tR tRt$ RtR]R&   R]R&   R]R&   R	]R
&   R]R&   R]R&   R]R&   R0t]! R]R,          R7      tR]R&   ]! R]R,          R7      t	R]R&   ]! R]R,          R7      t
R]R&   ]! R]R,          R7      tR]R&   A]R  R! l4       t]P                  R" R# l4       t]R$ 4       t]P                  R% R& l4       t]R' 4       t]P                  R( R) l4       t]R* R+ l4       t]P                  R, R- l4       tR.tR/# )1r  i  z5``<w:tcPr>`` element, defining table cell properties.zCallable[[], CT_DecimalNumber]get_or_add_gridSpanzCallable[[], CT_TblWidth]get_or_add_tcWzCallable[[], CT_VerticalJc]get_or_add_vAlignzCallable[[], CT_VMerge]_add_vMerger   _remove_gridSpan_remove_vAlign_remove_vMergew:tcW
w:gridSpanw:vMergew:vAlign:r>   NNr   zCT_TblWidth | NonetcW   NNCT_DecimalNumber | NonegridSpan:   NNzCT_VMerge | Noner'  :   NNzCT_VerticalJc | NonevAlignc                   V ^8  d   QhRR/# r=   r*   )rA   s   "r3   rB   CT_TcPr.__annotate__>  s     7 73 7r2   c                >    V P                   pVf   ^# VP                  # )zcThe integer number of columns this cell spans.

Determined by ./w:gridSpan/@val, it defaults to 1.
)r  r'   )rH   r  s   & r3   rS   CT_TcPr.grid_span=  s!     ==$q6(,,6r2   c                   V ^8  d   QhRR/# rC  r*   )rA   s   "r3   rB   r  G  s     3 3s 3r2   c                	`    V P                  4        V^8  d   WP                  4       n        R# R# r  )r  r  r'   r
  s   &&r3   rS   r  F  s)    19-2$$&* r2   c                >    V P                   pVf   R# VP                  # )zValue of `w:val` attribute on  `w:vAlign` child.

Value is |None| if `w:vAlign` child is not present. The `w:val` attribute on
`w:vAlign` is required.
N)r  r'   )rH   r  s   & r3   
vAlign_valCT_TcPr.vAlign_valL  s     >zzr2   c                   V ^8  d   QhRR/# )r>   ri   z!WD_CELL_VERTICAL_ALIGNMENT | Noner*   )rA   s   "r3   rB   r  Y  s     - - A -r2   c                	Z    Vf   V P                  4        R # WP                  4       n        R # rk   )r  r  r'   r
  s   &&r3   r
  r  X  s%    =!', $r2   c                >    V P                   pVf   R# VP                  # )z]The value of the ./w:vMerge/@val attribute, or |None| if the w:vMerge element
is not present.N)r'  r'   )rH   r'  s   & r3   ro  CT_TcPr.vMerge_val_  s     >zzr2   c                   V ^8  d   QhRR/# r  r*   )rA   s   "r3   rB   r  i  s     + +
 +r2   c                	Z    V P                  4        Ve   WP                  4       n        R # R # rk   )r  r  r'   r
  s   &&r3   ro  r  h  s(    %*" r2   c                   V ^8  d   QhRR/# r  r*   )rA   s   "r3   rB   r  o  s      } r2   c                >    V P                   pVf   R# VP                  # )zJEMU length in `./w:tcW` or |None| if not present or its type is not 'dxa'.N)r  r   )rH   r  s   & r3   r   CT_TcPr.widthn  s     hh;yyr2   c                   V ^8  d   QhRR/# r  r*   )rA   s   "r3   rB   r  w  s      6 r2   c                	2    V P                  4       pWn        R # rk   )r  r   )rH   ri   r  s   && r3   r   r  v  s    !!#	r2   r*   N)
w:cnfStyler  r  zw:hMerger  zw:tcBordersr  zw:noWrapzw:tcMarzw:textDirectionzw:tcFitTextr  z
w:hideMarkz	w:headersz	w:cellInsz	w:cellDelzw:cellMergezw:tcPrChange)r+   r,   r-   r.   r/   r0   r  r   r  r  r'  r  r   rS   r   r
  ro  r   r1   r*   r2   r3   r  r    sc   ?77--22((((&&&&H( (HRLC	  )2")H%   )x| F  $-x}$F   	7 7 3 3
 	 	 - -   + +
   \\ r2   r  c                  V   ] tR tRt$ RtR]R&   Rt]! R]R,          R	7      tR
]R&   ]! R]R,          R	7      t	R
]R&   ]! R]R,          R	7      t
R]R&   A]R R l4       t]R R l4       t]R R l4       t]P                  R R l4       t]R 4       t]P                  R R l4       tRtR# )r|   i|  z4``<w:trPr>`` element, defining table row properties.zCallable[[], CT_Height]get_or_add_trHeightw:gridBeforew:gridAfter
w:trHeightr   r   r  	gridAfterr  
gridBeforer   zCT_Height | NonetrHeightc                   V ^8  d   QhRR/# r=   r*   )rA   s   "r3   rB   CT_TrPr.__annotate__  s     9 9C 9r2   c                >    V P                   pVf   ^ # VP                  # rE   )r  r'   )rH   r  s   & r3   rF   CT_TrPr.grid_after  s!     NN	%q89==8r2   c                   V ^8  d   QhRR/# r=   r*   )rA   s   "r3   rB   r!    s     ; ;S ;r2   c                >    V P                   pVf   ^ # VP                  # rL   )r  r'   )rH   r  s   & r3   rM   CT_TrPr.grid_before  s!     __
&q:JNN:r2   c                   V ^8  d   QhRR/# rc   r*   )rA   s   "r3   rB   r!    s     < < 9 <r2   c                >    V P                   pVf   R# VP                  # )zCReturn the value of `w:trHeight@w:hRule`, or |None| if not present.N)r  r)   rH   r  s   & r3   re   CT_TrPr.trHeight_hRule  s!     =='t;X^^;r2   c                   V ^8  d   QhRR/# rh   r*   )rA   s   "r3   rB   r!    s      $= r2   c                	Z    Vf   V P                   f   R # V P                  4       pWn        R # rk   )r  r  r)   rH   ri   r  s   && r3   re   r*    s&    =T]]2++-r2   c                >    V P                   pVf   R# VP                  # )zAReturn the value of `w:trHeight@w:val`, or |None| if not present.N)r  r'   r)  s   & r3   rn   CT_TrPr.trHeight_val  s!     =='t9X\\9r2   c                   V ^8  d   QhRR/# rq   r*   )rA   s   "r3   rB   r!    s      - r2   c                	Z    Vf   V P                   f   R # V P                  4       pWn        R # rk   )r  r  r'   r-  s   && r3   rn   r/    s&    =T]]2++-r2   r*   N)r  zw:divIdr  r  z	w:wBeforezw:wAfterzw:cantSplitr  zw:tblHeaderr  r   zw:hiddenzw:inszw:delzw:trPrChange)r+   r,   r-   r.   r/   r0   r  r   r  r  r  r   rF   rM   re   r   rn   r1   r*   r2   r3   r|   r|   |  s    >00H" *3(2,*I&  +48B<+J'  "+""H  	9 9
 ; ;
 < <
   : :
  r2   r|   c                  8    ] tR tRt$ Rt]! R]4      tR]R&   Rt	R# )CT_VerticalJci  z:`w:vAlign` element, specifying vertical alignment of cell.r%   r   r'   r*   N)
r+   r,   r-   r.   r/   r   r   r'   r0   r1   r*   r2   r3   r3  r3    s    D&7+'C	# r2   r3  c                  P    ] tR tRt$ Rt]! R]]P                  R7      tR]	R&   Rt
R# )		CT_VMergei  zG``<w:vMerge>`` element, specifying vertical merging behavior of a cell.r%   )defaultr   r'   r*   N)r+   r,   r-   r.   r/   r   r   r)  r'   r0   r1   r*   r2   r3   r5  r5    s#    Q'8#4#4C r2   r5  N)=r/   
__future__r   typingr   r   r   docx.enum.tabler   r   r   docx.exceptionsr	   docx.oxml.nsr
   r   docx.oxml.parserr   docx.oxml.sharedr   docx.oxml.simpletypesr   r   r   r   r   docx.oxml.text.paragraphr   docx.oxml.xmlchemyr   r   r   r   r   r   r   docx.sharedr   r   r   r   docx.enum.textr   r    r!   docx.oxml.text.parfmtr"   r$   r5   r[   r   r   r   r   rt   r  rQ   r  r|   r3  r5  r*   r2   r3   <module>rD     s   ( " 0 0 ^ ^ , $ & -  *   + *214+ ^_ ^Bn_ nb	G 	G/O /	 	Z) Z)z "/ ",h0O h0Vio iXEo EPO  r2   