aspose.cells

Class PictureCollection

Encapsulates a collection of Picture objects.

Property Getters/Setters Summary
functiongetCount()
functionget(index)
Gets the Picture element at the specified index.
 
Method Summary
functionadd(upperLeftRow, upperLeftColumn, lowerRightRow, lowerRightColumn, fileName)
Adds a picture to the collection.
functionadd(upperLeftRow, upperLeftColumn, fileName)
Adds a picture to the collection.
functionadd(upperLeftRow, upperLeftColumn, fileName, widthScale, heightScale)
Adds a picture to the collection.
static functionaddPictureFromStream(pictures, upperLeftRow, upperLeftColumn, lowerRightRow, lowerRightColumn, stream, callback)
Adds a picture to the collection.
static functionaddPictureFromStream(pictures, upperLeftRow, upperLeftColumn, stream, callback)
Adds a picture to the collection.
static functionaddPictureFromStream(pictures, upperLeftRow, upperLeftColumn, stream, widthScale, heightScale, callback)
Adds a picture to the collection.
functionclear()
Clear all pictures.
functioncontains(value)
Reserved for internal use.
functionget(index)
Reserved for internal use.
functionindexOf(value)
Reserved for internal use.
functioniterator()
functionremoveAt(index)
Remove shapes at the specific index
 

    • Property Getters/Setters Detail

      • getCount : Number 

        function getCount()
        
      • get : Picture 

        function get(index)
        
        Gets the Picture element at the specified index.
        Parameters:
        index - The zero based index of the element.
        Returns:
        The element at the specified index.
    • Method Detail

      • add

        function add(upperLeftRow, upperLeftColumn, lowerRightRow, lowerRightColumn, fileName)
        Adds a picture to the collection.
        Parameters:
        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:
        Picture object index.
      • add

        function add(upperLeftRow, upperLeftColumn, fileName)
        Adds a picture to the collection.
        Parameters:
        upperLeftRow: Number - Upper left row index.
        upperLeftColumn: Number - Upper left column index.
        fileName: String - Image filename.
        Returns:
        Picture object index.
      • add

        function add(upperLeftRow, upperLeftColumn, fileName, widthScale, heightScale)
        Adds a picture to the collection.
        Parameters:
        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:
        Picture object index.
      • clear

        function clear()
        Clear all pictures.
      • removeAt

        function removeAt(index)
        Remove shapes at the specific index
      • iterator

        function iterator()
      • get

        function get(index)
        Reserved for internal use.
      • contains

        function contains(value)
        Reserved for internal use.
      • indexOf

        function indexOf(value)
        Reserved for internal use.
      • addPictureFromStream

        static function addPictureFromStream(pictures, upperLeftRow, upperLeftColumn, lowerRightRow, lowerRightColumn, stream, callback)
        Adds a picture to the collection.
        Parameters:
        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:
        Picture object index.

        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');
            }
        );
        				
      • addPictureFromStream

        static function addPictureFromStream(pictures, upperLeftRow, upperLeftColumn, stream, callback)
        Adds a picture to the collection.
        Parameters:
        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
        callback: Callback - The callback function
        Returns:
        Picture object index.

        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');
            }
        );
        				
      • addPictureFromStream

        static function addPictureFromStream(pictures, upperLeftRow, upperLeftColumn, stream, widthScale, heightScale, callback)
        Adds a picture to the collection.
        Parameters:
        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:
        Picture object index.

        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');
            }
        );