aspose.cells.node.samples 25.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.
@@ -0,0 +1,10 @@
1
+ <html>
2
+ <head>
3
+ <title>Aspose - End User License Agreement (EULA)</title>
4
+ <meta http-equiv="refresh" content="0; url=https://about.aspose.com/legal/eula" />
5
+ </head>
6
+ <body>
7
+ <p>Please wait. You'll be redirected to the online version of EULA.</p>
8
+ <p>If it fails to redirect then please go the following link manually: <a href="https://about.aspose.com/legal/eula">https://about.aspose.com/legal/eula</a></p>
9
+ </body>
10
+ </html>
package/README.md ADDED
@@ -0,0 +1,222 @@
1
+ ## aspose.cells.node
2
+
3
+ Aspose.Cells for Node.js via C++ is a powerful and robust library designed for high-performance spreadsheet manipulation and management within Node.js applications. It offers a comprehensive set of features that enable developers to create, edit, convert, and render Excel files programmatically. Supporting all major Excel formats, including XLS, XLSX, XLSM, and more, it ensures compatibility and flexibility. This makes Aspose.Cells for Node.js via C++ a versatile tool for a wide range of data processing and management tasks, providing developers with a complete and efficient solution for integrating comprehensive Excel functionality into their Node.js applications.
4
+
5
+ ## Key features
6
+ - **File Creation and Editing:** Create new spreadsheets from scratch or edit existing ones with ease. This includes adding or modifying data, formatting cells, managing worksheets, and more.
7
+ - **Data Processing:** Perform complex data manipulations such as sorting, filtering, and validation. The library also supports advanced formulas and functions to facilitate data analysis and calculations.
8
+ - **File Conversion**: Convert Excel files to various formats such as PDF, HTML, ODS, and image formats like PNG and JPEG. This feature is useful for sharing and distributing spreadsheet data in different formats.
9
+ - **Chart and Graphics**: Create and customize a wide range of charts and graphics to visually represent data. The library supports bar charts, line charts, pie charts, and many more, along with customization options for design and layout.
10
+ - **Rendering and Printing**: Render Excel sheets to high-fidelity images and PDFs, ensuring that the visual representation is accurate. The library also provides options for printing spreadsheets with precise control over page layout and formatting.
11
+ - **Advanced Protection and Security**: Protect spreadsheets with passwords, encrypt files, and manage access permissions to ensure data security and integrity.
12
+ - **Performance and Scalability**: Designed to handle large datasets and complex spreadsheets efficiently, Aspose.Cells for Node.js via C++ ensures high performance and scalability for enterprise-level applications.
13
+
14
+ ## Read & Write Excel Files
15
+ - **Microsoft Excel:** XLS, XLSX, XLSB, XLTX, XLTM, XLSM, XML
16
+ - **OpenOffice:** ODS
17
+ - **Text:** CSV, Tab-Delimited, TXT, JSON
18
+ - **Web:** HTML, MHTML
19
+
20
+ ## Save Excel Files As
21
+ - **Fixed Layout:** PDF, XPS
22
+ - **Images:** JPEG, PNG, BMP, SVG, TIFF, GIF, EMF
23
+ - **Text:** CSV, Tab-Delimited, JSON, SQL, XML
24
+
25
+ ## Support multiple operating systems and CPU architectures, including:
26
+ - **Windows x64**
27
+ - **Linux x64**
28
+ - **macOS x64 & arm64**
29
+
30
+ ## Getting Started with Aspose.Cells for Node.js via C++
31
+ ### Create Excel XLSX File from Scratch
32
+ ``` js
33
+ const AsposeCells = require("aspose.cells.node");
34
+
35
+ var workbook = new AsposeCells.Workbook(AsposeCells.FileFormatType.Xlsx);
36
+ workbook.getWorksheets().get(0).getCells().get("A1").putValue("Hello World");
37
+ workbook.save("hello-world.xlsx");
38
+ ```
39
+
40
+ #### Open and save Excel file asynchronously
41
+ ``` js
42
+ const fs = require("fs");
43
+ const { Workbook, SaveFormat } = require("aspose.cells.node");
44
+
45
+ Workbook.openAsync("example.xlsx")
46
+ .then(workbook => {
47
+ workbook.calculateFormulaAsync()
48
+ .then(() => {
49
+ workbook.saveAsync(SaveFormat.Pdf)
50
+ .then((buffer) => {
51
+ var writeStream = fs.createWriteStream("example.pdf");
52
+ writeStream.write(buffer);
53
+ writeStream.end();
54
+ })
55
+ .catch(error => {
56
+ console.error(error);
57
+ });
58
+ })
59
+ .catch(error => {
60
+ console.error(error);
61
+ });
62
+
63
+ })
64
+ .catch(error => {
65
+ console.error(error);
66
+ });
67
+ ```
68
+
69
+ #### Use **import** of ES6
70
+ ``` js
71
+ import AsposeCells from "aspose.cells.node";
72
+ const { Workbook, FileFormatType } = AsposeCells;
73
+
74
+ var workbook = new Workbook(FileFormatType.Xlsx);
75
+ workbook.getWorksheets().get(0).getCells().get("A1").putValue("Hello World");
76
+ workbook.save("hello-world.xlsx");
77
+ ```
78
+ **Note**: Please save the above code as **example.mjs** file and run it using **`node example.mjs`**.
79
+
80
+ ### Convert Excel XLSX File to PDF
81
+ ``` js
82
+ const { Workbook } = require("aspose.cells.node");
83
+
84
+ var workbook = new Workbook("example.xlsx");
85
+ workbook.save("pdf-example.pdf");
86
+ ```
87
+
88
+ ### Format Excel Cells
89
+ ```js
90
+ const { Workbook, Color } = require("aspose.cells.node");
91
+
92
+ var workbook = new Workbook();
93
+ var style = workbook.createStyle();
94
+ style.getFont().setName("Times New Roman");
95
+ var blue = new Color(0, 0, 0xff);
96
+ style.getFont().setColor(blue);
97
+ for (var i = 0; i < 10; i++) {
98
+ var cell = workbook.getWorksheets().get(0).getCells().get(0, i);
99
+ cell.putValue(i);
100
+ cell.setStyle(style);
101
+ }
102
+ workbook.save("style-example.xlsx");
103
+ ```
104
+
105
+ ### Add Picture to Excel Worksheet
106
+ ```js
107
+ const { Workbook, SaveFormat } = require("aspose.cells.node");
108
+
109
+ var workbook = new Workbook();
110
+ var sheetIndex = workbook.getWorksheets().add();
111
+ var worksheet = workbook.getWorksheets().get(sheetIndex);
112
+
113
+ // adding a picture at "F6" cell
114
+ worksheet.getPictures().add(5, 5, "image.gif");
115
+
116
+ workbook.save("picture-example.xls", SaveFormat.Excel97To2003);
117
+ ```
118
+
119
+ ### Calculate Custom Functions
120
+ ```js
121
+ const { Workbook, CalculationOptions, AbstractCalculationEngine } = require("aspose.cells.node");
122
+
123
+ class CustomFunction extends AbstractCalculationEngine {
124
+ constructor() {
125
+ super();
126
+ }
127
+
128
+ calculate(data) {
129
+ var functionName = data.getFunctionName();
130
+ if (functionName == "myarrayfunch") {
131
+ var r = new Array();
132
+ r[0] = [1.0, 2.0, 3.0, 4.0, 5.0];
133
+ data.setCalculatedValue(r);
134
+ return;
135
+ }
136
+ else if (functionName == "myarrayfuncv") {
137
+ var r = new Array();
138
+ r[0] = [1.0];
139
+ r[1] = [2.0];
140
+ r[2] = [3.0];
141
+ r[3] = [4.0];
142
+ r[4] = [5.0];
143
+ data.setCalculatedValue(r);
144
+ return;
145
+ }
146
+ else if (functionName == "myrange") {
147
+ data.setCalculatedValue(data.getWorksheet().getCells().createRange("A1", "F1"));
148
+ return;
149
+ }
150
+ else if (functionName == "UDFTest") {
151
+ data.setCalculatedValue(data.getParamValue(0));
152
+ }
153
+ }
154
+ };
155
+
156
+ var wb = new Workbook();
157
+ var sheet = wb.getWorksheets().get(0);
158
+ var cells = sheet.getCells();
159
+
160
+ // Create table with data
161
+ var range = cells.createRange("B3:D5");
162
+ var arr = new Array();
163
+ arr[0] = ["AccountNum", "UDF", "Normal"];
164
+ arr[1] = ["Row01", "", ""];
165
+ arr[2] = ["Row02", "", ""];
166
+
167
+ range.setValue(arr);
168
+ var firstRow = range.getFirstRow();
169
+ var firstColumn = range.getFirstColumn();
170
+ var endRow = firstRow + range.getRowCount();
171
+ var endColumn = firstColumn + range.getColumnCount();
172
+ sheet.getListObjects().add(firstRow, firstColumn, endRow, endColumn, true);
173
+
174
+ // Populate formulas
175
+ cells.get("C5").setFormula("=UDFTest([@AccountNum])");
176
+ cells.get("C4").setFormula("=UDFTest([@AccountNum])"); // UDF formula
177
+
178
+ cells.get("D5").setFormula("=[@AccountNum]");
179
+ cells.get("D4").setFormula("=[@AccountNum]"); // Built-in formula comparison
180
+
181
+ // Calculate workbook
182
+ var opt = new CalculationOptions();
183
+ var customFunction = new CustomFunction();
184
+ opt.setCustomEngine(customFunction);
185
+ wb.calculateFormula(opt);
186
+
187
+ console.log("Row01" == cells.get("C4").getStringValue());
188
+ console.log("Row02" == cells.get("C5").getStringValue());
189
+ console.log("Row01" == cells.get("D4").getStringValue());
190
+ console.log("Row02" == cells.get("D5").getStringValue());
191
+
192
+
193
+ var workbook = new Workbook();
194
+ var worksheet = workbook.getWorksheets().get(0);
195
+
196
+ // Get the cells collection in the sheet
197
+ var cells = worksheet.getCells();
198
+ cells.get("A1").setArrayFormula("=myarrayfunch()", 1, 5);
199
+ cells.get("A2").setArrayFormula("=myarrayfuncv()", 5, 1);
200
+ cells.get("A7").setArrayFormula("=A1:E1*100", 1, 5);
201
+ cells.get("A8").setFormula("=sum(myrange())", 100);
202
+
203
+ var cf = new CustomFunction();
204
+ var cOpt = new CalculationOptions();
205
+ cOpt.setCustomEngine(cf);
206
+ workbook.calculateFormula(cOpt);
207
+ for (var i = 0; i < 5; i++) {
208
+ console.log(i + 1.0 == cells.get(0, i).getDoubleValue());
209
+ }
210
+ for (var i = 1; i < 6; i++) {
211
+ console.log(i == cells.get(i, 0).getDoubleValue());
212
+ }
213
+ for (var i = 0; i < 5; i++) {
214
+ console.log(i * 100 + 100.0 == cells.get(6, i).getDoubleValue());
215
+ }
216
+ console.log(cells.get("A8").getDoubleValue() == 15);
217
+ console.log("done");
218
+ ```
219
+
220
+ Please refer to [aspose.cells.node.samples](https://www.npmjs.com/package/aspose.cells.node.samples) package for more code samples.
221
+
222
+ [Product Page](https://products.aspose.com/cells/nodejs-cpp) | [Product Documentation](https://docs.aspose.com/cells/nodejs-cpp/) | [Blog](https://blog.aspose.com/categories/aspose.cells-product-family/) |[API Reference](https://reference.aspose.com/cells/nodejs-cpp) | [Free Support](https://forum.aspose.com/c/cells) | [Temporary License](https://purchase.aspose.com/temporary-license)
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
File without changes
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "aspose.cells.node.samples",
3
+ "version": "25.1.0",
4
+ "description": "This is the sample code using aspose.cells.node library.",
5
+ "scripts": {
6
+ "test": "node src/samples.js"
7
+ },
8
+ "keywords": [
9
+ "Excel",
10
+ "XLS",
11
+ "XLSX",
12
+ "XLSB",
13
+ "CSV",
14
+ "to",
15
+ "PDF",
16
+ "JPG",
17
+ "PNG",
18
+ "HTML",
19
+ "ODS",
20
+ "Numbers",
21
+ "XLSM",
22
+ "Spreadsheet",
23
+ "Markdown",
24
+ "XPS",
25
+ "DOCX",
26
+ "PPTX",
27
+ "MHTML",
28
+ "SVG",
29
+ "JSON",
30
+ "SQL",
31
+ "XML"
32
+ ],
33
+ "author": "Aspose",
34
+ "license": "Commercial",
35
+ "homepage": "https://www.aspose.com",
36
+ "dependencies": {
37
+ "aspose.cells.node": "~25.1.0"
38
+ }
39
+ }