aspose.cells.node
Advanced tools
Comparing version 24.12.0 to 25.1.0
{ | ||
"name": "aspose.cells.node", | ||
"version": "24.12.0", | ||
"version": "25.1.0", | ||
"description": "Aspose.Cells for Node.js via C++ is a high-performance and powerful library for manipulating and converting Excel (XLS, XLSX, XLSB), ODS, CSV, and HTML files, offering a comprehensive set of features for creating, editing, converting, and rendering spreadsheets within Node.js applications.", | ||
@@ -38,7 +38,7 @@ "main": "aspose.cells.js", | ||
"optionalDependencies": { | ||
"aspose.cells.node.win32.x64": "~24.12.0", | ||
"aspose.cells.node.linux.x64": "~24.12.0", | ||
"aspose.cells.node.darwin.x64": "~24.12.0", | ||
"aspose.cells.node.darwin.arm64": "~24.12.0" | ||
"aspose.cells.node.win32.x64": "~25.1.0", | ||
"aspose.cells.node.linux.x64": "~25.1.0", | ||
"aspose.cells.node.darwin.x64": "~25.1.0", | ||
"aspose.cells.node.darwin.arm64": "~25.1.0" | ||
} | ||
} |
112
README.md
@@ -38,2 +38,13 @@ 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. | ||
#### Use **import** of ES6 | ||
``` js | ||
import AsposeCells from "aspose.cells.node"; | ||
const { Workbook, FileFormatType } = AsposeCells; | ||
var workbook = new Workbook(FileFormatType.Xlsx); | ||
workbook.getWorksheets().get(0).getCells().get("A1").putValue("Hello World"); | ||
workbook.save("hello-world.xlsx"); | ||
``` | ||
**Note**: Please save the above code as **example.mjs** file and run it using **`node example.mjs`**. | ||
### Convert Excel XLSX File to PDF | ||
@@ -78,2 +89,103 @@ ``` js | ||
### Calculate Custom Functions | ||
```js | ||
const { Workbook, CalculationOptions, AbstractCalculationEngine } = require("aspose.cells.node"); | ||
class CustomFunction extends AbstractCalculationEngine { | ||
constructor() { | ||
super(); | ||
} | ||
calculate(data) { | ||
var functionName = data.getFunctionName(); | ||
if (functionName == "myarrayfunch") { | ||
var r = new Array(); | ||
r[0] = [1.0, 2.0, 3.0, 4.0, 5.0]; | ||
data.setCalculatedValue(r); | ||
return; | ||
} | ||
else if (functionName == "myarrayfuncv") { | ||
var r = new Array(); | ||
r[0] = [1.0]; | ||
r[1] = [2.0]; | ||
r[2] = [3.0]; | ||
r[3] = [4.0]; | ||
r[4] = [5.0]; | ||
data.setCalculatedValue(r); | ||
return; | ||
} | ||
else if (functionName == "myrange") { | ||
data.setCalculatedValue(data.getWorksheet().getCells().createRange("A1", "F1")); | ||
return; | ||
} | ||
else if (functionName == "UDFTest") { | ||
data.setCalculatedValue(data.getParamValue(0)); | ||
} | ||
} | ||
}; | ||
var wb = new Workbook(); | ||
var sheet = wb.getWorksheets().get(0); | ||
var cells = sheet.getCells(); | ||
// Create table with data | ||
var range = cells.createRange("B3:D5"); | ||
var arr = new Array(); | ||
arr[0] = ["AccountNum", "UDF", "Normal"]; | ||
arr[1] = ["Row01", "", ""]; | ||
arr[2] = ["Row02", "", ""]; | ||
range.setValue(arr); | ||
var firstRow = range.getFirstRow(); | ||
var firstColumn = range.getFirstColumn(); | ||
var endRow = firstRow + range.getRowCount(); | ||
var endColumn = firstColumn + range.getColumnCount(); | ||
sheet.getListObjects().add(firstRow, firstColumn, endRow, endColumn, true); | ||
// Populate formulas | ||
cells.get("C5").setFormula("=UDFTest([@AccountNum])"); | ||
cells.get("C4").setFormula("=UDFTest([@AccountNum])"); // UDF formula | ||
cells.get("D5").setFormula("=[@AccountNum]"); | ||
cells.get("D4").setFormula("=[@AccountNum]"); // Built-in formula comparison | ||
// Calculate workbook | ||
var opt = new CalculationOptions(); | ||
var customFunction = new CustomFunction(); | ||
opt.setCustomEngine(customFunction); | ||
wb.calculateFormula(opt); | ||
console.log("Row01" == cells.get("C4").getStringValue()); | ||
console.log("Row02" == cells.get("C5").getStringValue()); | ||
console.log("Row01" == cells.get("D4").getStringValue()); | ||
console.log("Row02" == cells.get("D5").getStringValue()); | ||
var workbook = new Workbook(); | ||
var worksheet = workbook.getWorksheets().get(0); | ||
// Get the cells collection in the sheet | ||
var cells = worksheet.getCells(); | ||
cells.get("A1").setArrayFormula("=myarrayfunch()", 1, 5); | ||
cells.get("A2").setArrayFormula("=myarrayfuncv()", 5, 1); | ||
cells.get("A7").setArrayFormula("=A1:E1*100", 1, 5); | ||
cells.get("A8").setFormula("=sum(myrange())", 100); | ||
var cf = new CustomFunction(); | ||
var cOpt = new CalculationOptions(); | ||
cOpt.setCustomEngine(cf); | ||
workbook.calculateFormula(cOpt); | ||
for (var i = 0; i < 5; i++) { | ||
console.log(i + 1.0 == cells.get(0, i).getDoubleValue()); | ||
} | ||
for (var i = 1; i < 6; i++) { | ||
console.log(i == cells.get(i, 0).getDoubleValue()); | ||
} | ||
for (var i = 0; i < 5; i++) { | ||
console.log(i * 100 + 100.0 == cells.get(6, i).getDoubleValue()); | ||
} | ||
console.log(cells.get("A8").getDoubleValue() == 15); | ||
console.log("done"); | ||
``` | ||
[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) |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
2032320
59415
190