o
    	'f1l                     @  s  d Z ddlmZ ddlmZmZmZ ddlmZm	Z	 ddl
mZ ddlmZmZ ddlmZ ddlmZmZmZmZmZ dd	lmZmZmZmZmZmZmZ dd
lm Z m!Z! erdddl"m#Z# ddlm$Z$ G dd deZ%G dd deZ&G dd deZ'G dd deZ(G dd deZ)G dd deZ*G dd deZ+G dd deZ,G dd deZ-G dd  d eZ.G d!d" d"eZ/G d#d$ d$eZ0G d%d& d&eZ1d'S )(z"Custom element classes for tables.    )annotations)TYPE_CHECKINGCallableList)WD_CELL_VERTICAL_ALIGNMENTWD_ROW_HEIGHT_RULE)InvalidSpanError)nsdeclsqn)	parse_xml)ST_MergeST_TblLayoutTypeST_TblWidthST_TwipsMeasureXsdInt)BaseOxmlElementOneAndOnlyOne	OneOrMoreOptionalAttributeRequiredAttribute
ZeroOrMore	ZeroOrOne)EmuTwips)CT_P)Lengthc                   @  s$   e Zd ZdZedeZedeZdS )	CT_HeightzFUsed for ``<w:trHeight>`` to specify a row height and row height rule.w:valzw:hRuleN)	__name__
__module____qualname____doc__r   r   valr   hRule r$   r$   G/home/ubuntu/flask/venv/lib/python3.10/site-packages/docx/oxml/table.pyr   "   s    
r   c                   @  s   e Zd ZdZedZedZedZdd Z	e
dd Ze
d	d
 Zejdd
 Ze
dd Zejdd Zdd Zdd Zdd ZdS )CT_Rowz``<w:tr>`` element.z	w:tblPrExzw:trPrzw:tcc                 C  sF   d}| j D ]}||kr|  S ||j7 }||krtd| qtd)zThe ``<w:tc>`` element appearing at grid column `idx`.

        Raises |ValueError| if no ``w:tc`` element begins at that grid column.
        r   zno cell on grid column %dzindex out of bounds)tc_lst	grid_span
ValueError)selfidxgrid_coltcr$   r$   r%   tc_at_grid_col0   s   

zCT_Row.tc_at_grid_colc                 C     |   j| S )zSThe index of this ``<w:tr>`` element within its parent ``<w:tbl>``
        element.)	getparenttr_lstindexr*   r$   r$   r%   tr_idx>      zCT_Row.tr_idxc                 C     | j }|du r	dS |jS )zJReturn the value of `w:trPr/w:trHeight@w:hRule`, or |None| if not present.N)trPrtrHeight_hRuler*   r7   r$   r$   r%   r8   D      zCT_Row.trHeight_hRulec                 C     |   }||_d S N)get_or_add_trPrr8   r*   valuer7   r$   r$   r%   r8   L      
c                 C  r6   )zHReturn the value of `w:trPr/w:trHeight@w:val`, or |None| if not present.N)r7   trHeight_valr9   r$   r$   r%   rA   Q   r:   zCT_Row.trHeight_valc                 C  r;   r<   )r=   rA   r>   r$   r$   r%   rA   Y   r@   c                 C  s   |  d| d S Nr   insert)r*   tblPrExr$   r$   r%   _insert_tblPrEx^   s   zCT_Row._insert_tblPrExc                 C  s,   | j }|d ur|| d S | d| d S rB   )rE   addnextrD   )r*   r7   rE   r$   r$   r%   _insert_trPra   s   zCT_Row._insert_trPrc                 C     t  S r<   )CT_Tcnewr3   r$   r$   r%   _new_tch      zCT_Row._new_tcN)r   r   r    r!   r   rE   r7   r   r-   r.   propertyr4   r8   setterrA   rF   rH   rL   r$   r$   r$   r%   r&   )   s&    




r&   c                   @  s   e Zd ZdZedZedZedZe	dd Z
e
jdd Z
e	dd	 Zd
d Zed!ddZe	dd Zejdd Zed"ddZedd Zedd Zedd Zd S )#CT_Tblz``<w:tbl>`` element.zw:tblPrz	w:tblGridzw:trc                 C     | j j}|du r
dS |jS )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)tblPr
bidiVisualr"   )r*   rS   r$   r$   r%   bidiVisual_vals   s   zCT_Tbl.bidiVisual_valc                 C  s(   | j }|d u r|  d S || _d S r<   )rR   _remove_bidiVisualget_or_add_bidiVisualr"   )r*   r?   rR   r$   r$   r%   rT   ~   s   c                 C  s   t | jjS )z)The number of grid columns in this table.)lentblGridgridCol_lstr3   r$   r$   r%   	col_count   s   zCT_Tbl.col_countc                 c  s$    | j D ]}|jD ]}|V  q	qdS )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)r1   r'   )r*   trr-   r$   r$   r%   iter_tcs   s   

zCT_Tbl.iter_tcsrowsintcolswidthr   returnc                 C  s   t | |||S )zReturn a new `w:tbl` element having `rows` rows and `cols` columns.

        `width` is distributed evenly between the columns.
        )r   _tbl_xml)clsr]   r_   r`   r$   r$   r%   new_tbl   s   zCT_Tbl.new_tblc                 C  rQ   )zYValue of `w:tblPr/w:tblStyle/@w:val` (a table style id) or |None| if not
        present.N)rR   tblStyler"   r*   re   r$   r$   r%   tblStyle_val   s   zCT_Tbl.tblStyle_valc                 C  s(   | j }|  |du rdS || _dS )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)rR   _remove_tblStyle_add_tblStyler"   )r*   styleIdrR   r$   r$   r%   rg      s
   strc                 C  s@   |dkr
t || nt d}dtd| ||| |||f S )Nr   z<w:tbl %s>
  <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>
%s%s</w:tbl>
w)r   r	   _tblGrid_xml_trs_xml)rc   r]   r_   r`   	col_widthr$   r$   r%   rb      s   
zCT_Tbl._tbl_xmlc                 C  s,   d}t |D ]	}|d|j 7 }q|d7 }|S )Nz  <w:tblGrid>
z    <w:gridCol w:w="%d"/>
z  </w:tblGrid>
rangetwipsrc   rZ   ro   xmlir$   r$   r%   rm      s
   zCT_Tbl._tblGrid_xmlc                 C  s*   d}t |D ]}|d| || 7 }q|S )N z  <w:tr>
%s  </w:tr>
)rq   _tcs_xml)rc   	row_countrZ   ro   rt   ru   r$   r$   r%   rn      s   
zCT_Tbl._trs_xmlc                 C  s$   d}t |D ]	}|d|j 7 }q|S )Nrv   zj    <w:tc>
      <w:tcPr>
        <w:tcW w:type="dxa" w:w="%d"/>
      </w:tcPr>
      <w:p/>
    </w:tc>
rp   rs   r$   r$   r%   rw      s   zCT_Tbl._tcs_xmlN)r]   r^   r_   r^   r`   r   ra   rP   )r]   r^   r_   r^   r`   r   ra   rk   )r   r   r    r!   r   rR   rX   r   r[   rN   rT   rO   rZ   r\   classmethodrd   rg   rb   rm   rn   rw   r$   r$   r$   r%   rP   l   s4    







rP   c                   @  s   e Zd ZdZedddZdS )
CT_TblGridzw``<w:tblGrid>`` element, child of ``<w:tbl>``, holds ``<w:gridCol>`` elements
    that define column count, width, etc.z	w:gridCol)zw:tblGridChange
successorsN)r   r   r    r!   r   gridColr$   r$   r$   r%   rz      s    rz   c                   @  s&   e Zd ZdZedeZedd ZdS )CT_TblGridColzJ``<w:gridCol>`` element, child of ``<w:tblGrid>``, defines a table column.w:wc                 C  r/   )z\The index of this ``<w:gridCol>`` element within its parent ``<w:tblGrid>``
        element.)r0   rY   r2   r3   r$   r$   r%   gridCol_idx   r5   zCT_TblGridCol.gridCol_idxN)	r   r   r    r!   r   r   rl   rN   r   r$   r$   r$   r%   r~      s
    
r~   c                   @     e Zd ZdZedeZdS )CT_TblLayoutTypez|``<w:tblLayout>`` element, specifying whether column widths are fixed or can be
    automatically adjusted based on content.w:typeN)r   r   r    r!   r   r   typer$   r$   r$   r%   r      s    r   c                   @  s   e Zd ZdZdZededd dZededd dZed	ed
d dZededd dZ	[e
dd Zejdd Ze
dddZejdddZe
dd Zejdd ZdS )CT_TblPrz}``<w:tblPr>`` element, child of ``<w:tbl>``, holds child elements that define
    table properties such as style and borders.)
w:tblStylezw:tblpPrzw:tblOverlapw:bidiVisualzw:tblStyleRowBandSizezw:tblStyleColBandSizezw:tblWw:jcw:tblCellSpacingzw:tblIndzw:tblBordersw:shdw:tblLayoutzw:tblCellMarz	w:tblLookzw:tblCaptionzw:tblDescriptionzw:tblPrChanger      Nr{   r      r      r      c                 C  r6   )zMember of :ref:`WdRowAlignment` enumeration or |None|, based on the contents
        of the `w:val` attribute of `./w:jc`.

        |None| if no `w:jc` element is present.
        N)jcr"   )r*   r   r$   r$   r%   	alignment     zCT_TblPr.alignmentc                 C  s&   |    |d u r
d S |  }||_d S r<   )
_remove_jcget_or_add_jcr"   )r*   r?   r   r$   r$   r%   r   +  s
   
ra   boolc                 C  s   | j }|du r	dS |jdkS )zg|False| when there is a `w:tblLayout` child with `@w:type="fixed"`.

        Otherwise |True|.
        NTfixed)	tblLayoutr   )r*   r   r$   r$   r%   autofit3  s   zCT_TblPr.autofitr?   c                 C  s    |   }|rd|_d S d|_d S )Nr   r   )get_or_add_tblLayoutr   )r*   r?   r   r$   r$   r%   r   <  s   c                 C  r6   )ziReturn the value of the ``val`` attribute of the ``<w:tblStyle>`` child or
        |None| if not present.N)re   r"   rf   r$   r$   r%   styleA     zCT_TblPr.stylec                 C  s$   |    |d u r
d S | j|d d S )N)r"   )rh   ri   r*   r?   r$   r$   r%   r   J  s   )ra   r   )r?   r   )r   r   r    r!   _tag_seqr   re   rS   r   r   rN   r   rO   r   r   r$   r$   r$   r%   r     s(    


r   c                   @  s>   e Zd ZdZedeZedeZe	dd Z
e
jdd Z
dS )CT_TblWidthzeUsed for ``<w:tblW>`` and ``<w:tcW>`` elements and many others, to specify a
    table-related width.r   r   c                 C  s   | j dkrdS t| jS )zbReturn the EMU length value represented by the combined ``w:w`` and
        ``w:type`` attributes.dxaN)r   r   rl   r3   r$   r$   r%   r`   \  s   

zCT_TblWidth.widthc                 C  s   d| _ t|j| _d S )Nr   )r   r   rr   rl   r   r$   r$   r%   r`   d  s   N)r   r   r    r!   r   r   rl   r   r   rN   r`   rO   r$   r$   r$   r%   r   R  s    


r   c                   @  s  e Zd ZU dZded< ded< ded< ded	< ed
ZedZedZ	e
dd Zdd Ze
dd Zejdd Ze
dSddZdd Ze
dd Zdd Zedd Ze
d d! Ze
d"d# Ze
d$d% Zejd&d% Ze
d'd( Zejd)d( Zd*d+ Ze
d,d- ZdTd/d0Zd1d2 Ze
d3d4 Zd5d6 Zd7d8 Ze
d9d: Z d;d< Z!d=d> Z"d?d@ Z#dAdB Z$dCdD Z%e
dEdF Z&e
dGdH Z'e
dIdJ Z(e
dKdL Z)e
dMdN Z*e
dOdP Z+e
dQdR Z,d.S )UrJ   z`w:tc` table cell element.zCallable[[], CT_P]add_pz
List[CT_P]p_lstzList[CT_Tbl]tbl_lstzCallable[[CT_Tbl], CT_Tbl]_insert_tblzw:tcPrw:pw:tblc                 C  s4   | j dur| j}|dur|j tjkr|jS | jd S )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.
        Nr   )vMerge	_tc_belowr   CONTINUEbottom_tr_idx)r*   tc_belowr$   r$   r%   r   w  s
   

zCT_Tc.bottomc                 C  s,   g }| j }|dur|| || dd< dS )aM  Remove all content child elements, preserving the ``<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.
        N)tcPrappend)r*   new_childrenr   r$   r$   r%   clear_content  s
   
zCT_Tc.clear_contentc                 C     | j }|du r	dS |jS )zzThe integer number of columns this cell spans.

        Determined by ./w:tcPr/w:gridSpan/@val, it defaults to 1.
        Nr   )r   r(   r*   r   r$   r$   r%   r(        zCT_Tc.grid_spanc                 C  r;   r<   )get_or_add_tcPrr(   r*   r?   r   r$   r$   r%   r(     r@   ra   List[CT_P | CT_Tbl]c                 C  s
   |  dS )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xpathr3   r$   r$   r%   inner_content_elements  s   
zCT_Tc.inner_content_elementsc                 c  s6    t dt dt df}| D ]
}|j|v r|V  qdS )zpGenerate 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)r*   block_item_tagschildr$   r$   r%   iter_block_items  s   
zCT_Tc.iter_block_itemsc                 C  s   | j S )z?The grid column index at which this ``<w:tc>`` element appears.)	_grid_colr3   r$   r$   r%   left  s   z
CT_Tc.leftc                 C  s4   |  |\}}}}| jj| |}||| |S )zReturn the top-left ``<w:tc>`` element of a new span formed by merging the
        rectangular region defined by using this tc element and `other_tc` as diagonal
        corners.)_span_dimensions_tblr1   r.   _grow_to)r*   other_tctopr   heightr`   top_tcr$   r$   r%   merge  s   zCT_Tc.mergec                 C  s   t dtd S )zhReturn a new ``<w:tc>`` element, containing an empty paragraph as the
        required EG_BlockLevelElt.z<w:tc %s>
  <w:p/>
</w:tc>rl   )r   r	   )rc   r$   r$   r%   rK     r5   z	CT_Tc.newc                 C  s   | j | j S )a  The 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.
        )r   r(   r3   r$   r$   r%   right  s   zCT_Tc.rightc                 C  s$   | j du s| j tjkr| jS | jjS )z9The top-most row index in the vertical span of this cell.N)r   r   RESTARTr   	_tc_abover   r3   r$   r$   r%   r     s   z	CT_Tc.topc                 C  r6   )zlThe value of the ./w:tcPr/w:vMerge/@val attribute, or |None| if the w:vMerge
        element is not present.N)r   
vMerge_valr   r$   r$   r%   r     r   zCT_Tc.vMergec                 C  r;   r<   )r   r   r   r$   r$   r%   r     r@   c                 C  r6   )zqReturn the EMU length value represented in the ``./w:tcPr/w:tcW`` child
        element or |None| if not present.N)r   r`   r   r$   r$   r%   r`     r   zCT_Tc.widthc                 C  r;   r<   )r   r`   r   r$   r$   r%   r`     r@   c                 C  s(   | j r|j r|  j |j 7  _ dS dS dS )zAdd 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*   r   r$   r$   r%   _add_width_of  s   zCT_Tc._add_width_ofc                 C  s2   | j }|j| }|jd| }tdd |D S )z*The grid column at which this cell begins.Nc                 s  s    | ]}|j V  qd S r<   )r(   ).0r-   r$   r$   r%   	<genexpr>  s    z"CT_Tc._grid_col.<locals>.<genexpr>)_trr'   r2   sum)r*   r[   r+   preceding_tcsr$   r$   r%   r     s   zCT_Tc._grid_colNc                   sT    fdd}|du rn|} ||||  dkr(j| d | dS dS )zGrow this cell to `width` grid columns and `height` rows by expanding
        horizontal spans and creating continuation cells to form vertical spans.c                   s    | urt jS  dkrd S t jS Nr   )r   r   r   )r   r   r*   r$   r%   r     s
   z"CT_Tc._grow_to.<locals>.vMerge_valNr   )_span_to_widthr   r   )r*   r`   r   r   r   r$   r   r%   r     s   zCT_Tc._grow_toc                 C  s   |  d| |S )z``tcPr`` has a bunch of successors, but it comes first if it appears, so just
        overriding and using insert(0, ...) rather than spelling out successors.r   rC   r   r$   r$   r%   _insert_tcPr  s   zCT_Tc._insert_tcPrc                 C  s:   t |  }t|dkrdS |d }t|jdkrdS dS )zATrue if this cell contains only a single empty ``<w:p>`` element.r   Fr   T)listr   rW   r_lst)r*   block_itemspr$   r$   r%   	_is_empty  s   zCT_Tc._is_emptyc                 C  sH   || u rdS | j rdS |  |  D ]}|| q| |   dS )zoAppend the content of this cell to `other_tc`, leaving this cell with a
        single empty ``<w:p>`` element.N)r   _remove_trailing_empty_pr   r   _new_p)r*   r   block_elementr$   r$   r%   _move_content_to%  s   zCT_Tc._move_content_toc                 C  rI   r<   )rP   rK   r3   r$   r$   r%   _new_tbl3  rM   zCT_Tc._new_tblc                 C  s   |  d}|r|d S dS )zThe `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:tcr   Nr   )r*   following_tcsr$   r$   r%   _next_tc6  s   
zCT_Tc._next_tcc                 C  s   |   |  dS )z-Remove this `w:tc` element from the XML tree.N)r0   remover3   r$   r$   r%   _remove=  s   zCT_Tc._removec                 C  sJ   t |  }|d }|jtdkrdS |}t|jdkrdS | | dS )z[Remove the last content element from this cell if it is an empty ``<w:p>``
        element.r   Nr   )r   r   r   r
   rW   r   r   )r*   r   last_content_elmr   r$   r$   r%   r   A  s   zCT_Tc._remove_trailing_empty_pc                 C  sp   dd }dd }|| | || | t | j|j}t | j|j}t| j|j}t| j|j}|||| || fS )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                 S  sH   | j |j kr| j|jkrtd| j|jkr | j|jkr"tdd S d S Nzrequested span not rectangularr   r   r   r   r   )abr$   r$   r%   raise_on_inverted_LR  s
   z3CT_Tc._span_dimensions.<locals>.raise_on_inverted_Lc                 S  s   | j |j k r
| |fn|| f\}}|j |j k r |j|jkr td| j|jk r*| |fn|| f\}}|j|jk r@|j|jkrBtdd S d S r   r   )r   r   top_mostother	left_mostr$   r$   r%   raise_on_tee_shapedX  s     z3CT_Tc._span_dimensions.<locals>.raise_on_tee_shaped)minr   r   maxr   r   )r*   r   r   r   r   r   r   r   r$   r$   r%   r   M  s   
	
zCT_Tc._span_dimensionsc                 C  s4   |  | | j|k r| || | j|k s
|| _dS )aZ  Incorporate and then remove `w:tc` elements to the right of this one until
        this cell spans `grid_width`.

        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   r(   _swallow_next_tcr   )r*   
grid_widthr   r   r$   r$   r%   r   k  s
   



zCT_Tc._span_to_widthc                   sL    fdd}j }|| || |  j|j7  _|  dS )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                   s,   | d u rt dj| j  krt dd S )Nznot enough grid columnszspan is not rectangular)r   r(   )next_tcr   r*   r$   r%   raise_on_invalid_swallow  s
   z8CT_Tc._swallow_next_tc.<locals>.raise_on_invalid_swallowN)r   r   r   r(   r   )r*   r   r   r   r   r$   r   r%   r   {  s   

zCT_Tc._swallow_next_tcc                 C     |  dd S )z+The tbl element this tc element appears in.z./ancestor::w:tbl[position()=1]r   r   r3   r$   r$   r%   r        z
CT_Tc._tblc                 C  s   | j | jS )zAThe `w:tc` element immediately above this one in its grid column.)	_tr_abover.   r   r3   r$   r$   r%   r     r   zCT_Tc._tc_abovec                 C  s   | j }|du r	dS || jS )z=The tc element immediately below this one in its grid column.N)	_tr_belowr.   r   )r*   tr_belowr$   r$   r%   r     s   zCT_Tc._tc_belowc                 C  r   )z*The tr element this tc element appears in.z./ancestor::w:tr[position()=1]r   r   r3   r$   r$   r%   r     r   z	CT_Tc._trc                 C  s0   | j j}|| j}|dkrtd||d  S )zThe tr element prior in sequence to the tr this cell appears in.

        Raises |ValueError| if called on a cell in the top-most row.
        r   zno tr above topmost trr   )r   r1   r2   r   r)   r*   r1   r4   r$   r$   r%   r     s
   zCT_Tc._tr_abovec                 C  s8   | j j}|| j}z||d  W S  ty   Y dS w )zzThe tr element next in sequence after the tr this cell appears in, or |None|
        if this cell appears in the last row.r   N)r   r1   r2   r   
IndexErrorr   r$   r$   r%   r     s   zCT_Tc._tr_belowc                 C  s   | j j| jS )z;The row index of the tr element this tc element appears in.)r   r1   r2   r   r3   r$   r$   r%   r     s   zCT_Tc._tr_idx)ra   r   r<   )-r   r   r    r!   __annotations__r   r   r   r   tblrN   r   r   r(   rO   r   r   r   r   ry   rK   r   r   r   r`   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r$   r$   r$   r%   rJ   j  s   
 




	

	
















rJ   c                   @  s   e Zd ZdZdZededd dZededd dZed	ed
d dZededd dZ	[e
dd Zejdd Ze
dd Zejdd Ze
dd Zejdd Ze
dd Zejdd ZdS )CT_TcPrz5``<w:tcPr>`` element, defining table cell properties.)
w:cnfStylew:tcW
w:gridSpanzw:hMergew:vMergezw:tcBordersr   zw:noWrapzw:tcMarzw:textDirectionzw:tcFitTextw:vAlignz
w:hideMarkz	w:headersz	w:cellInsz	w:cellDelzw:cellMergezw:tcPrChanger      Nr{   r     r     r     c                 C  r   )zsThe integer number of columns this cell spans.

        Determined by ./w:gridSpan/@val, it defaults to 1.
        Nr   )gridSpanr"   )r*   r  r$   r$   r%   r(     r   zCT_TcPr.grid_spanc                 C  s"   |    |dkr||  _d S d S r   )_remove_gridSpanget_or_add_gridSpanr"   r   r$   r$   r%   r(        c                 C  r6   )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)vAlignr"   )r*   r  r$   r$   r%   
vAlign_val  r   zCT_TcPr.vAlign_valc                 C  s"   |d u r
|    d S ||  _d S r<   )_remove_vAlignget_or_add_vAlignr"   r   r$   r$   r%   r    s   c                 C  r6   )zeThe value of the ./w:vMerge/@val attribute, or |None| if the w:vMerge element
        is not present.N)r   r"   )r*   r   r$   r$   r%   r     r   zCT_TcPr.vMerge_valc                 C  s"   |    |d ur||  _d S d S r<   )_remove_vMerge_add_vMerger"   r   r$   r$   r%   r     r  c                 C  r6   )zReturn the EMU length value represented in the ``<w:tcW>`` child element or
        |None| if not present or its type is not 'dxa'.N)tcWr`   )r*   r  r$   r$   r%   r`     r   zCT_TcPr.widthc                 C  r;   r<   )get_or_add_tcWr`   )r*   r?   r  r$   r$   r%   r`      r@   )r   r   r    r!   r   r   r  r  r   r  rN   r(   rO   r  r   r`   r$   r$   r$   r%   r     s0    







r   c                   @  s^   e Zd ZdZdZededd dZ[edd Zej	d	d Zed
d Z
e
j	dd Z
dS )CT_TrPrz4``<w:trPr>`` element, defining table row properties.)r   zw:divIdzw:gridBeforezw:gridAfterz	w:wBeforezw:wAfterzw:cantSplit
w:trHeightzw:tblHeaderr   r   zw:hiddenzw:inszw:delzw:trPrChanger  r   Nr{   c                 C  r6   )zCReturn the value of `w:trHeight@w:hRule`, or |None| if not present.N)trHeightr#   r*   r  r$   r$   r%   r8   =  r:   zCT_TrPr.trHeight_hRulec                 C  (   |d u r| j d u rd S |  }||_d S r<   )r  get_or_add_trHeightr#   r*   r?   r  r$   r$   r%   r8   E     
c                 C  r6   )zAReturn the value of `w:trHeight@w:val`, or |None| if not present.N)r  r"   r  r$   r$   r%   rA   L  r:   zCT_TrPr.trHeight_valc                 C  r  r<   )r  r  r"   r  r$   r$   r%   rA   T  r  )r   r   r    r!   r   r   r  rN   r8   rO   rA   r$   r$   r$   r%   r  &  s    


r  c                   @  r   )CT_VerticalJcz:`w:vAlign` element, specifying vertical alignment of cell.r   N)r   r   r    r!   r   r   r"   r$   r$   r$   r%   r  \  s    r  c                   @  s    e Zd ZdZedeejdZdS )	CT_VMergezG``<w:vMerge>`` element, specifying vertical merging behavior of a cell.r   )defaultN)r   r   r    r!   r   r   r   r"   r$   r$   r$   r%   r  b  s    r  N)2r!   
__future__r   typingr   r   r   docx.enum.tabler   r   docx.exceptionsr   docx.oxml.nsr	   r
   docx.oxml.parserr   docx.oxml.simpletypesr   r   r   r   r   docx.oxml.xmlchemyr   r   r   r   r   r   r   docx.sharedr   r   docx.oxml.text.paragraphr   r   r   r&   rP   rz   r~   r   r   r   rJ   r   r  r  r  r$   r$   r$   r%   <module>   s8    $	C{Q  __6