@sswroom/sswr 1.6.13 → 1.6.15
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.
- package/Changelog +14 -0
- package/certutil.d.ts +1 -1
- package/certutil.js +645 -23
- package/data.d.ts +30 -2
- package/data.js +673 -72
- package/exporter/GPXExporter.d.ts +12 -0
- package/exporter/GPXExporter.js +89 -0
- package/exporter/XLSXExporter.d.ts +40 -0
- package/exporter/XLSXExporter.js +1976 -0
- package/hash.d.ts +25 -0
- package/hash.js +257 -2
- package/map.d.ts +14 -10
- package/map.js +57 -10
- package/osm.js +41 -2
- package/package.json +4 -1
- package/parser.js +46 -0
- package/spreadsheet.d.ts +786 -0
- package/spreadsheet.js +3294 -0
- package/text.d.ts +19 -0
- package/text.js +17 -0
- package/web.d.ts +2 -0
- package/web.js +28 -0
- package/zip.d.ts +57 -0
- package/zip.js +474 -0
package/spreadsheet.js
ADDED
|
@@ -0,0 +1,3294 @@
|
|
|
1
|
+
import * as data from "./data.js";
|
|
2
|
+
import * as text from "./text.js";
|
|
3
|
+
import * as unit from "./unit.js";
|
|
4
|
+
|
|
5
|
+
export const FontFamily = {
|
|
6
|
+
NA: 0,
|
|
7
|
+
Roman: 1,
|
|
8
|
+
Swiss: 2,
|
|
9
|
+
Modern: 3,
|
|
10
|
+
Script: 4,
|
|
11
|
+
Decorative: 5
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const BorderType = {
|
|
15
|
+
None: 0,
|
|
16
|
+
Thin: 1,
|
|
17
|
+
Medium: 2,
|
|
18
|
+
Dashed: 3,
|
|
19
|
+
Dotted: 4,
|
|
20
|
+
Thick: 5,
|
|
21
|
+
DOUBLE: 6,
|
|
22
|
+
Hair: 7,
|
|
23
|
+
MediumDashed: 8,
|
|
24
|
+
DashDot: 9,
|
|
25
|
+
MediumDashDot: 10,
|
|
26
|
+
DashDotDot: 11,
|
|
27
|
+
MediumDashDotDot: 12,
|
|
28
|
+
SlantedDashDot: 13
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const FillPattern = {
|
|
32
|
+
NoFill: 0,
|
|
33
|
+
SolidForeground: 1,
|
|
34
|
+
FineDot: 2,
|
|
35
|
+
AltBars: 3,
|
|
36
|
+
SparseDots: 4,
|
|
37
|
+
ThickHorzBands: 5,
|
|
38
|
+
ThickVertBands: 6,
|
|
39
|
+
ThickBackwardDiag: 7,
|
|
40
|
+
ThickForwardDiag: 8,
|
|
41
|
+
BigSpots: 9,
|
|
42
|
+
Bricks: 10,
|
|
43
|
+
ThinHorzBands: 11,
|
|
44
|
+
ThinVertBands: 12,
|
|
45
|
+
ThinBackwardDiag: 13,
|
|
46
|
+
ThinForwardDiag: 14,
|
|
47
|
+
Squares: 15,
|
|
48
|
+
Diamonds: 16,
|
|
49
|
+
LessDots: 17,
|
|
50
|
+
LeastDots: 18
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export const CellDataType = {
|
|
54
|
+
String: 0,
|
|
55
|
+
Number: 1,
|
|
56
|
+
DateTime: 2,
|
|
57
|
+
MergedLeft: 3,
|
|
58
|
+
MergedUp: 4
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export const AnchorType = {
|
|
62
|
+
Absolute: 0,
|
|
63
|
+
OneCell: 1,
|
|
64
|
+
TwoCell: 2
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export const LegendPos = {
|
|
68
|
+
Bottom: 0
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export const BlankAs = {
|
|
72
|
+
Default: 0,
|
|
73
|
+
Gap: 1,
|
|
74
|
+
Zero: 2
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export const ChartType = {
|
|
78
|
+
Unknown: 0,
|
|
79
|
+
LineChart: 1
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export const AxisType = {
|
|
83
|
+
Date: 0,
|
|
84
|
+
Category: 1,
|
|
85
|
+
Numeric: 2,
|
|
86
|
+
Series: 3
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export const AxisPosition = {
|
|
90
|
+
Left: 0,
|
|
91
|
+
Top: 1,
|
|
92
|
+
Right: 2,
|
|
93
|
+
Bottom: 3
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export const TickLabelPosition = {
|
|
97
|
+
High: 0,
|
|
98
|
+
Low: 1,
|
|
99
|
+
NextTo: 2,
|
|
100
|
+
None: 3
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export const AxisCrosses = {
|
|
104
|
+
AutoZero: 0,
|
|
105
|
+
Max: 1,
|
|
106
|
+
Min: 2
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export const ColorType = {
|
|
110
|
+
Preset: 0,
|
|
111
|
+
Argb: 1
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export const PresetColor = {
|
|
115
|
+
AliceBlue: 0,
|
|
116
|
+
AntiqueWhite: 1,
|
|
117
|
+
Aqua: 2,
|
|
118
|
+
Aquamarine: 3,
|
|
119
|
+
Azure: 4,
|
|
120
|
+
Beige: 5,
|
|
121
|
+
Bisque: 6,
|
|
122
|
+
Black: 7,
|
|
123
|
+
BlanchedAlmond: 8,
|
|
124
|
+
Blue: 9,
|
|
125
|
+
BlueViolet: 10,
|
|
126
|
+
Brown: 11,
|
|
127
|
+
BurlyWood: 12,
|
|
128
|
+
CadetBlue: 13,
|
|
129
|
+
Chartreuse: 14,
|
|
130
|
+
Chocolate: 15,
|
|
131
|
+
Coral: 16,
|
|
132
|
+
CornflowerBlue: 17,
|
|
133
|
+
Cornsilk: 18,
|
|
134
|
+
Crimson: 19,
|
|
135
|
+
Cyan: 20,
|
|
136
|
+
DeepPink: 21,
|
|
137
|
+
DeepSkyBlue: 22,
|
|
138
|
+
DimGray: 23,
|
|
139
|
+
DarkBlue: 24,
|
|
140
|
+
DarkCyan: 25,
|
|
141
|
+
DarkGoldenrod: 26,
|
|
142
|
+
DarkGray: 27,
|
|
143
|
+
DarkGreen: 28,
|
|
144
|
+
DarkKhaki: 29,
|
|
145
|
+
DarkMagenta: 30,
|
|
146
|
+
DarkOliveGreen: 31,
|
|
147
|
+
DarkOrange: 32,
|
|
148
|
+
DarkOrchid: 33,
|
|
149
|
+
DarkRed: 34,
|
|
150
|
+
DarkSalmon: 35,
|
|
151
|
+
DarkSeaGreen: 36,
|
|
152
|
+
DarkSlateBlue: 37,
|
|
153
|
+
DarkSlateGray: 38,
|
|
154
|
+
DarkTurquoise: 39,
|
|
155
|
+
DarkViolet: 40,
|
|
156
|
+
DodgerBlue: 41,
|
|
157
|
+
Firebrick: 42,
|
|
158
|
+
FloralWhite: 43,
|
|
159
|
+
ForestGreen: 44,
|
|
160
|
+
Fuchsia: 45,
|
|
161
|
+
Gainsboro: 46,
|
|
162
|
+
GhostWhite: 47,
|
|
163
|
+
Gold: 48,
|
|
164
|
+
Goldenrod: 49,
|
|
165
|
+
Gray: 50,
|
|
166
|
+
Green: 51,
|
|
167
|
+
GreenYellow: 52,
|
|
168
|
+
Honeydew: 53,
|
|
169
|
+
HotPink: 54,
|
|
170
|
+
IndianRed: 55,
|
|
171
|
+
Indigo: 56,
|
|
172
|
+
Ivory: 57,
|
|
173
|
+
Khaki: 58,
|
|
174
|
+
Lavender: 59,
|
|
175
|
+
LavenderBlush: 60,
|
|
176
|
+
LawnGreen: 61,
|
|
177
|
+
LemonChiffon: 62,
|
|
178
|
+
Lime: 63,
|
|
179
|
+
LimeGreen: 64,
|
|
180
|
+
Linen: 65,
|
|
181
|
+
LightBlue: 66,
|
|
182
|
+
LightCoral: 67,
|
|
183
|
+
LightCyan: 68,
|
|
184
|
+
LightGoldenrodYellow: 69,
|
|
185
|
+
LightGray: 70,
|
|
186
|
+
LightGreen: 71,
|
|
187
|
+
LightPink: 72,
|
|
188
|
+
LightSalmon: 73,
|
|
189
|
+
LightSeaGreen: 74,
|
|
190
|
+
LightSkyBlue: 75,
|
|
191
|
+
LightSlateGray: 76,
|
|
192
|
+
LightSteelBlue: 77,
|
|
193
|
+
LightYellow: 78,
|
|
194
|
+
Magenta: 79,
|
|
195
|
+
Maroon: 80,
|
|
196
|
+
MediumAquamarine: 81,
|
|
197
|
+
MediumBlue: 82,
|
|
198
|
+
MediumOrchid: 83,
|
|
199
|
+
MediumPurple: 84,
|
|
200
|
+
MediumSeaGreen: 85,
|
|
201
|
+
MediumSlateBlue: 86,
|
|
202
|
+
MediumSpringGreen: 87,
|
|
203
|
+
MediumTurquoise: 88,
|
|
204
|
+
MediumVioletRed: 89,
|
|
205
|
+
MidnightBlue: 90,
|
|
206
|
+
MintCream: 91,
|
|
207
|
+
MistyRose: 92,
|
|
208
|
+
Moccasin: 93,
|
|
209
|
+
NavajoWhite: 94,
|
|
210
|
+
Navy: 95,
|
|
211
|
+
OldLace: 96,
|
|
212
|
+
Olive: 97,
|
|
213
|
+
OliveDrab: 98,
|
|
214
|
+
Orange: 99,
|
|
215
|
+
OrangeRed: 100,
|
|
216
|
+
Orchid: 101,
|
|
217
|
+
PaleGoldenrod: 102,
|
|
218
|
+
PaleGreen: 103,
|
|
219
|
+
PaleTurquoise: 104,
|
|
220
|
+
PaleVioletRed: 105,
|
|
221
|
+
PapayaWhip: 106,
|
|
222
|
+
PeachPuff: 107,
|
|
223
|
+
Peru: 108,
|
|
224
|
+
Pink: 109,
|
|
225
|
+
Plum: 110,
|
|
226
|
+
PowderBlue: 111,
|
|
227
|
+
Purple: 112,
|
|
228
|
+
Red: 113,
|
|
229
|
+
RosyBrown: 114,
|
|
230
|
+
RoyalBlue: 115,
|
|
231
|
+
SaddleBrown: 116,
|
|
232
|
+
Salmon: 117,
|
|
233
|
+
SandyBrown: 118,
|
|
234
|
+
SeaGreen: 119,
|
|
235
|
+
SeaShell: 120,
|
|
236
|
+
Sienna: 121,
|
|
237
|
+
Silver: 122,
|
|
238
|
+
SkyBlue: 123,
|
|
239
|
+
SlateBlue: 124,
|
|
240
|
+
SlateGray: 125,
|
|
241
|
+
Snow: 126,
|
|
242
|
+
SpringGreen: 127,
|
|
243
|
+
SteelBlue: 128,
|
|
244
|
+
Tan: 129,
|
|
245
|
+
Teal: 130,
|
|
246
|
+
Thistle: 131,
|
|
247
|
+
Tomato: 132,
|
|
248
|
+
Turquoise: 133,
|
|
249
|
+
Violet: 134,
|
|
250
|
+
Wheat: 135,
|
|
251
|
+
White: 136,
|
|
252
|
+
WhiteSmoke: 137,
|
|
253
|
+
Yellow: 138,
|
|
254
|
+
YellowGreen: 139
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
export const FillType = {
|
|
258
|
+
SolidFill: 0
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
export const MarkerStyle = {
|
|
262
|
+
Circle: 0,
|
|
263
|
+
Dash: 1,
|
|
264
|
+
Diamond: 2,
|
|
265
|
+
Dot: 3,
|
|
266
|
+
None: 4,
|
|
267
|
+
Picture: 5,
|
|
268
|
+
Plus: 6,
|
|
269
|
+
Square: 7,
|
|
270
|
+
Star: 8,
|
|
271
|
+
Triangle: 9,
|
|
272
|
+
X: 10
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
export class WorkbookFont
|
|
276
|
+
{
|
|
277
|
+
constructor()
|
|
278
|
+
{
|
|
279
|
+
/** @type {string|null} */
|
|
280
|
+
this.name = null;
|
|
281
|
+
this.size = 0;
|
|
282
|
+
this.bold = false;
|
|
283
|
+
this.italic = false;
|
|
284
|
+
this.underline = false;
|
|
285
|
+
this.color = 0;
|
|
286
|
+
this.family = FontFamily.NA;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* @param {string | null} name
|
|
291
|
+
*/
|
|
292
|
+
setName(name)
|
|
293
|
+
{
|
|
294
|
+
this.name = name;
|
|
295
|
+
return this;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* @param {number} size
|
|
300
|
+
*/
|
|
301
|
+
setSize(size)
|
|
302
|
+
{
|
|
303
|
+
this.size = size;
|
|
304
|
+
return this;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* @param {boolean} bold
|
|
309
|
+
*/
|
|
310
|
+
setBold(bold)
|
|
311
|
+
{
|
|
312
|
+
this.bold = bold;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* @param {boolean} italic
|
|
317
|
+
*/
|
|
318
|
+
setItalic(italic)
|
|
319
|
+
{
|
|
320
|
+
this.italic = italic;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* @param {boolean} underline
|
|
325
|
+
*/
|
|
326
|
+
setUnderline(underline)
|
|
327
|
+
{
|
|
328
|
+
this.underline = underline;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* @param {number} color
|
|
333
|
+
*/
|
|
334
|
+
setColor(color)
|
|
335
|
+
{
|
|
336
|
+
this.color = color;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* @param {number} family
|
|
341
|
+
*/
|
|
342
|
+
setFamily(family)
|
|
343
|
+
{
|
|
344
|
+
this.family = family;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
getName()
|
|
348
|
+
{
|
|
349
|
+
return this.name;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
getSize()
|
|
353
|
+
{
|
|
354
|
+
return this.size;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
isBold()
|
|
358
|
+
{
|
|
359
|
+
return this.bold;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
isItalic()
|
|
363
|
+
{
|
|
364
|
+
return this.italic;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
isUnderline()
|
|
368
|
+
{
|
|
369
|
+
return this.underline;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
getColor()
|
|
373
|
+
{
|
|
374
|
+
return this.color;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
getFamily()
|
|
378
|
+
{
|
|
379
|
+
return this.family;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
clone()
|
|
383
|
+
{
|
|
384
|
+
let font = new WorkbookFont();
|
|
385
|
+
font.name = this.name;
|
|
386
|
+
font.size = this.size;
|
|
387
|
+
font.bold = this.bold;
|
|
388
|
+
font.italic = this.italic;
|
|
389
|
+
font.underline = this.underline;
|
|
390
|
+
font.color = this.color;
|
|
391
|
+
font.family = this.family;
|
|
392
|
+
return font;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* @param {WorkbookFont} font
|
|
397
|
+
*/
|
|
398
|
+
equals(font)
|
|
399
|
+
{
|
|
400
|
+
return this.name == font.name &&
|
|
401
|
+
this.size == font.size &&
|
|
402
|
+
this.bold == font.bold &&
|
|
403
|
+
this.italic == font.italic &&
|
|
404
|
+
this.underline == font.underline &&
|
|
405
|
+
this.color == font.color;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
export class BorderStyle
|
|
410
|
+
{
|
|
411
|
+
/**
|
|
412
|
+
* @param {number} borderColor
|
|
413
|
+
* @param {number} borderType
|
|
414
|
+
*/
|
|
415
|
+
constructor(borderColor, borderType)
|
|
416
|
+
{
|
|
417
|
+
this.borderColor = borderColor;
|
|
418
|
+
this.borderType = borderType;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* @param {BorderStyle} style
|
|
423
|
+
*/
|
|
424
|
+
set(style)
|
|
425
|
+
{
|
|
426
|
+
this.borderColor = style.borderColor;
|
|
427
|
+
this.borderType = style.borderType;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
clone()
|
|
431
|
+
{
|
|
432
|
+
return new BorderStyle(this.borderColor, this.borderType);
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* @param {BorderStyle} style
|
|
437
|
+
*/
|
|
438
|
+
equals(style)
|
|
439
|
+
{
|
|
440
|
+
if (style.borderType == BorderType.None && this.borderType == BorderType.None)
|
|
441
|
+
return true;
|
|
442
|
+
else if (style.borderType != this.borderType)
|
|
443
|
+
return false;
|
|
444
|
+
else if (style.borderColor != this.borderColor)
|
|
445
|
+
return false;
|
|
446
|
+
else
|
|
447
|
+
return true;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
export class CellStyle
|
|
452
|
+
{
|
|
453
|
+
/**
|
|
454
|
+
* @param {number} index
|
|
455
|
+
*/
|
|
456
|
+
constructor(index)
|
|
457
|
+
{
|
|
458
|
+
this.index = index;
|
|
459
|
+
/** @type {string|null} */
|
|
460
|
+
this.id = null;
|
|
461
|
+
this.halign = text.HAlignment.Unknown;
|
|
462
|
+
this.valign = text.VAlignment.Unknown;
|
|
463
|
+
this.wordWrap = false;
|
|
464
|
+
this.borderBottom = new BorderStyle(0, BorderType.None);
|
|
465
|
+
this.borderLeft = new BorderStyle(0, BorderType.None);
|
|
466
|
+
this.borderRight = new BorderStyle(0, BorderType.None);
|
|
467
|
+
this.borderTop = new BorderStyle(0, BorderType.None);
|
|
468
|
+
/** @type {WorkbookFont|null} */
|
|
469
|
+
this.font = null;
|
|
470
|
+
this.fillColor = 0xffffff;
|
|
471
|
+
this.fillPattern = FillPattern.NoFill;
|
|
472
|
+
/** @type {string|null} */
|
|
473
|
+
this.dataFormat = null;
|
|
474
|
+
this.protection = false;
|
|
475
|
+
};
|
|
476
|
+
|
|
477
|
+
clone()
|
|
478
|
+
{
|
|
479
|
+
let style = new CellStyle(this.index);
|
|
480
|
+
style.id = this.id;
|
|
481
|
+
style.halign = this.halign;
|
|
482
|
+
style.valign = this.valign;
|
|
483
|
+
style.wordWrap = this.wordWrap;
|
|
484
|
+
style.borderBottom = this.borderBottom.clone();
|
|
485
|
+
style.borderLeft = this.borderLeft.clone();
|
|
486
|
+
style.borderRight = this.borderRight.clone();
|
|
487
|
+
style.borderTop = this.borderTop.clone();
|
|
488
|
+
style.font = this.font;
|
|
489
|
+
style.fillColor = this.fillColor;
|
|
490
|
+
style.fillPattern = this.fillPattern;
|
|
491
|
+
style.dataFormat = this.dataFormat;
|
|
492
|
+
style.protection = this.protection;
|
|
493
|
+
return style;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
/**
|
|
497
|
+
* @param {CellStyle} style
|
|
498
|
+
*/
|
|
499
|
+
copyFrom(style)
|
|
500
|
+
{
|
|
501
|
+
this.index = style.index;
|
|
502
|
+
this.id = style.id;
|
|
503
|
+
this.halign = style.halign;
|
|
504
|
+
this.valign = style.valign;
|
|
505
|
+
this.wordWrap = style.wordWrap;
|
|
506
|
+
this.borderBottom = style.borderBottom.clone();
|
|
507
|
+
this.borderLeft = style.borderLeft.clone();
|
|
508
|
+
this.borderRight = style.borderRight.clone();
|
|
509
|
+
this.borderTop = style.borderTop.clone();
|
|
510
|
+
this.font = style.font;
|
|
511
|
+
this.fillColor = style.fillColor;
|
|
512
|
+
this.fillPattern = style.fillPattern;
|
|
513
|
+
this.dataFormat = style.dataFormat;
|
|
514
|
+
this.protection = style.protection;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* @param {CellStyle} style
|
|
519
|
+
*/
|
|
520
|
+
equals(style)
|
|
521
|
+
{
|
|
522
|
+
if (style.halign != this.halign)
|
|
523
|
+
return false;
|
|
524
|
+
if (style.valign != this.valign)
|
|
525
|
+
return false;
|
|
526
|
+
if (style.wordWrap != this.wordWrap)
|
|
527
|
+
return false;
|
|
528
|
+
|
|
529
|
+
if (style.borderBottom != this.borderBottom)
|
|
530
|
+
return false;
|
|
531
|
+
if (style.borderLeft != this.borderLeft)
|
|
532
|
+
return false;
|
|
533
|
+
if (style.borderRight != this.borderRight)
|
|
534
|
+
return false;
|
|
535
|
+
if (style.borderTop != this.borderTop)
|
|
536
|
+
return false;
|
|
537
|
+
|
|
538
|
+
if (this.font == null)
|
|
539
|
+
{
|
|
540
|
+
if (style.font != null)
|
|
541
|
+
return false;
|
|
542
|
+
}
|
|
543
|
+
else if (style.font == null)
|
|
544
|
+
{
|
|
545
|
+
return false;
|
|
546
|
+
}
|
|
547
|
+
else
|
|
548
|
+
{
|
|
549
|
+
if (style.font.equals(this.font))
|
|
550
|
+
return false;
|
|
551
|
+
}
|
|
552
|
+
if (style.fillColor != this.fillColor)
|
|
553
|
+
return false;
|
|
554
|
+
if (style.fillPattern != this.fillPattern)
|
|
555
|
+
return false;
|
|
556
|
+
if (this.dataFormat != style.dataFormat)
|
|
557
|
+
return false;
|
|
558
|
+
if (style.protection != this.protection)
|
|
559
|
+
return false;
|
|
560
|
+
return true;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
/**
|
|
564
|
+
* @param {number} index
|
|
565
|
+
*/
|
|
566
|
+
setIndex(index)
|
|
567
|
+
{
|
|
568
|
+
this.index = index;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
/**
|
|
572
|
+
* @param {string | null} id
|
|
573
|
+
*/
|
|
574
|
+
setID(id)
|
|
575
|
+
{
|
|
576
|
+
if (id == null)
|
|
577
|
+
return;
|
|
578
|
+
this.id = id;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
/**
|
|
582
|
+
* @param {text.HAlignment} halign
|
|
583
|
+
*/
|
|
584
|
+
setHAlign(halign)
|
|
585
|
+
{
|
|
586
|
+
this.halign = halign;
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
/**
|
|
590
|
+
* @param {text.VAlignment} valign
|
|
591
|
+
*/
|
|
592
|
+
setVAlign(valign)
|
|
593
|
+
{
|
|
594
|
+
this.valign = valign;
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
/**
|
|
598
|
+
* @param {boolean} wordWrap
|
|
599
|
+
*/
|
|
600
|
+
setWordWrap(wordWrap)
|
|
601
|
+
{
|
|
602
|
+
this.wordWrap = wordWrap;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
/**
|
|
606
|
+
* @param {number} color
|
|
607
|
+
* @param {number} pattern
|
|
608
|
+
*/
|
|
609
|
+
setFillColor(color, pattern)
|
|
610
|
+
{
|
|
611
|
+
this.fillColor = color;
|
|
612
|
+
this.fillPattern = pattern;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
/**
|
|
616
|
+
* @param {WorkbookFont | null} font
|
|
617
|
+
*/
|
|
618
|
+
setFont(font)
|
|
619
|
+
{
|
|
620
|
+
this.font = font;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
/**
|
|
624
|
+
* @param {BorderStyle} border
|
|
625
|
+
*/
|
|
626
|
+
setBorderLeft(border)
|
|
627
|
+
{
|
|
628
|
+
this.borderLeft.set(border);
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
/**
|
|
632
|
+
* @param {BorderStyle} border
|
|
633
|
+
*/
|
|
634
|
+
setBorderRight(border)
|
|
635
|
+
{
|
|
636
|
+
this.borderRight.set(border);
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
/**
|
|
640
|
+
* @param {BorderStyle} border
|
|
641
|
+
*/
|
|
642
|
+
setBorderTop(border)
|
|
643
|
+
{
|
|
644
|
+
this.borderTop = border;
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
/**
|
|
648
|
+
* @param {BorderStyle} border
|
|
649
|
+
*/
|
|
650
|
+
setBorderBottom(border)
|
|
651
|
+
{
|
|
652
|
+
this.borderBottom.set(border);
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
/**
|
|
656
|
+
* @param {string | null} dataFormat
|
|
657
|
+
*/
|
|
658
|
+
setDataFormat(dataFormat)
|
|
659
|
+
{
|
|
660
|
+
this.dataFormat = dataFormat;
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
getIndex()
|
|
664
|
+
{
|
|
665
|
+
return this.index;
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
getID()
|
|
669
|
+
{
|
|
670
|
+
return this.id;
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
getHAlign()
|
|
674
|
+
{
|
|
675
|
+
return this.halign;
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
getVAlign()
|
|
679
|
+
{
|
|
680
|
+
return this.valign;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
getWordWrap()
|
|
684
|
+
{
|
|
685
|
+
return this.wordWrap;
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
getFillColor()
|
|
689
|
+
{
|
|
690
|
+
return this.fillColor;
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
getFillPattern()
|
|
694
|
+
{
|
|
695
|
+
return this.fillPattern;
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
getFont()
|
|
699
|
+
{
|
|
700
|
+
return this.font;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
getBorderLeft()
|
|
704
|
+
{
|
|
705
|
+
return this.borderLeft;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
getBorderRight()
|
|
709
|
+
{
|
|
710
|
+
return this.borderRight;
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
getBorderTop()
|
|
714
|
+
{
|
|
715
|
+
return this.borderTop;
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
getBorderBottom()
|
|
719
|
+
{
|
|
720
|
+
return this.borderBottom;
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
getDataFormat()
|
|
724
|
+
{
|
|
725
|
+
return this.dataFormat;
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
/**
|
|
730
|
+
* @param {number} r
|
|
731
|
+
* @param {number} g
|
|
732
|
+
* @param {number} b
|
|
733
|
+
*/
|
|
734
|
+
function rgbValue(r, g, b)
|
|
735
|
+
{
|
|
736
|
+
return 0xFF000000 + ((r) << 16) + ((g) << 8) + (b);
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
export class OfficeColor
|
|
740
|
+
{
|
|
741
|
+
/**
|
|
742
|
+
* @param {number} colorType
|
|
743
|
+
* @param {number} color
|
|
744
|
+
*/
|
|
745
|
+
constructor(colorType, color)
|
|
746
|
+
{
|
|
747
|
+
this.colorType = colorType;
|
|
748
|
+
this.color = color;
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
getColorType()
|
|
752
|
+
{
|
|
753
|
+
return this.colorType;
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
getPresetColor()
|
|
757
|
+
{
|
|
758
|
+
return this.color;
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
getColorArgb()
|
|
762
|
+
{
|
|
763
|
+
switch (this.colorType)
|
|
764
|
+
{
|
|
765
|
+
case ColorType.Argb:
|
|
766
|
+
return this.color;
|
|
767
|
+
case ColorType.Preset:
|
|
768
|
+
return OfficeColor.presetColorGetArgb(this.color);
|
|
769
|
+
}
|
|
770
|
+
return 0;
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
/**
|
|
774
|
+
* @param {number} color
|
|
775
|
+
*/
|
|
776
|
+
static newPreset(color)
|
|
777
|
+
{
|
|
778
|
+
return new OfficeColor(ColorType.Preset, color);
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
/**
|
|
782
|
+
* @param {number} argb
|
|
783
|
+
*/
|
|
784
|
+
static newArgb(argb)
|
|
785
|
+
{
|
|
786
|
+
return new OfficeColor(ColorType.Argb, argb);
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
/**
|
|
790
|
+
* @param {number} color
|
|
791
|
+
*/
|
|
792
|
+
static presetColorGetArgb(color)
|
|
793
|
+
{
|
|
794
|
+
switch (color)
|
|
795
|
+
{
|
|
796
|
+
case PresetColor.AliceBlue:
|
|
797
|
+
return rgbValue(240,248,255);
|
|
798
|
+
case PresetColor.AntiqueWhite:
|
|
799
|
+
return rgbValue(250,235,215);
|
|
800
|
+
case PresetColor.Aqua:
|
|
801
|
+
return rgbValue(0,255,255);
|
|
802
|
+
case PresetColor.Aquamarine:
|
|
803
|
+
return rgbValue(127,255,212);
|
|
804
|
+
case PresetColor.Azure:
|
|
805
|
+
return rgbValue(240,255,255);
|
|
806
|
+
case PresetColor.Beige:
|
|
807
|
+
return rgbValue(245,245,220);
|
|
808
|
+
case PresetColor.Bisque:
|
|
809
|
+
return rgbValue(255,228,196);
|
|
810
|
+
case PresetColor.Black:
|
|
811
|
+
return rgbValue(0,0,0);
|
|
812
|
+
case PresetColor.BlanchedAlmond:
|
|
813
|
+
return rgbValue(255,235,205);
|
|
814
|
+
case PresetColor.Blue:
|
|
815
|
+
return rgbValue(0,0,255);
|
|
816
|
+
case PresetColor.BlueViolet:
|
|
817
|
+
return rgbValue(138,43,226);
|
|
818
|
+
case PresetColor.Brown:
|
|
819
|
+
return rgbValue(165,42,42);
|
|
820
|
+
case PresetColor.BurlyWood:
|
|
821
|
+
return rgbValue(222,184,135);
|
|
822
|
+
case PresetColor.CadetBlue:
|
|
823
|
+
return rgbValue(95,158,160);
|
|
824
|
+
case PresetColor.Chartreuse:
|
|
825
|
+
return rgbValue(127,255,0);
|
|
826
|
+
case PresetColor.Chocolate:
|
|
827
|
+
return rgbValue(210,105,30);
|
|
828
|
+
case PresetColor.Coral:
|
|
829
|
+
return rgbValue(255,127,80);
|
|
830
|
+
case PresetColor.CornflowerBlue:
|
|
831
|
+
return rgbValue(100,149,237);
|
|
832
|
+
case PresetColor.Cornsilk:
|
|
833
|
+
return rgbValue(255,248,220);
|
|
834
|
+
case PresetColor.Crimson:
|
|
835
|
+
return rgbValue(220,20,60);
|
|
836
|
+
case PresetColor.Cyan:
|
|
837
|
+
return rgbValue(0,255,255);
|
|
838
|
+
case PresetColor.DeepPink:
|
|
839
|
+
return rgbValue(255,20,147);
|
|
840
|
+
case PresetColor.DeepSkyBlue:
|
|
841
|
+
return rgbValue(0,191,255);
|
|
842
|
+
case PresetColor.DimGray:
|
|
843
|
+
return rgbValue(105,105,105);
|
|
844
|
+
case PresetColor.DarkBlue:
|
|
845
|
+
return rgbValue(0,0,139);
|
|
846
|
+
case PresetColor.DarkCyan:
|
|
847
|
+
return rgbValue(0,139,139);
|
|
848
|
+
case PresetColor.DarkGoldenrod:
|
|
849
|
+
return rgbValue(184,134,11);
|
|
850
|
+
case PresetColor.DarkGray:
|
|
851
|
+
return rgbValue(169,169,169);
|
|
852
|
+
case PresetColor.DarkGreen:
|
|
853
|
+
return rgbValue(0,100,0);
|
|
854
|
+
case PresetColor.DarkKhaki:
|
|
855
|
+
return rgbValue(189,183,107);
|
|
856
|
+
case PresetColor.DarkMagenta:
|
|
857
|
+
return rgbValue(139,0,139);
|
|
858
|
+
case PresetColor.DarkOliveGreen:
|
|
859
|
+
return rgbValue(85,107,47);
|
|
860
|
+
case PresetColor.DarkOrange:
|
|
861
|
+
return rgbValue(255,140,0);
|
|
862
|
+
case PresetColor.DarkOrchid:
|
|
863
|
+
return rgbValue(153,50,204);
|
|
864
|
+
case PresetColor.DarkRed:
|
|
865
|
+
return rgbValue(153,50,204);
|
|
866
|
+
case PresetColor.DarkSalmon:
|
|
867
|
+
return rgbValue(233,150,122);
|
|
868
|
+
case PresetColor.DarkSeaGreen:
|
|
869
|
+
return rgbValue(143,188,139);
|
|
870
|
+
case PresetColor.DarkSlateBlue:
|
|
871
|
+
return rgbValue(72,61,139);
|
|
872
|
+
case PresetColor.DarkSlateGray:
|
|
873
|
+
return rgbValue(47,79,79);
|
|
874
|
+
case PresetColor.DarkTurquoise:
|
|
875
|
+
return rgbValue(0,206,209);
|
|
876
|
+
case PresetColor.DarkViolet:
|
|
877
|
+
return rgbValue(148,0,211);
|
|
878
|
+
case PresetColor.DodgerBlue:
|
|
879
|
+
return rgbValue(30,144,255);
|
|
880
|
+
case PresetColor.Firebrick:
|
|
881
|
+
return rgbValue(178,34,34);
|
|
882
|
+
case PresetColor.FloralWhite:
|
|
883
|
+
return rgbValue(255,250,240);
|
|
884
|
+
case PresetColor.ForestGreen:
|
|
885
|
+
return rgbValue(34,139,34);
|
|
886
|
+
case PresetColor.Fuchsia:
|
|
887
|
+
return rgbValue(255,0,255);
|
|
888
|
+
case PresetColor.Gainsboro:
|
|
889
|
+
return rgbValue(220,220,220);
|
|
890
|
+
case PresetColor.GhostWhite:
|
|
891
|
+
return rgbValue(248,248,255);
|
|
892
|
+
case PresetColor.Gold:
|
|
893
|
+
return rgbValue(255,215,0);
|
|
894
|
+
case PresetColor.Goldenrod:
|
|
895
|
+
return rgbValue(218,165,32);
|
|
896
|
+
case PresetColor.Gray:
|
|
897
|
+
return rgbValue(128,128,128);
|
|
898
|
+
case PresetColor.Green:
|
|
899
|
+
return rgbValue(0,128,0);
|
|
900
|
+
case PresetColor.GreenYellow:
|
|
901
|
+
return rgbValue(173,255,47);
|
|
902
|
+
case PresetColor.Honeydew:
|
|
903
|
+
return rgbValue(240,255,240);
|
|
904
|
+
case PresetColor.HotPink:
|
|
905
|
+
return rgbValue(255,105,180);
|
|
906
|
+
case PresetColor.IndianRed:
|
|
907
|
+
return rgbValue(205,92,92);
|
|
908
|
+
case PresetColor.Indigo:
|
|
909
|
+
return rgbValue(75,0,130);
|
|
910
|
+
case PresetColor.Ivory:
|
|
911
|
+
return rgbValue(255,255,240);
|
|
912
|
+
case PresetColor.Khaki:
|
|
913
|
+
return rgbValue(240,230,140);
|
|
914
|
+
case PresetColor.Lavender:
|
|
915
|
+
return rgbValue(230,230,250);
|
|
916
|
+
case PresetColor.LavenderBlush:
|
|
917
|
+
return rgbValue(255,240,245);
|
|
918
|
+
case PresetColor.LawnGreen:
|
|
919
|
+
return rgbValue(124,252,0);
|
|
920
|
+
case PresetColor.LemonChiffon:
|
|
921
|
+
return rgbValue(255,250,205);
|
|
922
|
+
case PresetColor.Lime:
|
|
923
|
+
return rgbValue(0,255,0);
|
|
924
|
+
case PresetColor.LimeGreen:
|
|
925
|
+
return rgbValue(50,205,50);
|
|
926
|
+
case PresetColor.Linen:
|
|
927
|
+
return rgbValue(250,240,230);
|
|
928
|
+
case PresetColor.LightBlue:
|
|
929
|
+
return rgbValue(173,216,230);
|
|
930
|
+
case PresetColor.LightCoral:
|
|
931
|
+
return rgbValue(240,128,128);
|
|
932
|
+
case PresetColor.LightCyan:
|
|
933
|
+
return rgbValue(224,255,255);
|
|
934
|
+
case PresetColor.LightGoldenrodYellow:
|
|
935
|
+
return rgbValue(250,250,120);
|
|
936
|
+
case PresetColor.LightGray:
|
|
937
|
+
return rgbValue(211,211,211);
|
|
938
|
+
case PresetColor.LightGreen:
|
|
939
|
+
return rgbValue(144,238,144);
|
|
940
|
+
case PresetColor.LightPink:
|
|
941
|
+
return rgbValue(255,182,193);
|
|
942
|
+
case PresetColor.LightSalmon:
|
|
943
|
+
return rgbValue(255,160,122);
|
|
944
|
+
case PresetColor.LightSeaGreen:
|
|
945
|
+
return rgbValue(32,178,170);
|
|
946
|
+
case PresetColor.LightSkyBlue:
|
|
947
|
+
return rgbValue(135,206,250);
|
|
948
|
+
case PresetColor.LightSlateGray:
|
|
949
|
+
return rgbValue(119,136,153);
|
|
950
|
+
case PresetColor.LightSteelBlue:
|
|
951
|
+
return rgbValue(176,196,222);
|
|
952
|
+
case PresetColor.LightYellow:
|
|
953
|
+
return rgbValue(255,255,224);
|
|
954
|
+
case PresetColor.Magenta:
|
|
955
|
+
return rgbValue(255,0,255);
|
|
956
|
+
case PresetColor.Maroon:
|
|
957
|
+
return rgbValue(128,0,0);
|
|
958
|
+
case PresetColor.MediumAquamarine:
|
|
959
|
+
return rgbValue(102,205,170);
|
|
960
|
+
case PresetColor.MediumBlue:
|
|
961
|
+
return rgbValue(0,0,205);
|
|
962
|
+
case PresetColor.MediumOrchid:
|
|
963
|
+
return rgbValue(186,85,211);
|
|
964
|
+
case PresetColor.MediumPurple:
|
|
965
|
+
return rgbValue(147,112,219);
|
|
966
|
+
case PresetColor.MediumSeaGreen:
|
|
967
|
+
return rgbValue(60,179,113);
|
|
968
|
+
case PresetColor.MediumSlateBlue:
|
|
969
|
+
return rgbValue(123,104,238);
|
|
970
|
+
case PresetColor.MediumSpringGreen:
|
|
971
|
+
return rgbValue(0,250,154);
|
|
972
|
+
case PresetColor.MediumTurquoise:
|
|
973
|
+
return rgbValue(72,209,204);
|
|
974
|
+
case PresetColor.MediumVioletRed:
|
|
975
|
+
return rgbValue(199,21,133);
|
|
976
|
+
case PresetColor.MidnightBlue:
|
|
977
|
+
return rgbValue(25,25,112);
|
|
978
|
+
case PresetColor.MintCream:
|
|
979
|
+
return rgbValue(245,255,250);
|
|
980
|
+
case PresetColor.MistyRose:
|
|
981
|
+
return rgbValue(255,228,225);
|
|
982
|
+
case PresetColor.Moccasin:
|
|
983
|
+
return rgbValue(255,228,181);
|
|
984
|
+
case PresetColor.NavajoWhite:
|
|
985
|
+
return rgbValue(255,222,173);
|
|
986
|
+
case PresetColor.Navy:
|
|
987
|
+
return rgbValue(0,0,128);
|
|
988
|
+
case PresetColor.OldLace:
|
|
989
|
+
return rgbValue(253,245,230);
|
|
990
|
+
case PresetColor.Olive:
|
|
991
|
+
return rgbValue(128,128,0);
|
|
992
|
+
case PresetColor.OliveDrab:
|
|
993
|
+
return rgbValue(107,142,35);
|
|
994
|
+
case PresetColor.Orange:
|
|
995
|
+
return rgbValue(255,165,0);
|
|
996
|
+
case PresetColor.OrangeRed:
|
|
997
|
+
return rgbValue(255,69,0);
|
|
998
|
+
case PresetColor.Orchid:
|
|
999
|
+
return rgbValue(218,112,214);
|
|
1000
|
+
case PresetColor.PaleGoldenrod:
|
|
1001
|
+
return rgbValue(238,232,170);
|
|
1002
|
+
case PresetColor.PaleGreen:
|
|
1003
|
+
return rgbValue(152,251,152);
|
|
1004
|
+
case PresetColor.PaleTurquoise:
|
|
1005
|
+
return rgbValue(175,238,238);
|
|
1006
|
+
case PresetColor.PaleVioletRed:
|
|
1007
|
+
return rgbValue(219,112,147);
|
|
1008
|
+
case PresetColor.PapayaWhip:
|
|
1009
|
+
return rgbValue(255,239,213);
|
|
1010
|
+
case PresetColor.PeachPuff:
|
|
1011
|
+
return rgbValue(255,218,185);
|
|
1012
|
+
case PresetColor.Peru:
|
|
1013
|
+
return rgbValue(205,133,63);
|
|
1014
|
+
case PresetColor.Pink:
|
|
1015
|
+
return rgbValue(255,192,203);
|
|
1016
|
+
case PresetColor.Plum:
|
|
1017
|
+
return rgbValue(221,160,221);
|
|
1018
|
+
case PresetColor.PowderBlue:
|
|
1019
|
+
return rgbValue(176,224,230);
|
|
1020
|
+
case PresetColor.Purple:
|
|
1021
|
+
return rgbValue(128,0,128);
|
|
1022
|
+
case PresetColor.Red:
|
|
1023
|
+
return rgbValue(255,0,0);
|
|
1024
|
+
case PresetColor.RosyBrown:
|
|
1025
|
+
return rgbValue(188,143,143);
|
|
1026
|
+
case PresetColor.RoyalBlue:
|
|
1027
|
+
return rgbValue(65,105,225);
|
|
1028
|
+
case PresetColor.SaddleBrown:
|
|
1029
|
+
return rgbValue(139,69,19);
|
|
1030
|
+
case PresetColor.Salmon:
|
|
1031
|
+
return rgbValue(250,128,114);
|
|
1032
|
+
case PresetColor.SandyBrown:
|
|
1033
|
+
return rgbValue(244,164,96);
|
|
1034
|
+
case PresetColor.SeaGreen:
|
|
1035
|
+
return rgbValue(46,139,87);
|
|
1036
|
+
case PresetColor.SeaShell:
|
|
1037
|
+
return rgbValue(255,245,238);
|
|
1038
|
+
case PresetColor.Sienna:
|
|
1039
|
+
return rgbValue(160,82,45);
|
|
1040
|
+
case PresetColor.Silver:
|
|
1041
|
+
return rgbValue(192,192,192);
|
|
1042
|
+
case PresetColor.SkyBlue:
|
|
1043
|
+
return rgbValue(135,206,235);
|
|
1044
|
+
case PresetColor.SlateBlue:
|
|
1045
|
+
return rgbValue(106,90,205);
|
|
1046
|
+
case PresetColor.SlateGray:
|
|
1047
|
+
return rgbValue(112,128,144);
|
|
1048
|
+
case PresetColor.Snow:
|
|
1049
|
+
return rgbValue(255,250,250);
|
|
1050
|
+
case PresetColor.SpringGreen:
|
|
1051
|
+
return rgbValue(0,255,127);
|
|
1052
|
+
case PresetColor.SteelBlue:
|
|
1053
|
+
return rgbValue(70,130,180);
|
|
1054
|
+
case PresetColor.Tan:
|
|
1055
|
+
return rgbValue(210,180,140);
|
|
1056
|
+
case PresetColor.Teal:
|
|
1057
|
+
return rgbValue(0,128,128);
|
|
1058
|
+
case PresetColor.Thistle:
|
|
1059
|
+
return rgbValue(216,191,216);
|
|
1060
|
+
case PresetColor.Tomato:
|
|
1061
|
+
return rgbValue(255,99,71);
|
|
1062
|
+
case PresetColor.Turquoise:
|
|
1063
|
+
return rgbValue(64,224,208);
|
|
1064
|
+
case PresetColor.Violet:
|
|
1065
|
+
return rgbValue(238,130,238);
|
|
1066
|
+
case PresetColor.Wheat:
|
|
1067
|
+
return rgbValue(245,222,179);
|
|
1068
|
+
case PresetColor.White:
|
|
1069
|
+
return rgbValue(255,255,255);
|
|
1070
|
+
case PresetColor.WhiteSmoke:
|
|
1071
|
+
return rgbValue(245,245,245);
|
|
1072
|
+
case PresetColor.Yellow:
|
|
1073
|
+
return rgbValue(255,255,0);
|
|
1074
|
+
case PresetColor.YellowGreen:
|
|
1075
|
+
return rgbValue(154,205,50);
|
|
1076
|
+
default:
|
|
1077
|
+
return 0;
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
export class OfficeFill
|
|
1083
|
+
{
|
|
1084
|
+
/**
|
|
1085
|
+
* @param {number} fillType
|
|
1086
|
+
* @param {OfficeColor | null} color
|
|
1087
|
+
*/
|
|
1088
|
+
constructor(fillType, color)
|
|
1089
|
+
{
|
|
1090
|
+
this.fillType = fillType;
|
|
1091
|
+
this.color = color;
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
getFillType()
|
|
1095
|
+
{
|
|
1096
|
+
return this.fillType;
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
getColor()
|
|
1100
|
+
{
|
|
1101
|
+
return this.color;
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
/**
|
|
1105
|
+
* @param {OfficeColor | null} color
|
|
1106
|
+
*/
|
|
1107
|
+
static newSolidFill(color)
|
|
1108
|
+
{
|
|
1109
|
+
return new OfficeFill(FillType.SolidFill, color);
|
|
1110
|
+
}
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1113
|
+
export class OfficeLineStyle
|
|
1114
|
+
{
|
|
1115
|
+
/**
|
|
1116
|
+
* @param {OfficeFill|null} fill
|
|
1117
|
+
*/
|
|
1118
|
+
constructor(fill)
|
|
1119
|
+
{
|
|
1120
|
+
this.fill = fill;
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
getFillStyle()
|
|
1124
|
+
{
|
|
1125
|
+
return this.fill;
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
export class OfficeShapeProp
|
|
1130
|
+
{
|
|
1131
|
+
/**
|
|
1132
|
+
* @param {OfficeFill | null} fill
|
|
1133
|
+
* @param {OfficeLineStyle | null} lineStyle
|
|
1134
|
+
*/
|
|
1135
|
+
constructor(fill, lineStyle)
|
|
1136
|
+
{
|
|
1137
|
+
this.fill = fill;
|
|
1138
|
+
this.lineStyle = lineStyle;
|
|
1139
|
+
};
|
|
1140
|
+
|
|
1141
|
+
getFill()
|
|
1142
|
+
{
|
|
1143
|
+
return this.fill;
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
/**
|
|
1147
|
+
* @param {OfficeFill | null} fill
|
|
1148
|
+
*/
|
|
1149
|
+
setFill(fill)
|
|
1150
|
+
{
|
|
1151
|
+
this.fill = fill;
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
getLineStyle()
|
|
1155
|
+
{
|
|
1156
|
+
return this.lineStyle;
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
/**
|
|
1160
|
+
* @param {OfficeLineStyle | null} lineStyle
|
|
1161
|
+
*/
|
|
1162
|
+
setLineStyle(lineStyle)
|
|
1163
|
+
{
|
|
1164
|
+
this.lineStyle = lineStyle;
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
export class OfficeChartAxis
|
|
1169
|
+
{
|
|
1170
|
+
/**
|
|
1171
|
+
* @param {number} axisType
|
|
1172
|
+
* @param {number} axisPos
|
|
1173
|
+
*/
|
|
1174
|
+
constructor(axisType, axisPos)
|
|
1175
|
+
{
|
|
1176
|
+
this.axisType = axisType;
|
|
1177
|
+
this.axisPos = axisPos;
|
|
1178
|
+
/** @type {string|null} */
|
|
1179
|
+
this.title = null;
|
|
1180
|
+
/** @type {OfficeShapeProp|null} */
|
|
1181
|
+
this.shapeProp = null;
|
|
1182
|
+
/** @type {OfficeShapeProp|null} */
|
|
1183
|
+
this.majorGridProp = null;
|
|
1184
|
+
this.tickLblPos = TickLabelPosition.NextTo;
|
|
1185
|
+
this.crosses = AxisCrosses.AutoZero;
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
getAxisType()
|
|
1189
|
+
{
|
|
1190
|
+
return this.axisType;
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
getAxisPos()
|
|
1194
|
+
{
|
|
1195
|
+
return this.axisPos;
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
getTitle()
|
|
1199
|
+
{
|
|
1200
|
+
return this.title;
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
/**
|
|
1204
|
+
* @param {string | null} title
|
|
1205
|
+
*/
|
|
1206
|
+
setTitle(title)
|
|
1207
|
+
{
|
|
1208
|
+
this.title = title;
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
getShapeProp()
|
|
1212
|
+
{
|
|
1213
|
+
return this.shapeProp;
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1216
|
+
/**
|
|
1217
|
+
* @param {OfficeShapeProp | null} shapeProp
|
|
1218
|
+
*/
|
|
1219
|
+
setShapeProp(shapeProp)
|
|
1220
|
+
{
|
|
1221
|
+
this.shapeProp = shapeProp;
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
getMajorGridProp()
|
|
1225
|
+
{
|
|
1226
|
+
return this.majorGridProp;
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1229
|
+
/**
|
|
1230
|
+
* @param {OfficeShapeProp | null} majorGridProp
|
|
1231
|
+
*/
|
|
1232
|
+
setMajorGridProp(majorGridProp)
|
|
1233
|
+
{
|
|
1234
|
+
this.majorGridProp = majorGridProp;
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
getTickLblPos()
|
|
1238
|
+
{
|
|
1239
|
+
return this.tickLblPos;
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1242
|
+
/**
|
|
1243
|
+
* @param {number} tickLblPos
|
|
1244
|
+
*/
|
|
1245
|
+
setTickLblPos(tickLblPos)
|
|
1246
|
+
{
|
|
1247
|
+
this.tickLblPos = tickLblPos;
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
getCrosses()
|
|
1251
|
+
{
|
|
1252
|
+
return this.crosses;
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1255
|
+
/**
|
|
1256
|
+
* @param {number} axisCrosses
|
|
1257
|
+
*/
|
|
1258
|
+
setCrosses(axisCrosses)
|
|
1259
|
+
{
|
|
1260
|
+
this.crosses = axisCrosses;
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1264
|
+
export class WorkbookDataSource
|
|
1265
|
+
{
|
|
1266
|
+
/**
|
|
1267
|
+
* @param {Worksheet} sheet
|
|
1268
|
+
* @param {number} firstRow
|
|
1269
|
+
* @param {number} lastRow
|
|
1270
|
+
* @param {number} firstCol
|
|
1271
|
+
* @param {number} lastCol
|
|
1272
|
+
*/
|
|
1273
|
+
constructor(sheet, firstRow, lastRow, firstCol, lastCol)
|
|
1274
|
+
{
|
|
1275
|
+
this.sheet = sheet;
|
|
1276
|
+
this.firstRow = firstRow;
|
|
1277
|
+
this.lastRow = lastRow;
|
|
1278
|
+
this.firstCol = firstCol;
|
|
1279
|
+
this.lastCol = lastCol;
|
|
1280
|
+
}
|
|
1281
|
+
|
|
1282
|
+
toCodeRange()
|
|
1283
|
+
{
|
|
1284
|
+
let sb = [];
|
|
1285
|
+
sb.push(this.sheet.getName());
|
|
1286
|
+
sb.push('!$');
|
|
1287
|
+
sb.push(Workbook.colCode(this.firstCol));
|
|
1288
|
+
sb.push('$');
|
|
1289
|
+
sb.push(""+(this.firstRow + 1));
|
|
1290
|
+
sb.push(':$');
|
|
1291
|
+
sb.push(Workbook.colCode(this.lastCol));
|
|
1292
|
+
sb.push('$');
|
|
1293
|
+
sb.push(""+(this.lastRow + 1));
|
|
1294
|
+
return sb.join("");
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1297
|
+
getSheet()
|
|
1298
|
+
{
|
|
1299
|
+
return this.sheet;
|
|
1300
|
+
}
|
|
1301
|
+
|
|
1302
|
+
getFirstRow()
|
|
1303
|
+
{
|
|
1304
|
+
return this.firstRow;
|
|
1305
|
+
}
|
|
1306
|
+
|
|
1307
|
+
getLastRow()
|
|
1308
|
+
{
|
|
1309
|
+
return this.lastRow;
|
|
1310
|
+
}
|
|
1311
|
+
|
|
1312
|
+
getFirstCol()
|
|
1313
|
+
{
|
|
1314
|
+
return this.firstCol;
|
|
1315
|
+
}
|
|
1316
|
+
|
|
1317
|
+
getLastCol()
|
|
1318
|
+
{
|
|
1319
|
+
return this.lastCol;
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
|
|
1323
|
+
export class OfficeChartSeries
|
|
1324
|
+
{
|
|
1325
|
+
/**
|
|
1326
|
+
* @param {WorkbookDataSource} categoryData
|
|
1327
|
+
* @param {WorkbookDataSource} valueData
|
|
1328
|
+
*/
|
|
1329
|
+
constructor(categoryData, valueData)
|
|
1330
|
+
{
|
|
1331
|
+
this.categoryData = categoryData;
|
|
1332
|
+
this.valueData = valueData;
|
|
1333
|
+
/** @type {string|null} */
|
|
1334
|
+
this.title = null;
|
|
1335
|
+
this.smooth = false;
|
|
1336
|
+
/** @type {OfficeShapeProp|null} */
|
|
1337
|
+
this.shapeProp = null;
|
|
1338
|
+
this.markerSize = 0;
|
|
1339
|
+
this.markerStyle = MarkerStyle.None;
|
|
1340
|
+
}
|
|
1341
|
+
|
|
1342
|
+
getCategoryData()
|
|
1343
|
+
{
|
|
1344
|
+
return this.categoryData;
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1347
|
+
getValueData()
|
|
1348
|
+
{
|
|
1349
|
+
return this.valueData;
|
|
1350
|
+
}
|
|
1351
|
+
|
|
1352
|
+
getTitle()
|
|
1353
|
+
{
|
|
1354
|
+
return this.title;
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1357
|
+
/**
|
|
1358
|
+
* @param {string | null} title
|
|
1359
|
+
*/
|
|
1360
|
+
setTitle(title)
|
|
1361
|
+
{
|
|
1362
|
+
this.title = title;
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1365
|
+
isSmooth()
|
|
1366
|
+
{
|
|
1367
|
+
return this.smooth;
|
|
1368
|
+
}
|
|
1369
|
+
|
|
1370
|
+
/**
|
|
1371
|
+
* @param {boolean} smooth
|
|
1372
|
+
*/
|
|
1373
|
+
setSmooth(smooth)
|
|
1374
|
+
{
|
|
1375
|
+
this.smooth = smooth;
|
|
1376
|
+
}
|
|
1377
|
+
|
|
1378
|
+
getShapeProp()
|
|
1379
|
+
{
|
|
1380
|
+
return this.shapeProp;
|
|
1381
|
+
}
|
|
1382
|
+
|
|
1383
|
+
/**
|
|
1384
|
+
* @param {OfficeShapeProp | null} shapeProp
|
|
1385
|
+
*/
|
|
1386
|
+
setShapeProp(shapeProp)
|
|
1387
|
+
{
|
|
1388
|
+
this.shapeProp = shapeProp;
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1391
|
+
/**
|
|
1392
|
+
* @param {OfficeLineStyle | null} lineStyle
|
|
1393
|
+
*/
|
|
1394
|
+
setLineStyle(lineStyle)
|
|
1395
|
+
{
|
|
1396
|
+
if (this.shapeProp)
|
|
1397
|
+
{
|
|
1398
|
+
this.shapeProp.setLineStyle(lineStyle);
|
|
1399
|
+
}
|
|
1400
|
+
else
|
|
1401
|
+
{
|
|
1402
|
+
this.shapeProp = new OfficeShapeProp(null, lineStyle);
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
|
|
1406
|
+
getMarkerSize()
|
|
1407
|
+
{
|
|
1408
|
+
return this.markerSize;
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1411
|
+
/**
|
|
1412
|
+
* @param {number} markerSize
|
|
1413
|
+
*/
|
|
1414
|
+
setMarkerSize(markerSize)
|
|
1415
|
+
{
|
|
1416
|
+
this.markerSize = markerSize;
|
|
1417
|
+
}
|
|
1418
|
+
|
|
1419
|
+
getMarkerStyle()
|
|
1420
|
+
{
|
|
1421
|
+
return this.markerStyle;
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1424
|
+
/**
|
|
1425
|
+
* @param {number} markerStyle
|
|
1426
|
+
*/
|
|
1427
|
+
setMarkerStyle(markerStyle)
|
|
1428
|
+
{
|
|
1429
|
+
this.markerStyle = markerStyle;
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1432
|
+
|
|
1433
|
+
class OfficeChart
|
|
1434
|
+
{
|
|
1435
|
+
static seriesColor = [
|
|
1436
|
+
PresetColor.DarkBlue,
|
|
1437
|
+
PresetColor.Aqua,
|
|
1438
|
+
PresetColor.Fuchsia,
|
|
1439
|
+
PresetColor.BlueViolet,
|
|
1440
|
+
PresetColor.Lavender,
|
|
1441
|
+
PresetColor.GreenYellow,
|
|
1442
|
+
PresetColor.Khaki,
|
|
1443
|
+
PresetColor.Honeydew,
|
|
1444
|
+
PresetColor.Magenta,
|
|
1445
|
+
PresetColor.Orchid,
|
|
1446
|
+
PresetColor.Thistle
|
|
1447
|
+
];
|
|
1448
|
+
|
|
1449
|
+
/**
|
|
1450
|
+
* @param {unit.Distance.Unit} du
|
|
1451
|
+
* @param {number} x
|
|
1452
|
+
* @param {number} y
|
|
1453
|
+
* @param {number} w
|
|
1454
|
+
* @param {number} h
|
|
1455
|
+
*/
|
|
1456
|
+
constructor(du, x, y, w, h)
|
|
1457
|
+
{
|
|
1458
|
+
this.xInch = unit.Distance.convert(du, unit.Distance.Unit.INCH, x);
|
|
1459
|
+
this.yInch = unit.Distance.convert(du, unit.Distance.Unit.INCH, y);
|
|
1460
|
+
this.wInch = unit.Distance.convert(du, unit.Distance.Unit.INCH, w);
|
|
1461
|
+
this.hInch = unit.Distance.convert(du, unit.Distance.Unit.INCH, h);
|
|
1462
|
+
/** @type {string|null} */
|
|
1463
|
+
this.titleText = null;
|
|
1464
|
+
/** @type {OfficeShapeProp|null} */
|
|
1465
|
+
this.shapeProp = null;
|
|
1466
|
+
this.legend = false;
|
|
1467
|
+
this.legendPos = LegendPos.Bottom;
|
|
1468
|
+
this.legendOverlay = false;
|
|
1469
|
+
this.displayBlankAs = BlankAs.Default;
|
|
1470
|
+
this.chartType = ChartType.Unknown;
|
|
1471
|
+
/** @type {OfficeChartAxis|null} */
|
|
1472
|
+
this.categoryAxis = null;
|
|
1473
|
+
/** @type {OfficeChartAxis|null} */
|
|
1474
|
+
this.valueAxis = null;
|
|
1475
|
+
/** @type {OfficeChartAxis[]} */
|
|
1476
|
+
this.axes = [];
|
|
1477
|
+
/** @type {OfficeChartSeries[]} */
|
|
1478
|
+
this.series = [];
|
|
1479
|
+
}
|
|
1480
|
+
|
|
1481
|
+
getXInch()
|
|
1482
|
+
{
|
|
1483
|
+
return this.xInch;
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1486
|
+
getYInch()
|
|
1487
|
+
{
|
|
1488
|
+
return this.yInch;
|
|
1489
|
+
}
|
|
1490
|
+
|
|
1491
|
+
getWInch()
|
|
1492
|
+
{
|
|
1493
|
+
return this.wInch;
|
|
1494
|
+
}
|
|
1495
|
+
|
|
1496
|
+
getHInch()
|
|
1497
|
+
{
|
|
1498
|
+
return this.hInch;
|
|
1499
|
+
}
|
|
1500
|
+
|
|
1501
|
+
/**
|
|
1502
|
+
* @param {string | null} titleText
|
|
1503
|
+
*/
|
|
1504
|
+
setTitleText(titleText)
|
|
1505
|
+
{
|
|
1506
|
+
this.titleText = titleText;
|
|
1507
|
+
}
|
|
1508
|
+
|
|
1509
|
+
getTitleText()
|
|
1510
|
+
{
|
|
1511
|
+
return this.titleText;
|
|
1512
|
+
}
|
|
1513
|
+
|
|
1514
|
+
getShapeProp()
|
|
1515
|
+
{
|
|
1516
|
+
return this.shapeProp;
|
|
1517
|
+
}
|
|
1518
|
+
|
|
1519
|
+
/**
|
|
1520
|
+
* @param {OfficeShapeProp | null} shapeProp
|
|
1521
|
+
*/
|
|
1522
|
+
setShapeProp(shapeProp)
|
|
1523
|
+
{
|
|
1524
|
+
this.shapeProp = shapeProp;
|
|
1525
|
+
}
|
|
1526
|
+
|
|
1527
|
+
/**
|
|
1528
|
+
* @param {number} pos
|
|
1529
|
+
*/
|
|
1530
|
+
addLegend(pos)
|
|
1531
|
+
{
|
|
1532
|
+
this.legend = true;
|
|
1533
|
+
this.legendPos = pos;
|
|
1534
|
+
this.legendOverlay = false;
|
|
1535
|
+
}
|
|
1536
|
+
|
|
1537
|
+
hasLegend()
|
|
1538
|
+
{
|
|
1539
|
+
return this.legend;
|
|
1540
|
+
}
|
|
1541
|
+
|
|
1542
|
+
getLegendPos()
|
|
1543
|
+
{
|
|
1544
|
+
return this.legendPos;
|
|
1545
|
+
}
|
|
1546
|
+
|
|
1547
|
+
isLegendOverlay()
|
|
1548
|
+
{
|
|
1549
|
+
return this.legendOverlay;
|
|
1550
|
+
}
|
|
1551
|
+
|
|
1552
|
+
/**
|
|
1553
|
+
* @param {number} displayBlankAs
|
|
1554
|
+
*/
|
|
1555
|
+
setDisplayBlankAs(displayBlankAs)
|
|
1556
|
+
{
|
|
1557
|
+
this.displayBlankAs = displayBlankAs;
|
|
1558
|
+
}
|
|
1559
|
+
|
|
1560
|
+
getDisplayBlankAs()
|
|
1561
|
+
{
|
|
1562
|
+
return this.displayBlankAs;
|
|
1563
|
+
}
|
|
1564
|
+
|
|
1565
|
+
/**
|
|
1566
|
+
* @param {number} chartType
|
|
1567
|
+
* @param {OfficeChartAxis} categoryAxis
|
|
1568
|
+
* @param {OfficeChartAxis} valueAxis
|
|
1569
|
+
*/
|
|
1570
|
+
initChart(chartType, categoryAxis, valueAxis)
|
|
1571
|
+
{
|
|
1572
|
+
this.chartType = chartType;
|
|
1573
|
+
this.categoryAxis = categoryAxis;
|
|
1574
|
+
this.valueAxis = valueAxis;
|
|
1575
|
+
}
|
|
1576
|
+
|
|
1577
|
+
/**
|
|
1578
|
+
* @param {string | null} leftAxisName
|
|
1579
|
+
* @param {string | null} bottomAxisName
|
|
1580
|
+
* @param {number} bottomAxisType
|
|
1581
|
+
*/
|
|
1582
|
+
initLineChart(leftAxisName, bottomAxisName, bottomAxisType)
|
|
1583
|
+
{
|
|
1584
|
+
let leftAxis = this.createAxis(AxisType.Numeric, AxisPosition.Left);
|
|
1585
|
+
if (leftAxisName && leftAxisName.length > 0) leftAxis.setTitle(leftAxisName);
|
|
1586
|
+
leftAxis.setCrosses(AxisCrosses.AutoZero);
|
|
1587
|
+
leftAxis.setMajorGridProp(new OfficeShapeProp(null, new OfficeLineStyle(OfficeFill.newSolidFill(OfficeColor.newPreset(PresetColor.LightGray)))));
|
|
1588
|
+
leftAxis.setShapeProp(new OfficeShapeProp(null, new OfficeLineStyle(OfficeFill.newSolidFill(OfficeColor.newPreset(PresetColor.Black)))));
|
|
1589
|
+
let bottomAxis = this.createAxis(bottomAxisType, AxisPosition.Bottom);
|
|
1590
|
+
if (bottomAxisName && bottomAxisName.length > 0) bottomAxis.setTitle(bottomAxisName);
|
|
1591
|
+
bottomAxis.setShapeProp(new OfficeShapeProp(null, new OfficeLineStyle(OfficeFill.newSolidFill(OfficeColor.newPreset(PresetColor.Black)))));
|
|
1592
|
+
bottomAxis.setTickLblPos(TickLabelPosition.Low);
|
|
1593
|
+
|
|
1594
|
+
this.initChart(ChartType.LineChart, bottomAxis, leftAxis);
|
|
1595
|
+
}
|
|
1596
|
+
|
|
1597
|
+
getChartType()
|
|
1598
|
+
{
|
|
1599
|
+
return this.chartType;
|
|
1600
|
+
}
|
|
1601
|
+
|
|
1602
|
+
/**
|
|
1603
|
+
* @param {number} axisType
|
|
1604
|
+
* @param {number} axisPos
|
|
1605
|
+
*/
|
|
1606
|
+
createAxis(axisType, axisPos)
|
|
1607
|
+
{
|
|
1608
|
+
let axis = new OfficeChartAxis(axisType, axisPos);
|
|
1609
|
+
this.axes.push(axis);
|
|
1610
|
+
return axis;
|
|
1611
|
+
}
|
|
1612
|
+
|
|
1613
|
+
getAxisCount()
|
|
1614
|
+
{
|
|
1615
|
+
return this.axes.length;
|
|
1616
|
+
}
|
|
1617
|
+
|
|
1618
|
+
/**
|
|
1619
|
+
* @param {number} index
|
|
1620
|
+
*/
|
|
1621
|
+
getAxis(index)
|
|
1622
|
+
{
|
|
1623
|
+
return this.axes[index];
|
|
1624
|
+
}
|
|
1625
|
+
|
|
1626
|
+
/**
|
|
1627
|
+
* @param {OfficeChartAxis} axis
|
|
1628
|
+
*/
|
|
1629
|
+
getAxisIndex(axis)
|
|
1630
|
+
{
|
|
1631
|
+
let i;
|
|
1632
|
+
for (i in this.axes)
|
|
1633
|
+
{
|
|
1634
|
+
if (this.axes[i] == axis)
|
|
1635
|
+
return Number(i);
|
|
1636
|
+
}
|
|
1637
|
+
return -1;
|
|
1638
|
+
}
|
|
1639
|
+
|
|
1640
|
+
getCategoryAxis()
|
|
1641
|
+
{
|
|
1642
|
+
return this.categoryAxis;
|
|
1643
|
+
}
|
|
1644
|
+
|
|
1645
|
+
getValueAxis()
|
|
1646
|
+
{
|
|
1647
|
+
return this.valueAxis;
|
|
1648
|
+
}
|
|
1649
|
+
|
|
1650
|
+
/**
|
|
1651
|
+
* @param {WorkbookDataSource} categoryData
|
|
1652
|
+
* @param {WorkbookDataSource} valueData
|
|
1653
|
+
* @param {string | null} name
|
|
1654
|
+
* @param {boolean} showMarker
|
|
1655
|
+
*/
|
|
1656
|
+
addSeries(categoryData, valueData, name, showMarker)
|
|
1657
|
+
{
|
|
1658
|
+
let i = this.series.length;
|
|
1659
|
+
let series = new OfficeChartSeries(categoryData, valueData);
|
|
1660
|
+
if (name != null)
|
|
1661
|
+
series.setTitle(name);
|
|
1662
|
+
series.setSmooth(false);
|
|
1663
|
+
if (showMarker)
|
|
1664
|
+
{
|
|
1665
|
+
series.setMarkerSize(3);
|
|
1666
|
+
series.setMarkerStyle(MarkerStyle.Circle);
|
|
1667
|
+
}
|
|
1668
|
+
else
|
|
1669
|
+
{
|
|
1670
|
+
series.setMarkerStyle(MarkerStyle.None);
|
|
1671
|
+
}
|
|
1672
|
+
series.setLineStyle(new OfficeLineStyle(OfficeFill.newSolidFill(OfficeColor.newPreset(OfficeChart.seriesColor[i % OfficeChart.seriesColor.length]))));
|
|
1673
|
+
this.series.push(series);
|
|
1674
|
+
}
|
|
1675
|
+
|
|
1676
|
+
getSeriesCount()
|
|
1677
|
+
{
|
|
1678
|
+
return this.series.length;
|
|
1679
|
+
}
|
|
1680
|
+
|
|
1681
|
+
/**
|
|
1682
|
+
* @param {number} index
|
|
1683
|
+
*/
|
|
1684
|
+
getSeriesNoCheck(index)
|
|
1685
|
+
{
|
|
1686
|
+
let o = this.series[index];
|
|
1687
|
+
if (o == null)
|
|
1688
|
+
throw new Error("Series is null");
|
|
1689
|
+
return o;
|
|
1690
|
+
}
|
|
1691
|
+
|
|
1692
|
+
/**
|
|
1693
|
+
* @param {number} index
|
|
1694
|
+
*/
|
|
1695
|
+
getSeries(index)
|
|
1696
|
+
{
|
|
1697
|
+
return this.series[index];
|
|
1698
|
+
}
|
|
1699
|
+
}
|
|
1700
|
+
|
|
1701
|
+
export class Worksheet
|
|
1702
|
+
{
|
|
1703
|
+
/**
|
|
1704
|
+
* @param {number} row
|
|
1705
|
+
*/
|
|
1706
|
+
createRow(row)
|
|
1707
|
+
{
|
|
1708
|
+
if (row >= 1048576)
|
|
1709
|
+
return null;
|
|
1710
|
+
while (row >= this.rows.length)
|
|
1711
|
+
{
|
|
1712
|
+
this.rows.push(null);
|
|
1713
|
+
}
|
|
1714
|
+
let rowData = this.rows[row];
|
|
1715
|
+
if (rowData == null)
|
|
1716
|
+
{
|
|
1717
|
+
rowData = {style: null, height: -1, cells: []};
|
|
1718
|
+
this.rows[row] = rowData;
|
|
1719
|
+
}
|
|
1720
|
+
return rowData;
|
|
1721
|
+
}
|
|
1722
|
+
|
|
1723
|
+
/**
|
|
1724
|
+
* @param {number} row
|
|
1725
|
+
* @param {number} col
|
|
1726
|
+
* @param {boolean} keepMerge
|
|
1727
|
+
*/
|
|
1728
|
+
getCellData(row, col, keepMerge)
|
|
1729
|
+
{
|
|
1730
|
+
let rowData;
|
|
1731
|
+
let cell;
|
|
1732
|
+
if (row >= this.rows.length + 65536)
|
|
1733
|
+
return null;
|
|
1734
|
+
if (col >= 65536)
|
|
1735
|
+
return null;
|
|
1736
|
+
if (col > this.maxCol)
|
|
1737
|
+
{
|
|
1738
|
+
this.maxCol = col;
|
|
1739
|
+
}
|
|
1740
|
+
while (true)
|
|
1741
|
+
{
|
|
1742
|
+
if ((rowData = this.createRow(row)) == null)
|
|
1743
|
+
return null;
|
|
1744
|
+
while (col >= rowData.cells.length)
|
|
1745
|
+
{
|
|
1746
|
+
rowData.cells.push(null);
|
|
1747
|
+
}
|
|
1748
|
+
if ((cell = rowData.cells[col]) == null)
|
|
1749
|
+
{
|
|
1750
|
+
cell = {cdt: CellDataType.String, cellValue: null, style: null, mergeHori: 0, mergeVert: 0, hidden: false, cellURL: null};
|
|
1751
|
+
rowData.cells[col] = cell;
|
|
1752
|
+
}
|
|
1753
|
+
|
|
1754
|
+
if (keepMerge)
|
|
1755
|
+
break;
|
|
1756
|
+
if (cell.cdt == CellDataType.MergedLeft)
|
|
1757
|
+
{
|
|
1758
|
+
col--;
|
|
1759
|
+
}
|
|
1760
|
+
else if (cell.cdt == CellDataType.MergedUp)
|
|
1761
|
+
{
|
|
1762
|
+
row--;
|
|
1763
|
+
}
|
|
1764
|
+
else
|
|
1765
|
+
{
|
|
1766
|
+
break;
|
|
1767
|
+
}
|
|
1768
|
+
}
|
|
1769
|
+
return cell;
|
|
1770
|
+
}
|
|
1771
|
+
|
|
1772
|
+
/**
|
|
1773
|
+
* @param {{style: CellStyle|null,cells: ({cdt: number,cellValue: string|null,style: CellStyle|null,mergeHori: number,mergeVert: number,hidden: boolean,cellURL: string|null}|null)[],height: number}} row
|
|
1774
|
+
* @param {Workbook} srcCtrl
|
|
1775
|
+
* @param {Workbook} newCtrl
|
|
1776
|
+
*/
|
|
1777
|
+
cloneRow(row, srcCtrl, newCtrl)
|
|
1778
|
+
{
|
|
1779
|
+
let newRow;
|
|
1780
|
+
let cell;
|
|
1781
|
+
let i;
|
|
1782
|
+
let j;
|
|
1783
|
+
let style;
|
|
1784
|
+
if (row.style)
|
|
1785
|
+
style = newCtrl.getStyle(srcCtrl.getStyleIndex(row.style));
|
|
1786
|
+
else
|
|
1787
|
+
style = null;
|
|
1788
|
+
newRow = {style: style, cells: new Array(), height: -1};
|
|
1789
|
+
newRow.height = row.height;
|
|
1790
|
+
i = 0;
|
|
1791
|
+
j = row.cells.length;
|
|
1792
|
+
while (i < j)
|
|
1793
|
+
{
|
|
1794
|
+
if ((cell = row.cells[i]) == null)
|
|
1795
|
+
{
|
|
1796
|
+
newRow.cells.push(null);
|
|
1797
|
+
}
|
|
1798
|
+
else
|
|
1799
|
+
{
|
|
1800
|
+
newRow.cells.push(this.cloneCell(cell, srcCtrl, newCtrl));
|
|
1801
|
+
}
|
|
1802
|
+
i++;
|
|
1803
|
+
}
|
|
1804
|
+
return newRow;
|
|
1805
|
+
}
|
|
1806
|
+
|
|
1807
|
+
/**
|
|
1808
|
+
* @param {{cdt: number,cellValue: string|null,style: CellStyle|null,mergeHori: number,mergeVert: number,hidden: boolean,cellURL: string|null}} cell
|
|
1809
|
+
* @param {Workbook} srcCtrl
|
|
1810
|
+
* @param {Workbook} newCtrl
|
|
1811
|
+
*/
|
|
1812
|
+
cloneCell(cell, srcCtrl, newCtrl)
|
|
1813
|
+
{
|
|
1814
|
+
let newCell = {};
|
|
1815
|
+
newCell.cdt = cell.cdt;
|
|
1816
|
+
newCell.cellValue = cell.cellValue;
|
|
1817
|
+
if (cell.style)
|
|
1818
|
+
newCell.style = newCtrl.getStyle(srcCtrl.getStyleIndex(cell.style));
|
|
1819
|
+
else
|
|
1820
|
+
newCell.style = null;
|
|
1821
|
+
newCell.mergeHori = cell.mergeHori;
|
|
1822
|
+
newCell.mergeVert = cell.mergeVert;
|
|
1823
|
+
newCell.hidden = cell.hidden;
|
|
1824
|
+
newCell.cellURL = cell.cellURL;
|
|
1825
|
+
return newCell;
|
|
1826
|
+
}
|
|
1827
|
+
|
|
1828
|
+
/**
|
|
1829
|
+
* @param {string} name
|
|
1830
|
+
*/
|
|
1831
|
+
constructor(name)
|
|
1832
|
+
{
|
|
1833
|
+
this.name = name;
|
|
1834
|
+
/** @type {({style: CellStyle|null,cells: ({cdt: number,cellValue: string|null,style: CellStyle|null,mergeHori: number,mergeVert: number,hidden: boolean,cellURL: string|null}|null)[],height: number}|null)[]} */
|
|
1835
|
+
this.rows = [];
|
|
1836
|
+
/** @type {number[]} */
|
|
1837
|
+
this.colWidthsPt = [];
|
|
1838
|
+
/** @type {{anchorType: number,posXInch: number,posYInch: number,widthInch: number,heightInch: number,row1: number,col1: number,row2: number,col2: number,chart: OfficeChart|null}[]} */
|
|
1839
|
+
this.drawings = [];
|
|
1840
|
+
this.freezeHori = 0;
|
|
1841
|
+
this.freezeVert = 0;
|
|
1842
|
+
this.marginLeft = 2.0;
|
|
1843
|
+
this.marginRight = 2.0;
|
|
1844
|
+
this.marginTop = 2.5;
|
|
1845
|
+
this.marginBottom = 2.5;
|
|
1846
|
+
this.marginHeader = 1.3;
|
|
1847
|
+
this.marginFooter = 1.3;
|
|
1848
|
+
this.zoom = 100;
|
|
1849
|
+
this.options = 0x4b6;
|
|
1850
|
+
this.maxCol = 0;
|
|
1851
|
+
this.defColWidthPt = 48.0;
|
|
1852
|
+
this.defRowHeightPt = 13.5;
|
|
1853
|
+
}
|
|
1854
|
+
|
|
1855
|
+
/**
|
|
1856
|
+
* @param {Workbook} srcCtrl
|
|
1857
|
+
* @param {Workbook} newCtrl
|
|
1858
|
+
*/
|
|
1859
|
+
clone(srcCtrl, newCtrl)
|
|
1860
|
+
{
|
|
1861
|
+
let i;
|
|
1862
|
+
let j;
|
|
1863
|
+
let row;
|
|
1864
|
+
let newWS = new Worksheet(this.name);
|
|
1865
|
+
newWS.freezeHori = this.freezeHori;
|
|
1866
|
+
newWS.freezeVert = this.freezeVert;
|
|
1867
|
+
newWS.marginLeft = this.marginLeft;
|
|
1868
|
+
newWS.marginRight = this.marginRight;
|
|
1869
|
+
newWS.marginTop = this.marginTop;
|
|
1870
|
+
newWS.marginBottom = this.marginBottom;
|
|
1871
|
+
newWS.marginHeader = this.marginHeader;
|
|
1872
|
+
newWS.marginFooter = this.marginFooter;
|
|
1873
|
+
newWS.options = this.options;
|
|
1874
|
+
newWS.zoom = this.zoom;
|
|
1875
|
+
i = 0;
|
|
1876
|
+
j = this.colWidthsPt.length;
|
|
1877
|
+
while (i < j)
|
|
1878
|
+
{
|
|
1879
|
+
newWS.colWidthsPt.push(this.colWidthsPt[i]);
|
|
1880
|
+
i++;
|
|
1881
|
+
}
|
|
1882
|
+
i = 0;
|
|
1883
|
+
j = this.rows.length;
|
|
1884
|
+
while (i < j)
|
|
1885
|
+
{
|
|
1886
|
+
if ((row = this.rows[i]) == null)
|
|
1887
|
+
{
|
|
1888
|
+
newWS.rows.push(null);
|
|
1889
|
+
}
|
|
1890
|
+
else
|
|
1891
|
+
{
|
|
1892
|
+
newWS.rows.push(this.cloneRow(row, srcCtrl, newCtrl));
|
|
1893
|
+
}
|
|
1894
|
+
i++;
|
|
1895
|
+
}
|
|
1896
|
+
return newWS;
|
|
1897
|
+
}
|
|
1898
|
+
|
|
1899
|
+
/**
|
|
1900
|
+
* @param {number} options
|
|
1901
|
+
*/
|
|
1902
|
+
setOptions(options)
|
|
1903
|
+
{
|
|
1904
|
+
this.options = options;
|
|
1905
|
+
}
|
|
1906
|
+
|
|
1907
|
+
getOptions()
|
|
1908
|
+
{
|
|
1909
|
+
return this.options;
|
|
1910
|
+
}
|
|
1911
|
+
|
|
1912
|
+
/**
|
|
1913
|
+
* @param {number} freezeHori
|
|
1914
|
+
*/
|
|
1915
|
+
setFreezeHori(freezeHori)
|
|
1916
|
+
{
|
|
1917
|
+
this.freezeHori = freezeHori;
|
|
1918
|
+
this.options |= 0x108;
|
|
1919
|
+
}
|
|
1920
|
+
|
|
1921
|
+
getFreezeHori()
|
|
1922
|
+
{
|
|
1923
|
+
return this.freezeHori;
|
|
1924
|
+
}
|
|
1925
|
+
|
|
1926
|
+
/**
|
|
1927
|
+
* @param {number} freezeVert
|
|
1928
|
+
*/
|
|
1929
|
+
setFreezeVert(freezeVert)
|
|
1930
|
+
{
|
|
1931
|
+
this.freezeVert = freezeVert;
|
|
1932
|
+
this.options |= 0x108;
|
|
1933
|
+
}
|
|
1934
|
+
|
|
1935
|
+
getFreezeVert()
|
|
1936
|
+
{
|
|
1937
|
+
return this.freezeVert;
|
|
1938
|
+
}
|
|
1939
|
+
|
|
1940
|
+
/**
|
|
1941
|
+
* @param {number} marginLeft
|
|
1942
|
+
*/
|
|
1943
|
+
setMarginLeft(marginLeft)
|
|
1944
|
+
{
|
|
1945
|
+
this.marginLeft = marginLeft;
|
|
1946
|
+
}
|
|
1947
|
+
|
|
1948
|
+
getMarginLeft()
|
|
1949
|
+
{
|
|
1950
|
+
return this.marginLeft;
|
|
1951
|
+
}
|
|
1952
|
+
|
|
1953
|
+
/**
|
|
1954
|
+
* @param {number} marginRight
|
|
1955
|
+
*/
|
|
1956
|
+
setMarginRight(marginRight)
|
|
1957
|
+
{
|
|
1958
|
+
this.marginRight = marginRight;
|
|
1959
|
+
}
|
|
1960
|
+
|
|
1961
|
+
getMarginRight()
|
|
1962
|
+
{
|
|
1963
|
+
return this.marginRight;
|
|
1964
|
+
}
|
|
1965
|
+
|
|
1966
|
+
/**
|
|
1967
|
+
* @param {number} marginTop
|
|
1968
|
+
*/
|
|
1969
|
+
setMarginTop(marginTop)
|
|
1970
|
+
{
|
|
1971
|
+
this.marginTop = marginTop;
|
|
1972
|
+
}
|
|
1973
|
+
|
|
1974
|
+
getMarginTop()
|
|
1975
|
+
{
|
|
1976
|
+
return this.marginTop;
|
|
1977
|
+
}
|
|
1978
|
+
|
|
1979
|
+
/**
|
|
1980
|
+
* @param {number} marginBottom
|
|
1981
|
+
*/
|
|
1982
|
+
setMarginBottom(marginBottom)
|
|
1983
|
+
{
|
|
1984
|
+
this.marginBottom = marginBottom;
|
|
1985
|
+
}
|
|
1986
|
+
|
|
1987
|
+
getMarginBottom()
|
|
1988
|
+
{
|
|
1989
|
+
return this.marginBottom;
|
|
1990
|
+
}
|
|
1991
|
+
|
|
1992
|
+
/**
|
|
1993
|
+
* @param {number} marginHeader
|
|
1994
|
+
*/
|
|
1995
|
+
setMarginHeader(marginHeader)
|
|
1996
|
+
{
|
|
1997
|
+
this.marginHeader = marginHeader;
|
|
1998
|
+
}
|
|
1999
|
+
|
|
2000
|
+
getMarginHeader()
|
|
2001
|
+
{
|
|
2002
|
+
return this.marginHeader;
|
|
2003
|
+
}
|
|
2004
|
+
|
|
2005
|
+
/**
|
|
2006
|
+
* @param {number} marginFooter
|
|
2007
|
+
*/
|
|
2008
|
+
setMarginFooter(marginFooter)
|
|
2009
|
+
{
|
|
2010
|
+
this.marginFooter = marginFooter;
|
|
2011
|
+
}
|
|
2012
|
+
|
|
2013
|
+
getMarginFooter()
|
|
2014
|
+
{
|
|
2015
|
+
return this.marginFooter;
|
|
2016
|
+
}
|
|
2017
|
+
|
|
2018
|
+
/**
|
|
2019
|
+
* @param {number} zoom
|
|
2020
|
+
*/
|
|
2021
|
+
setZoom(zoom)
|
|
2022
|
+
{
|
|
2023
|
+
this.zoom = zoom;
|
|
2024
|
+
}
|
|
2025
|
+
|
|
2026
|
+
getZoom()
|
|
2027
|
+
{
|
|
2028
|
+
return this.zoom;
|
|
2029
|
+
}
|
|
2030
|
+
|
|
2031
|
+
isDefaultPageSetup()
|
|
2032
|
+
{
|
|
2033
|
+
return this.marginHeader == 1.3 && this.marginFooter == 1.3 && this.marginLeft == 2.0 && this.marginRight == 2.0 && this.marginTop == 2.5 && this.marginBottom == 2.5;
|
|
2034
|
+
}
|
|
2035
|
+
|
|
2036
|
+
/**
|
|
2037
|
+
* @param {number} defColWidthPt
|
|
2038
|
+
*/
|
|
2039
|
+
setDefColWidthPt(defColWidthPt)
|
|
2040
|
+
{
|
|
2041
|
+
this.defColWidthPt = defColWidthPt;
|
|
2042
|
+
}
|
|
2043
|
+
|
|
2044
|
+
getDefColWidthPt()
|
|
2045
|
+
{
|
|
2046
|
+
return this.defColWidthPt;
|
|
2047
|
+
}
|
|
2048
|
+
|
|
2049
|
+
/**
|
|
2050
|
+
* @param {number} defRowHeightPt
|
|
2051
|
+
*/
|
|
2052
|
+
setDefRowHeightPt(defRowHeightPt)
|
|
2053
|
+
{
|
|
2054
|
+
this.defRowHeightPt = defRowHeightPt;
|
|
2055
|
+
}
|
|
2056
|
+
|
|
2057
|
+
getDefRowHeightPt()
|
|
2058
|
+
{
|
|
2059
|
+
return this.defRowHeightPt;
|
|
2060
|
+
}
|
|
2061
|
+
|
|
2062
|
+
getName()
|
|
2063
|
+
{
|
|
2064
|
+
return this.name;
|
|
2065
|
+
}
|
|
2066
|
+
|
|
2067
|
+
/**
|
|
2068
|
+
* @param {number} row
|
|
2069
|
+
* @param {number} col
|
|
2070
|
+
* @param {CellStyle|null} style
|
|
2071
|
+
*/
|
|
2072
|
+
setCellStyle(row, col, style)
|
|
2073
|
+
{
|
|
2074
|
+
let cell;
|
|
2075
|
+
if ((cell = this.getCellData(row, col, false)) == null)
|
|
2076
|
+
return false;
|
|
2077
|
+
cell.style = style;
|
|
2078
|
+
return true;
|
|
2079
|
+
}
|
|
2080
|
+
|
|
2081
|
+
/**
|
|
2082
|
+
* @param {number} row
|
|
2083
|
+
* @param {number} col
|
|
2084
|
+
* @param {Workbook} wb
|
|
2085
|
+
* @param {text.HAlignment} hAlign
|
|
2086
|
+
*/
|
|
2087
|
+
setCellStyleHAlign(row, col, wb, hAlign)
|
|
2088
|
+
{
|
|
2089
|
+
let cell;
|
|
2090
|
+
if ((cell = this.getCellData(row, col, false)) == null)
|
|
2091
|
+
return false;
|
|
2092
|
+
let tmpStyle;
|
|
2093
|
+
if (cell.style == null)
|
|
2094
|
+
{
|
|
2095
|
+
if (hAlign == text.HAlignment.Unknown)
|
|
2096
|
+
return true;
|
|
2097
|
+
tmpStyle = new CellStyle(0);
|
|
2098
|
+
tmpStyle.setHAlign(hAlign);
|
|
2099
|
+
cell.style = wb.findOrCreateStyle(tmpStyle);
|
|
2100
|
+
}
|
|
2101
|
+
else
|
|
2102
|
+
{
|
|
2103
|
+
if (cell.style.getHAlign() == hAlign)
|
|
2104
|
+
return true;
|
|
2105
|
+
tmpStyle = cell.style.clone();
|
|
2106
|
+
tmpStyle.setHAlign(hAlign);
|
|
2107
|
+
cell.style = wb.findOrCreateStyle(tmpStyle);
|
|
2108
|
+
}
|
|
2109
|
+
return true;
|
|
2110
|
+
}
|
|
2111
|
+
|
|
2112
|
+
/**
|
|
2113
|
+
* @param {number} row
|
|
2114
|
+
* @param {number} col
|
|
2115
|
+
* @param {Workbook} wb
|
|
2116
|
+
* @param {number} color
|
|
2117
|
+
* @param {number} borderType
|
|
2118
|
+
*/
|
|
2119
|
+
setCellStyleBorderBottom(row, col, wb, color, borderType)
|
|
2120
|
+
{
|
|
2121
|
+
let cell;
|
|
2122
|
+
if ((cell = this.getCellData(row, col, true)) == null)
|
|
2123
|
+
return false;
|
|
2124
|
+
let tmpStyle;
|
|
2125
|
+
if (cell.style == null)
|
|
2126
|
+
{
|
|
2127
|
+
if (borderType == BorderType.None)
|
|
2128
|
+
return true;
|
|
2129
|
+
tmpStyle = new CellStyle(0);
|
|
2130
|
+
tmpStyle.setBorderBottom(new BorderStyle(color, borderType));
|
|
2131
|
+
cell.style = wb.findOrCreateStyle(tmpStyle);
|
|
2132
|
+
}
|
|
2133
|
+
else
|
|
2134
|
+
{
|
|
2135
|
+
|
|
2136
|
+
if (cell.style.getBorderBottom().equals(new BorderStyle(color, borderType)))
|
|
2137
|
+
return true;
|
|
2138
|
+
tmpStyle = cell.style.clone();
|
|
2139
|
+
tmpStyle.setBorderBottom(new BorderStyle(color, borderType));
|
|
2140
|
+
cell.style = wb.findOrCreateStyle(tmpStyle);
|
|
2141
|
+
}
|
|
2142
|
+
return true;
|
|
2143
|
+
}
|
|
2144
|
+
|
|
2145
|
+
/**
|
|
2146
|
+
* @param {number} row
|
|
2147
|
+
* @param {number} col
|
|
2148
|
+
* @param {string | null} url
|
|
2149
|
+
*/
|
|
2150
|
+
setCellURL(row, col, url)
|
|
2151
|
+
{
|
|
2152
|
+
let cell;
|
|
2153
|
+
if ((cell = this.getCellData(row, col, false)) == null)
|
|
2154
|
+
return false;
|
|
2155
|
+
cell.cellURL = url;
|
|
2156
|
+
return true;
|
|
2157
|
+
}
|
|
2158
|
+
|
|
2159
|
+
/**
|
|
2160
|
+
* @param {number} row
|
|
2161
|
+
* @param {number} col
|
|
2162
|
+
* @param {string | null} val
|
|
2163
|
+
* @param {CellStyle | null} style
|
|
2164
|
+
*/
|
|
2165
|
+
setCellString(row, col, val, style)
|
|
2166
|
+
{
|
|
2167
|
+
let cell;
|
|
2168
|
+
if ((cell = this.getCellData(row, col, false)) == null)
|
|
2169
|
+
return false;
|
|
2170
|
+
cell.cdt = CellDataType.String;
|
|
2171
|
+
cell.cellValue = val;
|
|
2172
|
+
if (style) cell.style = style;
|
|
2173
|
+
return true;
|
|
2174
|
+
}
|
|
2175
|
+
|
|
2176
|
+
/**
|
|
2177
|
+
* @param {number} row
|
|
2178
|
+
* @param {number} col
|
|
2179
|
+
* @param {data.Timestamp} val
|
|
2180
|
+
* @param {CellStyle | null} style
|
|
2181
|
+
*/
|
|
2182
|
+
setCellTS(row, col, val, style)
|
|
2183
|
+
{
|
|
2184
|
+
let cell;
|
|
2185
|
+
if ((cell = this.getCellData(row, col, false)) == null)
|
|
2186
|
+
return false;
|
|
2187
|
+
cell.cdt = CellDataType.DateTime;
|
|
2188
|
+
cell.cellValue = val.toString("yyyy-MM-ddTHH:mm:ss.fffffffff");
|
|
2189
|
+
if (style) cell.style = style;
|
|
2190
|
+
return true;
|
|
2191
|
+
}
|
|
2192
|
+
|
|
2193
|
+
/**
|
|
2194
|
+
* @param {number} row
|
|
2195
|
+
* @param {number} col
|
|
2196
|
+
* @param {number} val
|
|
2197
|
+
* @param {CellStyle | null} style
|
|
2198
|
+
*/
|
|
2199
|
+
setCellDouble(row, col, val, style)
|
|
2200
|
+
{
|
|
2201
|
+
let cell;
|
|
2202
|
+
if ((cell = this.getCellData(row, col, false)) == null)
|
|
2203
|
+
return false;
|
|
2204
|
+
cell.cdt = CellDataType.Number;
|
|
2205
|
+
cell.cellValue = ""+val;
|
|
2206
|
+
if (style) cell.style = style;
|
|
2207
|
+
return true;
|
|
2208
|
+
}
|
|
2209
|
+
|
|
2210
|
+
/**
|
|
2211
|
+
* @param {number} row
|
|
2212
|
+
* @param {number} col
|
|
2213
|
+
* @param {number} val
|
|
2214
|
+
* @param {CellStyle | null} style
|
|
2215
|
+
*/
|
|
2216
|
+
setCellInt32(row, col, val, style)
|
|
2217
|
+
{
|
|
2218
|
+
let cell;
|
|
2219
|
+
if ((cell = this.getCellData(row, col, false)) == null)
|
|
2220
|
+
return false;
|
|
2221
|
+
cell.cdt = CellDataType.Number;
|
|
2222
|
+
cell.cellValue = ""+val;
|
|
2223
|
+
if (style) cell.style = style;
|
|
2224
|
+
return true;
|
|
2225
|
+
}
|
|
2226
|
+
|
|
2227
|
+
/**
|
|
2228
|
+
* @param {number} row
|
|
2229
|
+
* @param {number} col
|
|
2230
|
+
* @param {number} val
|
|
2231
|
+
* @param {CellStyle | null} style
|
|
2232
|
+
*/
|
|
2233
|
+
setCellInt64(row, col, val, style)
|
|
2234
|
+
{
|
|
2235
|
+
let cell;
|
|
2236
|
+
if ((cell = this.getCellData(row, col, false)) == null)
|
|
2237
|
+
return false;
|
|
2238
|
+
cell.cdt = CellDataType.Number;
|
|
2239
|
+
cell.cellValue = ""+val;
|
|
2240
|
+
if (style) cell.style = style;
|
|
2241
|
+
return true;
|
|
2242
|
+
}
|
|
2243
|
+
|
|
2244
|
+
/**
|
|
2245
|
+
* @param {number} row
|
|
2246
|
+
* @param {number} col
|
|
2247
|
+
* @param {CellStyle | null} style
|
|
2248
|
+
*/
|
|
2249
|
+
setCellEmpty(row, col, style)
|
|
2250
|
+
{
|
|
2251
|
+
let cell;
|
|
2252
|
+
if ((cell = this.getCellData(row, col, false)) == null)
|
|
2253
|
+
return false;
|
|
2254
|
+
cell.cdt = CellDataType.Number;
|
|
2255
|
+
cell.cellValue = null;
|
|
2256
|
+
if (style) cell.style = style;
|
|
2257
|
+
return true;
|
|
2258
|
+
}
|
|
2259
|
+
|
|
2260
|
+
/**
|
|
2261
|
+
* @param {number} row
|
|
2262
|
+
* @param {number} col
|
|
2263
|
+
* @param {number} height
|
|
2264
|
+
* @param {number} width
|
|
2265
|
+
*/
|
|
2266
|
+
mergeCells(row, col, height, width)
|
|
2267
|
+
{
|
|
2268
|
+
if (width == 0)
|
|
2269
|
+
return false;
|
|
2270
|
+
if (height == 0)
|
|
2271
|
+
return false;
|
|
2272
|
+
if (width == 0 && height == 0)
|
|
2273
|
+
return false;
|
|
2274
|
+
|
|
2275
|
+
let cell;
|
|
2276
|
+
let i;
|
|
2277
|
+
let j;
|
|
2278
|
+
i = 0;
|
|
2279
|
+
while (i < height)
|
|
2280
|
+
{
|
|
2281
|
+
j = 0;
|
|
2282
|
+
while (j < width)
|
|
2283
|
+
{
|
|
2284
|
+
if ((cell = this.getCellData(row + i, col + j, true)) != null && (cell.cdt == CellDataType.MergedLeft || cell.cdt == CellDataType.MergedUp))
|
|
2285
|
+
return false;
|
|
2286
|
+
j++;
|
|
2287
|
+
}
|
|
2288
|
+
i++;
|
|
2289
|
+
}
|
|
2290
|
+
|
|
2291
|
+
i = 0;
|
|
2292
|
+
while (i < height)
|
|
2293
|
+
{
|
|
2294
|
+
j = 0;
|
|
2295
|
+
while (j < width)
|
|
2296
|
+
{
|
|
2297
|
+
if ((cell = this.getCellData(row + i, col + j, true)) != null)
|
|
2298
|
+
{
|
|
2299
|
+
if (i == 0)
|
|
2300
|
+
{
|
|
2301
|
+
if (j == 0)
|
|
2302
|
+
{
|
|
2303
|
+
cell.mergeHori = width;
|
|
2304
|
+
cell.mergeVert = height;
|
|
2305
|
+
}
|
|
2306
|
+
else
|
|
2307
|
+
{
|
|
2308
|
+
cell.cdt = CellDataType.MergedLeft;
|
|
2309
|
+
}
|
|
2310
|
+
}
|
|
2311
|
+
else
|
|
2312
|
+
{
|
|
2313
|
+
cell.cdt = CellDataType.MergedUp;
|
|
2314
|
+
}
|
|
2315
|
+
}
|
|
2316
|
+
j++;
|
|
2317
|
+
}
|
|
2318
|
+
i++;
|
|
2319
|
+
}
|
|
2320
|
+
return true;
|
|
2321
|
+
}
|
|
2322
|
+
|
|
2323
|
+
/**
|
|
2324
|
+
* @param {number} row
|
|
2325
|
+
* @param {number} col
|
|
2326
|
+
*/
|
|
2327
|
+
setCellMergeLeft(row, col)
|
|
2328
|
+
{
|
|
2329
|
+
if (col == 0)
|
|
2330
|
+
return false;
|
|
2331
|
+
|
|
2332
|
+
let cell;
|
|
2333
|
+
let width = 1;
|
|
2334
|
+
let height = 1;
|
|
2335
|
+
if ((cell = this.getCellData(row, col, true)) != null)
|
|
2336
|
+
cell.cdt = CellDataType.MergedLeft;
|
|
2337
|
+
col--;
|
|
2338
|
+
width++;
|
|
2339
|
+
while (true)
|
|
2340
|
+
{
|
|
2341
|
+
if ((cell = this.getCellData(row, col, true)) == null)
|
|
2342
|
+
{
|
|
2343
|
+
return false;
|
|
2344
|
+
}
|
|
2345
|
+
else if (cell.cdt == CellDataType.MergedUp)
|
|
2346
|
+
{
|
|
2347
|
+
row--;
|
|
2348
|
+
height++;
|
|
2349
|
+
}
|
|
2350
|
+
else if (cell.cdt == CellDataType.MergedLeft)
|
|
2351
|
+
{
|
|
2352
|
+
col--;
|
|
2353
|
+
width++;
|
|
2354
|
+
}
|
|
2355
|
+
else
|
|
2356
|
+
{
|
|
2357
|
+
if (cell.mergeHori < width)
|
|
2358
|
+
{
|
|
2359
|
+
cell.mergeHori = width;
|
|
2360
|
+
}
|
|
2361
|
+
if (cell.mergeVert < height)
|
|
2362
|
+
{
|
|
2363
|
+
cell.mergeVert = height;
|
|
2364
|
+
}
|
|
2365
|
+
break;
|
|
2366
|
+
}
|
|
2367
|
+
}
|
|
2368
|
+
return true;
|
|
2369
|
+
}
|
|
2370
|
+
|
|
2371
|
+
/**
|
|
2372
|
+
* @param {number} row
|
|
2373
|
+
* @param {number} col
|
|
2374
|
+
*/
|
|
2375
|
+
setCellMergeUp(row, col)
|
|
2376
|
+
{
|
|
2377
|
+
if (row == 0)
|
|
2378
|
+
return false;
|
|
2379
|
+
|
|
2380
|
+
let cell;
|
|
2381
|
+
let width = 1;
|
|
2382
|
+
let height = 1;
|
|
2383
|
+
if ((cell = this.getCellData(row, col, true)) != null)
|
|
2384
|
+
cell.cdt = CellDataType.MergedUp;
|
|
2385
|
+
row--;
|
|
2386
|
+
height++;
|
|
2387
|
+
while (true)
|
|
2388
|
+
{
|
|
2389
|
+
if ((cell = this.getCellData(row, col, true)) == null)
|
|
2390
|
+
{
|
|
2391
|
+
return false;
|
|
2392
|
+
}
|
|
2393
|
+
else if (cell.cdt == CellDataType.MergedUp)
|
|
2394
|
+
{
|
|
2395
|
+
row--;
|
|
2396
|
+
height++;
|
|
2397
|
+
}
|
|
2398
|
+
else if (cell.cdt == CellDataType.MergedLeft)
|
|
2399
|
+
{
|
|
2400
|
+
col--;
|
|
2401
|
+
width++;
|
|
2402
|
+
}
|
|
2403
|
+
else
|
|
2404
|
+
{
|
|
2405
|
+
if (cell.mergeHori < width)
|
|
2406
|
+
{
|
|
2407
|
+
cell.mergeHori = width;
|
|
2408
|
+
}
|
|
2409
|
+
if (cell.mergeVert < height)
|
|
2410
|
+
{
|
|
2411
|
+
cell.mergeVert = height;
|
|
2412
|
+
}
|
|
2413
|
+
break;
|
|
2414
|
+
}
|
|
2415
|
+
}
|
|
2416
|
+
return true;
|
|
2417
|
+
}
|
|
2418
|
+
|
|
2419
|
+
/**
|
|
2420
|
+
* @param {number} row
|
|
2421
|
+
* @param {boolean} hidden
|
|
2422
|
+
*/
|
|
2423
|
+
setRowHidden(row, hidden)
|
|
2424
|
+
{
|
|
2425
|
+
let cell;
|
|
2426
|
+
if (row >= 65536 || (cell = this.getCellData(row, 0, true)) == null)
|
|
2427
|
+
return false;
|
|
2428
|
+
cell.hidden = hidden;
|
|
2429
|
+
return true;
|
|
2430
|
+
}
|
|
2431
|
+
|
|
2432
|
+
/**
|
|
2433
|
+
* @param {number} row
|
|
2434
|
+
* @param {number} height
|
|
2435
|
+
*/
|
|
2436
|
+
setRowHeight(row, height)
|
|
2437
|
+
{
|
|
2438
|
+
let rowData;
|
|
2439
|
+
if ((rowData = this.createRow(row)) != null)
|
|
2440
|
+
{
|
|
2441
|
+
rowData.height = height;
|
|
2442
|
+
return true;
|
|
2443
|
+
}
|
|
2444
|
+
else
|
|
2445
|
+
{
|
|
2446
|
+
return false;
|
|
2447
|
+
}
|
|
2448
|
+
}
|
|
2449
|
+
|
|
2450
|
+
getCount()
|
|
2451
|
+
{
|
|
2452
|
+
return this.rows.length;
|
|
2453
|
+
}
|
|
2454
|
+
|
|
2455
|
+
/**
|
|
2456
|
+
* @param {number} row
|
|
2457
|
+
*/
|
|
2458
|
+
getItem(row)
|
|
2459
|
+
{
|
|
2460
|
+
return this.rows[row];
|
|
2461
|
+
}
|
|
2462
|
+
|
|
2463
|
+
/**
|
|
2464
|
+
* @param {number} col
|
|
2465
|
+
*/
|
|
2466
|
+
removeCol(col)
|
|
2467
|
+
{
|
|
2468
|
+
let i;
|
|
2469
|
+
let row;
|
|
2470
|
+
|
|
2471
|
+
this.colWidthsPt.splice(col, 1);
|
|
2472
|
+
i = this.rows.length;
|
|
2473
|
+
while (i-- > 0)
|
|
2474
|
+
{
|
|
2475
|
+
if ((row = this.rows[i]) != null)
|
|
2476
|
+
{
|
|
2477
|
+
row.cells.splice(col, 1);
|
|
2478
|
+
}
|
|
2479
|
+
}
|
|
2480
|
+
}
|
|
2481
|
+
|
|
2482
|
+
/**
|
|
2483
|
+
* @param {number} col
|
|
2484
|
+
*/
|
|
2485
|
+
insertCol(col)
|
|
2486
|
+
{
|
|
2487
|
+
let i;
|
|
2488
|
+
let row;
|
|
2489
|
+
|
|
2490
|
+
if (this.colWidthsPt.length > col)
|
|
2491
|
+
{
|
|
2492
|
+
this.colWidthsPt.splice(col, 0, 0);
|
|
2493
|
+
}
|
|
2494
|
+
i = this.rows.length;
|
|
2495
|
+
while (i-- > 0)
|
|
2496
|
+
{
|
|
2497
|
+
if ((row = this.rows[i]) != null)
|
|
2498
|
+
{
|
|
2499
|
+
if (row.cells.length > col)
|
|
2500
|
+
{
|
|
2501
|
+
row.cells.splice(col, 0, null);
|
|
2502
|
+
}
|
|
2503
|
+
}
|
|
2504
|
+
}
|
|
2505
|
+
}
|
|
2506
|
+
|
|
2507
|
+
getMaxCol()
|
|
2508
|
+
{
|
|
2509
|
+
this.maxCol;
|
|
2510
|
+
}
|
|
2511
|
+
|
|
2512
|
+
/**
|
|
2513
|
+
* @param {number} col
|
|
2514
|
+
* @param {number} width
|
|
2515
|
+
* @param {unit.Distance.Unit} du
|
|
2516
|
+
*/
|
|
2517
|
+
setColWidth(col, width, du)
|
|
2518
|
+
{
|
|
2519
|
+
while (col >= this.colWidthsPt.length)
|
|
2520
|
+
{
|
|
2521
|
+
this.colWidthsPt.push(-1);
|
|
2522
|
+
}
|
|
2523
|
+
if (du == unit.Distance.Unit.POINT)
|
|
2524
|
+
{
|
|
2525
|
+
this.colWidthsPt[col] = width;
|
|
2526
|
+
}
|
|
2527
|
+
else
|
|
2528
|
+
{
|
|
2529
|
+
this.colWidthsPt[col] = unit.Distance.convert(du, unit.Distance.Unit.POINT, width);
|
|
2530
|
+
}
|
|
2531
|
+
}
|
|
2532
|
+
|
|
2533
|
+
getColWidthCount()
|
|
2534
|
+
{
|
|
2535
|
+
return this.colWidthsPt.length;
|
|
2536
|
+
}
|
|
2537
|
+
|
|
2538
|
+
/**
|
|
2539
|
+
* @param {number} col
|
|
2540
|
+
*/
|
|
2541
|
+
getColWidthPt(col)
|
|
2542
|
+
{
|
|
2543
|
+
if (col >= this.colWidthsPt.length)
|
|
2544
|
+
return -1;
|
|
2545
|
+
return this.colWidthsPt[col];
|
|
2546
|
+
}
|
|
2547
|
+
|
|
2548
|
+
/**
|
|
2549
|
+
* @param {number} col
|
|
2550
|
+
* @param {unit.Distance.Unit} du
|
|
2551
|
+
*/
|
|
2552
|
+
getColWidth(col, du)
|
|
2553
|
+
{
|
|
2554
|
+
if (col >= this.colWidthsPt.length)
|
|
2555
|
+
return -1;
|
|
2556
|
+
if (du == unit.Distance.Unit.POINT)
|
|
2557
|
+
return this.colWidthsPt[col];
|
|
2558
|
+
return unit.Distance.convert(unit.Distance.Unit.POINT, du, this.colWidthsPt[col]);
|
|
2559
|
+
}
|
|
2560
|
+
|
|
2561
|
+
/**
|
|
2562
|
+
* @param {number} row
|
|
2563
|
+
* @param {number} col
|
|
2564
|
+
*/
|
|
2565
|
+
getCellDataRead(row, col)
|
|
2566
|
+
{
|
|
2567
|
+
let rowData;
|
|
2568
|
+
let cell;
|
|
2569
|
+
if (row >= this.rows.length + 65536)
|
|
2570
|
+
return null;
|
|
2571
|
+
if (col >= 65536)
|
|
2572
|
+
return null;
|
|
2573
|
+
if (col > this.maxCol)
|
|
2574
|
+
{
|
|
2575
|
+
return null;
|
|
2576
|
+
}
|
|
2577
|
+
while (true)
|
|
2578
|
+
{
|
|
2579
|
+
if ((rowData = this.rows[row]) == null)
|
|
2580
|
+
return null;
|
|
2581
|
+
if ((cell = rowData.cells[col]) == null)
|
|
2582
|
+
{
|
|
2583
|
+
return null;
|
|
2584
|
+
}
|
|
2585
|
+
if (cell.cdt == CellDataType.MergedLeft)
|
|
2586
|
+
{
|
|
2587
|
+
col--;
|
|
2588
|
+
}
|
|
2589
|
+
else if (cell.cdt == CellDataType.MergedUp)
|
|
2590
|
+
{
|
|
2591
|
+
row--;
|
|
2592
|
+
}
|
|
2593
|
+
else
|
|
2594
|
+
{
|
|
2595
|
+
break;
|
|
2596
|
+
}
|
|
2597
|
+
}
|
|
2598
|
+
return cell;
|
|
2599
|
+
}
|
|
2600
|
+
|
|
2601
|
+
/**
|
|
2602
|
+
* @param {{cdt: number,cellValue: string|null,style: CellStyle|null,mergeHori: number,mergeVert: number,hidden: boolean,cellURL: string|null} | null} cell
|
|
2603
|
+
*/
|
|
2604
|
+
getCellString(cell)
|
|
2605
|
+
{
|
|
2606
|
+
let cellValue;
|
|
2607
|
+
if (cell == null || (cellValue = cell.cellValue) == null)
|
|
2608
|
+
{
|
|
2609
|
+
return false;
|
|
2610
|
+
}
|
|
2611
|
+
if (cell.cdt == CellDataType.Number)
|
|
2612
|
+
{
|
|
2613
|
+
let v = Number(cellValue);
|
|
2614
|
+
let iv;
|
|
2615
|
+
if (Number.isNaN(v))
|
|
2616
|
+
{
|
|
2617
|
+
return cellValue;
|
|
2618
|
+
}
|
|
2619
|
+
else
|
|
2620
|
+
{
|
|
2621
|
+
return ""+v;
|
|
2622
|
+
/* if (iv == v)
|
|
2623
|
+
{
|
|
2624
|
+
sb.AppendI32(iv);
|
|
2625
|
+
}
|
|
2626
|
+
else
|
|
2627
|
+
{
|
|
2628
|
+
sb.AppendDouble(v);
|
|
2629
|
+
}*/
|
|
2630
|
+
/* Text.String *fmt;
|
|
2631
|
+
if (cell.style && (fmt = cell.style.GetDataFormat()) != 0)
|
|
2632
|
+
{
|
|
2633
|
+
printf("Style: %s\r\n", fmt.v);
|
|
2634
|
+
}
|
|
2635
|
+
else
|
|
2636
|
+
{
|
|
2637
|
+
printf("Style: null\r\n");
|
|
2638
|
+
}*/
|
|
2639
|
+
}
|
|
2640
|
+
}
|
|
2641
|
+
else
|
|
2642
|
+
{
|
|
2643
|
+
return cellValue;
|
|
2644
|
+
}
|
|
2645
|
+
}
|
|
2646
|
+
|
|
2647
|
+
getDrawingCount()
|
|
2648
|
+
{
|
|
2649
|
+
return this.drawings.length;
|
|
2650
|
+
}
|
|
2651
|
+
|
|
2652
|
+
/**
|
|
2653
|
+
* @param {number} index
|
|
2654
|
+
*/
|
|
2655
|
+
getDrawing(index)
|
|
2656
|
+
{
|
|
2657
|
+
return this.drawings[index];
|
|
2658
|
+
}
|
|
2659
|
+
|
|
2660
|
+
/**
|
|
2661
|
+
* @param {number} index
|
|
2662
|
+
*/
|
|
2663
|
+
getDrawingNoCheck(index)
|
|
2664
|
+
{
|
|
2665
|
+
let o = this.drawings[index];
|
|
2666
|
+
if (o == null)
|
|
2667
|
+
throw new Error("Drawing is null");
|
|
2668
|
+
return o;
|
|
2669
|
+
}
|
|
2670
|
+
|
|
2671
|
+
/**
|
|
2672
|
+
* @param {unit.Distance.Unit} du
|
|
2673
|
+
* @param {number} x
|
|
2674
|
+
* @param {number} y
|
|
2675
|
+
* @param {number} w
|
|
2676
|
+
* @param {number} h
|
|
2677
|
+
*/
|
|
2678
|
+
createDrawing(du, x, y, w, h)
|
|
2679
|
+
{
|
|
2680
|
+
let inch = unit.Distance.Unit.INCH;
|
|
2681
|
+
let drawing = {
|
|
2682
|
+
anchorType: AnchorType.Absolute,
|
|
2683
|
+
posXInch: unit.Distance.convert(du, inch, x),
|
|
2684
|
+
posYInch: unit.Distance.convert(du, inch, y),
|
|
2685
|
+
widthInch: unit.Distance.convert(du, inch, w),
|
|
2686
|
+
heightInch: unit.Distance.convert(du, inch, h),
|
|
2687
|
+
col1: 0,
|
|
2688
|
+
row1: 0,
|
|
2689
|
+
col2: 0,
|
|
2690
|
+
row2: 0,
|
|
2691
|
+
/** @type {OfficeChart|null} */
|
|
2692
|
+
chart: null
|
|
2693
|
+
};
|
|
2694
|
+
this.drawings.push(drawing);
|
|
2695
|
+
return drawing;
|
|
2696
|
+
}
|
|
2697
|
+
|
|
2698
|
+
/**
|
|
2699
|
+
* @param {unit.Distance.Unit} du
|
|
2700
|
+
* @param {number} x
|
|
2701
|
+
* @param {number} y
|
|
2702
|
+
* @param {number} w
|
|
2703
|
+
* @param {number} h
|
|
2704
|
+
* @param {string | null} title
|
|
2705
|
+
*/
|
|
2706
|
+
createChart(du, x, y, w, h, title)
|
|
2707
|
+
{
|
|
2708
|
+
let drawing = this.createDrawing(du, x, y, w, h);
|
|
2709
|
+
let chart = new OfficeChart(du, x, y, w, h);
|
|
2710
|
+
drawing.chart = chart;
|
|
2711
|
+
if (title && title.length > 0)
|
|
2712
|
+
{
|
|
2713
|
+
chart.setTitleText(title);
|
|
2714
|
+
}
|
|
2715
|
+
chart.setShapeProp(new OfficeShapeProp(
|
|
2716
|
+
OfficeFill.newSolidFill(OfficeColor.newPreset(PresetColor.White)),
|
|
2717
|
+
new OfficeLineStyle(OfficeFill.newSolidFill(null))));
|
|
2718
|
+
return chart;
|
|
2719
|
+
}
|
|
2720
|
+
}
|
|
2721
|
+
|
|
2722
|
+
|
|
2723
|
+
export class Workbook extends data.ParsedObject
|
|
2724
|
+
{
|
|
2725
|
+
static defPalette = [
|
|
2726
|
+
0xff000000, 0xffffffff, 0xffff0000, 0xff00ff00, 0xff0000ff, 0xffffff00, 0xffff00ff, 0xff00ffff,
|
|
2727
|
+
0xff800000, 0xff008000, 0xff000080, 0xff808000, 0xff800080, 0xff008080, 0xffc0c0c0, 0xff808080,
|
|
2728
|
+
0xff9999ff, 0xff993366, 0xffffffcc, 0xffccffff, 0xff660066, 0xffff8080, 0xff0066cc, 0xffccccff,
|
|
2729
|
+
0xff000080, 0xffff00ff, 0xffffff00, 0xff00ffff, 0xff800080, 0xff800000, 0xff008080, 0xff0000ff,
|
|
2730
|
+
0xff00ccff, 0xffccffff, 0xffccffcc, 0xffffff99, 0xff99ccff, 0xffff99cc, 0xffcc99ff, 0xffffcc99,
|
|
2731
|
+
0xff3366ff, 0xff33cccc, 0xff99cc00, 0xffffcc00, 0xffff9900, 0xffff6600, 0xff666699, 0xff969696,
|
|
2732
|
+
0xff003366, 0xff339966, 0xff003300, 0xff333300, 0xff993300, 0xff993366, 0xff333399, 0xff333333
|
|
2733
|
+
];
|
|
2734
|
+
|
|
2735
|
+
constructor()
|
|
2736
|
+
{
|
|
2737
|
+
super("Untitled", "Workbook");
|
|
2738
|
+
/**
|
|
2739
|
+
* @type {string|null}
|
|
2740
|
+
*/
|
|
2741
|
+
this.author = null;
|
|
2742
|
+
/**
|
|
2743
|
+
* @type {string|null}
|
|
2744
|
+
*/
|
|
2745
|
+
this.lastAuthor = null;
|
|
2746
|
+
/**
|
|
2747
|
+
* @type {string|null}
|
|
2748
|
+
*/
|
|
2749
|
+
this.company = null;
|
|
2750
|
+
/**
|
|
2751
|
+
* @type {data.Timestamp|null}
|
|
2752
|
+
*/
|
|
2753
|
+
this.createTime = null;
|
|
2754
|
+
/**
|
|
2755
|
+
* @type {data.Timestamp|null}
|
|
2756
|
+
*/
|
|
2757
|
+
this.modifyTime = null;
|
|
2758
|
+
this.version = 0;
|
|
2759
|
+
this.windowTopX = 0;
|
|
2760
|
+
this.windowTopY = 0;
|
|
2761
|
+
this.windowWidth = 0;
|
|
2762
|
+
this.windowHeight = 0;
|
|
2763
|
+
this.activeSheet = 0;
|
|
2764
|
+
/** @type {number[]} */
|
|
2765
|
+
this.palette = new Array(56);
|
|
2766
|
+
/** @type {Worksheet[]} */
|
|
2767
|
+
this.sheets = [];
|
|
2768
|
+
/** @type {CellStyle[]} */
|
|
2769
|
+
this.styles = [];
|
|
2770
|
+
/** @type {WorkbookFont[]} */
|
|
2771
|
+
this.fonts = [];
|
|
2772
|
+
|
|
2773
|
+
let i;
|
|
2774
|
+
for (i in Workbook.defPalette)
|
|
2775
|
+
{
|
|
2776
|
+
this.palette[i] = Workbook.defPalette[i];
|
|
2777
|
+
}
|
|
2778
|
+
|
|
2779
|
+
this.newCellStyle(null, text.HAlignment.Unknown, text.VAlignment.Bottom, "general");
|
|
2780
|
+
this.newFont("Arial", 10.0, false).setFamily(FontFamily.Swiss);
|
|
2781
|
+
this.newFont("Arial", 10.0, false);
|
|
2782
|
+
this.newFont("Arial", 10.0, false);
|
|
2783
|
+
this.newFont("Arial", 10.0, false);
|
|
2784
|
+
|
|
2785
|
+
}
|
|
2786
|
+
|
|
2787
|
+
clone()
|
|
2788
|
+
{
|
|
2789
|
+
let i;
|
|
2790
|
+
let j;
|
|
2791
|
+
let newWB = new Workbook();
|
|
2792
|
+
newWB.author = this.author;
|
|
2793
|
+
newWB.lastAuthor = this.lastAuthor;
|
|
2794
|
+
newWB.company = this.company;
|
|
2795
|
+
newWB.createTime = this.createTime;
|
|
2796
|
+
newWB.modifyTime = this.modifyTime;
|
|
2797
|
+
newWB.version = this.version;
|
|
2798
|
+
newWB.windowTopX = this.windowTopX;
|
|
2799
|
+
newWB.windowTopY = this.windowTopY;
|
|
2800
|
+
newWB.windowWidth = this.windowWidth;
|
|
2801
|
+
newWB.windowHeight = this.windowHeight;
|
|
2802
|
+
newWB.activeSheet = this.activeSheet;
|
|
2803
|
+
for (i in this.palette)
|
|
2804
|
+
{
|
|
2805
|
+
newWB.palette[i] = this.palette[i];
|
|
2806
|
+
}
|
|
2807
|
+
|
|
2808
|
+
for (i in this.styles)
|
|
2809
|
+
{
|
|
2810
|
+
newWB.styles.push(this.styles[i].clone());
|
|
2811
|
+
}
|
|
2812
|
+
for (i in this.sheets)
|
|
2813
|
+
{
|
|
2814
|
+
newWB.sheets.push(this.sheets[i].clone(this, newWB));
|
|
2815
|
+
}
|
|
2816
|
+
i = 0;
|
|
2817
|
+
j = this.fonts.length;
|
|
2818
|
+
while (i < j)
|
|
2819
|
+
{
|
|
2820
|
+
newWB.fonts.push(this.fonts[i].clone());
|
|
2821
|
+
i++;
|
|
2822
|
+
}
|
|
2823
|
+
return newWB;
|
|
2824
|
+
}
|
|
2825
|
+
|
|
2826
|
+
addDefaultStyles()
|
|
2827
|
+
{
|
|
2828
|
+
let style;
|
|
2829
|
+
while (this.styles.length < 21)
|
|
2830
|
+
{
|
|
2831
|
+
style = new CellStyle(this.styles.length);
|
|
2832
|
+
this.styles.push(style);
|
|
2833
|
+
}
|
|
2834
|
+
}
|
|
2835
|
+
|
|
2836
|
+
/**
|
|
2837
|
+
* @param {string | null} author
|
|
2838
|
+
*/
|
|
2839
|
+
setAuthor(author)
|
|
2840
|
+
{
|
|
2841
|
+
this.author = author;
|
|
2842
|
+
}
|
|
2843
|
+
|
|
2844
|
+
/**
|
|
2845
|
+
* @param {string | null} lastAuthor
|
|
2846
|
+
*/
|
|
2847
|
+
setLastAuthor(lastAuthor)
|
|
2848
|
+
{
|
|
2849
|
+
this.lastAuthor = lastAuthor;
|
|
2850
|
+
}
|
|
2851
|
+
|
|
2852
|
+
/**
|
|
2853
|
+
* @param {string | null} company
|
|
2854
|
+
*/
|
|
2855
|
+
setCompany(company)
|
|
2856
|
+
{
|
|
2857
|
+
this.company = company;
|
|
2858
|
+
}
|
|
2859
|
+
|
|
2860
|
+
/**
|
|
2861
|
+
* @param {data.Timestamp | null} createTime
|
|
2862
|
+
*/
|
|
2863
|
+
setCreateTime(createTime)
|
|
2864
|
+
{
|
|
2865
|
+
this.createTime = createTime;
|
|
2866
|
+
}
|
|
2867
|
+
|
|
2868
|
+
/**
|
|
2869
|
+
* @param {data.Timestamp | null} modifyTime
|
|
2870
|
+
*/
|
|
2871
|
+
setModifyTime(modifyTime)
|
|
2872
|
+
{
|
|
2873
|
+
this.modifyTime = modifyTime;
|
|
2874
|
+
}
|
|
2875
|
+
|
|
2876
|
+
/**
|
|
2877
|
+
* @param {number} version
|
|
2878
|
+
*/
|
|
2879
|
+
setVersion(version)
|
|
2880
|
+
{
|
|
2881
|
+
this.version = version;
|
|
2882
|
+
}
|
|
2883
|
+
|
|
2884
|
+
getAuthor()
|
|
2885
|
+
{
|
|
2886
|
+
return this.author;
|
|
2887
|
+
}
|
|
2888
|
+
|
|
2889
|
+
getLastAuthor()
|
|
2890
|
+
{
|
|
2891
|
+
return this.lastAuthor;
|
|
2892
|
+
}
|
|
2893
|
+
|
|
2894
|
+
getCompany()
|
|
2895
|
+
{
|
|
2896
|
+
return this.company;
|
|
2897
|
+
}
|
|
2898
|
+
|
|
2899
|
+
getCreateTime()
|
|
2900
|
+
{
|
|
2901
|
+
return this.createTime;
|
|
2902
|
+
}
|
|
2903
|
+
|
|
2904
|
+
getModifyTime()
|
|
2905
|
+
{
|
|
2906
|
+
return this.modifyTime;
|
|
2907
|
+
}
|
|
2908
|
+
|
|
2909
|
+
getVersion()
|
|
2910
|
+
{
|
|
2911
|
+
return this.version;
|
|
2912
|
+
}
|
|
2913
|
+
|
|
2914
|
+
hasInfo()
|
|
2915
|
+
{
|
|
2916
|
+
if (this.author != null)
|
|
2917
|
+
return true;
|
|
2918
|
+
if (this.lastAuthor != null)
|
|
2919
|
+
return true;
|
|
2920
|
+
if (this.company != null)
|
|
2921
|
+
return true;
|
|
2922
|
+
if (this.createTime != null)
|
|
2923
|
+
return true;
|
|
2924
|
+
if (this.version != 0)
|
|
2925
|
+
return true;
|
|
2926
|
+
return false;
|
|
2927
|
+
}
|
|
2928
|
+
|
|
2929
|
+
/**
|
|
2930
|
+
* @param {number} windowTopX
|
|
2931
|
+
*/
|
|
2932
|
+
setWindowTopX(windowTopX)
|
|
2933
|
+
{
|
|
2934
|
+
this.windowTopX = windowTopX;
|
|
2935
|
+
}
|
|
2936
|
+
|
|
2937
|
+
/**
|
|
2938
|
+
* @param {number} windowTopY
|
|
2939
|
+
*/
|
|
2940
|
+
setWindowTopY(windowTopY)
|
|
2941
|
+
{
|
|
2942
|
+
this.windowTopY = windowTopY;
|
|
2943
|
+
}
|
|
2944
|
+
|
|
2945
|
+
/**
|
|
2946
|
+
* @param {number} windowWidth
|
|
2947
|
+
*/
|
|
2948
|
+
setWindowWidth(windowWidth)
|
|
2949
|
+
{
|
|
2950
|
+
this.windowWidth = windowWidth;
|
|
2951
|
+
}
|
|
2952
|
+
|
|
2953
|
+
/**
|
|
2954
|
+
* @param {number} windowHeight
|
|
2955
|
+
*/
|
|
2956
|
+
setWindowHeight(windowHeight)
|
|
2957
|
+
{
|
|
2958
|
+
this.windowHeight = windowHeight;
|
|
2959
|
+
}
|
|
2960
|
+
|
|
2961
|
+
/**
|
|
2962
|
+
* @param {number} index
|
|
2963
|
+
*/
|
|
2964
|
+
setActiveSheet(index)
|
|
2965
|
+
{
|
|
2966
|
+
this.activeSheet = index;
|
|
2967
|
+
}
|
|
2968
|
+
|
|
2969
|
+
getWindowTopX()
|
|
2970
|
+
{
|
|
2971
|
+
return this.windowTopX;
|
|
2972
|
+
}
|
|
2973
|
+
|
|
2974
|
+
getWindowTopY()
|
|
2975
|
+
{
|
|
2976
|
+
return this.windowTopY;
|
|
2977
|
+
}
|
|
2978
|
+
|
|
2979
|
+
getWindowWidth()
|
|
2980
|
+
{
|
|
2981
|
+
return this.windowWidth;
|
|
2982
|
+
}
|
|
2983
|
+
|
|
2984
|
+
getWindowHeight()
|
|
2985
|
+
{
|
|
2986
|
+
return this.windowHeight;
|
|
2987
|
+
}
|
|
2988
|
+
|
|
2989
|
+
getActiveSheet()
|
|
2990
|
+
{
|
|
2991
|
+
return this.activeSheet;
|
|
2992
|
+
}
|
|
2993
|
+
|
|
2994
|
+
hasWindowInfo()
|
|
2995
|
+
{
|
|
2996
|
+
if (this.windowTopX != 0 || this.windowTopY != 0 || this.windowWidth != 0 || this.windowHeight != 0 || this.activeSheet != 0)
|
|
2997
|
+
return true;
|
|
2998
|
+
return false;
|
|
2999
|
+
}
|
|
3000
|
+
|
|
3001
|
+
hasCellStyle()
|
|
3002
|
+
{
|
|
3003
|
+
if (this.styles.length > 0)
|
|
3004
|
+
return true;
|
|
3005
|
+
return false;
|
|
3006
|
+
}
|
|
3007
|
+
|
|
3008
|
+
newCellStyleDef()
|
|
3009
|
+
{
|
|
3010
|
+
let style = new CellStyle(this.styles.length);
|
|
3011
|
+
this.styles.push(style);
|
|
3012
|
+
return style;
|
|
3013
|
+
}
|
|
3014
|
+
|
|
3015
|
+
/**
|
|
3016
|
+
* @param {WorkbookFont | null} font
|
|
3017
|
+
* @param {text.HAlignment} halign
|
|
3018
|
+
* @param {text.VAlignment} valign
|
|
3019
|
+
* @param {string | null} dataFormat
|
|
3020
|
+
*/
|
|
3021
|
+
newCellStyle(font, halign, valign, dataFormat)
|
|
3022
|
+
{
|
|
3023
|
+
let style = new CellStyle(this.styles.length);
|
|
3024
|
+
style.setFont(font);
|
|
3025
|
+
style.setHAlign(halign);
|
|
3026
|
+
style.setVAlign(valign);
|
|
3027
|
+
style.setDataFormat(dataFormat);
|
|
3028
|
+
this.styles.push(style);
|
|
3029
|
+
return style;
|
|
3030
|
+
}
|
|
3031
|
+
|
|
3032
|
+
getStyleCount()
|
|
3033
|
+
{
|
|
3034
|
+
return this.styles.length;
|
|
3035
|
+
}
|
|
3036
|
+
|
|
3037
|
+
/**
|
|
3038
|
+
* @param {CellStyle} style
|
|
3039
|
+
*/
|
|
3040
|
+
getStyleIndex(style)
|
|
3041
|
+
{
|
|
3042
|
+
let i = this.styles.length;
|
|
3043
|
+
while (i-- > 0)
|
|
3044
|
+
{
|
|
3045
|
+
if (this.styles[i] == style)
|
|
3046
|
+
return i;
|
|
3047
|
+
}
|
|
3048
|
+
return -1;
|
|
3049
|
+
}
|
|
3050
|
+
|
|
3051
|
+
/**
|
|
3052
|
+
* @param {number} index
|
|
3053
|
+
*/
|
|
3054
|
+
getStyle(index)
|
|
3055
|
+
{
|
|
3056
|
+
return this.styles[index];
|
|
3057
|
+
}
|
|
3058
|
+
|
|
3059
|
+
/**
|
|
3060
|
+
* @param {CellStyle} tmpStyle
|
|
3061
|
+
*/
|
|
3062
|
+
findOrCreateStyle(tmpStyle)
|
|
3063
|
+
{
|
|
3064
|
+
let style;
|
|
3065
|
+
let i = this.styles.length;
|
|
3066
|
+
while (i-- > 0)
|
|
3067
|
+
{
|
|
3068
|
+
if ((style = this.styles[i]) != null)
|
|
3069
|
+
{
|
|
3070
|
+
if (style.equals(tmpStyle))
|
|
3071
|
+
{
|
|
3072
|
+
return style;
|
|
3073
|
+
}
|
|
3074
|
+
}
|
|
3075
|
+
}
|
|
3076
|
+
style = tmpStyle.clone();
|
|
3077
|
+
style.setIndex(this.styles.length);
|
|
3078
|
+
this.styles.push(style);
|
|
3079
|
+
return style;
|
|
3080
|
+
}
|
|
3081
|
+
|
|
3082
|
+
getDefaultStyle()
|
|
3083
|
+
{
|
|
3084
|
+
return this.styles[0];
|
|
3085
|
+
}
|
|
3086
|
+
|
|
3087
|
+
getPalette()
|
|
3088
|
+
{
|
|
3089
|
+
return this.palette;
|
|
3090
|
+
}
|
|
3091
|
+
|
|
3092
|
+
/**
|
|
3093
|
+
* @param {number[]} palette
|
|
3094
|
+
*/
|
|
3095
|
+
setPalette(palette)
|
|
3096
|
+
{
|
|
3097
|
+
let i;
|
|
3098
|
+
for (i in palette)
|
|
3099
|
+
{
|
|
3100
|
+
this.palette[i] = palette[i];
|
|
3101
|
+
}
|
|
3102
|
+
}
|
|
3103
|
+
|
|
3104
|
+
/**
|
|
3105
|
+
* @param {string | null} name
|
|
3106
|
+
*/
|
|
3107
|
+
addWorksheet(name)
|
|
3108
|
+
{
|
|
3109
|
+
if (name == null)
|
|
3110
|
+
name = "Sheet"+ this.sheets.length;
|
|
3111
|
+
let ws = new Worksheet(name);
|
|
3112
|
+
this.sheets.push(ws);
|
|
3113
|
+
return ws;
|
|
3114
|
+
}
|
|
3115
|
+
|
|
3116
|
+
/**
|
|
3117
|
+
* @param {number} index
|
|
3118
|
+
* @param {string} name
|
|
3119
|
+
*/
|
|
3120
|
+
insertWorksheet(index, name)
|
|
3121
|
+
{
|
|
3122
|
+
let ws = new Worksheet(name);
|
|
3123
|
+
this.sheets.splice(index, 0, ws);
|
|
3124
|
+
return ws;
|
|
3125
|
+
}
|
|
3126
|
+
|
|
3127
|
+
getCount()
|
|
3128
|
+
{
|
|
3129
|
+
return this.sheets.length;
|
|
3130
|
+
}
|
|
3131
|
+
|
|
3132
|
+
/**
|
|
3133
|
+
* @param {number} index
|
|
3134
|
+
*/
|
|
3135
|
+
getItem(index)
|
|
3136
|
+
{
|
|
3137
|
+
return this.sheets[index];
|
|
3138
|
+
}
|
|
3139
|
+
|
|
3140
|
+
/**
|
|
3141
|
+
* @param {number} index
|
|
3142
|
+
*/
|
|
3143
|
+
removeAt(index)
|
|
3144
|
+
{
|
|
3145
|
+
return this.sheets.splice(index, 1);
|
|
3146
|
+
}
|
|
3147
|
+
|
|
3148
|
+
/**
|
|
3149
|
+
* @param {string} name
|
|
3150
|
+
*/
|
|
3151
|
+
getWorksheetByName(name)
|
|
3152
|
+
{
|
|
3153
|
+
let i;
|
|
3154
|
+
for (i in this.sheets)
|
|
3155
|
+
{
|
|
3156
|
+
if (this.sheets[i].getName() == name)
|
|
3157
|
+
return this.sheets[i];
|
|
3158
|
+
}
|
|
3159
|
+
return null;
|
|
3160
|
+
}
|
|
3161
|
+
|
|
3162
|
+
getFontCount()
|
|
3163
|
+
{
|
|
3164
|
+
return this.fonts.length;
|
|
3165
|
+
}
|
|
3166
|
+
|
|
3167
|
+
/**
|
|
3168
|
+
* @param {number} index
|
|
3169
|
+
*/
|
|
3170
|
+
getFontNoCheck(index)
|
|
3171
|
+
{
|
|
3172
|
+
let fnt = this.fonts[index];
|
|
3173
|
+
if (fnt == null)
|
|
3174
|
+
throw new Error("Font is null");
|
|
3175
|
+
return fnt;
|
|
3176
|
+
}
|
|
3177
|
+
|
|
3178
|
+
/**
|
|
3179
|
+
* @param {number} index
|
|
3180
|
+
*/
|
|
3181
|
+
getFont(index)
|
|
3182
|
+
{
|
|
3183
|
+
return this.fonts[index];
|
|
3184
|
+
}
|
|
3185
|
+
|
|
3186
|
+
/**
|
|
3187
|
+
* @param {WorkbookFont} font
|
|
3188
|
+
*/
|
|
3189
|
+
getFontIndex(font)
|
|
3190
|
+
{
|
|
3191
|
+
let i;
|
|
3192
|
+
for (i in this.fonts)
|
|
3193
|
+
{
|
|
3194
|
+
if (this.fonts[i] == font)
|
|
3195
|
+
{
|
|
3196
|
+
return i;
|
|
3197
|
+
}
|
|
3198
|
+
}
|
|
3199
|
+
return -1;
|
|
3200
|
+
}
|
|
3201
|
+
|
|
3202
|
+
/**
|
|
3203
|
+
* @param {string | null} name
|
|
3204
|
+
* @param {number} size
|
|
3205
|
+
* @param {boolean} bold
|
|
3206
|
+
*/
|
|
3207
|
+
newFont(name, size, bold)
|
|
3208
|
+
{
|
|
3209
|
+
let font = new WorkbookFont();
|
|
3210
|
+
this.fonts.push(font);
|
|
3211
|
+
font.setName(name);
|
|
3212
|
+
font.setSize(size);
|
|
3213
|
+
font.setBold(bold);
|
|
3214
|
+
return font;
|
|
3215
|
+
}
|
|
3216
|
+
|
|
3217
|
+
static getDefPalette()
|
|
3218
|
+
{
|
|
3219
|
+
return Workbook.defPalette;
|
|
3220
|
+
}
|
|
3221
|
+
|
|
3222
|
+
/**
|
|
3223
|
+
* @param {number} col
|
|
3224
|
+
*/
|
|
3225
|
+
static colCode(col)
|
|
3226
|
+
{
|
|
3227
|
+
if (col < 26)
|
|
3228
|
+
{
|
|
3229
|
+
return String.fromCharCode(65 + col);
|
|
3230
|
+
}
|
|
3231
|
+
col -= 26;
|
|
3232
|
+
if (col < 26 * 26)
|
|
3233
|
+
{
|
|
3234
|
+
return String.fromCharCode(65 + (col / 26), 65 + (col % 26));
|
|
3235
|
+
}
|
|
3236
|
+
let sbuff = new Array(3);
|
|
3237
|
+
col -= 26 * 26;
|
|
3238
|
+
sbuff[2] = (65 + (col % 26));
|
|
3239
|
+
col = col / 26;
|
|
3240
|
+
sbuff[1] = (65 + (col % 26));
|
|
3241
|
+
sbuff[0] = (65 + (col / 26));
|
|
3242
|
+
return String.fromCharCode(sbuff[0], sbuff[1], sbuff[2]);
|
|
3243
|
+
}
|
|
3244
|
+
}
|
|
3245
|
+
|
|
3246
|
+
export class XLSUtil
|
|
3247
|
+
{
|
|
3248
|
+
/**
|
|
3249
|
+
* @param {data.Timestamp} ts
|
|
3250
|
+
*/
|
|
3251
|
+
static date2Number(ts)
|
|
3252
|
+
{
|
|
3253
|
+
ts = ts.setTimeZoneQHR(0);
|
|
3254
|
+
let secs = ts.inst.sec;
|
|
3255
|
+
let days = Number(secs / 86400n) + 25569;
|
|
3256
|
+
secs -= BigInt(days - 25569) * 86400n;
|
|
3257
|
+
while (secs < 0)
|
|
3258
|
+
{
|
|
3259
|
+
secs += 86400n;
|
|
3260
|
+
days -= 1;
|
|
3261
|
+
}
|
|
3262
|
+
return days + Number(secs) / 86400.0 + (ts.inst.nanosec + 50000) / 86400000000000.0;
|
|
3263
|
+
}
|
|
3264
|
+
|
|
3265
|
+
/**
|
|
3266
|
+
* @param {number} v
|
|
3267
|
+
*/
|
|
3268
|
+
static number2Timestamp(v)
|
|
3269
|
+
{
|
|
3270
|
+
let days = Math.floor(v);
|
|
3271
|
+
let tz = data.DateTimeUtil.getLocalTzQhr();
|
|
3272
|
+
let ds = (v - days);
|
|
3273
|
+
let s = Math.floor(ds * 86400);
|
|
3274
|
+
return new data.Timestamp(new data.TimeInstant(BigInt(days - 25569) * 86400n + BigInt(s), Math.round((ds * 86400 - s) * 1000000000)), tz);
|
|
3275
|
+
}
|
|
3276
|
+
|
|
3277
|
+
/**
|
|
3278
|
+
* @param {number} col
|
|
3279
|
+
* @param {number} row
|
|
3280
|
+
*/
|
|
3281
|
+
static getCellID(col, row)
|
|
3282
|
+
{
|
|
3283
|
+
let s;
|
|
3284
|
+
if (col >= 26)
|
|
3285
|
+
{
|
|
3286
|
+
s = String.fromCharCode(0x41 + Math.floor(col / 26) - 1, 0x41 + (col % 26));
|
|
3287
|
+
}
|
|
3288
|
+
else
|
|
3289
|
+
{
|
|
3290
|
+
s = String.fromCharCode(0x41 + col);
|
|
3291
|
+
}
|
|
3292
|
+
return s + (row + 1);
|
|
3293
|
+
}
|
|
3294
|
+
}
|