@corbe30/fortune-excel 1.0.3

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.
Files changed (44) hide show
  1. package/.github/workflows/main.yml +30 -0
  2. package/.github/workflows/publish.yml +30 -0
  3. package/.storybook/main.ts +18 -0
  4. package/.storybook/preview.ts +15 -0
  5. package/LICENSE +21 -0
  6. package/README.md +59 -0
  7. package/dist/HandleZip.d.ts +8 -0
  8. package/dist/HandleZip.js +37 -0
  9. package/dist/ICommon.d.ts +34 -0
  10. package/dist/ICommon.js +1 -0
  11. package/dist/ToExcel/ExcelBorder.d.ts +3 -0
  12. package/dist/ToExcel/ExcelBorder.js +1412 -0
  13. package/dist/ToExcel/ExcelConvert.d.ts +16 -0
  14. package/dist/ToExcel/ExcelConvert.js +92 -0
  15. package/dist/ToExcel/ExcelFile.d.ts +1 -0
  16. package/dist/ToExcel/ExcelFile.js +30 -0
  17. package/dist/ToExcel/ExcelImage.d.ts +2 -0
  18. package/dist/ToExcel/ExcelImage.js +64 -0
  19. package/dist/ToExcel/ExcelStyle.d.ts +3 -0
  20. package/dist/ToExcel/ExcelStyle.js +53 -0
  21. package/dist/ToFortuneSheet/FortuneBase.d.ts +133 -0
  22. package/dist/ToFortuneSheet/FortuneBase.js +28 -0
  23. package/dist/ToFortuneSheet/FortuneCell.d.ts +25 -0
  24. package/dist/ToFortuneSheet/FortuneCell.js +782 -0
  25. package/dist/ToFortuneSheet/FortuneFile.d.ts +50 -0
  26. package/dist/ToFortuneSheet/FortuneFile.js +432 -0
  27. package/dist/ToFortuneSheet/FortuneImage.d.ts +20 -0
  28. package/dist/ToFortuneSheet/FortuneImage.js +51 -0
  29. package/dist/ToFortuneSheet/FortuneSheet.d.ts +36 -0
  30. package/dist/ToFortuneSheet/FortuneSheet.js +581 -0
  31. package/dist/ToFortuneSheet/IFortune.d.ts +301 -0
  32. package/dist/ToFortuneSheet/IFortune.js +1 -0
  33. package/dist/ToFortuneSheet/ReadXml.d.ts +61 -0
  34. package/dist/ToFortuneSheet/ReadXml.js +337 -0
  35. package/dist/common/constant.d.ts +25 -0
  36. package/dist/common/constant.js +277 -0
  37. package/dist/common/emf.d.ts +3 -0
  38. package/dist/common/emf.js +1294 -0
  39. package/dist/common/method.d.ts +132 -0
  40. package/dist/common/method.js +1075 -0
  41. package/dist/main.d.ts +2 -0
  42. package/dist/main.js +24 -0
  43. package/package.json +47 -0
  44. package/tsconfig.json +13 -0
@@ -0,0 +1,301 @@
1
+ export interface IFortuneFile {
2
+ info: IFortuneFileInfo;
3
+ sheets: IfortuneSheet[];
4
+ }
5
+ export interface IFortuneFileInfo {
6
+ name: string;
7
+ creator: string;
8
+ lastmodifiedby: string;
9
+ createdTime: string;
10
+ modifiedTime: string;
11
+ company: string;
12
+ appversion: string;
13
+ }
14
+ export interface IfortuneSheet {
15
+ name: string;
16
+ color: string;
17
+ config?: IfortuneSheetConfig;
18
+ id: string;
19
+ status: string;
20
+ order: string;
21
+ row: number;
22
+ column: number;
23
+ luckysheet_select_save?: IfortuneSheetSelection[];
24
+ scrollLeft: number;
25
+ scrollTop: number;
26
+ celldata?: IfortuneSheetCelldata[];
27
+ chart?: IfortuneSheetChart[];
28
+ isPivotTable: boolean;
29
+ pivotTable?: IfortuneSheetPivotTable;
30
+ luckysheet_conditionformat_save?: IfortunesheetConditionFormat[];
31
+ freezen?: IfortunesheetFrozen;
32
+ calcChain?: IfortunesheetCalcChain[];
33
+ zoomRatio: number;
34
+ showGridLines: string;
35
+ defaultColWidth: number;
36
+ defaultRowHeight: number;
37
+ images: IfortuneImages;
38
+ dataVerification: IfortunesheetDataVerification;
39
+ hyperlink: IfortunesheetHyperlink;
40
+ hide: number;
41
+ }
42
+ export interface IfortuneSheetSelection {
43
+ row: number[];
44
+ column: number[];
45
+ sheetIndex: number;
46
+ }
47
+ export interface IfortuneSheetChart {
48
+ }
49
+ export interface IfortuneSheetPivotTable {
50
+ pivot_select_save: IfortuneSheetSelection;
51
+ pivotDataSheetIndex: string | undefined;
52
+ column: IfortuneSheetPivotTableField[];
53
+ row: IfortuneSheetPivotTableField[];
54
+ filter: IfortuneSheetPivotTableField[];
55
+ filterparm: IfortuneSheetPivotTablefilterParam;
56
+ values: IfortuneSheetPivotTableField[];
57
+ showType: string;
58
+ pivotDatas: any[][];
59
+ drawPivotTable: boolean;
60
+ pivotTableBoundary: number[];
61
+ }
62
+ export interface IfortuneSheetPivotTableField {
63
+ index: number;
64
+ name: string;
65
+ fullname: string;
66
+ sumtype: string;
67
+ nameindex: number;
68
+ }
69
+ export interface IfortuneSheetPivotTablefilterParam {
70
+ [index: string]: IfortuneSheetPivotTablefilterParamItem;
71
+ }
72
+ export interface IfortuneSheetPivotTablefilterParamItem {
73
+ caljs: IfortuneSheetPivotTablefilterParamItemCaljs;
74
+ rowhidden: IfortuneSheetPivotTablefilterParamItemRowhidden;
75
+ selected: IfortuneSheetPivotTablefilterParamItemSelected;
76
+ }
77
+ export interface IfortuneSheetPivotTablefilterParamItemCaljs {
78
+ text: string;
79
+ type: string;
80
+ value: string;
81
+ value1: string;
82
+ }
83
+ export interface IfortuneSheetPivotTablefilterParamItemRowhidden {
84
+ [index: number]: number;
85
+ }
86
+ export interface IfortuneSheetPivotTablefilterParamItemSelected {
87
+ [index: number]: number;
88
+ }
89
+ export interface IfortunesheetFrozen {
90
+ horizen: number | undefined;
91
+ vertical: number | undefined;
92
+ }
93
+ export interface IfortunesheetConditionFormat {
94
+ type: string;
95
+ cellrange: IfortuneSheetSelection[];
96
+ format: string[] | IfortunesheetCFDefaultFormat | IfortunesheetCFIconsFormat;
97
+ conditionName: string | undefined;
98
+ conditionRange: IfortuneSheetSelection[];
99
+ conditionValue: any[];
100
+ }
101
+ export interface IfortunesheetCFDefaultFormat {
102
+ textColor: string | undefined | null;
103
+ cellColor: string | undefined | null;
104
+ }
105
+ export interface IfortunesheetCFIconsFormat {
106
+ len: string | number;
107
+ leftMin: string | number;
108
+ top: string | number;
109
+ }
110
+ export interface IfortunesheetCalcChain {
111
+ r: number;
112
+ c: number;
113
+ id: string | undefined;
114
+ }
115
+ export interface IfortuneSheetCelldata {
116
+ r: number;
117
+ c: number;
118
+ v: IfortuneSheetCelldataValue | {
119
+ mc: IfortuneSheetCelldataValueMerge;
120
+ ct?: IFortuneSheetCellFormat;
121
+ } | string | null;
122
+ }
123
+ export interface IfortuneSheetCelldataValue {
124
+ ct: IFortuneSheetCellFormat | undefined;
125
+ bg: string | undefined;
126
+ ff: string | undefined;
127
+ fc: string | undefined;
128
+ bl: number | undefined;
129
+ it: number | undefined;
130
+ fs: number | undefined;
131
+ cl: number | undefined;
132
+ un: number | undefined;
133
+ vt: number | undefined;
134
+ ht: number | undefined;
135
+ mc: IfortuneSheetCelldataValueMerge | undefined;
136
+ tr: number | undefined;
137
+ tb: number | undefined;
138
+ v: string | undefined;
139
+ m: string | undefined;
140
+ rt: number | undefined;
141
+ f: string | undefined;
142
+ qp: number | undefined;
143
+ }
144
+ export interface IFortuneSheetCellFormat {
145
+ fa: string;
146
+ t: string;
147
+ }
148
+ export interface IfortuneSheetCelldataValueMerge {
149
+ rs?: number;
150
+ cs?: number;
151
+ r: number;
152
+ c: number;
153
+ }
154
+ export interface IfortuneSheetConfig {
155
+ merge?: IfortuneSheetConfigMerges;
156
+ borderInfo: IfortuneSheetborderInfoCellForImp[];
157
+ rowlen?: IfortuneSheetRowAndColumnLen;
158
+ columnlen?: IfortuneSheetRowAndColumnLen;
159
+ rowhidden?: IfortuneSheetRowAndColumnHidden;
160
+ colhidden?: IfortuneSheetRowAndColumnHidden;
161
+ customHeight: IfortuneSheetRowAndColumnHidden;
162
+ customWidth: IfortuneSheetRowAndColumnHidden;
163
+ }
164
+ export interface IfortuneSheetConfigMerges {
165
+ [firstRange: string]: IfortuneSheetConfigMerge;
166
+ }
167
+ export interface IfortuneSheetConfigMerge {
168
+ r: number;
169
+ c: number;
170
+ rs: number;
171
+ cs: number;
172
+ }
173
+ export interface IfortuneSheetborderInfoCell {
174
+ rangeType: string;
175
+ value: IfortuneSheetborderInfoCellValue;
176
+ }
177
+ export interface IfortuneSheetborderInfoCellValue {
178
+ row_index: number;
179
+ col_index: number;
180
+ l: IfortuneSheetborderInfoCellValueStyle;
181
+ r: IfortuneSheetborderInfoCellValueStyle;
182
+ t: IfortuneSheetborderInfoCellValueStyle;
183
+ b: IfortuneSheetborderInfoCellValueStyle;
184
+ }
185
+ export interface IfortuneSheetborderInfoCellValueStyle {
186
+ style: number;
187
+ color: string;
188
+ }
189
+ export interface IfortuneSheetborderInfoRange {
190
+ rangeType: string;
191
+ borderType: string;
192
+ style: string;
193
+ color: string;
194
+ range: IfortuneSheetSelection[];
195
+ }
196
+ export interface IfortuneSheetborderInfoCellForImp {
197
+ rangeType: string;
198
+ cells?: string[];
199
+ value: IfortuneSheetborderInfoCellValue;
200
+ }
201
+ export interface IMapfortuneSheetborderInfoCellForImp {
202
+ [index: number]: IfortuneSheetborderInfoCellForImp;
203
+ }
204
+ export interface IfortuneSheetRowAndColumnLen {
205
+ [index: string]: number;
206
+ }
207
+ export interface IfortuneSheetRowAndColumnHidden {
208
+ [index: string]: number;
209
+ }
210
+ export interface IFormulaSI {
211
+ [index: string]: IFormulaCell;
212
+ }
213
+ export interface IFormulaCell {
214
+ [index: string]: IFormulaCellValue;
215
+ }
216
+ export interface IFormulaCellValue {
217
+ t: string;
218
+ ref: string;
219
+ si: string;
220
+ fv: string;
221
+ cellValue: IfortuneSheetCelldata;
222
+ }
223
+ export interface IFortuneInlineString {
224
+ ff: string | undefined;
225
+ fc: string | undefined;
226
+ fs: number | undefined;
227
+ cl: number | undefined;
228
+ un: number | undefined;
229
+ bl: number | undefined;
230
+ it: number | undefined;
231
+ va: number | undefined;
232
+ v: string | undefined;
233
+ }
234
+ export interface IfortuneImage {
235
+ border: IfortuneImageBorder;
236
+ crop: IfortuneImageCrop;
237
+ default: IfortuneImageDefault;
238
+ fixedLeft: number;
239
+ fixedTop: number;
240
+ isFixedPos: Boolean;
241
+ originHeight: number;
242
+ originWidth: number;
243
+ src: string;
244
+ type: string;
245
+ }
246
+ export interface IfortuneImageBorder {
247
+ color: string;
248
+ radius: number;
249
+ style: string;
250
+ width: number;
251
+ }
252
+ export interface IfortuneImageCrop {
253
+ height: number;
254
+ offsetLeft: number;
255
+ offsetTop: number;
256
+ width: number;
257
+ }
258
+ export interface IfortuneImageDefault {
259
+ height: number;
260
+ left: number;
261
+ top: number;
262
+ width: number;
263
+ }
264
+ export interface IfortuneImages {
265
+ [index: string]: IfortuneImage;
266
+ }
267
+ export interface IcellOtherInfo {
268
+ [index: string]: IformulaList;
269
+ }
270
+ export interface IformulaList {
271
+ [index: string]: IformulaListItem;
272
+ }
273
+ export interface IformulaListItem {
274
+ r: number;
275
+ c: number;
276
+ }
277
+ export interface IfortunesheetDataVerification {
278
+ [key: string]: IfortunesheetDataVerificationValue;
279
+ }
280
+ export interface IfortunesheetDataVerificationValue {
281
+ type: IfortunesheetDataVerificationType;
282
+ type2: string | null;
283
+ value1: string | number | null;
284
+ value2: string | number | null;
285
+ checked: boolean;
286
+ remote: boolean;
287
+ prohibitInput: boolean;
288
+ hintShow: boolean;
289
+ hintText: string;
290
+ }
291
+ export type IfortunesheetDataVerificationType = "dropdown" | "checkbox" | "number" | "number_integer" | "number_decimal" | "text_content" | "text_length" | "date" | "validity";
292
+ export interface IfortunesheetHyperlink {
293
+ [key: string]: IfortunesheetHyperlinkValue;
294
+ }
295
+ export interface IfortunesheetHyperlinkValue {
296
+ linkAddress: string;
297
+ linkTooltip: string;
298
+ linkType: IfortunesheetHyperlinkType;
299
+ display: string;
300
+ }
301
+ export type IfortunesheetHyperlinkType = "internal" | "external";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,61 @@
1
+ import { IuploadfileList, IattributeList } from "../ICommon.js";
2
+ declare class xmloperation {
3
+ /**
4
+ * @param tag Search xml tag name , div,title etc.
5
+ * @param file Xml string
6
+ * @return Xml element string
7
+ */
8
+ protected getElementsByOneTag(tag: string, file: string): string[];
9
+ }
10
+ export declare class ReadXml extends xmloperation {
11
+ originFile: IuploadfileList;
12
+ constructor(files: IuploadfileList);
13
+ /**
14
+ * @param path Search xml tag group , div,title etc.
15
+ * @param fileName One of uploadfileList, uploadfileList is file group, {key:value}
16
+ * @return Xml element calss
17
+ */
18
+ getElementsByTagName(path: string, fileName: string): Element[];
19
+ /**
20
+ * @param name One of uploadfileList's name, search for file by this parameter
21
+ * @retrun Select a file from uploadfileList
22
+ */
23
+ private getFileByName;
24
+ }
25
+ export declare class Element extends xmloperation {
26
+ elementString: string;
27
+ attributeList: IattributeList;
28
+ value: string;
29
+ container: string;
30
+ constructor(str: string);
31
+ /**
32
+ * @param name Get attribute by key in element
33
+ * @return Single attribute
34
+ */
35
+ get(name: string): string | number | boolean;
36
+ /**
37
+ * @param tag Get elements by tag in elementString
38
+ * @return Element group
39
+ */
40
+ getInnerElements(tag: string): Element[];
41
+ /**
42
+ * @desc get xml dom value and container, <container>value</container>
43
+ */
44
+ private setValue;
45
+ /**
46
+ * @desc get xml dom first tag, <a><b></b></a>, get a
47
+ */
48
+ private getFirstTag;
49
+ }
50
+ export interface IStyleCollections {
51
+ [index: string]: Element[] | IattributeList;
52
+ }
53
+ export declare function getColor(color: Element, styles: IStyleCollections, type?: string): string;
54
+ /**
55
+ * @dom xml attribute object
56
+ * @attr attribute name
57
+ * @d if attribute is null, return default value
58
+ * @return attribute value
59
+ */
60
+ export declare function getlineStringAttr(frpr: Element, attr: string): string;
61
+ export {};
@@ -0,0 +1,337 @@
1
+ import { indexedColors } from "../common/constant.js";
2
+ import { LightenDarkenColor } from "../common/method.js";
3
+ class xmloperation {
4
+ /**
5
+ * @param tag Search xml tag name , div,title etc.
6
+ * @param file Xml string
7
+ * @return Xml element string
8
+ */
9
+ getElementsByOneTag(tag, file) {
10
+ //<a:[^/>: ]+?>.*?</a:[^/>: ]+?>
11
+ let readTagReg;
12
+ if (tag.indexOf("|") > -1) {
13
+ let tags = tag.split("|"), tagsRegTxt = "";
14
+ for (let i = 0; i < tags.length; i++) {
15
+ let t = tags[i];
16
+ tagsRegTxt +=
17
+ "|<" +
18
+ t +
19
+ " [^>]+?[^/]>[\\s\\S]*?</" +
20
+ t +
21
+ ">|<" +
22
+ t +
23
+ " [^>]+?/>|<" +
24
+ t +
25
+ ">[\\s\\S]*?</" +
26
+ t +
27
+ ">|<" +
28
+ t +
29
+ "/>";
30
+ }
31
+ tagsRegTxt = tagsRegTxt.substr(1, tagsRegTxt.length);
32
+ readTagReg = new RegExp(tagsRegTxt, "g");
33
+ }
34
+ else {
35
+ readTagReg = new RegExp("<" +
36
+ tag +
37
+ " [^>]+?[^/]>[\\s\\S]*?</" +
38
+ tag +
39
+ ">|<" +
40
+ tag +
41
+ " [^>]+?/>|<" +
42
+ tag +
43
+ ">[\\s\\S]*?</" +
44
+ tag +
45
+ ">|<" +
46
+ tag +
47
+ "/>", "g");
48
+ }
49
+ let ret = file.match(readTagReg);
50
+ if (ret == null) {
51
+ return [];
52
+ }
53
+ else {
54
+ return ret;
55
+ }
56
+ }
57
+ }
58
+ export class ReadXml extends xmloperation {
59
+ constructor(files) {
60
+ super();
61
+ this.originFile = files;
62
+ }
63
+ /**
64
+ * @param path Search xml tag group , div,title etc.
65
+ * @param fileName One of uploadfileList, uploadfileList is file group, {key:value}
66
+ * @return Xml element calss
67
+ */
68
+ getElementsByTagName(path, fileName) {
69
+ let file = this.getFileByName(fileName);
70
+ let pathArr = path.split("/"), ret;
71
+ for (let key in pathArr) {
72
+ let path = pathArr[key];
73
+ if (ret == undefined) {
74
+ ret = this.getElementsByOneTag(path, file);
75
+ }
76
+ else {
77
+ if (ret instanceof Array) {
78
+ let items = [];
79
+ for (let key in ret) {
80
+ let item = ret[key];
81
+ items = items.concat(this.getElementsByOneTag(path, item));
82
+ }
83
+ ret = items;
84
+ }
85
+ else {
86
+ ret = this.getElementsByOneTag(path, ret);
87
+ }
88
+ }
89
+ }
90
+ let elements = [];
91
+ for (let i = 0; i < ret.length; i++) {
92
+ let ele = new Element(ret[i]);
93
+ elements.push(ele);
94
+ }
95
+ return elements;
96
+ }
97
+ /**
98
+ * @param name One of uploadfileList's name, search for file by this parameter
99
+ * @retrun Select a file from uploadfileList
100
+ */
101
+ getFileByName(name) {
102
+ for (let fileKey in this.originFile) {
103
+ if (fileKey.indexOf(name) > -1) {
104
+ return this.originFile[fileKey];
105
+ }
106
+ }
107
+ return "";
108
+ }
109
+ }
110
+ export class Element extends xmloperation {
111
+ constructor(str) {
112
+ super();
113
+ this.elementString = str;
114
+ this.setValue();
115
+ const readAttrReg = new RegExp('[a-zA-Z0-9_:]*?=".*?"', "g");
116
+ let attrList = this.container.match(readAttrReg);
117
+ this.attributeList = {};
118
+ if (attrList != null) {
119
+ for (let key in attrList) {
120
+ let attrFull = attrList[key];
121
+ // let al= attrFull.split("=");
122
+ if (attrFull.length == 0) {
123
+ continue;
124
+ }
125
+ let attrKey = attrFull.substr(0, attrFull.indexOf("="));
126
+ let attrValue = attrFull.substr(attrFull.indexOf("=") + 1);
127
+ if (attrKey == null ||
128
+ attrValue == null ||
129
+ attrKey.length == 0 ||
130
+ attrValue.length == 0) {
131
+ continue;
132
+ }
133
+ this.attributeList[attrKey] = attrValue.substr(1, attrValue.length - 2);
134
+ }
135
+ }
136
+ }
137
+ /**
138
+ * @param name Get attribute by key in element
139
+ * @return Single attribute
140
+ */
141
+ get(name) {
142
+ return this.attributeList[name];
143
+ }
144
+ /**
145
+ * @param tag Get elements by tag in elementString
146
+ * @return Element group
147
+ */
148
+ getInnerElements(tag) {
149
+ let ret = this.getElementsByOneTag(tag, this.elementString);
150
+ let elements = [];
151
+ for (let i = 0; i < ret.length; i++) {
152
+ let ele = new Element(ret[i]);
153
+ elements.push(ele);
154
+ }
155
+ if (elements.length == 0) {
156
+ return null;
157
+ }
158
+ return elements;
159
+ }
160
+ /**
161
+ * @desc get xml dom value and container, <container>value</container>
162
+ */
163
+ setValue() {
164
+ let str = this.elementString;
165
+ if (str.substr(str.length - 2, 2) == "/>") {
166
+ this.value = "";
167
+ this.container = str;
168
+ }
169
+ else {
170
+ let firstTag = this.getFirstTag();
171
+ const firstTagReg = new RegExp("(<" +
172
+ firstTag +
173
+ " [^>]+?[^/]>)([\\s\\S]*?)</" +
174
+ firstTag +
175
+ ">|(<" +
176
+ firstTag +
177
+ ">)([\\s\\S]*?)</" +
178
+ firstTag +
179
+ ">", "g");
180
+ let result = firstTagReg.exec(str);
181
+ if (result != null) {
182
+ if (result[1] != null) {
183
+ this.container = result[1];
184
+ this.value = result[2];
185
+ }
186
+ else {
187
+ this.container = result[3];
188
+ this.value = result[4];
189
+ }
190
+ }
191
+ }
192
+ }
193
+ /**
194
+ * @desc get xml dom first tag, <a><b></b></a>, get a
195
+ */
196
+ getFirstTag() {
197
+ let str = this.elementString;
198
+ let firstTag = str.substr(0, str.indexOf(" "));
199
+ if (firstTag == "" || firstTag.indexOf(">") > -1) {
200
+ firstTag = str.substr(0, str.indexOf(">"));
201
+ }
202
+ firstTag = firstTag.substr(1, firstTag.length);
203
+ return firstTag;
204
+ }
205
+ }
206
+ function combineIndexedColor(indexedColorsInner, indexedColors) {
207
+ let ret = {};
208
+ if (indexedColorsInner == null || indexedColorsInner.length == 0) {
209
+ return indexedColors;
210
+ }
211
+ for (let key in indexedColors) {
212
+ let value = indexedColors[key], kn = parseInt(key);
213
+ let inner = indexedColorsInner[kn];
214
+ if (inner == null) {
215
+ ret[key] = value;
216
+ }
217
+ else {
218
+ let rgb = inner.attributeList.rgb;
219
+ ret[key] = rgb;
220
+ }
221
+ }
222
+ return ret;
223
+ }
224
+ //clrScheme:Element[]
225
+ export function getColor(color, styles, type = "g") {
226
+ let attrList = color.attributeList;
227
+ let clrScheme = styles["clrScheme"];
228
+ let indexedColorsInner = styles["indexedColors"];
229
+ let mruColorsInner = styles["mruColors"];
230
+ let indexedColorsList = combineIndexedColor(indexedColorsInner, indexedColors);
231
+ let indexed = attrList.indexed, rgb = attrList.rgb, theme = attrList.theme, tint = attrList.tint;
232
+ let bg;
233
+ if (indexed != null) {
234
+ let indexedNum = parseInt(indexed);
235
+ bg = indexedColorsList[indexedNum];
236
+ if (bg != null) {
237
+ bg = bg.substring(bg.length - 6, bg.length);
238
+ bg = "#" + bg;
239
+ }
240
+ }
241
+ else if (rgb != null) {
242
+ rgb = rgb.substring(rgb.length - 6, rgb.length);
243
+ bg = "#" + rgb;
244
+ }
245
+ else if (theme != null) {
246
+ let themeNum = parseInt(theme);
247
+ if (themeNum == 0) {
248
+ themeNum = 1;
249
+ }
250
+ else if (themeNum == 1) {
251
+ themeNum = 0;
252
+ }
253
+ else if (themeNum == 2) {
254
+ themeNum = 3;
255
+ }
256
+ else if (themeNum == 3) {
257
+ themeNum = 2;
258
+ }
259
+ let clrSchemeElement = clrScheme[themeNum];
260
+ if (clrSchemeElement != null) {
261
+ let clrs = clrSchemeElement.getInnerElements("a:sysClr|a:srgbClr");
262
+ if (clrs != null) {
263
+ let clr = clrs[0];
264
+ let clrAttrList = clr.attributeList;
265
+ // console.log(clr.container, );
266
+ if (clr.container.indexOf("sysClr") > -1) {
267
+ // if(type=="g" && clrAttrList.val=="windowText"){
268
+ // bg = null;
269
+ // }
270
+ // else if((type=="t" || type=="b") && clrAttrList.val=="window"){
271
+ // bg = null;
272
+ // }
273
+ // else
274
+ if (clrAttrList.lastClr != null) {
275
+ bg = "#" + clrAttrList.lastClr;
276
+ }
277
+ else if (clrAttrList.val != null) {
278
+ bg = "#" + clrAttrList.val;
279
+ }
280
+ }
281
+ else if (clr.container.indexOf("srgbClr") > -1) {
282
+ // console.log(clrAttrList.val);
283
+ bg = "#" + clrAttrList.val;
284
+ }
285
+ }
286
+ }
287
+ }
288
+ if (tint != null) {
289
+ let tintNum = parseFloat(tint);
290
+ if (bg != null) {
291
+ bg = LightenDarkenColor(bg, tintNum);
292
+ }
293
+ }
294
+ return bg;
295
+ }
296
+ /**
297
+ * @dom xml attribute object
298
+ * @attr attribute name
299
+ * @d if attribute is null, return default value
300
+ * @return attribute value
301
+ */
302
+ export function getlineStringAttr(frpr, attr) {
303
+ let attrEle = frpr.getInnerElements(attr), value;
304
+ if (attrEle != null && attrEle.length > 0) {
305
+ if (attr == "b" || attr == "i" || attr == "strike") {
306
+ value = "1";
307
+ }
308
+ else if (attr == "u") {
309
+ let v = attrEle[0].attributeList.val;
310
+ if (v == "double") {
311
+ value = "2";
312
+ }
313
+ else if (v == "singleAccounting") {
314
+ value = "3";
315
+ }
316
+ else if (v == "doubleAccounting") {
317
+ value = "4";
318
+ }
319
+ else {
320
+ value = "1";
321
+ }
322
+ }
323
+ else if (attr == "vertAlign") {
324
+ let v = attrEle[0].attributeList.val;
325
+ if (v == "subscript") {
326
+ value = "1";
327
+ }
328
+ else if (v == "superscript") {
329
+ value = "2";
330
+ }
331
+ }
332
+ else {
333
+ value = attrEle[0].attributeList.val;
334
+ }
335
+ }
336
+ return value;
337
+ }