PictureCollection
Source: aspose.
Encapsulates a collection of Picture objects.
Methods
- removeAt()
- addPictureFromStream(pictures, upperLeftRow, upperLeftColumn, lowerRightRow, lowerRightColumn, stream, callback)
- addPictureFromStream(pictures, upperLeftRow, upperLeftColumn, stream, callback)
- addPictureFromStream(pictures, upperLeftRow, upperLeftColumn, stream, widthScale, heightScale, callback)
Methods
add(upperLeftRow, upperLeftColumn, lowerRightRow, lowerRightColumn, fileName) → Number
Adds a picture to the collection. ///
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
upperLeftRow |
Number |
|
Upper left row index. |
|
upperLeftColumn |
Number |
|
Upper left column index. |
|
lowerRightRow |
Number |
|
Lower right row index |
|
lowerRightColumn |
Number |
|
Lower right column index |
|
fileName |
String |
|
Image filename. |
- Returns
-
NumberPicture object index.
add(upperLeftRow, upperLeftColumn, fileName) → Number
Adds a picture to the collection.
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
upperLeftRow |
Number |
|
Upper left row index. |
|
upperLeftColumn |
Number |
|
Upper left column index. |
|
fileName |
String |
|
Image filename. |
- Returns
-
NumberPicture object index.
add(upperLeftRow, upperLeftColumn, fileName, widthScale, heightScale) → Number
Adds a picture to the collection.
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
upperLeftRow |
Number |
|
Upper left row index. |
|
upperLeftColumn |
Number |
|
Upper left column index. |
|
fileName |
String |
|
Image filename. |
|
widthScale |
Number |
|
Scale of image width, a percentage. |
|
heightScale |
Number |
|
Scale of image height, a percentage. |
- Returns
-
NumberPicture object index.
clear()
Clear all pictures.
contains()
Reserved for internal use.
get(index) → Picture
Gets the Picture element at the specified index.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
index |
Number |
|
The zero based index of the element. |
- Returns
-
PictureThe element at the specified index.
get()
Reserved for internal use.
getCount()
indexOf()
Reserved for internal use.
iterator()
removeAt()
Remove shapes at the specific index
addPictureFromStream(pictures, upperLeftRow, upperLeftColumn, lowerRightRow, lowerRightColumn, stream, callback) → Picture
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 pictures = workbook.getWorksheets().add("picture").getPictures();
var pictureStream = fs.createReadStream("boxing.PNG");
aspose.cells.PictureCollection.addPictureFromStream(pictures, 0, 0, 10, 8, pictureStream,
function(index, err) {
if (err) {
console.log("addPictureFromStream error");
return;
}
console.log("picture add index: " + index);
workbook.save('result.xlsx');
console.log('saved to file');
}
);
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
pictures |
|
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
-
PicturePicture object index.
addPictureFromStream(pictures, upperLeftRow, upperLeftColumn, stream, callback) → Picture
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 pictures = workbook.getWorksheets().add("picture").getPictures();
var pictureStream = fs.createReadStream("boxing.PNG");
aspose.cells.PictureCollection.addPictureFromStream(pictures, 0, 0, pictureStream,
function(index, err) {
if (err) {
console.log("addPictureFromStream error");
return;
}
console.log("picture add index: " + index);
workbook.save('result.xlsx');
console.log('saved to file');
}
);
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
pictures |
|
The PictureCollection object |
|
|
upperLeftRow |
Number |
|
Upper left row index |
|
upperLeftColumn |
Number |
|
Upper left column index |
|
stream |
ReadableStream |
|
Stream object which contains the image data |
|
callback |
Callback |
|
The callback function |
- Returns
-
PicturePicture object index.
addPictureFromStream(pictures, upperLeftRow, upperLeftColumn, stream, widthScale, heightScale, callback) → Picture
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 pictures = workbook.getWorksheets().add("picture").getPictures();
var pictureStream = fs.createReadStream("boxing.PNG");
aspose.cells.PictureCollection.addPictureFromStream(pictures, 0, 0, pictureStream, 80, 60,
function(index, err) {
if (err) {
console.log("addPictureFromStream error");
return;
}
console.log("picture add index: " + index);
workbook.save('result.xlsx');
console.log('saved to file');
}
);
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
pictures |
|
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
-
PicturePicture object index.