aspose-cells-foss 25.12.1__py3-none-any.whl → 26.2.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- aspose_cells/__init__.py +88 -0
- aspose_cells/auto_filter.py +527 -0
- aspose_cells/cell.py +483 -0
- aspose_cells/cell_value_handler.py +319 -0
- aspose_cells/cells.py +779 -0
- aspose_cells/cfb_handler.py +445 -0
- aspose_cells/cfb_writer.py +659 -0
- aspose_cells/cfb_writer_minimal.py +337 -0
- aspose_cells/comment_xml.py +475 -0
- aspose_cells/conditional_format.py +1185 -0
- aspose_cells/csv_handler.py +690 -0
- aspose_cells/data_validation.py +911 -0
- aspose_cells/document_properties.py +356 -0
- aspose_cells/encryption_crypto.py +247 -0
- aspose_cells/encryption_params.py +138 -0
- aspose_cells/hyperlink.py +372 -0
- aspose_cells/json_handler.py +185 -0
- aspose_cells/markdown_handler.py +583 -0
- aspose_cells/shared_strings.py +101 -0
- aspose_cells/style.py +841 -0
- aspose_cells/workbook.py +499 -0
- aspose_cells/workbook_hash_password.py +68 -0
- aspose_cells/workbook_properties.py +712 -0
- aspose_cells/worksheet.py +570 -0
- aspose_cells/worksheet_properties.py +1239 -0
- aspose_cells/xlsx_encryptor.py +403 -0
- aspose_cells/xml_autofilter_loader.py +195 -0
- aspose_cells/xml_autofilter_saver.py +173 -0
- aspose_cells/xml_conditional_format_loader.py +215 -0
- aspose_cells/xml_conditional_format_saver.py +351 -0
- aspose_cells/xml_datavalidation_loader.py +239 -0
- aspose_cells/xml_datavalidation_saver.py +245 -0
- aspose_cells/xml_hyperlink_handler.py +323 -0
- aspose_cells/xml_loader.py +986 -0
- aspose_cells/xml_properties_loader.py +512 -0
- aspose_cells/xml_properties_saver.py +607 -0
- aspose_cells/xml_saver.py +1306 -0
- aspose_cells_foss-26.2.2.dist-info/METADATA +190 -0
- aspose_cells_foss-26.2.2.dist-info/RECORD +41 -0
- {aspose_cells_foss-25.12.1.dist-info → aspose_cells_foss-26.2.2.dist-info}/WHEEL +1 -1
- aspose_cells_foss-26.2.2.dist-info/top_level.txt +1 -0
- aspose/__init__.py +0 -14
- aspose/cells/__init__.py +0 -31
- aspose/cells/cell.py +0 -350
- aspose/cells/constants.py +0 -44
- aspose/cells/converters/__init__.py +0 -13
- aspose/cells/converters/csv_converter.py +0 -55
- aspose/cells/converters/json_converter.py +0 -46
- aspose/cells/converters/markdown_converter.py +0 -453
- aspose/cells/drawing/__init__.py +0 -17
- aspose/cells/drawing/anchor.py +0 -172
- aspose/cells/drawing/collection.py +0 -233
- aspose/cells/drawing/image.py +0 -338
- aspose/cells/formats.py +0 -80
- aspose/cells/formula/__init__.py +0 -10
- aspose/cells/formula/evaluator.py +0 -360
- aspose/cells/formula/functions.py +0 -433
- aspose/cells/formula/tokenizer.py +0 -340
- aspose/cells/io/__init__.py +0 -27
- aspose/cells/io/csv/__init__.py +0 -8
- aspose/cells/io/csv/reader.py +0 -88
- aspose/cells/io/csv/writer.py +0 -98
- aspose/cells/io/factory.py +0 -138
- aspose/cells/io/interfaces.py +0 -48
- aspose/cells/io/json/__init__.py +0 -8
- aspose/cells/io/json/reader.py +0 -126
- aspose/cells/io/json/writer.py +0 -119
- aspose/cells/io/md/__init__.py +0 -8
- aspose/cells/io/md/reader.py +0 -161
- aspose/cells/io/md/writer.py +0 -334
- aspose/cells/io/models.py +0 -64
- aspose/cells/io/xlsx/__init__.py +0 -9
- aspose/cells/io/xlsx/constants.py +0 -312
- aspose/cells/io/xlsx/image_writer.py +0 -311
- aspose/cells/io/xlsx/reader.py +0 -284
- aspose/cells/io/xlsx/writer.py +0 -931
- aspose/cells/plugins/__init__.py +0 -6
- aspose/cells/plugins/docling_backend/__init__.py +0 -7
- aspose/cells/plugins/docling_backend/backend.py +0 -535
- aspose/cells/plugins/markitdown_plugin/__init__.py +0 -15
- aspose/cells/plugins/markitdown_plugin/plugin.py +0 -128
- aspose/cells/range.py +0 -210
- aspose/cells/style.py +0 -287
- aspose/cells/utils/__init__.py +0 -54
- aspose/cells/utils/coordinates.py +0 -68
- aspose/cells/utils/exceptions.py +0 -43
- aspose/cells/utils/validation.py +0 -102
- aspose/cells/workbook.py +0 -352
- aspose/cells/worksheet.py +0 -670
- aspose_cells_foss-25.12.1.dist-info/METADATA +0 -189
- aspose_cells_foss-25.12.1.dist-info/RECORD +0 -53
- aspose_cells_foss-25.12.1.dist-info/entry_points.txt +0 -2
- aspose_cells_foss-25.12.1.dist-info/top_level.txt +0 -1
|
@@ -0,0 +1,712 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Aspose.Cells for Python - Workbook Properties Module
|
|
3
|
+
|
|
4
|
+
This module provides classes for workbook-level properties according to ECMA-376 specification.
|
|
5
|
+
Includes file version, workbook protection, workbook views, calculation properties, and defined names.
|
|
6
|
+
|
|
7
|
+
ECMA-376 Sections: 18.2.1-18.2.30
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class FileVersion:
|
|
12
|
+
"""
|
|
13
|
+
Represents file version information for the workbook.
|
|
14
|
+
|
|
15
|
+
ECMA-376 Section: 18.2.10
|
|
16
|
+
|
|
17
|
+
Examples:
|
|
18
|
+
>>> wb.properties.file_version.app_name = "xl"
|
|
19
|
+
>>> wb.properties.file_version.last_edited = "7"
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
def __init__(self):
|
|
23
|
+
self._app_name = "xl"
|
|
24
|
+
self._last_edited = "7"
|
|
25
|
+
self._lowest_edited = "0"
|
|
26
|
+
self._rup_build = "12345"
|
|
27
|
+
|
|
28
|
+
@property
|
|
29
|
+
def app_name(self):
|
|
30
|
+
"""Application that created the file."""
|
|
31
|
+
return self._app_name
|
|
32
|
+
|
|
33
|
+
@app_name.setter
|
|
34
|
+
def app_name(self, value):
|
|
35
|
+
self._app_name = value
|
|
36
|
+
|
|
37
|
+
@property
|
|
38
|
+
def last_edited(self):
|
|
39
|
+
"""Number of times the file has been edited."""
|
|
40
|
+
return self._last_edited
|
|
41
|
+
|
|
42
|
+
@last_edited.setter
|
|
43
|
+
def last_edited(self, value):
|
|
44
|
+
self._last_edited = value
|
|
45
|
+
|
|
46
|
+
@property
|
|
47
|
+
def lowest_edited(self):
|
|
48
|
+
"""Lowest version of Excel that has edited the file."""
|
|
49
|
+
return self._lowest_edited
|
|
50
|
+
|
|
51
|
+
@lowest_edited.setter
|
|
52
|
+
def lowest_edited(self, value):
|
|
53
|
+
self._lowest_edited = value
|
|
54
|
+
|
|
55
|
+
@property
|
|
56
|
+
def rup_build(self):
|
|
57
|
+
"""Build number of the application."""
|
|
58
|
+
return self._rup_build
|
|
59
|
+
|
|
60
|
+
@rup_build.setter
|
|
61
|
+
def rup_build(self, value):
|
|
62
|
+
self._rup_build = value
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class WorkbookPr:
|
|
66
|
+
"""
|
|
67
|
+
Represents workbook properties (workbookPr element).
|
|
68
|
+
|
|
69
|
+
ECMA-376 Section: 18.2.13
|
|
70
|
+
|
|
71
|
+
Examples:
|
|
72
|
+
>>> wb.properties.workbook_pr.date1904 = True
|
|
73
|
+
>>> wb.properties.workbook_pr.code_name = "ThisWorkbook"
|
|
74
|
+
"""
|
|
75
|
+
|
|
76
|
+
def __init__(self):
|
|
77
|
+
self._date1904 = False
|
|
78
|
+
self._code_name = None
|
|
79
|
+
self._show_objects = "all"
|
|
80
|
+
self._filter_privacy = False
|
|
81
|
+
self._show_border_unselected_tables = True
|
|
82
|
+
self._show_ink_annotation = True
|
|
83
|
+
self._backup_file = False
|
|
84
|
+
self._save_external_link_values = True
|
|
85
|
+
self._update_links = "userSet"
|
|
86
|
+
self._hide_pivot_field_list = False
|
|
87
|
+
self._default_theme_version = None
|
|
88
|
+
|
|
89
|
+
@property
|
|
90
|
+
def date1904(self):
|
|
91
|
+
"""Whether to use 1904 date system."""
|
|
92
|
+
return self._date1904
|
|
93
|
+
|
|
94
|
+
@date1904.setter
|
|
95
|
+
def date1904(self, value):
|
|
96
|
+
self._date1904 = value
|
|
97
|
+
|
|
98
|
+
@property
|
|
99
|
+
def code_name(self):
|
|
100
|
+
"""VBA code name for the workbook."""
|
|
101
|
+
return self._code_name
|
|
102
|
+
|
|
103
|
+
@code_name.setter
|
|
104
|
+
def code_name(self, value):
|
|
105
|
+
self._code_name = value
|
|
106
|
+
|
|
107
|
+
@property
|
|
108
|
+
def show_objects(self):
|
|
109
|
+
"""Display objects mode: 'all', 'placeholders', or 'none'."""
|
|
110
|
+
return self._show_objects
|
|
111
|
+
|
|
112
|
+
@show_objects.setter
|
|
113
|
+
def show_objects(self, value):
|
|
114
|
+
self._show_objects = value
|
|
115
|
+
|
|
116
|
+
@property
|
|
117
|
+
def filter_privacy(self):
|
|
118
|
+
"""Whether to remove personal info from filters on save."""
|
|
119
|
+
return self._filter_privacy
|
|
120
|
+
|
|
121
|
+
@filter_privacy.setter
|
|
122
|
+
def filter_privacy(self, value):
|
|
123
|
+
self._filter_privacy = value
|
|
124
|
+
|
|
125
|
+
@property
|
|
126
|
+
def show_border_unselected_tables(self):
|
|
127
|
+
"""Whether to show borders for unselected tables."""
|
|
128
|
+
return self._show_border_unselected_tables
|
|
129
|
+
|
|
130
|
+
@show_border_unselected_tables.setter
|
|
131
|
+
def show_border_unselected_tables(self, value):
|
|
132
|
+
self._show_border_unselected_tables = value
|
|
133
|
+
|
|
134
|
+
@property
|
|
135
|
+
def show_ink_annotation(self):
|
|
136
|
+
"""Whether to show ink annotations."""
|
|
137
|
+
return self._show_ink_annotation
|
|
138
|
+
|
|
139
|
+
@show_ink_annotation.setter
|
|
140
|
+
def show_ink_annotation(self, value):
|
|
141
|
+
self._show_ink_annotation = value
|
|
142
|
+
|
|
143
|
+
@property
|
|
144
|
+
def backup_file(self):
|
|
145
|
+
"""Whether to create a backup file when saving."""
|
|
146
|
+
return self._backup_file
|
|
147
|
+
|
|
148
|
+
@backup_file.setter
|
|
149
|
+
def backup_file(self, value):
|
|
150
|
+
self._backup_file = value
|
|
151
|
+
|
|
152
|
+
@property
|
|
153
|
+
def save_external_link_values(self):
|
|
154
|
+
"""Whether to save cached values for external links."""
|
|
155
|
+
return self._save_external_link_values
|
|
156
|
+
|
|
157
|
+
@save_external_link_values.setter
|
|
158
|
+
def save_external_link_values(self, value):
|
|
159
|
+
self._save_external_link_values = value
|
|
160
|
+
|
|
161
|
+
@property
|
|
162
|
+
def update_links(self):
|
|
163
|
+
"""How to update external links: 'userSet', 'never', or 'always'."""
|
|
164
|
+
return self._update_links
|
|
165
|
+
|
|
166
|
+
@update_links.setter
|
|
167
|
+
def update_links(self, value):
|
|
168
|
+
self._update_links = value
|
|
169
|
+
|
|
170
|
+
@property
|
|
171
|
+
def hide_pivot_field_list(self):
|
|
172
|
+
"""Whether to hide the pivot field list."""
|
|
173
|
+
return self._hide_pivot_field_list
|
|
174
|
+
|
|
175
|
+
@hide_pivot_field_list.setter
|
|
176
|
+
def hide_pivot_field_list(self, value):
|
|
177
|
+
self._hide_pivot_field_list = value
|
|
178
|
+
|
|
179
|
+
@property
|
|
180
|
+
def default_theme_version(self):
|
|
181
|
+
"""Default theme version."""
|
|
182
|
+
return self._default_theme_version
|
|
183
|
+
|
|
184
|
+
@default_theme_version.setter
|
|
185
|
+
def default_theme_version(self, value):
|
|
186
|
+
self._default_theme_version = value
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
class WorkbookProtection:
|
|
190
|
+
"""
|
|
191
|
+
Represents workbook protection settings.
|
|
192
|
+
|
|
193
|
+
ECMA-376 Section: 18.2.29
|
|
194
|
+
|
|
195
|
+
Examples:
|
|
196
|
+
>>> wb.properties.protection.lock_structure = True
|
|
197
|
+
>>> wb.properties.protection.workbook_password = "hashed_password"
|
|
198
|
+
"""
|
|
199
|
+
|
|
200
|
+
def __init__(self):
|
|
201
|
+
self._lock_structure = False
|
|
202
|
+
self._lock_windows = False
|
|
203
|
+
self._lock_revision = False
|
|
204
|
+
self._revisions_password = None
|
|
205
|
+
self._workbook_password = None
|
|
206
|
+
|
|
207
|
+
@property
|
|
208
|
+
def lock_structure(self):
|
|
209
|
+
"""Whether workbook structure is locked."""
|
|
210
|
+
return self._lock_structure
|
|
211
|
+
|
|
212
|
+
@lock_structure.setter
|
|
213
|
+
def lock_structure(self, value):
|
|
214
|
+
self._lock_structure = value
|
|
215
|
+
|
|
216
|
+
@property
|
|
217
|
+
def lock_windows(self):
|
|
218
|
+
"""Whether workbook windows are locked."""
|
|
219
|
+
return self._lock_windows
|
|
220
|
+
|
|
221
|
+
@lock_windows.setter
|
|
222
|
+
def lock_windows(self, value):
|
|
223
|
+
self._lock_windows = value
|
|
224
|
+
|
|
225
|
+
@property
|
|
226
|
+
def lock_revision(self):
|
|
227
|
+
"""Whether revision tracking is locked."""
|
|
228
|
+
return self._lock_revision
|
|
229
|
+
|
|
230
|
+
@lock_revision.setter
|
|
231
|
+
def lock_revision(self, value):
|
|
232
|
+
self._lock_revision = value
|
|
233
|
+
|
|
234
|
+
@property
|
|
235
|
+
def revisions_password(self):
|
|
236
|
+
"""Hashed password for revision protection."""
|
|
237
|
+
return self._revisions_password
|
|
238
|
+
|
|
239
|
+
@revisions_password.setter
|
|
240
|
+
def revisions_password(self, value):
|
|
241
|
+
self._revisions_password = value
|
|
242
|
+
|
|
243
|
+
@property
|
|
244
|
+
def workbook_password(self):
|
|
245
|
+
"""Hashed password for workbook protection."""
|
|
246
|
+
return self._workbook_password
|
|
247
|
+
|
|
248
|
+
@workbook_password.setter
|
|
249
|
+
def workbook_password(self, value):
|
|
250
|
+
self._workbook_password = value
|
|
251
|
+
|
|
252
|
+
@property
|
|
253
|
+
def is_protected(self):
|
|
254
|
+
"""Returns True if workbook has any protection enabled."""
|
|
255
|
+
return self._lock_structure or self._lock_windows or self._lock_revision
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
class WorkbookView:
|
|
259
|
+
"""
|
|
260
|
+
Represents a workbook view configuration.
|
|
261
|
+
|
|
262
|
+
ECMA-376 Section: 18.2.30
|
|
263
|
+
|
|
264
|
+
Examples:
|
|
265
|
+
>>> wb.properties.view.active_tab = 0
|
|
266
|
+
>>> wb.properties.view.show_sheet_tabs = True
|
|
267
|
+
"""
|
|
268
|
+
|
|
269
|
+
def __init__(self):
|
|
270
|
+
self._x_window = 0
|
|
271
|
+
self._y_window = 0
|
|
272
|
+
self._window_width = 22260
|
|
273
|
+
self._window_height = 12645
|
|
274
|
+
self._active_tab = 0
|
|
275
|
+
self._first_sheet = 0
|
|
276
|
+
self._show_horizontal_scroll = True
|
|
277
|
+
self._show_vertical_scroll = True
|
|
278
|
+
self._show_sheet_tabs = True
|
|
279
|
+
self._tab_ratio = 600
|
|
280
|
+
self._visibility = 'visible'
|
|
281
|
+
self._minimized = False
|
|
282
|
+
self._auto_filter_date_grouping = True
|
|
283
|
+
|
|
284
|
+
@property
|
|
285
|
+
def x_window(self):
|
|
286
|
+
"""Horizontal position of window."""
|
|
287
|
+
return self._x_window
|
|
288
|
+
|
|
289
|
+
@x_window.setter
|
|
290
|
+
def x_window(self, value):
|
|
291
|
+
self._x_window = value
|
|
292
|
+
|
|
293
|
+
@property
|
|
294
|
+
def y_window(self):
|
|
295
|
+
"""Vertical position of window."""
|
|
296
|
+
return self._y_window
|
|
297
|
+
|
|
298
|
+
@y_window.setter
|
|
299
|
+
def y_window(self, value):
|
|
300
|
+
self._y_window = value
|
|
301
|
+
|
|
302
|
+
@property
|
|
303
|
+
def window_width(self):
|
|
304
|
+
"""Width of workbook window."""
|
|
305
|
+
return self._window_width
|
|
306
|
+
|
|
307
|
+
@window_width.setter
|
|
308
|
+
def window_width(self, value):
|
|
309
|
+
self._window_width = value
|
|
310
|
+
|
|
311
|
+
@property
|
|
312
|
+
def window_height(self):
|
|
313
|
+
"""Height of workbook window."""
|
|
314
|
+
return self._window_height
|
|
315
|
+
|
|
316
|
+
@window_height.setter
|
|
317
|
+
def window_height(self, value):
|
|
318
|
+
self._window_height = value
|
|
319
|
+
|
|
320
|
+
@property
|
|
321
|
+
def active_tab(self):
|
|
322
|
+
"""Index of active sheet (0-based)."""
|
|
323
|
+
return self._active_tab
|
|
324
|
+
|
|
325
|
+
@active_tab.setter
|
|
326
|
+
def active_tab(self, value):
|
|
327
|
+
self._active_tab = value
|
|
328
|
+
|
|
329
|
+
@property
|
|
330
|
+
def first_sheet(self):
|
|
331
|
+
"""First sheet in the tab bar."""
|
|
332
|
+
return self._first_sheet
|
|
333
|
+
|
|
334
|
+
@first_sheet.setter
|
|
335
|
+
def first_sheet(self, value):
|
|
336
|
+
self._first_sheet = value
|
|
337
|
+
|
|
338
|
+
@property
|
|
339
|
+
def show_horizontal_scroll(self):
|
|
340
|
+
"""Whether to show horizontal scroll bar."""
|
|
341
|
+
return self._show_horizontal_scroll
|
|
342
|
+
|
|
343
|
+
@show_horizontal_scroll.setter
|
|
344
|
+
def show_horizontal_scroll(self, value):
|
|
345
|
+
self._show_horizontal_scroll = value
|
|
346
|
+
|
|
347
|
+
@property
|
|
348
|
+
def show_vertical_scroll(self):
|
|
349
|
+
"""Whether to show vertical scroll bar."""
|
|
350
|
+
return self._show_vertical_scroll
|
|
351
|
+
|
|
352
|
+
@show_vertical_scroll.setter
|
|
353
|
+
def show_vertical_scroll(self, value):
|
|
354
|
+
self._show_vertical_scroll = value
|
|
355
|
+
|
|
356
|
+
@property
|
|
357
|
+
def show_sheet_tabs(self):
|
|
358
|
+
"""Whether to show sheet tabs."""
|
|
359
|
+
return self._show_sheet_tabs
|
|
360
|
+
|
|
361
|
+
@show_sheet_tabs.setter
|
|
362
|
+
def show_sheet_tabs(self, value):
|
|
363
|
+
self._show_sheet_tabs = value
|
|
364
|
+
|
|
365
|
+
@property
|
|
366
|
+
def tab_ratio(self):
|
|
367
|
+
"""Ratio of tab bar width to horizontal split bar."""
|
|
368
|
+
return self._tab_ratio
|
|
369
|
+
|
|
370
|
+
@tab_ratio.setter
|
|
371
|
+
def tab_ratio(self, value):
|
|
372
|
+
self._tab_ratio = value
|
|
373
|
+
|
|
374
|
+
@property
|
|
375
|
+
def visibility(self):
|
|
376
|
+
"""Window visibility: 'visible', 'hidden', or 'veryHidden'."""
|
|
377
|
+
return self._visibility
|
|
378
|
+
|
|
379
|
+
@visibility.setter
|
|
380
|
+
def visibility(self, value):
|
|
381
|
+
self._visibility = value
|
|
382
|
+
|
|
383
|
+
@property
|
|
384
|
+
def minimized(self):
|
|
385
|
+
"""Whether window is minimized."""
|
|
386
|
+
return self._minimized
|
|
387
|
+
|
|
388
|
+
@minimized.setter
|
|
389
|
+
def minimized(self, value):
|
|
390
|
+
self._minimized = value
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
class CalculationProperties:
|
|
394
|
+
"""
|
|
395
|
+
Represents calculation properties for the workbook.
|
|
396
|
+
|
|
397
|
+
ECMA-376 Section: 18.2.2
|
|
398
|
+
|
|
399
|
+
Examples:
|
|
400
|
+
>>> wb.properties.calculation.calc_mode = "auto"
|
|
401
|
+
>>> wb.properties.calculation.iterate = True
|
|
402
|
+
>>> wb.properties.calculation.iterate_count = 100
|
|
403
|
+
"""
|
|
404
|
+
|
|
405
|
+
def __init__(self):
|
|
406
|
+
self._calc_id = None
|
|
407
|
+
self._calc_mode = 'auto'
|
|
408
|
+
self._full_calc_on_load = False
|
|
409
|
+
self._ref_mode = 'A1'
|
|
410
|
+
self._iterate = False
|
|
411
|
+
self._iterate_count = 100
|
|
412
|
+
self._iterate_delta = 0.001
|
|
413
|
+
self._full_precision = True
|
|
414
|
+
self._calc_completed = True
|
|
415
|
+
self._calc_on_save = True
|
|
416
|
+
self._concurrent_calc = True
|
|
417
|
+
self._force_full_calc = False
|
|
418
|
+
|
|
419
|
+
@property
|
|
420
|
+
def calc_id(self):
|
|
421
|
+
"""Calculation engine version."""
|
|
422
|
+
return self._calc_id
|
|
423
|
+
|
|
424
|
+
@calc_id.setter
|
|
425
|
+
def calc_id(self, value):
|
|
426
|
+
self._calc_id = value
|
|
427
|
+
|
|
428
|
+
@property
|
|
429
|
+
def calc_mode(self):
|
|
430
|
+
"""Calculation mode: 'auto', 'manual', or 'autoNoTable'."""
|
|
431
|
+
return self._calc_mode
|
|
432
|
+
|
|
433
|
+
@calc_mode.setter
|
|
434
|
+
def calc_mode(self, value):
|
|
435
|
+
if value not in ('auto', 'manual', 'autoNoTable'):
|
|
436
|
+
raise ValueError("calc_mode must be 'auto', 'manual', or 'autoNoTable'")
|
|
437
|
+
self._calc_mode = value
|
|
438
|
+
|
|
439
|
+
@property
|
|
440
|
+
def full_calc_on_load(self):
|
|
441
|
+
"""Whether to recalculate on load."""
|
|
442
|
+
return self._full_calc_on_load
|
|
443
|
+
|
|
444
|
+
@full_calc_on_load.setter
|
|
445
|
+
def full_calc_on_load(self, value):
|
|
446
|
+
self._full_calc_on_load = value
|
|
447
|
+
|
|
448
|
+
@property
|
|
449
|
+
def ref_mode(self):
|
|
450
|
+
"""Reference style: 'A1' or 'R1C1'."""
|
|
451
|
+
return self._ref_mode
|
|
452
|
+
|
|
453
|
+
@ref_mode.setter
|
|
454
|
+
def ref_mode(self, value):
|
|
455
|
+
if value not in ('A1', 'R1C1'):
|
|
456
|
+
raise ValueError("ref_mode must be 'A1' or 'R1C1'")
|
|
457
|
+
self._ref_mode = value
|
|
458
|
+
|
|
459
|
+
@property
|
|
460
|
+
def iterate(self):
|
|
461
|
+
"""Whether to enable iterative calculation."""
|
|
462
|
+
return self._iterate
|
|
463
|
+
|
|
464
|
+
@iterate.setter
|
|
465
|
+
def iterate(self, value):
|
|
466
|
+
self._iterate = value
|
|
467
|
+
|
|
468
|
+
@property
|
|
469
|
+
def iterate_count(self):
|
|
470
|
+
"""Maximum iterations (default 100)."""
|
|
471
|
+
return self._iterate_count
|
|
472
|
+
|
|
473
|
+
@iterate_count.setter
|
|
474
|
+
def iterate_count(self, value):
|
|
475
|
+
self._iterate_count = value
|
|
476
|
+
|
|
477
|
+
@property
|
|
478
|
+
def iterate_delta(self):
|
|
479
|
+
"""Maximum change between iterations (default 0.001)."""
|
|
480
|
+
return self._iterate_delta
|
|
481
|
+
|
|
482
|
+
@iterate_delta.setter
|
|
483
|
+
def iterate_delta(self, value):
|
|
484
|
+
self._iterate_delta = value
|
|
485
|
+
|
|
486
|
+
@property
|
|
487
|
+
def full_precision(self):
|
|
488
|
+
"""Whether to use full precision."""
|
|
489
|
+
return self._full_precision
|
|
490
|
+
|
|
491
|
+
@full_precision.setter
|
|
492
|
+
def full_precision(self, value):
|
|
493
|
+
self._full_precision = value
|
|
494
|
+
|
|
495
|
+
@property
|
|
496
|
+
def calc_on_save(self):
|
|
497
|
+
"""Whether to recalculate before save."""
|
|
498
|
+
return self._calc_on_save
|
|
499
|
+
|
|
500
|
+
@calc_on_save.setter
|
|
501
|
+
def calc_on_save(self, value):
|
|
502
|
+
self._calc_on_save = value
|
|
503
|
+
|
|
504
|
+
@property
|
|
505
|
+
def concurrent_calc(self):
|
|
506
|
+
"""Whether to enable concurrent calculation."""
|
|
507
|
+
return self._concurrent_calc
|
|
508
|
+
|
|
509
|
+
@concurrent_calc.setter
|
|
510
|
+
def concurrent_calc(self, value):
|
|
511
|
+
self._concurrent_calc = value
|
|
512
|
+
|
|
513
|
+
@property
|
|
514
|
+
def calc_completed(self):
|
|
515
|
+
"""Whether the calculation is completed."""
|
|
516
|
+
return self._calc_completed
|
|
517
|
+
|
|
518
|
+
@calc_completed.setter
|
|
519
|
+
def calc_completed(self, value):
|
|
520
|
+
self._calc_completed = value
|
|
521
|
+
|
|
522
|
+
@property
|
|
523
|
+
def force_full_calc(self):
|
|
524
|
+
"""Whether to force a full calculation."""
|
|
525
|
+
return self._force_full_calc
|
|
526
|
+
|
|
527
|
+
@force_full_calc.setter
|
|
528
|
+
def force_full_calc(self, value):
|
|
529
|
+
self._force_full_calc = value
|
|
530
|
+
|
|
531
|
+
|
|
532
|
+
class DefinedName:
|
|
533
|
+
"""
|
|
534
|
+
Represents a defined name in the workbook.
|
|
535
|
+
|
|
536
|
+
ECMA-376 Section: 18.2.5
|
|
537
|
+
|
|
538
|
+
Examples:
|
|
539
|
+
>>> name = DefinedName("MyRange", "Sheet1!$A$1:$D$10")
|
|
540
|
+
>>> wb.properties.defined_names.add(name)
|
|
541
|
+
"""
|
|
542
|
+
|
|
543
|
+
def __init__(self, name, refers_to, local_sheet_id=None):
|
|
544
|
+
self._name = name
|
|
545
|
+
self._refers_to = refers_to
|
|
546
|
+
self._local_sheet_id = local_sheet_id
|
|
547
|
+
self._comment = None
|
|
548
|
+
self._description = None
|
|
549
|
+
self._hidden = False
|
|
550
|
+
self._function = False
|
|
551
|
+
self._vb_procedure = False
|
|
552
|
+
|
|
553
|
+
@property
|
|
554
|
+
def name(self):
|
|
555
|
+
"""Name of the defined name."""
|
|
556
|
+
return self._name
|
|
557
|
+
|
|
558
|
+
@name.setter
|
|
559
|
+
def name(self, value):
|
|
560
|
+
self._name = value
|
|
561
|
+
|
|
562
|
+
@property
|
|
563
|
+
def refers_to(self):
|
|
564
|
+
"""Formula or range that the name refers to."""
|
|
565
|
+
return self._refers_to
|
|
566
|
+
|
|
567
|
+
@refers_to.setter
|
|
568
|
+
def refers_to(self, value):
|
|
569
|
+
self._refers_to = value
|
|
570
|
+
|
|
571
|
+
@property
|
|
572
|
+
def local_sheet_id(self):
|
|
573
|
+
"""Sheet index for sheet-local names (None for global names)."""
|
|
574
|
+
return self._local_sheet_id
|
|
575
|
+
|
|
576
|
+
@local_sheet_id.setter
|
|
577
|
+
def local_sheet_id(self, value):
|
|
578
|
+
self._local_sheet_id = value
|
|
579
|
+
|
|
580
|
+
@property
|
|
581
|
+
def comment(self):
|
|
582
|
+
"""Comment associated with the name."""
|
|
583
|
+
return self._comment
|
|
584
|
+
|
|
585
|
+
@comment.setter
|
|
586
|
+
def comment(self, value):
|
|
587
|
+
self._comment = value
|
|
588
|
+
|
|
589
|
+
@property
|
|
590
|
+
def description(self):
|
|
591
|
+
"""Description of the name."""
|
|
592
|
+
return self._description
|
|
593
|
+
|
|
594
|
+
@description.setter
|
|
595
|
+
def description(self, value):
|
|
596
|
+
self._description = value
|
|
597
|
+
|
|
598
|
+
@property
|
|
599
|
+
def hidden(self):
|
|
600
|
+
"""Whether the name is hidden."""
|
|
601
|
+
return self._hidden
|
|
602
|
+
|
|
603
|
+
@hidden.setter
|
|
604
|
+
def hidden(self, value):
|
|
605
|
+
self._hidden = value
|
|
606
|
+
|
|
607
|
+
|
|
608
|
+
class DefinedNameCollection:
|
|
609
|
+
"""
|
|
610
|
+
Collection of defined names in the workbook.
|
|
611
|
+
|
|
612
|
+
Examples:
|
|
613
|
+
>>> wb.properties.defined_names.add(DefinedName("MyRange", "Sheet1!$A$1:$D$10"))
|
|
614
|
+
>>> name = wb.properties.defined_names["MyRange"]
|
|
615
|
+
"""
|
|
616
|
+
|
|
617
|
+
def __init__(self):
|
|
618
|
+
self._names = []
|
|
619
|
+
|
|
620
|
+
def add(self, name_or_str, refers_to=None, local_sheet_id=None):
|
|
621
|
+
"""
|
|
622
|
+
Adds a defined name to the collection.
|
|
623
|
+
|
|
624
|
+
Args:
|
|
625
|
+
name_or_str: Either a DefinedName object or a string name.
|
|
626
|
+
refers_to: Formula or range (required if name_or_str is a string).
|
|
627
|
+
local_sheet_id: Sheet index for sheet-local names.
|
|
628
|
+
|
|
629
|
+
Returns:
|
|
630
|
+
DefinedName: The added defined name.
|
|
631
|
+
"""
|
|
632
|
+
if isinstance(name_or_str, DefinedName):
|
|
633
|
+
self._names.append(name_or_str)
|
|
634
|
+
return name_or_str
|
|
635
|
+
else:
|
|
636
|
+
defined_name = DefinedName(name_or_str, refers_to, local_sheet_id)
|
|
637
|
+
self._names.append(defined_name)
|
|
638
|
+
return defined_name
|
|
639
|
+
|
|
640
|
+
def remove(self, name):
|
|
641
|
+
"""Removes a defined name by name string."""
|
|
642
|
+
for i, dn in enumerate(self._names):
|
|
643
|
+
if dn.name == name:
|
|
644
|
+
return self._names.pop(i)
|
|
645
|
+
return None
|
|
646
|
+
|
|
647
|
+
def __getitem__(self, key):
|
|
648
|
+
"""Gets a defined name by index or name string."""
|
|
649
|
+
if isinstance(key, int):
|
|
650
|
+
return self._names[key]
|
|
651
|
+
elif isinstance(key, str):
|
|
652
|
+
for dn in self._names:
|
|
653
|
+
if dn.name == key:
|
|
654
|
+
return dn
|
|
655
|
+
raise KeyError(f"Defined name '{key}' not found")
|
|
656
|
+
raise TypeError("Key must be int or str")
|
|
657
|
+
|
|
658
|
+
def __len__(self):
|
|
659
|
+
return len(self._names)
|
|
660
|
+
|
|
661
|
+
def __iter__(self):
|
|
662
|
+
return iter(self._names)
|
|
663
|
+
|
|
664
|
+
|
|
665
|
+
class WorkbookProperties:
|
|
666
|
+
"""
|
|
667
|
+
Container for all workbook-level properties.
|
|
668
|
+
|
|
669
|
+
Examples:
|
|
670
|
+
>>> wb.properties.file_version.app_name = "xl"
|
|
671
|
+
>>> wb.properties.protection.lock_structure = True
|
|
672
|
+
>>> wb.properties.view.active_tab = 0
|
|
673
|
+
>>> wb.properties.calculation.calc_mode = "auto"
|
|
674
|
+
"""
|
|
675
|
+
|
|
676
|
+
def __init__(self):
|
|
677
|
+
self._file_version = FileVersion()
|
|
678
|
+
self._workbook_pr = WorkbookPr()
|
|
679
|
+
self._protection = WorkbookProtection()
|
|
680
|
+
self._view = WorkbookView()
|
|
681
|
+
self._calculation = CalculationProperties()
|
|
682
|
+
self._defined_names = DefinedNameCollection()
|
|
683
|
+
|
|
684
|
+
@property
|
|
685
|
+
def file_version(self):
|
|
686
|
+
"""Gets file version properties."""
|
|
687
|
+
return self._file_version
|
|
688
|
+
|
|
689
|
+
@property
|
|
690
|
+
def workbook_pr(self):
|
|
691
|
+
"""Gets workbook properties (workbookPr)."""
|
|
692
|
+
return self._workbook_pr
|
|
693
|
+
|
|
694
|
+
@property
|
|
695
|
+
def protection(self):
|
|
696
|
+
"""Gets workbook protection settings."""
|
|
697
|
+
return self._protection
|
|
698
|
+
|
|
699
|
+
@property
|
|
700
|
+
def view(self):
|
|
701
|
+
"""Gets workbook view settings."""
|
|
702
|
+
return self._view
|
|
703
|
+
|
|
704
|
+
@property
|
|
705
|
+
def calculation(self):
|
|
706
|
+
"""Gets calculation properties."""
|
|
707
|
+
return self._calculation
|
|
708
|
+
|
|
709
|
+
@property
|
|
710
|
+
def defined_names(self):
|
|
711
|
+
"""Gets the collection of defined names."""
|
|
712
|
+
return self._defined_names
|