Methods

Methods

addActiveXControl(type, topRow, top, leftColumn, left, height, width) → Shape

Creates an Activex Control.

Parameters

Name Type Optional Description

type

Number

 

ControlType

topRow

Number

 

Upper left row index.

top

Number

 

Represents the vertical offset of Shape from its left row, in unit of pixel.

leftColumn

Number

 

Upper left column index.

left

Number

 

Represents the horizontal offset of Shape from its left column, in unit of pixel.

height

Number

 

Represents the height of Shape, in unit of pixel.

width

Number

 

Represents the width of Shape, in unit of pixel.

Returns

Shape 

addArc(upperLeftRow, top, upperLeftColumn, left, height, width) → ArcShape

Adds a ArcShape to the worksheet.

Parameters

Name Type Optional Description

upperLeftRow

Number

 

Upper left row index.

top

Number

 

Represents the vertical offset of ArcShape from its left row, in unit of pixel.

upperLeftColumn

Number

 

Upper left column index.

left

Number

 

Represents the horizontal offset of ArcShape from its left column, in unit of pixel.

height

Number

 

Represents the height of ArcShape, in unit of pixel.

width

Number

 

Represents the width of ArcShape, in unit of pixel.

Returns

ArcShape A ArcShape object.

addAutoShape(type, upperLeftRow, top, upperLeftColumn, left, height, width) → Shape

Adds a AutoShape to the worksheet. The type could not be Chart/Comment/Picture/OleObject/Polygon/DialogBox

Parameters

Name Type Optional Description

type

Number

 

AutoShapeType

upperLeftRow

Number

 

Upper left row index.

top

Number

 

Represents the vertical offset of Shape from its left row, in unit of pixel.

upperLeftColumn

Number

 

Upper left column index.

left

Number

 

Represents the horizontal offset of Shape from its left column, in unit of pixel.

height

Number

 

Represents the height of Shape, in unit of pixel.

width

Number

 

Represents the width of Shape, in unit of pixel.

Returns

Shape A Shape object.

addAutoShapeInChart(type, top, left, height, width) → Shape

Adds a AutoShape to the chart. The type could not be Chart/Comment/Picture/OleObject/Polygon/DialogBox

Parameters

Name Type Optional Description

type

Number

 

AutoShapeType

top

Number

 

Represents the vertical offset of textbox from the upper left corner in units of 1/4000 of the chart area.

left

Number

 

Represents the vertical offset of textbox from the upper left corner in units of 1/4000 of the chart area.

height

Number

 

Represents the height of textbox, in units of 1/4000 of the chart area.

width

Number

 

Represents the width of textbox, in units of 1/4000 of the chart area.

Returns

Shape Returns a shape object.

addButton(upperLeftRow, top, upperLeftColumn, left, height, width) → Button

Adds a Button to the worksheet.

Parameters

Name Type Optional Description

upperLeftRow

Number

 

Upper left row index.

top

Number

 

Represents the vertical offset of Button from its left row, in unit of pixel.

upperLeftColumn

Number

 

Upper left column index.

left

Number

 

Represents the horizontal offset of Button from its left column, in unit of pixel.

height

Number

 

Represents the height of Button, in unit of pixel.

width

Number

 

Represents the width of Button, in unit of pixel.

Returns

Button A Button object.

addCheckBox(upperLeftRow, top, upperLeftColumn, left, height, width) → CheckBox

Adds a checkbox to the worksheet.

Parameters

Name Type Optional Description

upperLeftRow

Number

 

Upper left row index.

top

Number

 

Represents the vertical offset of checkbox from its left row, in unit of pixel.

upperLeftColumn

Number

 

Upper left column index.

left

Number

 

Represents the horizontal offset of textbox from its left column, in unit of pixel.

height

Number

 

Height of textbox, in unit of pixel.

width

Number

 

Width of textbox, in unit of pixel.

Returns

CheckBox The new CheckBox object index.

addComboBox(upperLeftRow, top, upperLeftColumn, left, height, width) → ComboBox

Adds a ComboBox to the worksheet.

Parameters

Name Type Optional Description

upperLeftRow

Number

 

Upper left row index.

top

Number

 

Represents the vertical offset of ComboBox from its left row, in unit of pixel.

upperLeftColumn

Number

 

Upper left column index.

left

Number

 

Represents the horizontal offset of ComboBox from its left column, in unit of pixel.

height

Number

 

Represents the height of ComboBox, in unit of pixel.

width

Number

 

Represents the width of ComboBox, in unit of pixel.

Returns

ComboBox A ComboBox object.

addCopy(sourceShape, upperLeftRow, top, upperLeftColumn, left) → Shape

Adds and copy a shape to the worksheet.

Parameters

Name Type Optional Description

sourceShape

Shape

 

Source shape.

upperLeftRow

Number

 

Upper left row index.

top

Number

 

Represents the vertical offset of checkbox from its left row, in unit of pixel.

upperLeftColumn

Number

 

Upper left column index.

left

Number

 

Represents the horizontal offset of textbox from its left column, in unit of pixel.

Returns

Shape The new shape object index.

addEquation(upperLeftRow, top, upperLeftColumn, left, height, width) → TextBox

Add an equation object to the worksheet.

Parameters

Name Type Optional Description

upperLeftRow

Number

 

top

Number

 

upperLeftColumn

Number

 

left

Number

 

height

Number

 

width

Number

 

Returns

TextBox 

addFreeFloatingShape(type, top, left, height, width, imageData, isOriginalSize) → Shape

Adds a free floating shape to the worksheet.Only applies for line/image shape.

Parameters

Name Type Optional Description

type

Number

 

MsoDrawingType

top

Number

 

Represents the vertical offset of shape from the worksheet's top row, in unit of pixel.

left

Number

 

Represents the horizontal offset of shape from the worksheet's left column, in unit of pixel.

height

Number

 

Represents the height of LineShape, in unit of pixel.

width

Number

 

Represents the width of LineShape, in unit of pixel.

imageData

Array of byte

 

The image data,only applies for the picture.

isOriginalSize

boolean

 

Whether the shape use original size if the shape is image.

Returns

Shape 

addGroupBox(upperLeftRow, top, upperLeftColumn, left, height, width) → GroupBox

Adds a GroupBox to the worksheet.

Parameters

Name Type Optional Description

upperLeftRow

Number

 

Upper left row index.

top

Number

 

Represents the vertical offset of GroupBox from its left row, in unit of pixel.

upperLeftColumn

Number

 

Upper left column index.

left

Number

 

Represents the horizontal offset of GroupBox from its left column, in unit of pixel.

height

Number

 

Represents the height of GroupBox, in unit of pixel.

width

Number

 

Represents the width of GroupBox, in unit of pixel.

Returns

GroupBox A GroupBox object.

addIcons(upperLeftRow, top, upperLeftColumn, left, height, width, imageByteData, compatibleImageData) → Picture

Adds svg image.

Parameters

Name Type Optional Description

upperLeftRow

Number

 

Upper left row index.

top

Number

 

Represents the vertical offset of shape from its left row, in unit of pixel.

upperLeftColumn

Number

 

Upper left column index.

left

Number

 

The horizontal offset of shape from its left column, in unit of pixel.

height

Number

 

The height of shape, in unit of pixel.

width

Number

 

The width of shape, in unit of pixel.

imageByteData

Array of byte

 

The image byte data.

compatibleImageData

Array of byte

 

Converted image data from svg in order to be compatible with Excel 2016 or lower versions.

Returns

Picture 

addLabel(upperLeftRow, top, upperLeftColumn, left, height, width) → Label

Adds a Label to the worksheet.

Parameters

Name Type Optional Description

upperLeftRow

Number

 

Upper left row index.

top

Number

 

Represents the vertical offset of Label from its left row, in unit of pixel.

upperLeftColumn

Number

 

Upper left column index.

left

Number

 

Represents the horizontal offset of Label from its left column, in unit of pixel.

height

Number

 

Represents the height of Label, in unit of pixel.

width

Number

 

Represents the width of Label, in unit of pixel.

Returns

Label A Label object.

addLabelInChart(top, left, height, width) → Label

Adds a label to the chart.

Parameters

Name Type Optional Description

top

Number

 

Represents the vertical offset of label from the upper left corner in units of 1/4000 of the chart area.

left

Number

 

Represents the vertical offset of label from the upper left corner in units of 1/4000 of the chart area.

height

Number

 

Represents the height of label, in units of 1/4000 of the chart area.

width

Number

 

Represents the width of label, in units of 1/4000 of the chart area.

Returns

Label A new Label object.

addLine(upperLeftRow, top, upperLeftColumn, left, height, width) → LineShape

Adds a LineShape to the worksheet.

Parameters

Name Type Optional Description

upperLeftRow

Number

 

Upper left row index.

top

Number

 

Represents the vertical offset of LineShape from its left row, in unit of pixel.

upperLeftColumn

Number

 

Upper left column index.

left

Number

 

Represents the horizontal offset of LineShape from its left column, in unit of pixel.

height

Number

 

Represents the height of LineShape, in unit of pixel.

width

Number

 

Represents the width of LineShape, in unit of pixel.

Returns

LineShape A LineShape object.

addLinkedPicture(upperLeftRow, upperLeftColumn, height, width, sourceFullName) → Picture

Add a linked picture.

Parameters

Name Type Optional Description

upperLeftRow

Number

 

Upper left row index.

upperLeftColumn

Number

 

Upper left column index.

height

Number

 

The height of the shape. In unit of pixels

width

Number

 

The width of the shape. In unit of pixels

sourceFullName

String

 

The path and name of the source file for the linked image

Returns

Picture Picture Picture object.

addListBox(upperLeftRow, top, upperLeftColumn, left, height, width) → ListBox

Adds a ListBox to the worksheet.

Parameters

Name Type Optional Description

upperLeftRow

Number

 

Upper left row index.

top

Number

 

Represents the vertical offset of ListBox from its left row, in unit of pixel.

upperLeftColumn

Number

 

Upper left column index.

left

Number

 

Represents the horizontal offset of ListBox from its left column, in unit of pixel.

height

Number

 

Represents the height of ListBox, in unit of pixel.

width

Number

 

Represents the width of ListBox, in unit of pixel.

Returns

ListBox A ListBox object.

addOleObject(upperLeftRow, top, upperLeftColumn, left, height, width, imageData) → OleObject

Adds an OleObject.

Parameters

Name Type Optional Description

upperLeftRow

Number

 

top

Number

 

upperLeftColumn

Number

 

left

Number

 

height

Number

 

width

Number

 

imageData

Array of byte

 

Returns

OleObject 

addOleObjectWithLinkedImage(upperLeftRow, upperLeftColumn, height, width, sourceFullName) → OleObject

Add a linked picture.

Parameters

Name Type Optional Description

upperLeftRow

Number

 

Upper left row index.

upperLeftColumn

Number

 

Upper left column index.

height

Number

 

The height of the shape. In unit of pixels

width

Number

 

The width of the shape. In unit of pixels

sourceFullName

String

 

The path and name of the source file for the linked image

Returns

OleObject Picture Picture object.

addOval(upperLeftRow, top, upperLeftColumn, left, height, width) → Oval

Adds a Oval to the worksheet.

Parameters

Name Type Optional Description

upperLeftRow

Number

 

Upper left row index.

top

Number

 

Represents the vertical offset of Oval from its left row, in unit of pixel.

upperLeftColumn

Number

 

Upper left column index.

left

Number

 

Represents the horizontal offset of Oval from its left column, in unit of pixel.

height

Number

 

Represents the height of Oval, in unit of pixel.

width

Number

 

Represents the width of Oval, in unit of pixel.

Returns

Oval A Oval object.

addRadioButton(upperLeftRow, top, upperLeftColumn, left, height, width) → RadioButton

Adds a RadioButton to the worksheet.

Parameters

Name Type Optional Description

upperLeftRow

Number

 

Upper left row index.

top

Number

 

Represents the vertical offset of RadioButton from its left row, in unit of pixel.

upperLeftColumn

Number

 

Upper left column index.

left

Number

 

Represents the horizontal offset of RadioButton from its left column, in unit of pixel.

height

Number

 

Represents the height of RadioButton, in unit of pixel.

width

Number

 

Represents the width of RadioButton, in unit of pixel.

Returns

RadioButton A RadioButton object.

addRectangle(upperLeftRow, top, upperLeftColumn, left, height, width) → RectangleShape

Adds a RectangleShape to the worksheet.

Parameters

Name Type Optional Description

upperLeftRow

Number

 

Upper left row index.

top

Number

 

Represents the vertical offset of RectangleShape from its left row, in unit of pixel.

upperLeftColumn

Number

 

Upper left column index.

left

Number

 

Represents the horizontal offset of RectangleShape from its left column, in unit of pixel.

height

Number

 

Represents the height of RectangleShape, in unit of pixel.

width

Number

 

Represents the width of RectangleShape, in unit of pixel.

Returns

RectangleShape A RectangleShape object.

addScrollBar(upperLeftRow, top, upperLeftColumn, left, height, width) → ScrollBar

Adds a ScrollBar to the worksheet.

Parameters

Name Type Optional Description

upperLeftRow

Number

 

Upper left row index.

top

Number

 

Represents the vertical offset of ScrollBar from its left row, in unit of pixel.

upperLeftColumn

Number

 

Upper left column index.

left

Number

 

Represents the horizontal offset of ScrollBar from its left column, in unit of pixel.

height

Number

 

Represents the height of ScrollBar, in unit of pixel.

width

Number

 

Represents the width of ScrollBar, in unit of pixel.

Returns

ScrollBar A ScrollBar object.

addShape(type, upperLeftRow, top, upperLeftColumn, left, height, width) → Shape

Adds a Shape to the worksheet. The type could not be Chart/Comment/Picture/OleObject/Polygon/DialogBox

Parameters

Name Type Optional Description

type

Number

 

MsoDrawingType

upperLeftRow

Number

 

Upper left row index.

top

Number

 

Represents the vertical offset of Shape from its left row, in unit of pixel.

upperLeftColumn

Number

 

Upper left column index.

left

Number

 

Represents the horizontal offset of Shape from its left column, in unit of pixel.

height

Number

 

Represents the height of Shape, in unit of pixel.

width

Number

 

Represents the width of Shape, in unit of pixel.

Returns

Shape A Shape object.

addShapeInChart(type, placement, left, top, right, bottom, imageData)

Add a shape to chart .All unit is 1/4000 of chart area.

Parameters

Name Type Optional Description

type

Number

 

MsoDrawingType

placement

Number

 

PlacementType

left

Number

 

In unit of 1/4000 chart area width.

top

Number

 

In unit of 1/4000 chart area height.

right

Number

 

In unit of 1/4000 chart area width.

bottom

Number

 

In unit of 1/4000 chart area height.

imageData

Array of byte

 

If the shape is not a picture or ole object,imageData should be null.

addShapeInChart(type, placement, left, top, right, bottom)

Add a shape to chart .All unit is 1/4000 of chart area.

Parameters

Name Type Optional Description

type

Number

 

MsoDrawingType

placement

Number

 

PlacementType

left

Number

 

In unit of 1/4000 chart area width.

top

Number

 

In unit of 1/4000 chart area height.

right

Number

 

In unit of 1/4000 chart area width.

bottom

Number

 

In unit of 1/4000 chart area height.

addShapeInChartByScale(type, placement, left, top, right, bottom)

Add a shape to chart. All unit is percent scale of chart area.

Parameters

Name Type Optional Description

type

Number

 

MsoDrawingType

placement

Number

 

PlacementType

left

Number

 

Unit is percent scale of chart area width.

top

Number

 

Unit is percent scale of chart area height.

right

Number

 

Unit is percent scale of chart area width.

bottom

Number

 

Unit is percent scale of chart area height.

addShapeInChartByScale(type, placement, left, top, right, bottom, imageData)

Add a shape to chart .All unit is 1/4000 of chart area.

Parameters

Name Type Optional Description

type

Number

 

MsoDrawingType

placement

Number

 

PlacementType

left

Number

 

Unit is percent scale of chart area width.

top

Number

 

Unit is percent scale of chart area height.

right

Number

 

Unit is percent scale of chart area width.

bottom

Number

 

Unit is percent scale of chart area height.

imageData

Array of byte

 

If the shape is not a picture or ole object,imageData should be null.

addSpinner(upperLeftRow, top, upperLeftColumn, left, height, width) → Spinner

Adds a Spinner to the worksheet.

Parameters

Name Type Optional Description

upperLeftRow

Number

 

Upper left row index.

top

Number

 

Represents the vertical offset of Spinner from its left row, in unit of pixel.

upperLeftColumn

Number

 

Upper left column index.

left

Number

 

Represents the horizontal offset of Spinner from its left column, in unit of pixel.

height

Number

 

Represents the height of Spinner, in unit of pixel.

width

Number

 

Represents the width of Spinner, in unit of pixel.

Returns

Spinner A Spinner object.

addSvg(upperLeftRow, top, upperLeftColumn, left, height, width, svgData, compatibleImageData) → Picture

Adds svg image.

Parameters

Name Type Optional Description

upperLeftRow

Number

 

Upper left row index.

top

Number

 

Represents the vertical offset of shape from its left row, in unit of pixel.

upperLeftColumn

Number

 

Upper left column index.

left

Number

 

The horizontal offset of shape from its left column, in unit of pixel.

height

Number

 

The height of shape, in unit of pixel.

width

Number

 

The width of shape, in unit of pixel.

svgData

Array of byte

 

The svg image data.

compatibleImageData

Array of byte

 

Converted image data from svg in order to be compatible with Excel 2016 or lower versions.

Returns

Picture 

addTextBox(upperLeftRow, top, upperLeftColumn, left, height, width) → TextBox

Adds a text box to the worksheet.

Parameters

Name Type Optional Description

upperLeftRow

Number

 

Upper left row index.

top

Number

 

Represents the vertical offset of textbox from its left row, in unit of pixel.

upperLeftColumn

Number

 

Upper left column index.

left

Number

 

Represents the horizontal offset of textbox from its left column, in unit of pixel.

height

Number

 

Represents the height of textbox, in unit of pixel.

width

Number

 

Represents the width of textbox, in unit of pixel.

Returns

TextBox A TextBox object.

addTextBoxInChart(top, left, height, width) → TextBox

Adds a textbox to the chart.

Parameters

Name Type Optional Description

top

Number

 

Represents the vertical offset of textbox from the upper left corner in units of 1/4000 of the chart area.

left

Number

 

Represents the vertical offset of textbox from the upper left corner in units of 1/4000 of the chart area.

height

Number

 

Represents the height of textbox, in units of 1/4000 of the chart area.

width

Number

 

Represents the width of textbox, in units of 1/4000 of the chart area.

Returns

TextBox A TextBox object.

addTextEffect(effect, text, fontName, size, fontBold, fontItalic, upperLeftRow, top, upperLeftColumn, left, height, width) → Shape

Inserts a WordArt object.

Parameters

Name Type Optional Description

effect

Number

 

MsoPresetTextEffect

text

String

 

The WordArt text.

fontName

String

 

The font name.

size

Number

 

The font size

fontBold

boolean

 

Indicates whether font is bold.

fontItalic

boolean

 

Indicates whether font is italic.

upperLeftRow

Number

 

Upper left row index.

top

Number

 

Represents the vertical offset of shape from its left row, in unit of pixel.

upperLeftColumn

Number

 

Upper left column index.

left

Number

 

Represents the horizontal offset of shape from its left column, in unit of pixel.

height

Number

 

Represents the height of shape, in unit of pixel.

width

Number

 

Represents the width of shape, in unit of pixel.

Returns

Shape Returns a Shape object that represents the new WordArt object.

addTextEffectInChart(effect, text, fontName, size, fontBold, fontItalic, top, left, height, width) → Shape

Inserts a WordArt object to the chart

Parameters

Name Type Optional Description

effect

Number

 

MsoPresetTextEffect

text

String

 

The WordArt text.

fontName

String

 

The font name.

size

Number

 

The font size

fontBold

boolean

 

Indicates whether font is bold.

fontItalic

boolean

 

Indicates whether font is italic.

top

Number

 

Represents the vertical offset of shape from the upper left corner in units of 1/4000 of the chart area.

left

Number

 

Represents the vertical offset of shape from the upper left corner in units of 1/4000 of the chart area.

height

Number

 

Represents the height of shape, in units of 1/4000 of the chart area.

width

Number

 

Represents the width of shape, in units of 1/4000 of the chart area.

Returns

Shape Returns a Shape object that represents the new WordArt object.

addWordArt(style, text, upperLeftRow, top, upperLeftColumn, left, height, width) → Shape

Adds preset WordArt since Excel 2007.s

Parameters

Name Type Optional Description

style

Number

 

PresetWordArtStyle

text

String

 

The text.

upperLeftRow

Number

 

Upper left row index.

top

Number

 

Represents the vertical offset of shape from its left row, in unit of pixel.

upperLeftColumn

Number

 

Upper left column index.

left

Number

 

Represents the horizontal offset of shape from its left column, in unit of pixel.

height

Number

 

Represents the height of shape, in unit of pixel.

width

Number

 

Represents the width of shape, in unit of pixel.

Returns

Shape 

clear()

Clear all shapes.

contains()

Reserved for internal use.

copyCommentsInRange(shapes, ca, destRow, destColumn)

Copy all comments in the range.

Parameters

Name Type Optional Description

shapes

ShapeCollection

 

The source shapes.

ca

CellArea

 

The source range.

destRow

Number

 

The dest range start row.

destColumn

Number

 

The dest range start column.

copyInRange(sourceShapes, ca, destRow, destColumn, isContained)

Copy shapes in the range to destination range.

Parameters

Name Type Optional Description

sourceShapes

ShapeCollection

 

Source shapes.

ca

CellArea

 

The source range.

destRow

Number

 

The dest row index of the dest range.

destColumn

Number

 

The dest column of the dest range.

isContained

boolean

 

Whether only copy the shapes which are contained in the range. If true,only copies the shapes in the range. Otherwise,it works as MS Office.

deleteInRange(ca)

Delete shapes in the range.Comment shapes will not be deleted.

Parameter

Name Type Optional Description

ca

CellArea

 

The range.If the shapes are contained in the range, they will be removed.

deleteShape(shape)

Delete a shape. If the shape is in the group or is a comment shape, it will not be deleted.

Parameter

Name Type Optional Description

shape

Shape

 

get(index) → Shape

Gets the shape object at the specific index.

Parameter

Name Type Optional Description

index

Number

 

Returns

Shape 

get(name) → Shape

Gets the shape object by the shape image

Parameter

Name Type Optional Description

name

String

 

Returns

Shape 

get()

Reserved for internal use.

getCount()

group(groupItems) → GroupShape

Group the shapes. The shape in the groupItems should not be grouped. The shape must be in this Shapes collection.

Parameter

Name Type Optional Description

groupItems

Array of Shape

 

the group items.

Returns

GroupShape Return the group shape.

indexOf()

Reserved for internal use.

iterator()

remove(shape)

Remove the shape.

Parameter

Name Type Optional Description

shape

Shape

 

removeAt(index)

Remove the shape.

Parameter

Name Type Optional Description

index

Number

 

The index of the shape.

ungroup(group)

Ungroups the shape items. If the group shape is grouped by another group shape,nothing will be done.

Parameter

Name Type Optional Description

group

GroupShape

 

The group shape.

updateSelectedValue()

Update the selected value by the value of the linked cell of the shapes.

static

addPictureFromStream(pictures, upperLeftRow, upperLeftColumn, lowerRightRow, lowerRightColumn, stream, callback) → object

Adds a picture to the collection.

Example

var aspose = aspose || {};
aspose.cells = require("aspose.cells");
var fs = require("fs");
var workbook = new aspose.cells.Workbook();
var shapes = workbook.getWorksheets().get(0).getShapes();
var shapeStream = fs.createReadStream("boxing.PNG");
aspose.cells.ShapeCollection.addPictureFromStream(shapes, 1, 1, 10, 5, shapeStream,
function(picture, err) {
if (!err) {
console.log("addPictureFromStream done");
}
workbook.save('result.xlsx');
}
);

Parameters

Name Type Optional Description

pictures

PictureCollection

 

The PictureCollection object

upperLeftRow

Number

 

Upper left row index

upperLeftColumn

Number

 

Upper left column index

lowerRightRow

Number

 

Lower right row index

lowerRightColumn

Number

 

Lower right column index

stream

ReadableStream

 

Stream object which contains the image data

callback

Callback

 

The callback function

Returns

object Returns a Picture objct

static

addPictureFromStream(pictures, upperLeftRow, upperLeftColumn, stream, widthScale, heightScale, callback) → object

Adds a picture to the collection.

Example

var aspose = aspose || {};
aspose.cells = require("aspose.cells");
var fs = require("fs");
var workbook = new aspose.cells.Workbook();
var shapes = workbook.getWorksheets().get(0).getShapes();
var shapeStream = fs.createReadStream("boxing.PNG");
aspose.cells.ShapeCollection.addPictureFromStream(shapes, 1, 1, shapeStream, 80, 60,
function(picture, err) {
if (!err) {
console.log("addPictureFromStream done");
}
workbook.save('result.xlsx');
}
);

Parameters

Name Type Optional Description

pictures

PictureCollection

 

The PictureCollection object

upperLeftRow

Number

 

Upper left row index

upperLeftColumn

Number

 

Upper left column index

stream

ReadableStream

 

Stream object which contains the image data

widthScale

Number

 

Scale of image width, a percentage

heightScale

Number

 

Scale of image height, a percentage

callback

Callback

 

The callback function

Returns

object Returns a Picture objct

static

addPictureInChartFromStream(pictures, top, left, stream, widthScale, heightScale, callback) → object

Adds a picture to the chart.

Example

var aspose = aspose || {};
aspose.cells = require("aspose.cells");
var fs = require("fs");
var workbook = new aspose.cells.Workbook("Book2.xlsx");
var shapes = workbook.getWorksheets().get("Chart").getCharts().get(0).getShapes();
var shapeStream = fs.createReadStream("boxing.PNG");
aspose.cells.ShapeCollection.addPictureInChartFromStream(shapes, 1, 1, shapeStream, 10, 5,
function(picture, err) {
if (!err) {
console.log("addPictureInChartFromStream done");
}
workbook.save('result.xlsx');
}
);

Parameters

Name Type Optional Description

pictures

PictureCollection

 

The PictureCollection object

top

Number

 

Represents the vertical offset of shape from the upper left corner in units of 1/4000 of the chart area

left

Number

 

Represents the horizontal offset of shape from the upper left corner in units of 1/4000 of the chart area

stream

ReadableStream

 

Stream object which contains the image data

widthScale

Number

 

Scale of image width, a percentage

heightScale

Number

 

Scale of image height, a percentage

callback

Callback

 

The callback function

Returns

object Returns a Picture objct