@sswroom/sswr 1.6.14 → 1.6.16

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/spreadsheet.js CHANGED
@@ -254,6 +254,24 @@ export const PresetColor = {
254
254
  YellowGreen: 139
255
255
  }
256
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
+
257
275
  export class WorkbookFont
258
276
  {
259
277
  constructor()
@@ -708,6 +726,978 @@ export class CellStyle
708
726
  }
709
727
  }
710
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
+
711
1701
  export class Worksheet
712
1702
  {
713
1703
  /**
@@ -845,7 +1835,7 @@ export class Worksheet
845
1835
  this.rows = [];
846
1836
  /** @type {number[]} */
847
1837
  this.colWidthsPt = [];
848
- // @type {WorksheetDrawing[]}
1838
+ /** @type {{anchorType: number,posXInch: number,posYInch: number,widthInch: number,heightInch: number,row1: number,col1: number,row2: number,col2: number,chart: OfficeChart|null}[]} */
849
1839
  this.drawings = [];
850
1840
  this.freezeHori = 0;
851
1841
  this.freezeVert = 0;
@@ -1637,7 +2627,7 @@ export class Worksheet
1637
2627
  {
1638
2628
  sb.AppendDouble(v);
1639
2629
  }*/
1640
- /* Text::String *fmt;
2630
+ /* Text.String *fmt;
1641
2631
  if (cell.style && (fmt = cell.style.GetDataFormat()) != 0)
1642
2632
  {
1643
2633
  printf("Style: %s\r\n", fmt.v);
@@ -1658,10 +2648,75 @@ export class Worksheet
1658
2648
  {
1659
2649
  return this.drawings.length;
1660
2650
  }
1661
- // getDrawing(index: number): WorksheetDrawing|null;
1662
- // getDrawingNoCheck(index: number): WorksheetDrawing;
1663
- // createDrawing(du: unit.Distance.Unit, x: number, y: number, w: number, h: number): WorksheetDrawing;
1664
- // createChart(du: unit.Distance.Unit, x: number, y: number, w: number, h: number, title: string|null): OfficeChart;
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
+ }
1665
2720
  }
1666
2721
 
1667
2722
 
@@ -2082,6 +3137,9 @@ export class Workbook extends data.ParsedObject
2082
3137
  return this.sheets[index];
2083
3138
  }
2084
3139
 
3140
+ /**
3141
+ * @param {number} index
3142
+ */
2085
3143
  removeAt(index)
2086
3144
  {
2087
3145
  return this.sheets.splice(index, 1);
@@ -2141,6 +3199,11 @@ export class Workbook extends data.ParsedObject
2141
3199
  return -1;
2142
3200
  }
2143
3201
 
3202
+ /**
3203
+ * @param {string | null} name
3204
+ * @param {number} size
3205
+ * @param {boolean} bold
3206
+ */
2144
3207
  newFont(name, size, bold)
2145
3208
  {
2146
3209
  let font = new WorkbookFont();
@@ -2211,6 +3274,10 @@ export class XLSUtil
2211
3274
  return new data.Timestamp(new data.TimeInstant(BigInt(days - 25569) * 86400n + BigInt(s), Math.round((ds * 86400 - s) * 1000000000)), tz);
2212
3275
  }
2213
3276
 
3277
+ /**
3278
+ * @param {number} col
3279
+ * @param {number} row
3280
+ */
2214
3281
  static getCellID(col, row)
2215
3282
  {
2216
3283
  let s;