-
-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathtypes_py.py
More file actions
1280 lines (1073 loc) · 33.6 KB
/
types_py.py
File metadata and controls
1280 lines (1073 loc) · 33.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
"""Copyright 2024 - 2026 The excelize Authors. All rights reserved. Use of this
source code is governed by a BSD-style license that can be found in the LICENSE
file.
Package excelize-py is a Python port of Go Excelize library, providing a set of
functions that allow you to write and read from XLAM / XLSM / XLSX / XLTM / XLTX
files. Supports reading and writing spreadsheet documents generated by Microsoft
Excel™ 2007 and later. Supports complex components by high compatibility, and
provided streaming API for generating or reading data from a worksheet with huge
amounts of data. This library needs Python version 3.9 or later.
"""
from dataclasses import dataclass
from enum import IntEnum
from datetime import datetime, date
from typing import List, Optional, Union
class argsRule:
"""
argsRule defines a rule for validating function arguments.
"""
name: str
types: List[type]
opts: bool
def __init__(self, name: str, types: List[type], opts: bool = False):
self.name = name
self.types = types
self.opts = opts
def prepare_args(args: List, types: List[argsRule]):
"""
Validate arguments against expected types.
Args:
args (List): The arguments to validate.
types (List[argsRule]): The expected argument rules.
Raises:
TypeError: If an argument type doesn't match the expected types.
"""
if not types:
return
opts = types[-1].opts if types else False
for i, excepted in enumerate(types):
if opts and i >= len(args):
return
if i >= len(args):
continue
received = type(args[i])
if received not in excepted.types:
names = [t.__name__ for t in excepted.types]
if len(names) == 1:
t = names[0]
else:
t = ", ".join(names[:-1]) + f" or {names[-1]}"
raise TypeError(
f"expected type {t} for argument "
f"'{excepted.name}', but got {received.__name__}"
)
class CultureName(IntEnum):
"""
This section defines the currently supported country code types enumeration
for apply number format.
"""
CultureNameUnknown = 0
CultureNameEnUS = 1
CultureNameJaJP = 2
CultureNameKoKR = 3
CultureNameZhCN = 4
CultureNameZhTW = 5
class CellType(IntEnum):
"""
This section defines the cell value types enumeration.
"""
CellTypeUnset = 0
CellTypeBool = 1
CellTypeDate = 2
CellTypeError = 3
CellTypeFormula = 4
CellTypeInlineString = 5
CellTypeNumber = 6
CellTypeSharedString = 7
class FormControlType(IntEnum):
"""
FormControlType is the type of supported form controls.
"""
FormControlNote = 0
FormControlButton = 1
FormControlOptionButton = 2
FormControlSpinButton = 3
FormControlCheckBox = 4
FormControlGroupBox = 5
FormControlLabel = 6
FormControlScrollBar = 7
class LineDashType(IntEnum):
"""
LineDashType defines the currently supported line dash types enumeration.
"""
LineDashUnset = 0
LineDashSolid = 1
LineDashDot = 2
LineDashDash = 3
LineDashLgDash = 4
LineDashSashDot = 5
LineDashLgDashDot = 6
LineDashLgDashDotDot = 7
LineDashSysDash = 8
LineDashSysDot = 9
LineDashSysDashDot = 10
LineDashSysDashDotDot = 11
class LineType(IntEnum):
"""
LineType defines the currently supported line types enumeration.
"""
LineUnset = 0
LineSolid = 1
LineNone = 2
LineAutomatic = 3
class ChartType(IntEnum):
"""
ChartType defines the currently supported chart types enumeration.
"""
Area = 0
AreaStacked = 1
AreaPercentStacked = 2
Area3D = 3
Area3DStacked = 4
Area3DPercentStacked = 5
Bar = 6
BarStacked = 7
BarPercentStacked = 8
Bar3DClustered = 9
Bar3DStacked = 10
Bar3DPercentStacked = 11
Bar3DConeClustered = 12
Bar3DConeStacked = 13
Bar3DConePercentStacked = 14
Bar3DPyramidClustered = 15
Bar3DPyramidStacked = 16
Bar3DPyramidPercentStacked = 17
Bar3DCylinderClustered = 18
Bar3DCylinderStacked = 19
Bar3DCylinderPercentStacked = 20
Col = 21
ColStacked = 22
ColPercentStacked = 23
Col3D = 24
Col3DClustered = 25
Col3DStacked = 26
Col3DPercentStacked = 27
Col3DCone = 28
Col3DConeClustered = 29
Col3DConeStacked = 30
Col3DConePercentStacked = 31
Col3DPyramid = 32
Col3DPyramidClustered = 33
Col3DPyramidStacked = 34
Col3DPyramidPercentStacked = 35
Col3DCylinder = 36
Col3DCylinderClustered = 37
Col3DCylinderStacked = 38
Col3DCylinderPercentStacked = 39
Doughnut = 40
Line = 41
Line3D = 42
Pie = 43
Pie3D = 44
PieOfPie = 45
BarOfPie = 46
Radar = 47
Scatter = 48
Surface3D = 49
WireframeSurface3D = 50
Contour = 51
WireframeContour = 52
Bubble = 53
Bubble3D = 54
StockHighLowClose = 55
StockOpenHighLowClose = 56
class ChartDataLabelPositionType(IntEnum):
"""
ChartDataLabelPositionType is the type of chart data labels position.
"""
ChartDataLabelsPositionUnset = 0
ChartDataLabelsPositionBestFit = 1
ChartDataLabelsPositionBelow = 2
ChartDataLabelsPositionCenter = 3
ChartDataLabelsPositionInsideBase = 4
ChartDataLabelsPositionInsideEnd = 5
ChartDataLabelsPositionLeft = 6
ChartDataLabelsPositionOutsideEnd = 7
ChartDataLabelsPositionRight = 8
ChartDataLabelsPositionAbove = 9
class ChartTickLabelPositionType(IntEnum):
"""
ChartTickLabelPositionType is the type of supported chart tick label
"""
ChartTickLabelNextToAxis = 0
ChartTickLabelHigh = 1
ChartTickLabelLow = 2
ChartTickLabelNone = 3
class DataValidationType(IntEnum):
"""
DataValidationErrorStyle defined the style of data validation error alert.
"""
DataValidationTypeNone = 1
DataValidationTypeCustom = 2
DataValidationTypeDate = 3
DataValidationTypeDecimal = 4
DataValidationTypeList = 5
DataValidationTypeTextLength = 6
DataValidationTypeTime = 7
DataValidationTypeWhole = 8
class DataValidationErrorStyle(IntEnum):
"""
DataValidationErrorStyle defined the style of data validation error alert.
"""
DataValidationErrorStyleStop = 1
DataValidationErrorStyleWarning = 2
DataValidationErrorStyleInformation = 3
class DataValidationOperator(IntEnum):
"""
DataValidationOperator operator enum.
"""
DataValidationOperatorBetween = 1
DataValidationOperatorEqual = 2
DataValidationOperatorGreaterThan = 3
DataValidationOperatorGreaterThanOrEqual = 4
DataValidationOperatorLessThan = 5
DataValidationOperatorLessThanOrEqual = 6
DataValidationOperatorNotBetween = 7
DataValidationOperatorNotEqual = 8
class HeaderFooterImagePositionType(IntEnum):
"""
HeaderFooterImagePositionType is the type of header and footer image
position.
"""
HeaderFooterImagePositionLeft = 0
HeaderFooterImagePositionCenter = 1
HeaderFooterImagePositionRight = 2
class IgnoredErrorsType(IntEnum):
"""
IgnoredErrorsType is the type of ignored errors.
"""
IgnoredErrorsEvalError = 0
IgnoredErrorsTwoDigitTextYear = 1
IgnoredErrorsNumberStoredAsText = 2
IgnoredErrorsFormula = 3
IgnoredErrorsFormulaRange = 4
IgnoredErrorsUnlockedFormula = 5
IgnoredErrorsEmptyCellReference = 6
IgnoredErrorsListDataValidation = 7
IgnoredErrorsCalculatedColumn = 8
class PictureInsertType(IntEnum):
"""
PictureInsertType defines the type of the picture has been inserted into the
worksheet.
"""
PictureInsertTypePlaceOverCells = 0
PictureInsertTypePlaceInCell = 1
PictureInsertTypeIMAGE = 2
PictureInsertTypeDISPIMG = 3
@dataclass
class Interface:
type: int = 0
integer: int = 0
string: str = ""
float64: float = 0
boolean: bool = False
@dataclass
class Options:
max_calc_iterations: int = 0
password: str = ""
raw_cell_value: bool = False
unzip_size_limit: int = 0
unzip_xml_size_limit: int = 0
tmp_dir: str = ""
short_date_pattern: str = ""
long_date_pattern: str = ""
long_time_pattern: str = ""
culture_info: CultureName = CultureName.CultureNameUnknown
@dataclass
class AppProperties:
application: str = ""
scale_crop: bool = False
doc_security: int = 0
company: str = ""
links_up_to_date: bool = False
hyperlinks_changed: bool = False
app_version: str = ""
@dataclass
class CalcPropsOptions:
calc_id: Optional[int] = None
calc_mode: Optional[str] = None
full_calc_on_load: Optional[bool] = None
ref_mode: Optional[str] = None
iterate: Optional[bool] = None
iterate_count: Optional[int] = None
iterate_delta: Optional[float] = None
full_precision: Optional[bool] = None
calc_completed: Optional[bool] = None
calc_on_save: Optional[bool] = None
concurrent_calc: Optional[bool] = None
concurrent_manual_count: Optional[int] = None
force_full_calc: Optional[bool] = None
@dataclass
class CustomProperty:
name: str = ""
value: Union[bool, float, int, str, date, datetime, None] = None
# dataValidationTypeMap defined supported data validation types.
data_validation_type_map = {
DataValidationType.DataValidationTypeNone: "none",
DataValidationType.DataValidationTypeCustom: "custom",
DataValidationType.DataValidationTypeDate: "date",
DataValidationType.DataValidationTypeDecimal: "decimal",
DataValidationType.DataValidationTypeList: "list",
DataValidationType.DataValidationTypeTextLength: "textLength",
DataValidationType.DataValidationTypeTime: "time",
DataValidationType.DataValidationTypeWhole: "whole",
}
# dataValidationOperatorMap defined supported data validation operators.
data_validation_operator_map = {
DataValidationOperator.DataValidationOperatorBetween: "between",
DataValidationOperator.DataValidationOperatorEqual: "equal",
DataValidationOperator.DataValidationOperatorGreaterThan: "greaterThan",
DataValidationOperator.DataValidationOperatorGreaterThanOrEqual: "greaterThanOrEqual",
DataValidationOperator.DataValidationOperatorLessThan: "lessThan",
DataValidationOperator.DataValidationOperatorLessThanOrEqual: "lessThanOrEqual",
DataValidationOperator.DataValidationOperatorNotBetween: "notBetween",
DataValidationOperator.DataValidationOperatorNotEqual: "notEqual",
}
@dataclass
class DataValidation:
allow_blank: bool = False
error: Optional[str] = None
error_style: Optional[str] = None
error_title: Optional[str] = None
operator: str = ""
prompt: Optional[str] = None
prompt_title: Optional[str] = None
show_drop_down: bool = False
show_error_message: bool = False
show_input_message: bool = False
sqref: str = ""
type: str = ""
formula1: str = ""
formula2: str = ""
def set_error(self, style: DataValidationErrorStyle, title: str, msg: str) -> None:
"""
Set error notice.
Args:
style (DataValidationErrorStyle): The data validation error style
title (str): The error title
msg (str): The error message
Returns:
None: Return None if no error occurred, otherwise raise a
RuntimeError with the message.
"""
prepare_args(
[style, title, msg],
[
argsRule("style", [DataValidationErrorStyle]),
argsRule("title", [str]),
argsRule("msg", [str]),
],
)
self.error = msg
self.error_title = title
str_style = "stop"
if style == DataValidationErrorStyle.DataValidationErrorStyleStop:
str_style = "stop"
elif style == DataValidationErrorStyle.DataValidationErrorStyleWarning:
str_style = "warning"
elif style == DataValidationErrorStyle.DataValidationErrorStyleInformation:
str_style = "information"
self.show_error_message = True
self.error_style = str_style
def set_input(self, title: str, msg: str) -> None:
"""
Set the input prompt message.
Args:
title (str): The input title
msg (str): The input message
Returns:
None: Return None if no error occurred, otherwise raise a
RuntimeError with the message.
"""
prepare_args(
[title, msg],
[argsRule("title", [str]), argsRule("msg", [str])],
)
self.show_input_message = True
self.prompt_title = title
self.prompt = msg
def set_drop_list(self, keys: List[str]) -> None:
"""
Set data validation list. If you type the items into the data validation
dialog box (a delimited list), the limit is 255 characters, including
the separators. If your data validation list source formula is over the
maximum length limit, please set the allowed values in the worksheet
cells, and use the `set_sqref_drop_list` function to set the reference
for their cells.
Args:
keys (List[str]): The list of values for the drop list
Returns:
None: Return None if no error occurred, otherwise raise a
RuntimeError with the message.
"""
prepare_args([keys], [argsRule("keys", [list])])
formula = ",".join(keys)
if 255 < len(formula):
raise RuntimeError("data validation must be 0-255 characters")
self.type = data_validation_type_map[DataValidationType.DataValidationTypeList]
for k, v in {"&": "&", "<": "<", ">": ">"}.items():
formula = formula.replace(k, v)
if formula.startswith("="):
self.formula1 = formula
return
self.formula1 = '"' + formula.replace('"', '""') + '"'
def set_range(
self,
f1: Union[int, float, str],
f2: Union[int, float, str],
t: DataValidationType,
o: DataValidationOperator,
) -> None:
"""
Set data validation range in drop list.
Args:
f1: The first formula value (int, float, or str)
f2: The second formula value (int, float, or str)
t (DataValidationType): The data validation type
o (DataValidationOperator): The data validation operator
Returns:
None: Return None if no error occurred, otherwise raise a
TypeError with the message.
"""
def gen_formula(val):
if isinstance(val, int):
return str(val)
if isinstance(val, float):
if abs(val) > 3.4028235e38:
raise RuntimeError("data validation range exceeds limit")
return f"{val:.17g}"
if isinstance(val, str):
return val
raise TypeError("parameter is invalid")
self.formula1 = gen_formula(f1)
self.formula2 = gen_formula(f2)
self.type = data_validation_type_map[t]
self.operator = data_validation_operator_map[o]
def set_sqref_drop_list(self, sqref: str) -> None:
"""
Set data validation on a range with source reference range of the
worksheet by given data validation object and worksheet name. The data
validation object can be created by `new_data_validation` function.
There are limits to the number of items that will show in a data
validation drop down list: The list can show up to show 32768 items from
a list on the worksheet. If you need more items than that, you could
create a dependent drop down list, broken down by category.
Args:
sqref (str): The source reference range
Example:
For example, set data validation on Sheet1!A7:B8 with validation
criteria source Sheet1!E1:E3 settings, create in-cell dropdown by
allowing list source:
```python
try:
dv := excelize.new_data_validation(True)
dv.sqref = "A7:B8"
dv.set_sqref_drop_list("$E$1:$E$3")
f.add_data_validation("Sheet1", dv)
except (RuntimeError, TypeError) as err:
print(err)
```
"""
self.formula1 = sqref
self.type = data_validation_type_map[DataValidationType.DataValidationTypeList]
def set_sqref(self, sqref: str) -> None:
"""
Set data validation range in drop list.
Args:
sqref (str): The cell reference
"""
if not self.sqref:
self.sqref = sqref
return
self.sqref = f"{self.sqref} {sqref}"
@dataclass
class DocProperties:
category: str = ""
content_status: str = ""
created: str = ""
creator: str = ""
description: str = ""
identifier: str = ""
keywords: str = ""
last_modified_by: str = ""
modified: str = ""
revision: str = ""
subject: str = ""
title: str = ""
language: str = ""
version: str = ""
@dataclass
class RowOpts:
height: float = 0
hidden: bool = False
style_id: int = 0
outline_level: int = 0
@dataclass
class Border:
type: str = ""
color: str = ""
style: int = 0
@dataclass
class Fill:
type: str = ""
pattern: int = 0
color: Optional[List[str]] = None
shading: int = 0
transparency: int = 0
@dataclass
class Font:
bold: bool = False
italic: bool = False
underline: str = ""
family: str = ""
size: float = 0
strike: bool = False
color: str = ""
color_indexed: int = 0
color_theme: Optional[int] = None
color_tint: float = 0
vert_align: str = ""
charset: Optional[int] = None
@dataclass
class Alignment:
horizontal: str = ""
indent: int = 0
justify_last_line: bool = False
reading_order: int = 0
relative_indent: int = 0
shrink_to_fit: bool = False
text_rotation: int = 0
vertical: str = ""
wrap_text: bool = False
@dataclass
class Protection:
hidden: bool = False
locked: bool = False
@dataclass
class AutoFilterOptions:
column: str = ""
expression: str = ""
@dataclass
class FormulaOpts:
type: Optional[str] = None
ref: Optional[str] = None
@dataclass
class HeaderFooterOptions:
align_with_margins: Optional[bool] = None
different_first: bool = False
different_odd_even: bool = False
scale_with_doc: Optional[bool] = None
odd_header: str = ""
odd_footer: str = ""
even_header: str = ""
even_footer: str = ""
first_header: str = ""
first_footer: str = ""
@dataclass
class HeaderFooterImageOptions:
position: HeaderFooterImagePositionType = (
HeaderFooterImagePositionType.HeaderFooterImagePositionLeft
)
file: Optional[bytes] = None
is_footer: bool = False
first_page: bool = False
extension: str = ""
width: str = ""
height: str = ""
@dataclass
class HyperlinkOpts:
display: Optional[str] = None
tooltip: Optional[str] = None
@dataclass
class Style:
border: Optional[List[Border]] = None
fill: Fill = Fill
font: Optional[Font] = None
alignment: Optional[Alignment] = None
protection: Optional[Protection] = None
num_fmt: int = 0
decimal_places: Optional[int] = None
custom_num_fmt: Optional[str] = None
neg_red: bool = False
@dataclass
class Cells:
cell: Optional[List[str]] = None
@dataclass
class StringMatrixErrorResult:
row: Optional[List[Cells]] = None
@dataclass
class GraphicOptions:
alt_text: str = ""
name: str = ""
print_object: Optional[bool] = None
locked: Optional[bool] = None
lock_aspect_ratio: bool = False
auto_fit: bool = False
auto_fit_ignore_aspect: bool = False
offset_x: int = 0
offset_y: int = 0
scale_x: float = 0
scale_y: float = 0
hyperlink: str = ""
hyperlink_type: str = ""
positioning: str = ""
@dataclass
class PageLayoutMarginsOptions:
bottom: Optional[float] = None
footer: Optional[float] = None
header: Optional[float] = None
left: Optional[float] = None
right: Optional[float] = None
top: Optional[float] = None
horizontally: Optional[bool] = None
vertically: Optional[bool] = None
@dataclass
class PageLayoutOptions:
size: Optional[int] = None
orientation: Optional[str] = None
first_page_number: Optional[int] = None
adjust_to: Optional[int] = None
fit_to_height: Optional[int] = None
fit_to_width: Optional[int] = None
black_and_white: Optional[bool] = None
page_order: Optional[str] = None
@dataclass
class Picture:
extension: str = ""
file: Optional[bytes] = None
format: Optional[GraphicOptions] = None
insert_type: PictureInsertType = PictureInsertType.PictureInsertTypePlaceOverCells
@dataclass
class Selection:
sq_ref: str = ""
active_cell: str = ""
pane: str = ""
@dataclass
class Panes:
freeze: bool = False
split: bool = False
x_split: int = 0
y_split: int = 0
top_left_cell: str = ""
active_pane: str = ""
selection: Optional[List[Selection]] = None
@dataclass
class RichTextRun:
font: Optional[Font] = None
text: str = ""
@dataclass
class GetCellRichTextResult:
runs: Optional[List[RichTextRun]] = None
err: str = ""
@dataclass
class GetDataValidationsResult:
dvs: Optional[List[DataValidation]] = None
err: str = ""
@dataclass
class Comment:
author: str = ""
author_id: int = 0
cell: str = ""
text: str = ""
width: int = 0
height: int = 0
paragraph: Optional[List[RichTextRun]] = None
@dataclass
class ConditionalFormatOptions:
type: str = ""
above_average: bool = False
percent: bool = False
format: Optional[int] = None
criteria: str = ""
value: str = ""
min_type: str = ""
mid_type: str = ""
max_type: str = ""
min_value: str = ""
mid_value: str = ""
max_value: str = ""
min_color: str = ""
mid_color: str = ""
max_color: str = ""
bar_color: str = ""
bar_border_color: str = ""
bar_direction: str = ""
bar_only: bool = False
bar_solid: bool = False
icon_style: str = ""
reverse_icons: bool = False
icons_only: bool = False
stop_if_true: bool = False
@dataclass
class FormControl:
cell: str = ""
macro: str = ""
width: int = 0
height: int = 0
checked: bool = False
current_val: int = 0
min_val: int = 0
max_val: int = 0
inc_change: int = 0
page_change: int = 0
horizontally: bool = False
cell_link: str = ""
text: str = ""
paragraph: Optional[List[RichTextRun]] = None
type: FormControlType = FormControlType.FormControlNote
format: GraphicOptions = GraphicOptions
@dataclass
class LineOptions:
type: LineType = LineType.LineUnset
dash: LineDashType = LineDashType.LineDashUnset
fill: Fill = Fill
smooth: bool = False
width: float = 0
@dataclass
class ChartNumFmt:
custom_num_fmt: str = ""
source_linked: bool = False
@dataclass
class ChartTitle:
fill: Fill = Fill
border: LineOptions = LineOptions
paragraph: Optional[List[RichTextRun]] = None
offset_x: int = 0
offset_y: int = 0
width: int = 0
height: int = 0
overlay: bool = False
@dataclass
class ChartAxis:
none: bool = False
drop_lines: bool = False
high_low_lines: bool = False
major_grid_lines: bool = False
minor_grid_lines: bool = False
major_unit: float = 0
tick_label_position: ChartDataLabelPositionType = (
ChartDataLabelPositionType.ChartDataLabelsPositionUnset
)
tick_label_skip: int = 0
reverse_order: bool = False
secondary: bool = False
maximum: Optional[float] = None
minimum: Optional[float] = None
alignment: Alignment = Alignment
font: Font = Font
log_base: float = 0
num_fmt: ChartNumFmt = ChartNumFmt
title: ChartTitle = ChartTitle
@dataclass
class ChartDataLabel:
alignment: Alignment = Alignment
font: Font = Font
fill: Fill = Fill
@dataclass
class ChartDimension:
width: int = 0
height: int = 0
@dataclass
class ChartUpDownBar:
fill: Fill = Fill
border: LineOptions = LineOptions
@dataclass
class ChartPlotArea:
second_plot_values: int = 0
show_bubble_size: bool = False
show_cat_name: bool = False
show_data_table: bool = False
show_data_table_keys: bool = False
show_leader_lines: bool = False
show_percent: bool = False
show_ser_name: bool = False
show_val: bool = False
fill: Fill = Fill
up_bars: ChartUpDownBar = ChartUpDownBar
down_bars: ChartUpDownBar = ChartUpDownBar
num_fmt: ChartNumFmt = ChartNumFmt
@dataclass
class ChartLegend:
position: str = ""
show_legend_key: bool = False
font: Optional[Font] = None
@dataclass
class ChartMarker:
border: LineOptions = LineOptions
fill: Fill = Fill
symbol: str = ""
size: int = 0
@dataclass
class ChartDataPoint:
index: int = 0
fill: Fill = Fill
@dataclass
class ChartSeries:
name: str = ""
categories: str = ""
values: str = ""
sizes: str = ""
fill: Fill = Fill
legend: ChartLegend = ChartLegend
line: LineOptions = LineOptions
marker: ChartMarker = ChartMarker
data_label: ChartDataLabel = ChartDataLabel
data_label_position: ChartDataLabelPositionType = (
ChartDataLabelPositionType.ChartDataLabelsPositionUnset
)
data_point: Optional[List[ChartDataPoint]] = None
@dataclass
class Chart:
type: ChartType = ChartType.Area
series: Optional[List[ChartSeries]] = None
format: GraphicOptions = GraphicOptions
dimension: ChartDimension = ChartDimension
legend: ChartLegend = ChartLegend
title: ChartTitle = ChartTitle
vary_colors: Optional[bool] = None
x_axis: ChartAxis = ChartAxis
y_axis: ChartAxis = ChartAxis
plot_area: ChartPlotArea = ChartPlotArea
fill: Fill = Fill
border: LineOptions = LineOptions
show_blanks_as: str = ""
bubble_size: int = 0
hole_size: int = 0