o
    j,                     @   sH   d Z ddlmZ ddlmZ ddlmZ ddlmZ G dd	 d	eZd
S )zRow in a table.
    )WD_ROW_HEIGHT)Pt   )Cells   )Elementc                       sb   e Zd ZdZddef fddZdd Zdd	 Zd
d Zdd Z	 fddZ
defddZ  ZS )RowzRow in a table.Nrawc                    sD   |d u ri }t  | |dd| _t| d|dg | _d S )Nheightg        )parentcells)super__init__getr
   r   Zrestore_cells)selfr	   	__class__ S/var/www/html/Deteccion_Ine/venv/lib/python3.10/site-packages/pdf2docx/table/Row.pyr      s   zRow.__init__c                 C   s4   z| j | }W |S  ty   d| d}t|w )NzCell index z out of range)r   
IndexError)r   idxcellmsgr   r   r   __getitem__   s   zRow.__getitem__c                 C   s   dd | j D S )Nc                 s   s    | ]}|V  qd S Nr   ).0r   r   r   r   	<genexpr>#   s    zRow.__iter__.<locals>.<genexpr>)r   r   r   r   r   __iter__"   s   zRow.__iter__c                 C   s
   t | jS r   )lenr   r   r   r   r   __len__%   s   
zRow.__len__c                 C   s   | j | dS )z/Append cell to row and update bbox accordingly.N)r   append)r   r   r   r   r   r"   )   s   z
Row.appendc                    s&   t   }|| j| j d |S )N)r
   r   )r   storeupdater
   r   )r   resr   r   r   r#   .   s   
z	Row.storeidx_rowc                 C   s\   |j | }tj|_| jdk rd| _t| j|_tt|jD ]}| j	| 
|||f qdS )zCreate row of docx table.
        
        Args:
            table (Table): ``python-docx`` table instance.
            idx_row (int): Current row index.
        r   N)rowsr   ZEXACTLYZheight_ruler
   r   ranger    columnsr   	make_docx)r   tabler&   Zdocx_rowZidx_colr   r   r   r*   8   s   

zRow.make_docxr   )__name__
__module____qualname____doc__dictr   r   r   r!   r"   r#   intr*   __classcell__r   r   r   r   r      s    	
r   N)	r/   Zdocx.enum.tabler   Zdocx.sharedr   r   Zcommon.Elementr   r   r   r   r   r   <module>   s   