-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathtypes_c.h
756 lines (697 loc) · 16 KB
/
types_c.h
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
// Copyright 2024 - 2025 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.
#include <stdbool.h>
#include <stdlib.h>
#include <time.h>
struct Interface
{
int Type;
int Integer;
char *String;
double Float64;
bool Boolean;
};
// Options define the options for opening and reading the spreadsheet.
//
// MaxCalcIterations specifies the maximum iterations for iterative
// calculation, the default value is 0.
//
// Password specifies the password of the spreadsheet in plain text.
//
// RawCellValue specifies if apply the number format for the cell value or get
// the raw value.
//
// UnzipSizeLimit specifies to unzip size limit in bytes on open the
// spreadsheet, this value should be greater than or equal to
// UnzipXMLSizeLimit, the default size limit is 16GB.
//
// UnzipXMLSizeLimit specifies the memory limit on unzipping worksheet and
// shared string table in bytes, worksheet XML will be extracted to system
// temporary directory when the file size is over this value, this value
// should be less than or equal to UnzipSizeLimit, the default value is
// 16MB.
//
// ShortDatePattern specifies the short date number format code. In the
// spreadsheet applications, date formats display date and time serial numbers
// as date values. Date formats that begin with an asterisk (*) respond to
// changes in regional date and time settings that are specified for the
// operating system. Formats without an asterisk are not affected by operating
// system settings. The ShortDatePattern used for specifies apply date formats
// that begin with an asterisk.
//
// LongDatePattern specifies the long date number format code.
//
// LongTimePattern specifies the long time number format code.
//
// CultureInfo specifies the country code for applying built-in language number
// format code these effect by the system's local language settings.
struct Options
{
unsigned int MaxCalcIterations;
char *Password;
bool RawCellValue;
long int UnzipSizeLimit;
long int UnzipXMLSizeLimit;
char *ShortDatePattern;
char *LongDatePattern;
char *LongTimePattern;
unsigned char CultureInfo;
};
// AppProperties directly maps the document application properties.
struct AppProperties
{
char *Application;
bool ScaleCrop;
int DocSecurity;
char *Company;
bool LinksUpToDate;
bool HyperlinksChanged;
char *AppVersion;
};
// Cell can be used directly in StreamWriter.SetRow to specify a style and
// a value.
struct Cell
{
int StyleID;
char *Formula;
struct Interface Value;
};
// RowOpts define the options for the set row, it can be used directly in
// StreamWriter.SetRow to specify the style and properties of the row.
struct RowOpts
{
double Height;
bool Hidden;
int StyleID;
int OutlineLevel;
};
// Border directly maps the border settings of the cells.
struct Border
{
char *Type;
char *Color;
int Style;
};
// Fill directly maps the fill settings of the cells.
struct Fill
{
char *Type;
int Pattern;
int ColorLen;
char **Color;
int Shading;
};
// Font directly maps the font settings of the fonts.
struct Font
{
bool Bold;
bool Italic;
char *Underline;
char *Family;
double Size;
bool Strike;
char *Color;
int ColorIndexed;
int *ColorTheme;
double ColorTint;
char *VertAlign;
};
// Alignment directly maps the alignment settings of the cells.
struct Alignment
{
char *Horizontal;
int Indent;
bool JustifyLastLine;
unsigned int ReadingOrder;
int RelativeIndent;
bool ShrinkToFit;
int TextRotation;
char *Vertical;
bool WrapText;
};
// AutoFilterOptions directly maps the auto filter settings.
struct AutoFilterOptions
{
char *Column;
char *Expression;
};
// FormulaOpts can be passed to SetCellFormula to use other formula types.
struct FormulaOpts
{
char **Type;
char **Ref;
};
// HeaderFooterOptions directly maps the settings of header and footer.
struct HeaderFooterOptions
{
bool *AlignWithMargins;
bool DifferentFirst;
bool DifferentOddEven;
bool *ScaleWithDoc;
char *OddHeader;
char *OddFooter;
char *EvenHeader;
char *EvenFooter;
char *FirstHeader;
char *FirstFooter;
};
// HyperlinkOpts can be passed to SetCellHyperlink to set optional hyperlink
// attributes (e.g. display value)
struct HyperlinkOpts
{
char **Display;
char **Tooltip;
};
// Protection directly maps the protection settings of the cells.
struct Protection
{
bool Hidden;
bool Locked;
};
// Style directly maps the style settings of the cells.
struct Style
{
int BorderLen;
struct Border *Border;
struct Fill Fill;
struct Font *Font;
struct Alignment *Alignment;
struct Protection *Protection;
int NumFmt;
int *DecimalPlaces;
char **CustomNumFmt;
bool NegRed;
};
// GraphicOptions directly maps the format settings of the picture.
struct GraphicOptions
{
char *AltText;
bool *PrintObject;
bool *Locked;
bool LockAspectRatio;
bool AutoFit;
bool AutoFitIgnoreAspect;
int OffsetX;
int OffsetY;
double ScaleX;
double ScaleY;
char *Hyperlink;
char *HyperlinkType;
char *Positioning;
};
// PageLayoutMarginsOptions directly maps the settings of page layout margins.
struct PageLayoutMarginsOptions
{
double *Bottom;
double *Footer;
double *Header;
double *Left;
double *Right;
double *Top;
bool *Horizontally;
bool *Vertically;
};
// PageLayoutOptions directly maps the settings of page layout.
struct PageLayoutOptions
{
int *Size;
char **Orientation;
unsigned int *FirstPageNumber;
unsigned int *AdjustTo;
int *FitToHeight;
int *FitToWidth;
bool *BlackAndWhite;
char **PageOrder;
};
// Picture maps the format settings of the picture.
struct Picture
{
char *Extension;
int FileLen;
unsigned char *File;
struct GraphicOptions *Format;
unsigned char InsertType;
};
// Selection directly maps the settings of the worksheet selection.
struct Selection
{
char *SQRef;
char *ActiveCell;
char *Pane;
};
// Panes directly maps the settings of the panes.
struct Panes
{
bool Freeze;
bool Split;
int XSplit;
int YSplit;
char *TopLeftCell;
char *ActivePane;
int SelectionLen;
struct Selection *Selection;
};
// RichTextRun directly maps the settings of the rich text run.
struct RichTextRun
{
struct Font *Font;
char *Text;
};
// Comment directly maps the comment information.
struct Comment
{
char *Author;
int AuthorID;
char *Cell;
char *Text;
unsigned int Width;
unsigned int Height;
int ParagraphLen;
struct RichTextRun *Paragraph;
};
// ConditionalFormatOptions directly maps the conditional format settings of the cells.
struct ConditionalFormatOptions
{
char *Type;
bool AboveAverage;
bool Percent;
int *Format;
char *Criteria;
char *Value;
char *MinType;
char *MidType;
char *MaxType;
char *MinValue;
char *MidValue;
char *MaxValue;
char *MinColor;
char *MidColor;
char *MaxColor;
char *BarColor;
char *BarBorderColor;
char *BarDirection;
bool BarOnly;
bool BarSolid;
char *IconStyle;
bool ReverseIcons;
bool IconsOnly;
bool StopIfTrue;
};
// FormControl directly maps the form controls information.
struct FormControl
{
char *Cell;
char *Macro;
unsigned int Width;
unsigned int Height;
bool Checked;
unsigned int CurrentVal;
unsigned int MinVal;
unsigned int MaxVal;
unsigned int IncChange;
unsigned int PageChange;
bool Horizontally;
char *CellLink;
char *Text;
int ParagraphLen;
struct RichTextRun *Paragraph;
unsigned char Type;
struct GraphicOptions Format;
};
// ChartNumFmt directly maps the number format settings of the chart.
struct ChartNumFmt
{
char *CustomNumFmt;
bool SourceLinked;
};
// ChartAxis directly maps the format settings of the chart axis.
struct ChartAxis
{
bool None;
bool MajorGridLines;
bool MinorGridLines;
double MajorUnit;
unsigned char TickLabelPosition;
int TickLabelSkip;
bool ReverseOrder;
bool Secondary;
double *Maximum;
double *Minimum;
struct Alignment Alignment;
struct Font Font;
double LogBase;
struct ChartNumFmt NumFmt;
int TitleLen;
struct RichTextRun *Title;
};
// ChartDataLabel directly maps the format settings of the chart labels.
struct ChartDataLabel
{
struct Alignment Alignment;
struct Font Font;
struct Fill Fill;
};
// ChartDimension directly maps the dimension of the chart.
struct ChartDimension
{
unsigned int Width;
unsigned int Height;
};
// ChartPlotArea directly maps the format settings of the plot area.
struct ChartPlotArea
{
int SecondPlotValues;
bool ShowBubbleSize;
bool ShowCatName;
bool ShowLeaderLines;
bool ShowPercent;
bool ShowSerName;
bool ShowVal;
struct Fill Fill;
struct ChartNumFmt NumFmt;
};
// ChartLegend directly maps the format settings of the chart legend.
struct ChartLegend
{
char *Position;
bool ShowLegendKey;
};
// ChartMarker directly maps the format settings of the chart marker.
struct ChartMarker
{
struct Fill Fill;
char *Symbol;
int Size;
};
// ChartLine directly maps the format settings of the chart line.
struct ChartLine
{
unsigned char Type;
bool Smooth;
double Width;
};
// ChartSeries directly maps the format settings of the chart series.
struct ChartSeries
{
char *Name;
char *Categories;
char *Values;
char *Sizes;
struct Fill Fill;
struct ChartLine Line;
struct ChartMarker Marker;
struct ChartDataLabel DataLabel;
unsigned char DataLabelPosition;
};
// Chart directly maps the format settings of the chart.
struct Chart
{
unsigned char Type;
int SeriesLen;
struct ChartSeries *Series;
struct GraphicOptions Format;
struct ChartDimension Dimension;
struct ChartLegend Legend;
int TitleLen;
struct RichTextRun *Title;
bool *VaryColors;
struct ChartAxis XAxis;
struct ChartAxis YAxis;
struct ChartPlotArea PlotArea;
struct Fill Fill;
struct ChartLine Border;
char *ShowBlanksAs;
int BubbleSize;
int HoleSize;
unsigned int *GapWidth;
int *Overlap;
};
// PivotTableField directly maps the field settings of the pivot table.
struct PivotTableField
{
bool Compact;
char *Data;
char *Name;
bool Outline;
bool ShowAll;
bool InsertBlankRow;
char *Subtotal;
bool DefaultSubtotal;
int NumFmt;
};
// PivotTableOptions directly maps the format settings of the pivot table.
struct PivotTableOptions
{
char *DataRange;
char *PivotTableRange;
char *Name;
int RowsLen;
struct PivotTableField *Rows;
int ColumnsLen;
struct PivotTableField *Columns;
int DataLen;
struct PivotTableField *Data;
int FilterLen;
struct PivotTableField *Filter;
bool RowGrandTotals;
bool ColGrandTotals;
bool ShowDrill;
bool UseAutoFormatting;
bool PageOverThenDown;
bool MergeItem;
bool ClassicLayout;
bool CompactData;
bool ShowError;
bool ShowRowHeaders;
bool ShowColHeaders;
bool ShowRowStripes;
bool ShowColStripes;
bool ShowLastColumn;
bool FieldPrintTitles;
bool ItemPrintTitles;
char *PivotTableStyleName;
};
// ShapeLine directly maps the line settings of the shape.
struct ShapeLine
{
char *Color;
double *Width;
};
// Shape directly maps the format settings of the shape.
struct Shape
{
char *Cell;
char *Type;
char *Macro;
unsigned int Width;
unsigned int Height;
struct GraphicOptions Format;
struct Fill Fill;
struct ShapeLine Line;
int ParagraphLen;
struct RichTextRun *Paragraph;
};
// SheetPropsOptions directly maps the settings of sheet view.
struct SheetPropsOptions
{
char **CodeName;
bool *EnableFormatConditionsCalculation;
bool *Published;
bool *AutoPageBreaks;
bool *FitToPage;
int *TabColorIndexed;
char **TabColorRGB;
int *TabColorTheme;
double *TabColorTint;
bool *OutlineSummaryBelow;
bool *OutlineSummaryRight;
unsigned int *BaseColWidth;
double *DefaultColWidth;
double *DefaultRowHeight;
bool *CustomHeight;
bool *ZeroHeight;
bool *ThickTop;
bool *ThickBottom;
};
// SheetProtectionOptions directly maps the settings of worksheet protection.
struct SheetProtectionOptions
{
char *AlgorithmName;
bool AutoFilter;
bool DeleteColumns;
bool DeleteRows;
bool EditObjects;
bool EditScenarios;
bool FormatCells;
bool FormatColumns;
bool FormatRows;
bool InsertColumns;
bool InsertHyperlinks;
bool InsertRows;
char *Password;
bool PivotTables;
bool SelectLockedCells;
bool SelectUnlockedCells;
bool Sort;
};
// SlicerOptions represents the settings of the slicer.
struct SlicerOptions
{
char *Name;
char *Cell;
char *TableSheet;
char *TableName;
char *Caption;
char *Macro;
unsigned int Width;
unsigned int Height;
bool *DisplayHeader;
bool ItemDesc;
struct GraphicOptions Format;
};
// SparklineOptions directly maps the settings of the sparkline.
struct SparklineOptions
{
int LocationLen;
char **Location;
int RangeLen;
char **Range;
int Max;
int CustMax;
int Min;
int CustMin;
char *Type;
double Weight;
bool DateAxis;
bool Markers;
bool High;
bool Low;
bool First;
bool Last;
bool Negative;
bool Axis;
bool Hidden;
bool Reverse;
int Style;
char *SeriesColor;
char *NegativeColor;
char *MarkersColor;
char *FirstColor;
char *LastColor;
char *HightColor;
char *LowColor;
char *EmptyCells;
};
// Table directly maps the format settings of the table.
struct Table
{
char *Range;
char *Name;
char *StyleName;
bool ShowColumnStripes;
bool ShowFirstColumn;
bool *ShowHeaderRow;
bool ShowLastColumn;
bool *ShowRowStripes;
};
// ViewOptions directly maps the settings of sheet view.
struct ViewOptions
{
bool *DefaultGridColor;
bool *RightToLeft;
bool *ShowFormulas;
bool *ShowGridLines;
bool *ShowRowColHeaders;
bool *ShowRuler;
bool *ShowZeros;
char **TopLeftCell;
char **View;
double *ZoomScale;
};
// DefinedName directly maps the name for a cell or cell range on a
// worksheet.
struct DefinedName
{
char *Name;
char *Comment;
char *RefersTo;
char *Scope;
};
// WorkbookPropsOptions directly maps the settings of workbook proprieties.
struct WorkbookPropsOptions
{
bool *Date1904;
bool *FilterPrivacy;
char **CodeName;
};
// WorkbookProtectionOptions directly maps the settings of workbook protection.
struct WorkbookProtectionOptions
{
char *AlgorithmName;
char *Password;
bool LockStructure;
bool LockWindows;
};
struct StringErrorResult
{
char *val;
char *err;
};
struct IntErrorResult
{
int val;
char *err;
};
struct BoolErrorResult
{
bool val;
char *err;
};
struct GetCellHyperLinkResult
{
bool link;
char *target;
char *err;
};
struct CellNameToCoordinatesResult
{
int col;
int row;
char *err;
};
struct GetAppPropsResult
{
struct AppProperties opts;
char *err;
};
struct Row
{
int CellLen;
char **Cell;
};
struct GetRowsResult
{
int RowLen;
struct Row *Row;
char *err;
};
struct GetStyleResult
{
struct Style style;
char *err;
};
struct GetTablesResult
{
int TablesLen;
struct Table *Tables;
char *Err;
};