format.pyc
1 o 2 P��c|e � @ s. d dl mZ ddlmZ G dd� dej�ZdS )� )� xmlwriter� )�warnc sz e Zd ZdZd�� fdd� Zdd� Zd�dd �Zd 3 d� Zd�d d�Zd�dd�Z d�dd�Z 4 d�dd�Zd�dd�Zd�dd�Z d�dd�Zdd� Zd�dd�Zd�d d!�Zd"d#� Zd�d$d%�Zd�d&d'�Zd(d)� Zd�d*d+�Zd�d,d-�Zd�d.d/�Zd�d0d1�Zd2d3� Zd4d5� Zd�d6d7�Zd8d9� Zd�d:d;�Zd<d=� Zd�d>d?�Z d�d@dA�Z!dBdC� Z"d�dDdE�Z#dFdG� Z$d�dHdI�Z%dJdK� Z&dLdM� Z'd�dNdO�Z(d�dPdQ�Z)d�dRdS�Z*dTdU� Z+dVdW� Z,dXdY� Z-dZd[� Z.d\d]� Z/d^d_� Z0d�dadb�Z1dcdd� Z2dedf� Z3dgdh� Z4didj� Z5dkdl� Z6dmdn� Z7dodp� Z8d�dqdr�Z9dsdt� Z:d�dudv�Z;dwdx� Z<dydz� Z=d{d|� Z>d}d~� Z?dd�� Z@d�d�� ZAd�d�� ZBd�d�� ZCd�d�� ZDd�d�� ZEd�d�� ZFd�d�� ZGd�d�� ZH� ZIS )��Formatz; 5 A class for writing the Excel XLSX Format file. 6 7 8 Nc s� |du ri }t t| ��� || _|| _d| _d| _d| _d| _d| _ d| _ 9 d| _d| _d| _ d| _d| _d| _d| _d| _d| _d| _d| _d| _d| _d| _d| _d| _d| _d| _d| _d| _d | _d| _ d| _!d| _"d| _#d| _$d| _%d| _&d| _'d| _(d| _)d| _*d| _+d| _,d| _-d| _.d| _/d| _0d| _1d| _2d| _3d| _4d| _5d| _6d| _7d| _8d| _9d| _:d| _;d| _<d| _=d| _>d| _?d| _@d| _A|�B� D ] \}}tC| d 10 | �|� q�d| _DdS )z 11 Constructor. 12 13 N�Generalr �Calibri� � �minorFr �set_)E�superr �__init__�xf_format_indices�dxf_format_indices�xf_index� dxf_index� 14 num_format�num_format_index� 15 font_index�has_font�has_dxf_font�bold� underline�italic� font_name� font_size� 16 font_color�font_strikeout�font_outline�font_shadow�font_script�font_family�font_charset�font_scheme� font_condense�font_extend�theme� hyperlink�xf_id�hidden�locked�text_h_align� text_wrap�text_v_align� text_justlast�rotation�fg_color�bg_color�pattern�has_fill�has_dxf_fill� 17 fill_index� 18 fill_count�border_index� 19 has_border�has_dxf_border�border_count�bottom�bottom_color�diag_border� 20 diag_color� diag_type�left� 21 left_color�right�right_color�top� top_color�indent�shrink�merge_range� reading_order�just_distrib� color_indexed� font_only�items�getattr�_format_key)�self� 22 propertiesZ 23 xf_indicesZdxf_indices�key�value�� __class__� ��C:\Users\Jacks.GUTTSPC\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\xlsxwriter\format.pyr s� 24 zFormat.__init__c C � 25 || _ dS )z� 26 Set the Format font_name property such as 'Time New Roman'. The 27 default Excel font is 'Calibri'. 28 29 Args: 30 font_name: String with the font name. No default. 31 32 Returns: 33 Nothing. 34 35 N�r �rP r rV rV rW � set_font_namey s 36 zFormat.set_font_namer c C rX )z� 37 Set the Format font_size property. The default Excel font size is 11. 38 39 Args: 40 font_size: Int with font size. No default. 41 42 Returns: 43 Nothing. 44 45 N�r �rP r rV rV rW � set_font_size� � 46 zFormat.set_font_sizec C � | � |�| _dS )z� 47 Set the Format font_color property. The Excel default is black. 48 49 Args: 50 font_color: String with the font color. No default. 51 52 Returns: 53 Nothing. 54 55 N�� 56 _get_colorr �rP r rV rV rW �set_font_color� � zFormat.set_font_colorTc C rX )z� 57 Set the Format bold property. 58 59 Args: 60 bold: Default is True, turns property on. 61 62 Returns: 63 Nothing. 64 65 N)r )rP r rV rV rW �set_bold� r_ zFormat.set_boldc C rX )z� 66 Set the Format italic property. 67 68 Args: 69 italic: Default is True, turns property on. 70 71 Returns: 72 Nothing. 73 74 N)r )rP r rV rV rW � 75 set_italic� r_ zFormat.set_italicr c C rX )z� 76 Set the Format underline property. 77 78 Args: 79 underline: Default is 1, single underline. 80 81 Returns: 82 Nothing. 83 84 N)r )rP r rV rV rW � set_underline� r_ zFormat.set_underlinec C rX )z� 85 Set the Format font_strikeout property. 86 87 Args: 88 font_strikeout: Default is True, turns property on. 89 90 Returns: 91 Nothing. 92 93 N)r )rP r rV rV rW �set_font_strikeout� r_ zFormat.set_font_strikeoutc C rX )z� 94 Set the Format font_script property. 95 96 Args: 97 font_script: Default is 1, superscript. 98 99 Returns: 100 Nothing. 101 102 N)r )rP r rV rV rW �set_font_script� r_ zFormat.set_font_scriptc C rX )z� 103 Set the Format font_outline property. 104 105 Args: 106 font_outline: Default is True, turns property on. 107 108 Returns: 109 Nothing. 110 111 N)r )rP r rV rV rW �set_font_outline� r_ zFormat.set_font_outlinec C rX )z� 112 Set the Format font_shadow property. 113 114 Args: 115 font_shadow: Default is True, turns property on. 116 117 Returns: 118 Nothing. 119 120 N)r )rP r rV rV rW �set_font_shadow� r_ zFormat.set_font_shadowc C rX )z� 121 Set the Format num_format property such as '#,##0'. 122 123 Args: 124 num_format: String representing the number format. No default. 125 126 Returns: 127 Nothing. 128 129 N)r )rP r rV rV rW �set_num_format� r_ zFormat.set_num_formatc C rX )z� 130 Set the Format locked property. 131 132 Args: 133 locked: Default is True, turns property on. 134 135 Returns: 136 Nothing. 137 138 N)r* )rP r* rV rV rW � 139 set_locked r_ zFormat.set_lockedc C rX )z� 140 Set the Format hidden property. 141 142 Args: 143 hidden: Default is True, turns property on. 144 145 Returns: 146 Nothing. 147 148 N)r) )rP r) rV rV rW � 149 set_hidden r_ zFormat.set_hiddenc C s> |� � }|dkr | �d� |dkr| �d� |dkr| �d� |dkr(| �d� |dkr1| �d � |d 150 kr:| �d� |dkrC| �d � |dkrL| �d � |dkrU| �d� |dkr^| �d� |dkred| _|dkrn| �d� |dkrw| �d� |dkr�| �d� |dkr�| �d� |dkr�| �d � |dkr�| �d� dS dS )z� 151 Set the Format cell alignment. 152 153 Args: 154 alignment: String representing alignment. No default. 155 156 Returns: 157 Nothing. 158 r@ r �centrer �centerrB � �fill� �justify� Z center_across� Z centre_across�distributed� Zjustify_distributedrD Zvcentre�vcenterr; ZvjustifyZvdistributedN)�lower�set_text_h_alignrJ �set_text_v_align)rP � alignmentrV rV rW � set_align# sH 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 �zFormat.set_alignc C s | � d� dS )z` 175 Set the Format center_across property. 176 177 Returns: 178 Nothing. 179 180 rw N)r| )rP � 181 align_typerV rV rW �set_center_acrossV s zFormat.set_center_acrossc C rX )z� 182 Set the Format text_wrap property. 183 184 Args: 185 text_wrap: Default is True, turns property on. 186 187 Returns: 188 Nothing. 189 190 N)r, )rP r, rV rV rW � set_text_wrap` r_ zFormat.set_text_wrapc C sX t |�}|dkrd}nd| krdkr!n n 191 |dk r | d }ntd� dS || _dS )z� 192 Set the Format rotation property. 193 194 Args: 195 rotation: Rotation angle. No default. 196 197 Returns: 198 Nothing. 199 200 i �� i�����Z r z3Rotation rotation outside range: -90 <= angle <= 90N)�intr r/ )rP r/ rV rV rW �set_rotationm s 201 � 202 zFormat.set_rotationc C rX )z� 203 Set the Format indent property. 204 205 Args: 206 indent: Default is 1, first indentation level. 207 208 Returns: 209 Nothing. 210 211 N)rF )rP rF rV rV rW � 212 set_indent� r_ zFormat.set_indentc C rX )z� 213 Set the Format shrink property. 214 215 Args: 216 shrink: Default is True, turns property on. 217 218 Returns: 219 Nothing. 220 221 N)rG )rP rG rV rV rW � 222 set_shrink� r_ zFormat.set_shrinkc C rX )z� 223 Set the Format text_justlast property. 224 225 Args: 226 text_justlast: Default is True, turns property on. 227 228 Returns: 229 Nothing. 230 231 N)r. )rP r. rV rV rW �set_text_justlast� r_ zFormat.set_text_justlastc C rX )z� 232 Set the Format pattern property. 233 234 Args: 235 pattern: Default is 1, solid fill. 236 237 Returns: 238 Nothing. 239 240 N)r2 )rP r2 rV rV rW �set_pattern� r_ zFormat.set_patternc C r` )z� 241 Set the Format bg_color property. 242 243 Args: 244 bg_color: Background color. No default. 245 246 Returns: 247 Nothing. 248 249 N)rb r1 )rP r1 rV rV rW �set_bg_color� re zFormat.set_bg_colorc C r` )z� 250 Set the Format fg_color property. 251 252 Args: 253 fg_color: Foreground color. No default. 254 255 Returns: 256 Nothing. 257 258 N)rb r0 )rP r0 rV rV rW �set_fg_color� re zFormat.set_fg_colorc C �, | � |� | �|� | �|� | �|� dS �z� 259 Set the Format bottom property. 260 261 Args: 262 bottom: Default is 1, border type 1. 263 264 Returns: 265 Nothing. 266 267 N)� 268 set_bottom�set_top�set_left� set_right)rP �stylerV rV rW � 269 set_border� � 270 271 272 zFormat.set_borderc C r� )z� 273 Set the Format bottom property. 274 275 Args: 276 color: Color string. No default. 277 278 Returns: 279 Nothing. 280 281 N)�set_bottom_color� set_top_color�set_left_color�set_right_color)rP �colorrV rV rW �set_border_color� r� zFormat.set_border_colorc C rX r� )r; )rP r; rV rV rW r� � r_ zFormat.set_bottomc C r` )z� 282 Set the Format bottom_color property. 283 284 Args: 285 bottom_color: Color string. No default. 286 287 Returns: 288 Nothing. 289 290 N)rb r<