Create Union Range with Node.js via C++
Create Union Range
Aspose.Cells provides the ability to create a Union Range by using the WorksheetCollection.createUnionRange method. The WorksheetCollection.createUnionRange method accepts two parameters, the address to create the union range and the index of the worksheet. The WorksheetCollection.createUnionRange method returns a UnionRange object.
The following code snippet demonstrates creating a Union Range by using the WorksheetCollection.createUnionRange method. The output file generated by the code is attached for reference.
const AsposeCells = require("aspose.cells.node");
const path = require("path");
// The path to the documents directory.
const dataDir = path.join(__dirname, "data");
const filePath = path.join(dataDir, "sample.xlsx");
// Loads the workbook which contains hidden external links
const workbook = new AsposeCells.Workbook(filePath);
// Create union range
const unionRange = workbook.getWorksheets().createUnionRange("sheet1!A1:A10,sheet1!C1:C10", 0);
// Put value "ABCD" in the range
unionRange.setValue("ABCD");
// Save the output workbook.
workbook.save("CreateUnionRange_out.xlsx");