
    ,h?                         d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
 ddlmZ  G d d	e      Z G d
 de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Zy)z-Table-related objects such as Table and Cell.    )
is_integer)
FillFormat)TcRange)Subshape)	TextFrame)lazypropertyc                       e Zd ZdZ fdZd Zed        Zed        Z	e	j                  d        Z	ed        Zej                  d        Zed	        Zej                  d
        Zd Zed        Zej                  d        Zed        Zej                  d        Zd Zd Zed        Zed        Zed        Zej                  d        Z xZS )TablezA DrawingML table object.

    Not intended to be constructed directly, use
    :meth:`.Slide.shapes.add_table` to add a table to a slide.
    c                 F    t         t        |           || _        || _        y N)superr
   __init___tbl_graphic_frame)selftblgraphic_frame	__class__s      L/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/pptx/table.pyr   zTable.__init__   s    eT#%	+    c                 N    t        | j                  j                  ||      |       S )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   cellz
Table.cell   s      TYY\\'73T::r   c                 .    t        | j                  |       S )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   columnszTable.columns!   s     !D11r   c                 .    | j                   j                  S )z
        Read/write boolean property which, when true, indicates the first
        column should be formatted differently, as for a side-heading column
        at the far left of the table.
        r   firstColr   s    r   	first_colzTable.first_col*   s     yy!!!r   c                 &    || j                   _        y r   r"   r   values     r   r$   zTable.first_col3       "		r   c                 .    | j                   j                  S )z
        Read/write boolean property which, when true, indicates the first
        row should be formatted differently, e.g. for column headings.
        r   firstRowr   s    r   	first_rowzTable.first_row7   s     yy!!!r   c                 &    || j                   _        y r   r*   r&   s     r   r,   zTable.first_row?   r(   r   c                 .    | j                   j                  S )z
        Read/write boolean property which, when true, indicates the rows of
        the table should appear with alternating shading.
        r   bandRowr   s    r   horz_bandingzTable.horz_bandingC        yy   r   c                 &    || j                   _        y r   r/   r&   s     r   r1   zTable.horz_bandingK       !		r   c                 J      fd j                   j                         D        S )zGenerate _Cell object for each cell in this table.

        Each grid cell is generated in left-to-right, top-to-bottom order.
        c              3   6   K   | ]  }t        |        y wr   r   .0r   r   s     r   	<genexpr>z#Table.iter_cells.<locals>.<genexpr>T   s     ?Bb$?   )r   iter_tcsr   s   `r   
iter_cellszTable.iter_cellsO   s    
 @$))*<*<*>??r   c                 .    | j                   j                  S )z
        Read/write boolean property which, when true, indicates the last
        column should be formatted differently, as for a row totals column at
        the far right of the table.
        r   lastColr   s    r   last_colzTable.last_colV        yy   r   c                 &    || j                   _        y r   r?   r&   s     r   rA   zTable.last_col_   r4   r   c                 .    | j                   j                  S )z
        Read/write boolean property which, when true, indicates the last
        row should be formatted differently, as for a totals row at the
        bottom of the table.
        r   lastRowr   s    r   last_rowzTable.last_rowc   rB   r   c                 &    || j                   _        y r   rE   r&   s     r   rG   zTable.last_rowl   r4   r   c                     t        | j                  D cg c]  }|j                   c}      }|| j                  _        yc c}w )z
        Called by a row when its height changes, triggering the graphic frame
        to recalculate its total height (as the sum of the row heights).
        N)sumrowsheightr   )r   rownew_table_heights      r   notify_height_changedzTable.notify_height_changedp   s6    
 dii@s

@A%5"  A   A c                     t        | j                  D cg c]  }|j                   c}      }|| j                  _        yc c}w )z
        Called by a column when its width changes, triggering the graphic
        frame to recalculate its total width (as the sum of the column
        widths).
        N)rJ   r    widthr   )r   colnew_table_widths      r   notify_width_changedzTable.notify_width_changedx   s5     DLLASsyyAB$3! BrP   c                 .    | j                   j                  S )z9
        The package part containing this table.
        )r   partr   s    r   rW   z
Table.part   s    
 ""'''r   c                 .    t        | j                  |       S )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   rK   z
Table.rows   s     dii..r   c                 .    | j                   j                  S )z
        Read/write boolean property which, when true, indicates the columns
        of the table should appear with alternating shading.
        r   bandColr   s    r   vert_bandingzTable.vert_banding   r2   r   c                 &    || j                   _        y r   r[   r&   s     r   r]   zTable.vert_banding   r4   r   )__name__
__module____qualname____doc__r   r   r   r    propertyr$   setterr,   r1   r=   rA   rG   rO   rU   rW   rK   r]   __classcell__r   s   @r   r
   r
      sn   ,
; 2 2 " " # # " " # # ! ! " "@ ! ! __" " ! ! __" "64 ( ( / / ! ! " "r   r
   c                       e Zd ZdZ fdZd Zd Zed        Ze	d        Z
e	d        Ze	d        Zej                  d	        Ze	d
        Zej                  d        Ze	d        Zej                  d        Ze	d        Zej                  d        Zd Ze	d        Ze	d        Zd Ze	d        Zej                  d        Ze	d        Ze	d        Zej                  d        Zed        Z xZS )r   z
Table cellc                 :    t         t        |   |       || _        y r   )r   r   r   _tc)r   r   parentr   s      r   r   z_Cell.__init__   s    eT#F+r   c                 ^    t        |t        |             sy| j                  |j                  u S )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typeri   r   others     r   __eq__z_Cell.__eq__   s(     %d,xx599$$r   c                 ^    t        |t        |             sy| j                  |j                  uS )NTrl   ro   s     r   __ne__z_Cell.__ne__   s&    %d,xxuyy((r   c                 `    | j                   j                         }t        j                  |      S )z|
        |FillFormat| instance for this cell, providing access to fill
        properties such as foreground color.
        )ri   get_or_add_tcPrr   from_fill_parent)r   tcPrs     r   fillz
_Cell.fill   s'     xx'')**400r   c                 .    | j                   j                  S )z=True if this cell is the top-left grid cell in a merged cell.)ri   is_merge_originr   s    r   rz   z_Cell.is_merge_origin   s     xx'''r   c                 .    | j                   j                  S )ac  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.
        )ri   
is_spannedr   s    r   r|   z_Cell.is_spanned   s     xx"""r   c                 .    | j                   j                  S )z
        Read/write integer value of left margin of cell as a |Length| value
        object. If assigned |None|, the default value is used, 0.1 inches for
        left and right margins and 0.05 inches for top and bottom.
        )ri   marLr   s    r   margin_leftz_Cell.margin_left   s     xx}}r   c                 H    | j                  |       || j                  _        y r   )_validate_margin_valueri   r~   )r   r   s     r   r   z_Cell.margin_left   s    ##K0#r   c                 .    | j                   j                  S )z'
        Right margin of cell.
        )ri   marRr   s    r   margin_rightz_Cell.margin_right       
 xx}}r   c                 H    | j                  |       || j                  _        y r   )r   ri   r   )r   r   s     r   r   z_Cell.margin_right   s    ##L1$r   c                 .    | j                   j                  S )z%
        Top margin of cell.
        )ri   marTr   s    r   
margin_topz_Cell.margin_top   r   r   c                 H    | j                  |       || j                  _        y r   )r   ri   r   )r   r   s     r   r   z_Cell.margin_top   s    ##J/"r   c                 .    | j                   j                  S )z(
        Bottom margin of cell.
        )ri   marBr   s    r   margin_bottomz_Cell.margin_bottom   r   r   c                 H    | j                  |       || j                  _        y r   )r   ri   r   )r   r   s     r   r   z_Cell.margin_bottom   s    ##M2%r   c                    t        | j                  |j                        }|j                  st        d      |j                  rt        d      |j                          |j                  \  }}|j                         D ]	  }||_         |j                         D ]	  }||_
         |j                         D ]	  }d|_         |j                         D ]	  }d|_         y)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   ri   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   mergez_Cell.merge   s     488Z^^4%%>??((FGG'')'22	9++- 	#B"BJ	#,,. 	$B#BK	$335 	BBI	224 	BBI	r   c                 .    | j                   j                  S )an  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`.
        )ri   r   r   s    r   span_heightz_Cell.span_height  s     xxr   c                 .    | j                   j                  S )aq  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`.
        )ri   r   r   s    r   
span_widthz_Cell.span_width+  s     xx   r   c                     | j                   st        d      t        j                  | j                        }|j                         D ]  }dx|_        |_        dx|_        |_	          y)a`  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)
rz   r   r   from_merge_originri   r<   r   r   r   r   )r   r   r   s      r   splitz_Cell.split7  sg     ##S  ,,TXX6##% 	*B'((BJ$))BI		*r   c                 .    | j                   j                  S )a  Unicode (str in Python 3) representation of cell contents.

        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.)

        Either bytes (Python 2 str) or unicode (Python 3 str) can be assigned. Bytes can
        be 7-bit ASCII or UTF-8 encoded 8-bit bytes. Bytes values are converted to
        unicode assuming UTF-8 encoding (which correctly decodes ASCII).
        
text_frametextr   s    r   r   z
_Cell.textL  s    & ###r   c                 &    || j                   _        y r   r   )r   r   s     r   r   z
_Cell.texta  s    #r   c                 N    | j                   j                         }t        ||       S )zT
        |TextFrame| instance containing the text that appears in the cell.
        )ri   get_or_add_txBodyr   )r   txBodys     r   r   z_Cell.text_framee  s#    
 ++-&&r   c                 .    | j                   j                  S )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.
        ri   anchorr   s    r   vertical_anchorz_Cell.vertical_anchorm  s     xxr   c                 &    || j                   _        y r   r   )r   mso_anchor_idxs     r   r   z_Cell.vertical_anchor|  s    (r   c                 @    t        |       s| d}t        || z        yy)zg
        Raise ValueError if *margin_value* is not a positive integer value or
        |None|.
        Nz.margin value must be integer or None, got '%s')r   	TypeError)margin_valuetmpls     r   r   z_Cell._validate_margin_value  s/     ,'L,DCDD</00 -E'r   )r_   r`   ra   rb   r   rq   rs   r   rx   rc   rz   r|   r   rd   r   r   r   r   r   r   r   r   r   r   staticmethodr   re   rf   s   @r   r   r      s   %)
 1 1 ( ( 	# 	#   $ $   % %   # #   & &> 	  	  	! 	!** $ $( 
[[$ $ ' '   ) ) 1 1r   r   c                   V     e Zd ZdZ fdZed        Zej                  d        Z xZS )_ColumnzTable columnc                 :    t         t        |   |       || _        y r   )r   r   r   _gridCol)r   gridColrj   r   s      r   r   z_Column.__init__  s    gt%f-r   c                 .    | j                   j                  S )z)
        Width of column in EMU.
        )r   wr   s    r   rR   z_Column.width  s    
 }}r   c                 Z    || j                   _        | j                  j                          y r   )r   r   _parentrU   )r   rR   s     r   rR   z_Column.width  s    ))+r   )	r_   r`   ra   rb   r   rc   rR   rd   re   rf   s   @r   r   r     s7        \\, ,r   r   c                   f     e Zd ZdZ fdZed        Zed        Zej                  d        Z xZ	S )_Rowz	Table rowc                 :    t         t        |   |       || _        y r   )r   r   r   _trr   trrj   r   s      r   r   z_Row.__init__  s    dD"6*r   c                 .    t        | j                  |       S )z
        Read-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   cellsz
_Row.cells  s     txx..r   c                 .    | j                   j                  S )z'
        Height of row in EMU.
        )r   hr   s    r   rL   z_Row.height  s    
 xxzzr   c                 Z    || j                   _        | j                  j                          y r   )r   r   r   rO   )r   rL   s     r   rL   z_Row.height  s    
**,r   )
r_   r`   ra   rb   r   rc   r   rL   rd   re   rf   s   @r   r   r     sK     / /   ]]- -r   r   c                   4     e Zd ZdZ fdZd Zd Zd Z xZS )r   z Horizontal sequence of row cellsc                 :    t         t        |   |       || _        y r   )r   r   r   r   r   s      r   r   z_CellCollection.__init__  s    ot-f5r   c                     |dk  s"|t        | j                  j                        k\  rd|z  }t        |      t	        | j                  j                  |   |       S )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__z_CellCollection.__getitem__  sK    7cS11036CS/!TXX__S)400r   c                 B      fd j                   j                  D        S )zProvides iterability.c              3   6   K   | ]  }t        |        y wr   r7   r8   s     r   r:   z+_CellCollection.__iter__.<locals>.<genexpr>  s     :Bb$:r;   )r   r   r   s   `r   __iter__z_CellCollection.__iter__  s    :$((//::r   c                 @    t        | j                  j                        S )z1Supports len() function (e.g. 'len(cells) == 1').)r   r   r   r   s    r   __len__z_CellCollection.__len__  s    488??##r   )	r_   r`   ra   rb   r   r   r   r   re   rf   s   @r   r   r     s    *1;$r   r   c                   4     e Zd ZdZ fdZd Zd Zd Z xZS )r   zSequence of table columns.c                 :    t         t        |   |       || _        y r   )r   r   r   r   r   r   rj   r   s      r   r   z_ColumnCollection.__init__  s    /7	r   c                     |dk  s,|t        | j                  j                  j                        k\  rd|z  }t	        |      t        | j                  j                  j                  |   |       S )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   z_ColumnCollection.__getitem__  s]     7cS!2!2!>!>??2S8CS/!tyy((44S94@@r   c                 T    t        | j                  j                  j                        S )zE
        Supports len() function (e.g. 'len(columns) == 1').
        )r   r   r   r   r   s    r   r   z_ColumnCollection.__len__  s     499$$0011r   c                 8    | j                   j                          y)zR
        Called by a column when its width changes. Pass along to parent.
        N)r   rU   r   s    r   rU   z&_ColumnCollection.notify_width_changed  s     	))+r   )	r_   r`   ra   rb   r   r   r   rU   re   rf   s   @r   r   r     s    $A2,r   r   c                   4     e Zd ZdZ fdZd Zd Zd Z xZS )rY   zSequence of table rowsc                 :    t         t        |   |       || _        y r   )r   rY   r   r   r   s      r   r   z_RowCollection.__init__  s    nd,V4	r   c                     |dk  s|t        |       k\  rd|z  }t        |      t        | j                  j                  |   |       S )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   z_RowCollection.__getitem__  sF     7cSY&/#5CS/!DII$$S)400r   c                 @    t        | j                  j                        S )zB
        Supports len() function (e.g. 'len(rows) == 1').
        )r   r   r   r   s    r   r   z_RowCollection.__len__  s     499##$$r   c                 8    | j                   j                          y)zP
        Called by a row when its height changes. Pass along to parent.
        N)r   rO   r   s    r   rO   z$_RowCollection.notify_height_changed  s     	**,r   )	r_   r`   ra   rb   r   r   r   rO   re   rf   s   @r   rY   rY     s     1%-r   rY   N)rb   pptx.compatr   pptx.dml.fillr   pptx.oxml.tabler   pptx.shapesr   pptx.text.textr   	pptx.utilr   objectr
   r   r   r   r   r   rY    r   r   <module>r      sv    4 " $ #   $ "N"F N"bj1H j1Z,h ,(-8 -8$h $., ,:-X -r   