@node-projects/excelforge 2.4.0 → 3.1.0

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 (74) hide show
  1. package/.github/FUNDING.yml +4 -0
  2. package/FEATURES.md +294 -0
  3. package/README.md +628 -12
  4. package/dist/core/SharedStrings.js +6 -2
  5. package/dist/core/SharedStrings.js.map +1 -1
  6. package/dist/core/Workbook.d.ts +43 -1
  7. package/dist/core/Workbook.js +881 -58
  8. package/dist/core/Workbook.js.map +1 -1
  9. package/dist/core/WorkbookReader.d.ts +18 -4
  10. package/dist/core/WorkbookReader.js +1386 -20
  11. package/dist/core/WorkbookReader.js.map +1 -1
  12. package/dist/core/Worksheet.d.ts +136 -2
  13. package/dist/core/Worksheet.js +828 -63
  14. package/dist/core/Worksheet.js.map +1 -1
  15. package/dist/core/types.d.ts +311 -5
  16. package/dist/core/types.js +12 -1
  17. package/dist/core/types.js.map +1 -1
  18. package/dist/features/ChartBuilder.d.ts +9 -1
  19. package/dist/features/ChartBuilder.js +140 -14
  20. package/dist/features/ChartBuilder.js.map +1 -1
  21. package/dist/features/CsvModule.d.ts +11 -0
  22. package/dist/features/CsvModule.js +137 -0
  23. package/dist/features/CsvModule.js.map +1 -0
  24. package/dist/features/Encryption.d.ts +6 -0
  25. package/dist/features/Encryption.js +806 -0
  26. package/dist/features/Encryption.js.map +1 -0
  27. package/dist/features/FormControlBuilder.d.ts +6 -0
  28. package/dist/features/FormControlBuilder.js +135 -0
  29. package/dist/features/FormControlBuilder.js.map +1 -0
  30. package/dist/features/FormulaEngine.d.ts +22 -0
  31. package/dist/features/FormulaEngine.js +498 -0
  32. package/dist/features/FormulaEngine.js.map +1 -0
  33. package/dist/features/HtmlModule.d.ts +22 -0
  34. package/dist/features/HtmlModule.js +1441 -0
  35. package/dist/features/HtmlModule.js.map +1 -0
  36. package/dist/features/JsonModule.d.ts +10 -0
  37. package/dist/features/JsonModule.js +76 -0
  38. package/dist/features/JsonModule.js.map +1 -0
  39. package/dist/features/PdfModule.d.ts +30 -0
  40. package/dist/features/PdfModule.js +1567 -0
  41. package/dist/features/PdfModule.js.map +1 -0
  42. package/dist/features/PivotTableBuilder.d.ts +7 -0
  43. package/dist/features/PivotTableBuilder.js +170 -0
  44. package/dist/features/PivotTableBuilder.js.map +1 -0
  45. package/dist/features/Signing.d.ts +12 -0
  46. package/dist/features/Signing.js +326 -0
  47. package/dist/features/Signing.js.map +1 -0
  48. package/dist/features/TableBuilder.js +2 -2
  49. package/dist/features/TableBuilder.js.map +1 -1
  50. package/dist/index-min.js +609 -147
  51. package/dist/index.d.ts +19 -1
  52. package/dist/index.js +11 -0
  53. package/dist/index.js.map +1 -1
  54. package/dist/styles/StyleRegistry.d.ts +14 -0
  55. package/dist/styles/StyleRegistry.js +95 -30
  56. package/dist/styles/StyleRegistry.js.map +1 -1
  57. package/dist/utils/helpers.d.ts +4 -0
  58. package/dist/utils/helpers.js +64 -14
  59. package/dist/utils/helpers.js.map +1 -1
  60. package/dist/utils/zip.js +145 -73
  61. package/dist/utils/zip.js.map +1 -1
  62. package/dist/vba/VbaProject.d.ts +31 -0
  63. package/dist/vba/VbaProject.js +576 -0
  64. package/dist/vba/VbaProject.js.map +1 -0
  65. package/dist/vba/cfb.d.ts +7 -0
  66. package/dist/vba/cfb.js +352 -0
  67. package/dist/vba/cfb.js.map +1 -0
  68. package/dist/vba/ovba.d.ts +2 -0
  69. package/dist/vba/ovba.js +137 -0
  70. package/dist/vba/ovba.js.map +1 -0
  71. package/package.json +4 -3
  72. package/validator.cs +0 -155
  73. package/validatorEpplus.cs +0 -27
  74. package/validatorReadData.cs +0 -111
package/validator.cs DELETED
@@ -1,155 +0,0 @@
1
- #!/usr/bin/env dotnet run
2
-
3
- #:package DocumentFormat.OpenXml@3.0.2
4
-
5
- #pragma warning disable
6
- using System.IO.Compression;
7
- using System.Text.Json;
8
- using System.Text.Json.Serialization.Metadata;
9
- using System.Xml;
10
- using DocumentFormat.OpenXml.Packaging;
11
- using DocumentFormat.OpenXml.Validation;
12
-
13
- var result = new List<object>();
14
-
15
- if (args.Length == 0)
16
- {
17
- Console.WriteLine("Usage: dotnet run validator.cs <file.xlsx>");
18
- Environment.Exit(1);
19
- }
20
-
21
- var file = args[0];
22
-
23
- if (!File.Exists(file))
24
- {
25
- Console.WriteLine("File not found.");
26
- Environment.Exit(1);
27
- }
28
-
29
- // ------------------------
30
- // 1. ZIP + XML inspection
31
- // ------------------------
32
- try
33
- {
34
- using var zip = ZipFile.OpenRead(file);
35
-
36
- foreach (var entry in zip.Entries)
37
- {
38
- try
39
- {
40
- using var stream = entry.Open();
41
- using var ms = new MemoryStream();
42
- stream.CopyTo(ms);
43
- ms.Position = 0;
44
-
45
- if (entry.FullName.EndsWith(".xml", StringComparison.OrdinalIgnoreCase))
46
- {
47
- try
48
- {
49
- var settings = new XmlReaderSettings
50
- {
51
- DtdProcessing = DtdProcessing.Prohibit,
52
- IgnoreWhitespace = true,
53
- IgnoreComments = true
54
- };
55
-
56
- ms.Position = 0;
57
- using var reader = XmlReader.Create(ms, settings);
58
- while (reader.Read()) { }
59
- }
60
- catch (Exception ex)
61
- {
62
- result.Add(new
63
- {
64
- type = "xml",
65
- entry = entry.FullName,
66
- error = ex.Message
67
- });
68
- }
69
- }
70
- }
71
- catch (Exception ex)
72
- {
73
- result.Add(new
74
- {
75
- type = "zip-entry",
76
- entry = entry.FullName,
77
- error = ex.Message
78
- });
79
- }
80
- }
81
- }
82
- catch (Exception ex)
83
- {
84
- result.Add(new
85
- {
86
- type = "zip",
87
- error = ex.Message
88
- });
89
-
90
- PrintAndExit(result);
91
- }
92
-
93
- // ------------------------
94
- // 2. Attempt OpenXML validation if possible
95
- // ------------------------
96
- try
97
- {
98
- using var doc = SpreadsheetDocument.Open(file, false);
99
- var validator = new OpenXmlValidator();
100
- var errors = validator.Validate(doc);
101
-
102
- foreach (var e in errors)
103
- {
104
- result.Add(new
105
- {
106
- type = "openxml",
107
- description = e.Description,
108
- part = e.Part?.Uri?.ToString(),
109
- path = e.Path?.XPath,
110
- errorType = e.ErrorType.ToString(),
111
- node = e.Node?.OuterXml,
112
- relatedNode = e.RelatedNode?.OuterXml
113
- });
114
- }
115
- }
116
- catch (Exception ex)
117
- {
118
- // Report all nested exceptions for OpenXML
119
- int level = 0;
120
- var current = ex;
121
- while (current != null)
122
- {
123
- result.Add(new
124
- {
125
- type = "openxml-exception",
126
- level,
127
- exception = current.GetType().Name,
128
- message = current.Message,
129
- innerMessage = ex.InnerException?.Message
130
- });
131
-
132
- current = current.InnerException;
133
- level++;
134
- }
135
- }
136
-
137
- // ------------------------
138
- // 3. Output JSON + exit code
139
- // ------------------------
140
- PrintAndExit(result);
141
-
142
- // ------------------------
143
- void PrintAndExit(List<object> result)
144
- {
145
- var options = new JsonSerializerOptions
146
- {
147
- WriteIndented = true,
148
- TypeInfoResolver = new DefaultJsonTypeInfoResolver()
149
- };
150
-
151
- string json = JsonSerializer.Serialize(result, options);
152
- Console.WriteLine(json);
153
-
154
- Environment.Exit(result.Count == 0 ? 0 : 1);
155
- }
@@ -1,27 +0,0 @@
1
- #!/usr/bin/env dotnet run
2
- #:package EPPlus@8.5.0
3
-
4
- #pragma warning disable
5
-
6
- using OfficeOpenXml;
7
-
8
- if (args.Length == 0)
9
- {
10
- Console.WriteLine("Usage: dotnet run validator-epplus.cs <file.xlsx>");
11
- return;
12
- }
13
-
14
- var file = args[0];
15
-
16
- ExcelPackage.License.SetNonCommercialOrganization("NonCommercialOrganization:@node-projects");
17
-
18
- try
19
- {
20
- using var package = new ExcelPackage(new FileInfo(file));
21
- Console.WriteLine("EPPlus opened the file successfully.");
22
- }
23
- catch (Exception ex)
24
- {
25
- Console.WriteLine("EPPlus error:");
26
- Console.WriteLine(ex.ToString());
27
- }
@@ -1,111 +0,0 @@
1
- #!/usr/bin/env dotnet run
2
-
3
- #:package DocumentFormat.OpenXml@3.0.2
4
-
5
- #pragma warning disable
6
- using System.Text.Json;
7
- using System.Text.Json.Serialization.Metadata;
8
- using DocumentFormat.OpenXml.Packaging;
9
- using DocumentFormat.OpenXml.Spreadsheet;
10
-
11
- // Usage: dotnet run validatorReadData.cs <file.xlsx> <sheetName> <row> <colStart> <colEnd>
12
- // Reads a single row from the given sheet and outputs cell values as JSON array.
13
- // Example: dotnet run validatorReadData.cs output/20_loaded_table.xlsx ErrorsAndWarnings 10000 1 12
14
-
15
- if (args.Length < 5)
16
- {
17
- Console.Error.WriteLine("Usage: dotnet run validatorReadData.cs <file> <sheet> <row> <colStart> <colEnd>");
18
- Environment.Exit(1);
19
- }
20
-
21
- var file = args[0];
22
- var sheetName = args[1];
23
- var targetRow = int.Parse(args[2]);
24
- var colStart = int.Parse(args[3]);
25
- var colEnd = int.Parse(args[4]);
26
-
27
- if (!File.Exists(file))
28
- {
29
- Console.Error.WriteLine("File not found: " + file);
30
- Environment.Exit(1);
31
- }
32
-
33
- using var doc = SpreadsheetDocument.Open(file, false);
34
- var wbPart = doc.WorkbookPart!;
35
-
36
- // Find sheet by name
37
- var sheet = wbPart.Workbook.Sheets!.Elements<Sheet>()
38
- .FirstOrDefault(s => s.Name?.Value == sheetName);
39
-
40
- if (sheet == null)
41
- {
42
- Console.Error.WriteLine("Sheet not found: " + sheetName);
43
- Environment.Exit(1);
44
- }
45
-
46
- var wsPart = (WorksheetPart)wbPart.GetPartById(sheet.Id!.Value!);
47
- var sheetData = wsPart.Worksheet.GetFirstChild<SheetData>()!;
48
-
49
- // Get shared strings
50
- var sstPart = wbPart.SharedStringTablePart;
51
- var sst = sstPart?.SharedStringTable;
52
-
53
- // Find the target row
54
- var rowEl = sheetData.Elements<Row>().FirstOrDefault(r => r.RowIndex?.Value == (uint)targetRow);
55
-
56
- var result = new List<object?>();
57
-
58
- for (int col = colStart; col <= colEnd; col++)
59
- {
60
- string colLetter = ColToLetter(col);
61
- string cellRef = colLetter + targetRow;
62
-
63
- Cell? cell = rowEl?.Elements<Cell>().FirstOrDefault(c => c.CellReference?.Value == cellRef);
64
- if (cell == null || cell.CellValue == null)
65
- {
66
- result.Add(null);
67
- continue;
68
- }
69
-
70
- string raw = cell.CellValue.Text;
71
- var dataType = cell.DataType?.Value;
72
-
73
- if (dataType == CellValues.SharedString)
74
- {
75
- int idx = int.Parse(raw);
76
- var item = sst?.Elements<SharedStringItem>().ElementAt(idx);
77
- result.Add(item?.InnerText ?? raw);
78
- }
79
- else if (dataType == CellValues.Boolean)
80
- {
81
- result.Add(raw == "1");
82
- }
83
- else
84
- {
85
- // Try numeric
86
- if (double.TryParse(raw, System.Globalization.NumberStyles.Any,
87
- System.Globalization.CultureInfo.InvariantCulture, out var num))
88
- result.Add(num);
89
- else
90
- result.Add(raw);
91
- }
92
- }
93
-
94
- var options = new JsonSerializerOptions
95
- {
96
- WriteIndented = true,
97
- TypeInfoResolver = new DefaultJsonTypeInfoResolver()
98
- };
99
- Console.WriteLine(JsonSerializer.Serialize(result, options));
100
-
101
- static string ColToLetter(int col)
102
- {
103
- string s = "";
104
- while (col > 0)
105
- {
106
- int r = (col - 1) % 26;
107
- s = (char)('A' + r) + s;
108
- col = (col - 1) / 26;
109
- }
110
- return s;
111
- }