
    MiLB                    `   S r SSKJr  SSKJrJr  SSKJr  SSKJ	r	  SSK
Jr  SSKJr  SSKJrJr  \(       a*  SS	KJr  SS
KJrJrJrJr  SSKJr  SSKJr  SSKJr  SSKJr   " S S\5      r " S S\5      r  " S S\5      r! " S S\5      r" " S S\5      r# " S S\5      r$ " S S\5      r%g)z-Table-related objects such as Table and Cell.    )annotations)TYPE_CHECKINGIterator)
FillFormat)TcRange)Subshape)	TextFrame)Emulazyproperty)MSO_VERTICAL_ANCHOR)CT_TableCT_TableCellCT_TableColCT_TableRow)BaseSlidePart)GraphicFrame)ProvidesPart)Lengthc                    ^  \ rS rSrSrSU 4S jjrSS jr\SS j5       r\	SS j5       r
\
R                  SS j5       r
\	SS j5       r\R                  SS	 j5       r\	SS
 j5       r\R                  SS j5       rSS jr\	SS j5       r\R                  SS j5       r\	SS j5       r\R                  SS j5       rSS jrSS jr\	SS j5       r\S 5       r\	SS j5       r\R                  SS j5       rSrU =r$ ) Table   zA DrawingML table object.

Not intended to be constructed directly, use
:meth:`.Slide.shapes.add_table` to add a table to a slide.
c                B   > [         [        U ]  5         Xl        X l        g N)superr   __init___tbl_graphic_frame)selftblgraphic_frame	__class__s      d/var/www/eduai.edurigo.com/storigo/production/storigo_env/lib/python3.13/site-packages/pptx/table.pyr   Table.__init__   s    eT#%	+    c                L    [        U R                  R                  X5      U 5      $ )zReturn cell at `row_idx`, `col_idx`.

Return value is an instance of |_Cell|. `row_idx` and `col_idx` are zero-based, e.g.
cell(0, 0) is the top, left cell in the table.
)_Cellr   tc)r   row_idxcol_idxs      r"   cell
Table.cell"   s     TYY\\'3T::r$   c                .    [        U R                  U 5      $ )z|_ColumnCollection| instance for this table.

Provides access to |_Column| objects representing the table's columns. |_Column| objects
are accessed using list notation, e.g. `col = tbl.columns[0]`.
)_ColumnCollectionr   r   s    r"   columnsTable.columns*   s     !D11r$   c                .    U R                   R                  $ )zWhen `True`, indicates first column should have distinct formatting.

Read/write. Distinct formatting is used, for example, when the first column contains row
headings (is a side-heading column).
r   firstColr.   s    r"   	first_colTable.first_col3        yy!!!r$   c                $    XR                   l        g r   r2   r   values     r"   r4   r5   <       "		r$   c                .    U R                   R                  $ )zWhen `True`, indicates first row should have distinct formatting.

Read/write. Distinct formatting is used, for example, when the first row contains column
headings.
r   firstRowr.   s    r"   	first_rowTable.first_row@   r6   r$   c                $    XR                   l        g r   r<   r8   s     r"   r>   r?   I   r:   r$   c                .    U R                   R                  $ )zWhen `True`, indicates rows should have alternating shading.

Read/write. Used to allow rows to be traversed more easily without losing track of which
row is being read.
r   bandRowr.   s    r"   horz_bandingTable.horz_bandingM        yy   r$   c                $    XR                   l        g r   rB   r8   s     r"   rD   rE   V       !		r$   c                L   ^  U 4S jT R                   R                  5        5       $ )zwGenerate _Cell object for each cell in this table.

Each grid cell is generated in left-to-right, top-to-bottom order.
c              3  <   >#    U  H  n[        UT5      v   M     g 7fr   r&   .0r'   r   s     r"   	<genexpr>#Table.iter_cells.<locals>.<genexpr>_   s     ?*>Bb$*>   )r   iter_tcsr.   s   `r"   
iter_cellsTable.iter_cellsZ   s    
 @$))*<*<*>??r$   c                .    U R                   R                  $ )zWhen `True`, indicates the rightmost column should have distinct formatting.

Read/write. Used, for example, when a row totals column appears at the far right of the
table.
r   lastColr.   s    r"   last_colTable.last_cola   rF   r$   c                $    XR                   l        g r   rU   r8   s     r"   rW   rX   j   rH   r$   c                .    U R                   R                  $ )zWhen `True`, indicates the bottom row should have distinct formatting.

Read/write. Used, for example, when a totals row appears as the bottom row.
r   lastRowr.   s    r"   last_rowTable.last_rown   s     yy   r$   c                $    XR                   l        g r   r[   r8   s     r"   r]   r^   v   rH   r$   c                    [        [        U R                   Vs/ s H  oR                  PM     sn5      5      nX R                  l        gs  snf )zCalled by a row when its height changes.

Triggers the graphic frame to recalculate its total height (as the sum of the row
heights).
N)r
   sumrowsheightr   )r   rownew_table_heights      r"   notify_height_changedTable.notify_height_changedz   s;     s$))#D)3JJ)#DEF%5" $E   A
c                    [        [        U R                   Vs/ s H  oR                  PM     sn5      5      nX R                  l        gs  snf )zCalled by a column when its width changes.

Triggers the graphic frame to recalculate its total width (as the sum of the column
widths).
N)r
   ra   r/   widthr   )r   colnew_table_widths      r"   notify_width_changedTable.notify_width_changed   s:     c"E99"EFG$3! #Frh   c                .    U R                   R                  $ )z'The package part containing this table.)r   partr.   s    r"   rp   
Table.part   s     ""'''r$   c                .    [        U R                  U 5      $ )z|_RowCollection| instance for this table.

Provides access to |_Row| objects representing the table's rows. |_Row| objects are
accessed using list notation, e.g. `col = tbl.rows[0]`.
)_RowCollectionr   r.   s    r"   rb   
Table.rows   s     dii..r$   c                .    U R                   R                  $ )zWhen `True`, indicates columns should have alternating shading.

Read/write. Used to allow columns to be traversed more easily without losing track of
which column is being read.
r   bandColr.   s    r"   vert_bandingTable.vert_banding   rF   r$   c                $    XR                   l        g r   rv   r8   s     r"   rx   ry      rH   r$   )r   r   )r   r   r    r   )r(   intr)   r{   returnr&   )r|   r-   r|   bool)r9   r~   r|   zIterator[_Cell]r|   None)r|   r   )__name__
__module____qualname____firstlineno____doc__r   r*   r   r/   propertyr4   setterr>   rD   rR   rW   r]   rf   rm   rp   rb   rx   __static_attributes____classcell__r!   s   @r"   r   r      sn   ,
; 2 2 " " # # " " # # ! ! " "@ ! ! __" " ! ! __" "64 ( ( / / ! ! " "r$   r   c                  L  ^  \ rS rSrSrSU 4S jjrSS jrSS jr\SS j5       r	\
SS j5       r\
SS j5       r\
S S	 j5       r\R                  S!S
 j5       r\
S S j5       r\R                  S"S j5       r\
S S j5       r\R                  S#S j5       r\
S S j5       r\R                  S$S j5       rS%S jr\
S&S j5       r\
S&S j5       rS'S jr\
S(S j5       r\R                  S)S j5       r\
S*S j5       r\
S+S j5       r\R                  S,S j5       r\S-S j5       rSrU =r$ ).r&      z
Table cellc                8   > [         [        U ]  U5        Xl        g r   )r   r&   r   _tc)r   r'   parentr!   s      r"   r   _Cell.__init__   s    eT#F+r$   c                h    [        U[        U 5      5      (       d  gU R                  UR                  L $ )z|True| if this object proxies the same element as `other`.

Equality for proxy objects is defined as referring to the same XML element, whether or not
they are the same proxy object instance.
F
isinstancetyper   r   others     r"   __eq___Cell.__eq__   s+     %d,,xx599$$r$   c                h    [        U[        U 5      5      (       d  gU R                  UR                  L$ )NTr   r   s     r"   __ne___Cell.__ne__   s)    %d,,xxuyy((r$   c                b    U R                   R                  5       n[        R                  " U5      $ )zc|FillFormat| instance for this cell.

Provides access to fill properties such as foreground color.
)r   get_or_add_tcPrr   from_fill_parent)r   tcPrs     r"   fill
_Cell.fill   s'     xx'')**400r$   c                .    U R                   R                  $ )z=True if this cell is the top-left grid cell in a merged cell.)r   is_merge_originr.   s    r"   r   _Cell.is_merge_origin   s     xx'''r$   c                .    U R                   R                  $ )a;  True if this cell is spanned by a merge-origin cell.

A merge-origin cell "spans" the other grid cells in its merge range, consuming their area
and "shadowing" the spanned grid cells.

Note this value is |False| for a merge-origin cell. A merge-origin cell spans other grid
cells, but is not itself a spanned cell.
)r   
is_spannedr.   s    r"   r   _Cell.is_spanned   s     xx"""r$   c                .    U R                   R                  $ )zLeft margin of cells.

Read/write. If assigned |None|, the default value is used, 0.1 inches for left and right
margins and 0.05 inches for top and bottom.
)r   marLr.   s    r"   margin_left_Cell.margin_left   s     xx}}r$   c                F    U R                  U5        XR                  l        g r   )_validate_margin_valuer   r   )r   r   s     r"   r   r      s    ##K0#r$   c                .    U R                   R                  $ )zRight margin of cell.)r   marRr.   s    r"   margin_right_Cell.margin_right        xx}}r$   c                F    U R                  U5        XR                  l        g r   )r   r   r   )r   r   s     r"   r   r      s    ##L1$r$   c                .    U R                   R                  $ )zTop margin of cell.)r   marTr.   s    r"   
margin_top_Cell.margin_top   r   r$   c                F    U R                  U5        XR                  l        g r   )r   r   r   )r   r   s     r"   r   r      s    ##J/"r$   c                .    U R                   R                  $ )zBottom margin of cell.)r   marBr.   s    r"   margin_bottom_Cell.margin_bottom   r   r$   c                F    U R                  U5        XR                  l        g r   )r   r   r   )r   r   s     r"   r   r      s    ##M2%r$   c                   [        U R                  UR                  5      nUR                  (       d  [        S5      eUR                  (       a  [        S5      eUR                  5         UR                  u  p4UR                  5        H	  nX5l        M     UR                  5        H	  nXEl
        M     UR                  5        H
  nSUl        M     UR                  5        H
  nSUl        M     g)a  Create merged cell from this cell to `other_cell`.

This cell and `other_cell` specify opposite corners of the merged cell range. Either
diagonal of the cell region may be specified in either order, e.g. self=bottom-right,
other_cell=top-left, etc.

Raises |ValueError| if the specified range already contains merged cells anywhere within
its extents or if `other_cell` is not in the same table as `self`.
zother_cell from different tablez'range contains one or more merged cellsTN)r   r   in_same_table
ValueErrorcontains_merged_cellmove_content_to_origin
dimensionsiter_top_row_tcsrowSpaniter_left_col_tcsgridSpaniter_except_left_col_tcshMergeiter_except_top_row_tcsvMerge)r   
other_celltc_range	row_count	col_countr'   s         r"   merge_Cell.merge  s     488Z^^4%%>??((FGG'')'22	++-B"J .,,.B#K /335BBI 6224BBI 5r$   c                .    U R                   R                  $ )a>  int count of rows spanned by this cell.

The value of this property may be misleading (often 1) on cells where `.is_merge_origin`
is not |True|, since only a merge-origin cell contains complete span information. This
property is only intended for use on cells known to be a merge origin by testing
`.is_merge_origin`.
)r   r   r.   s    r"   span_height_Cell.span_height"  s     xxr$   c                .    U R                   R                  $ )aA  int count of columns spanned by this cell.

The value of this property may be misleading (often 1) on cells where `.is_merge_origin`
is not |True|, since only a merge-origin cell contains complete span information. This
property is only intended for use on cells known to be a merge origin by testing
`.is_merge_origin`.
)r   r   r.   s    r"   
span_width_Cell.span_width-  s     xx   r$   c                    U R                   (       d  [        S5      e[        R                  " U R                  5      nUR                  5        H  nS=Ul        Ul        S=Ul        Ul	        M!     g)a0  Remove merge from this (merge-origin) cell.

The merged cell represented by this object will be "unmerged", yielding a separate
unmerged cell for each grid cell previously spanned by this merge.

Raises |ValueError| when this cell is not a merge-origin cell. Test with
`.is_merge_origin` before calling.
z>not a merge-origin cell; only a merge-origin cell can be split   FN)
r   r   r   from_merge_originr   rQ   r   r   r   r   )r   r   r'   s      r"   split_Cell.split8  s\     ##`aa,,TXX6##%B'((BJ$))BI	 &r$   c                .    U R                   R                  $ )ak  Textual content of cell as a single string.

The returned string will contain a newline character (`"\n"`) separating each paragraph
and a vertical-tab (`"\v"`) character for each line break (soft carriage return) in the
cell's text.

Assignment to `text` replaces all text currently contained in the cell. A newline
character (`"\n"`) in the assigned text causes a new paragraph to be started. A
vertical-tab (`"\v"`) character in the assigned text causes a line-break (soft
carriage-return) to be inserted. (The vertical-tab character appears in clipboard text
copied from PowerPoint as its encoding of line-breaks.)

text_frametextr.   s    r"   r   
_Cell.textJ  s     ###r$   c                $    XR                   l        g r   r   )r   r   s     r"   r   r   Z  s    #r$   c                L    U R                   R                  5       n[        X5      $ )z9|TextFrame| containing the text that appears in the cell.)r   get_or_add_txBodyr	   )r   txBodys     r"   r   _Cell.text_frame^  s!     ++-&&r$   c                .    U R                   R                  $ )a  Vertical alignment of this cell.

This value is a member of the :ref:`MsoVerticalAnchor` enumeration or |None|. A value of
|None| indicates the cell has no explicitly applied vertical anchor setting and its
effective value is inherited from its style-hierarchy ancestors.

Assigning |None| to this property causes any explicitly applied vertical anchor setting to
be cleared and inheritance of its effective value to be restored.
r   anchorr.   s    r"   vertical_anchor_Cell.vertical_anchord  s     xxr$   c                $    XR                   l        g r   r   )r   mso_anchor_idxs     r"   r   r   q  s    (r$   c                T    [        U [        5      (       d  U b  Sn[        X-  5      egg)zMRaise ValueError if `margin_value` is not a positive integer value or |None|.Nz.margin value must be integer or None, got '%s')r   r{   	TypeError)margin_valuetmpls     r"   r   _Cell._validate_margin_valueu  s2     ,,,1ICDD/00 2J,r$   )r   )r'   r   r   r   )r   objectr|   r~   )r|   r   r}   r|   r   )r   Length | None)r   r   )r   r   )r   r   )r   r&   r|   r   r|   r{   r   )r|   str)r   r   )r|   r	   )r|   MSO_VERTICAL_ANCHOR | None)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   r   r   r   staticmethodr   r   r   r   s   @r"   r&   r&      s   %)
 1 1 ( ( 	# 	#   $ $   % %   # #   & &<     ! !*$ $ $ 
[[$ $ ' '
 
 
 ) ) 1 1r$   r&   c                  l   ^  \ rS rSrSrSU 4S jjr\SS j5       r\R                  S	S j5       rSr	U =r
$ )
_Columni}  zTable columnc                D   > [         [        U ]  U5        X l        Xl        g r   )r   r   r   _parent_gridCol)r   gridColr   r!   s      r"   r   _Column.__init__  s    gt%f-r$   c                .    U R                   R                  $ )zWidth of column in EMU.)r   wr.   s    r"   rj   _Column.width  s     }}r$   c                X    XR                   l        U R                  R                  5         g r   )r   r  r   rm   )r   rj   s     r"   rj   r    s    ))+r$   )r   r   )r   r   r   r-   r   )rj   r   )r   r   r   r   r   r   r   rj   r   r   r   r   s   @r"   r   r   }  s7     
   \\, ,r$   r   c                  |   ^  \ rS rSrSrSU 4S jjr\S 5       r\S	S j5       r\R                  S
S j5       rSr
U =r$ )_Rowi  z	Table rowc                D   > [         [        U ]  U5        X l        Xl        g r   )r   r  r   r   _trr   trr   r!   s      r"   r   _Row.__init__  s    dD"6*r$   c                .    [        U R                  U 5      $ )zRead-only reference to collection of cells in row.

An individual cell is referenced using list notation, e.g. `cell = row.cells[0]`.
)_CellCollectionr	  r.   s    r"   cells
_Row.cells  s     txx..r$   c                .    U R                   R                  $ )zHeight of row in EMU.)r	  hr.   s    r"   rc   _Row.height  s     xxzzr$   c                X    XR                   l        U R                  R                  5         g r   )r	  r  r   rf   )r   rc   s     r"   rc   r    s    
**,r$   r   r	  )r  r   r   rs   r   )rc   r   )r   r   r   r   r   r   r   r  rc   r   r   r   r   s   @r"   r  r    sK    
 / /   ]]- -r$   r  c                  N   ^  \ rS rSrSrSU 4S jjrS	S jrS
S jrSS jrSr	U =r
$ )r  i  z Horizontal sequence of row cellsc                D   > [         [        U ]  U5        X l        Xl        g r   )r   r  r   r   r	  r
  s      r"   r   _CellCollection.__init__  s    ot-f5r$   c                    US:  d#  U[        U R                  R                  5      :  a  SU-  n[        U5      e[	        U R                  R                  U   U 5      $ )z+Provides indexed access, (e.g. 'cells[0]').r   zcell index [%d] out of range)lenr	  tc_lst
IndexErrorr&   r   idxmsgs      r"   __getitem___CellCollection.__getitem__  sK    7cS11036CS/!TXX__S)400r$   c                D   ^  U 4S jT R                   R                   5       $ )zProvides iterability.c              3  <   >#    U  H  n[        UT5      v   M     g 7fr   rK   rL   s     r"   rN   +_CellCollection.__iter__.<locals>.<genexpr>  s     :/Bb$/rP   )r	  r  r.   s   `r"   __iter___CellCollection.__iter__  s    :$((//::r$   c                @    [        U R                  R                  5      $ )z1Supports len() function (e.g. 'len(cells) == 1').)r  r	  r  r.   s    r"   __len___CellCollection.__len__  s    488??##r$   r  )r  r   r   r  )r  r{   r|   r&   r   r   )r   r   r   r   r   r   r   r%  r(  r   r   r   s   @r"   r  r    s    *
1;$ $r$   r  c                  F   ^  \ rS rSrSrSU 4S jjrS	S jrS rS rSr	U =r
$ )
r-   i  zSequence of table columns.c                D   > [         [        U ]  U5        X l        Xl        g r   )r   r-   r   r   r   r   r   r   r!   s      r"   r   _ColumnCollection.__init__  s    /7	r$   c                    US:  d-  U[        U R                  R                  R                  5      :  a  SU-  n[	        U5      e[        U R                  R                  R                  U   U 5      $ )z-Provides indexed access, (e.g. 'columns[0]').r   zcolumn index [%d] out of range)r  r   tblGridgridCol_lstr  r   r  s      r"   r   _ColumnCollection.__getitem__  s[    7cS!2!2!>!>??2S8CS/!tyy((44S94@@r$   c                T    [        U R                  R                  R                  5      $ )z3Supports len() function (e.g. 'len(columns) == 1').)r  r   r/  r0  r.   s    r"   r(  _ColumnCollection.__len__  s    499$$0011r$   c                8    U R                   R                  5         g)z@Called by a column when its width changes. Pass along to parent.N)r   rm   r.   s    r"   rm   &_ColumnCollection.notify_width_changed  s    ))+r$   r   r   r   r   r   r   )r  r{   )r   r   r   r   r   r   r   r(  rm   r   r   r   s   @r"   r-   r-     s     $
A2, ,r$   r-   c                  F   ^  \ rS rSrSrSU 4S jjrS	S jrS rS rSr	U =r
$ )
rs   i  zSequence of table rowsc                D   > [         [        U ]  U5        X l        Xl        g r   )r   rs   r   r   r   r,  s      r"   r   _RowCollection.__init__  s    nd,V4	r$   c                    US:  d  U[        U 5      :  a  SU-  n[        U5      e[        U R                  R                  U   U 5      $ )z*Provides indexed access, (e.g. 'rows[0]').r   zrow index [%d] out of range)r  r  r  r   tr_lstr  s      r"   r   _RowCollection.__getitem__  sD    7cSY&/#5CS/!DII$$S)400r$   c                @    [        U R                  R                  5      $ )z0Supports len() function (e.g. 'len(rows) == 1').)r  r   r<  r.   s    r"   r(  _RowCollection.__len__  s    499##$$r$   c                8    U R                   R                  5         g)z>Called by a row when its height changes. Pass along to parent.N)r   rf   r.   s    r"   rf   $_RowCollection.notify_height_changed  s    **,r$   r6  r7  )r  r{   r|   r  )r   r   r   r   r   r   r   r(  rf   r   r   r   s   @r"   rs   rs     s     
1%- -r$   rs   N)&r   
__future__r   typingr   r   pptx.dml.fillr   pptx.oxml.tabler   pptx.shapesr   pptx.text.textr	   	pptx.utilr
   r   pptx.enum.textr   r   r   r   r   pptx.parts.slider   pptx.shapes.graphfrmr   
pptx.typesr   r   r   r   r&   r   r  r  r-   rs    r$   r"   <module>rN     s    3 " * $ #   $ '2PP.1' O"F O"dR1H R1j,h ,&-8 -6$h $0, ,0-X -r$   