Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
The shapes in Excel are mainly divided into the following types:
This guide document will select one or two shapes from each type to make samples. Through these examples, you will learn how to use Aspose.Cells to insert the specified shape into the worksheet.
Adding pictures to a spreadsheet is very easy. It only takes a few lines of code:
Simply call the PictureCollection.add(number, number, number, number, Uint8Array) method of the Pictures collection (encapsulated in the Worksheet object). The PictureCollection.add(number, number, number, number, Uint8Array) method takes the following parameters:
const path = require("path");
const AsposeCells = require("aspose.cells.node");
// The path to the documents directory.
const dataDir = path.join(__dirname, "data");
// Instantiating a Workbook object
const workbook = new AsposeCells.Workbook();
// Adding a new worksheet to the Workbook object
const sheetIndex = workbook.getWorksheets().add();
// Obtaining the reference of the newly added worksheet by passing its sheet index
const worksheet = workbook.getWorksheets().get(sheetIndex);
// Adding a picture at the location of a cell whose row and column indices
// Are 5 in the worksheet. It is "F6" cell
worksheet.getPictures().add(5, 5, path.join(dataDir, "logo.jpg"));
// Saving the Excel file
workbook.save(path.join(dataDir, "output.xls"));
Aspose.Cells supports adding, extracting, and manipulating OLE objects in worksheets. For this reason, Aspose.Cells has the OleObjectCollection class, used to add a new OLE Object to the collection list. Another class, OleObject, represents an OLE Object. It has some important members:
The following example shows how to add an OLE Object(s) into a worksheet.
const path = require("path");
const fs = require("fs");
const AsposeCells = require("aspose.cells.node");
// The path to the documents directory.
const dataDir = path.join(__dirname, "data");
// Instantiate a new Workbook.
const workbook = new AsposeCells.Workbook();
// Get the first worksheet.
const sheet = workbook.getWorksheets().get(0);
// Define a string variable to store the image path.
const imageUrl = path.join(dataDir, "logo.jpg");
// Get the picture into the streams.
const imageData = fs.readFileSync(imageUrl);
// Get an excel file path in a variable.
const excelFilePath = path.join(dataDir, "book1.xls");
// Get the file into the streams.
const objectData = fs.readFileSync(excelFilePath);
// Add an Ole object into the worksheet with the image
// Shown in MS Excel.
sheet.getOleObjects().add(14, 3, 200, 220, imageData);
// Set embedded ole object data.
sheet.getOleObjects().get(0).setObjectData(objectData);
// Save the excel file
workbook.save(path.join(dataDir, "output.out.xls"));
The shape of the line belongs to the lines category.
In Microsoft Excel (for example 2007):

Using Aspose.Cells
You can use the following method to insert a line in the worksheet.
The following example shows how to insert a line to a worksheet.
const path = require("path");
const AsposeCells = require("aspose.cells.node");
// The path to the documents directory.
const dataDir = path.join(__dirname, "data");
const filePath = path.join(dataDir, "sample.xlsx");
// Create workbook from sample file
const workbook = new AsposeCells.Workbook(filePath);
// Access first worksheet from the collection
const sheet = workbook.getWorksheets().get(0);
// Add the line to the worksheet
sheet.getShapes().addLine(2, 0, 2, 0, 100, 300); // method 1
// sheet.getShapes().addAutoShape(AutoShapeType.Line, 2, 0, 2, 0, 100, 300); // method 2
// sheet.getShapes().addShape(MsoDrawingType.Line, 2, 0, 2, 0, 100, 300); // method 3
// Save. You can check your line in this way.
workbook.save("sample.xlsx", AsposeCells.SaveFormat.Xlsx);
Execute the above code, you will get the following results:

The shape of the line arrow belongs to the Lines category. It is a special case of line.
In Microsoft Excel (for example 2007):

Using Aspose.Cells
You can use the following method to insert a line arrow in the worksheet.
The following example shows how to insert a line arrow to a worksheet.
const path = require("path");
const AsposeCells = require("aspose.cells.node");
// 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);
// Access first worksheet from the collection
const sheet = workbook.getWorksheets().get(0);
// Add the line arrow to the worksheet
let s = sheet.getShapes().addLine(2, 0, 2, 0, 100, 300); // method 1
// let s = sheet.getShapes().addAutoShape(AsposeCells.AutoShapeType.Line, 2, 0, 2, 0, 100, 300); // method 2
// let s = sheet.getShapes().addShape(AsposeCells.MsoDrawingType.Line, 2, 0, 2, 0, 100, 300); // method 3
// add a arrow at the line begin
s.getLine().setBeginArrowheadStyle(AsposeCells.MsoArrowheadStyle.Arrow); // arrow type
s.getLine().setBeginArrowheadWidth(AsposeCells.MsoArrowheadWidth.Wide); // arrow width
s.getLine().setBeginArrowheadLength(AsposeCells.MsoArrowheadLength.Short); // arrow length
// add a arrow at the line end
s.getLine().setEndArrowheadStyle(AsposeCells.MsoArrowheadStyle.ArrowOpen); // arrow type
s.getLine().setEndArrowheadWidth(AsposeCells.MsoArrowheadWidth.Narrow); // arrow width
s.getLine().setEndArrowheadLength(AsposeCells.MsoArrowheadLength.Long); // arrow length
// Save. You can check your arrow in this way.
workbook.save("sample.xlsx", AsposeCells.SaveFormat.Xlsx);
Execute the above code, you will get the following results:

The shape of the rectangle belongs to the Rectangles category.
In Microsoft Excel (for example 2007):

Using Aspose.Cells
You can use the following method to insert a rectangle in the worksheet.
The following example shows how to insert a rectangle to a worksheet.
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");
// Create workbook from sample file
const workbook = new AsposeCells.Workbook(filePath);
// Access first worksheet from the collection
const sheet = workbook.getWorksheets().get(0);
// Add the rectangle to the worksheet
sheet.getShapes().addRectangle(2, 0, 2, 0, 100, 300);
// Save
workbook.save("sample.xlsx", AsposeCells.SaveFormat.Xlsx);
Execute the above code, you will get the following results:

The shape of the cube belongs to the Basic Shapes category.
In Microsoft Excel (for example 2007):

Using Aspose.Cells
You can use the following method to insert a cube in the worksheet.
The following example shows how to insert a cube to a worksheet.
const path = require("path");
const AsposeCells = require("aspose.cells.node");
// 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);
// Access first worksheet from the collection
const sheet = workbook.getWorksheets().get(0);
// Add the cube to the worksheet
sheet.getShapes().addAutoShape(AsposeCells.AutoShapeType.Cube, 2, 0, 2, 0, 100, 300);
// Save. You can check your cube in this way.
workbook.save("sample.xlsx", AsposeCells.SaveFormat.Xlsx);
Execute the above code, you will get the following results:

The shape of the callout quad arrow belongs to the Block Arrows category.
In Microsoft Excel (for example 2007):

Using Aspose.Cells
You can use the following method to insert a callout quad arrow in the worksheet.
The following example shows how to insert a callout quad arrow to a worksheet.
const path = require("path");
const AsposeCells = require("aspose.cells.node");
// 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);
// Access first worksheet from the collection
const sheet = workbook.getWorksheets().get(0);
// Add the callout quad arrow to the worksheet
sheet.getShapes().addAutoShape(AsposeCells.AutoShapeType.QuadArrowCallout, 2, 0, 2, 0, 100, 100);
//Save
workbook.save("sample.xlsx", AsposeCells.SaveFormat.Xlsx);
Execute the above code, you will get the following results:

The shape of the multiplication sign belongs to the Equation Shapes category.
In Microsoft Excel (for example 2007):

Using Aspose.Cells
You can use the following method to insert a multiplication sign in the worksheet.
The following example shows how to insert a multiplication sign to a worksheet.
const path = require("path");
const AsposeCells = require("aspose.cells.node");
// 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);
// Access first worksheet from the collection
const sheet = workbook.getWorksheets().get(0);
// Add the multiplication sign to the worksheet
sheet.getShapes().addAutoShape(AsposeCells.AutoShapeType.MathMultiply, 2, 0, 2, 0, 100, 100);
// Save. You can check your multiplication in this way.
workbook.save("sample.xlsx", AsposeCells.SaveFormat.Xlsx);
Execute the above code, you will get the following results:

The shape of the multidocument belongs to the FlowCharts category.
In Microsoft Excel (for example 2007):

Using Aspose.Cells
You can use the following method to insert a multidocument in the worksheet.
The following example shows how to insert a multidocument to a worksheet.
const path = require("path");
const AsposeCells = require("aspose.cells.node");
// The path to the documents directory.
const dataDir = path.join(__dirname, "data");
const filePath = path.join(dataDir, "sample.xlsx");
// Create workbook from sample file
const workbook = new AsposeCells.Workbook(filePath);
// Access first worksheet from the collection
const sheet = workbook.getWorksheets().get(0);
// Add the multidocument to the worksheet
sheet.getShapes().addAutoShape(AsposeCells.AutoShapeType.FlowChartMultidocument, 2, 0, 2, 0, 100, 100);
// Save
workbook.save("sample.xlsx", AsposeCells.SaveFormat.Xlsx);
Execute the above code, you will get the following results:

The shape of the Five-pointed star belongs to the Stars and Banners category.
In Microsoft Excel (for example 2007):

Using Aspose.Cells
You can use the following method to insert a Five-pointed star in the worksheet.
The following example shows how to insert a Five-pointed star to a worksheet.
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");
// Create workbook from sample file
const workbook = new AsposeCells.Workbook(filePath);
// Access first worksheet from the collection
const sheet = workbook.getWorksheets().get(0);
// Add the Five-pointed star to the worksheet
sheet.getShapes().addAutoShape(AsposeCells.AutoShapeType.Star5, 2, 0, 2, 0, 100, 100);
// Save. You can check your icon in this way.
workbook.save("sample.xlsx", AsposeCells.SaveFormat.Xlsx);
Execute the above code, you will get the following results:

The shape of the thought bubble cloud belongs to the Callouts category.
In Microsoft Excel (for example 2007):

Using Aspose.Cells
You can use the following method to insert a thought bubble cloud in the worksheet.
The following example shows how to insert a thought bubble cloud to a worksheet.
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);
// Access first worksheet from the collection
const sheet = workbook.getWorksheets().get(0);
// Add the thought bubble cloud to the worksheet
sheet.getShapes().addAutoShape(AsposeCells.AutoShapeType.CloudCallout, 2, 0, 2, 0, 100, 100);
// Save
workbook.save("sample.xlsx", AsposeCells.SaveFormat.Xlsx);
Execute the above code, you will get the following results:

Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.