Topics   All   MacOS (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Deprecated   Guides   Examples   Videos
New in version: 9.3   9.4   9.5   10.0   10.1   10.2   10.3   10.4   10.5   10.6    Statistic    FMM    Blog  

XL.Sheet.SetPictureWithSize

Sets a picture with pictureId identifier at position row and col with custom size and offsets in pixels.

Component Version macOS Windows Linux Server FileMaker iOS SDK
XL 3.5 Yes Yes Yes Yes Yes
MBS( "XL.Sheet.SetPictureWithSize"; bookRef; sheetIndex; Row; Column; pictureId; width; height { ; X; Y; pos } )   More

Parameters

Parameter Description Example Flags
bookRef The reference to the workbook. Please use XL.LoadBook to load a file. $ref
sheetIndex The index of the sheet. This number ranges from 0 to XL.Book.SheetCount-1. 0
Row The row for the cell. First row has index 0. $row
Column The column for the cell. First column has index 0. $column
pictureId The picture identifier number. $pictureID
width The picture width to use.
Can be -1 or empty for automatic size.
400
height The picture height to use.
Can be -1 or empty for automatic size.
300
X Relative offset. 0 Optional
Y Relative offset. 0 Optional
pos The positioning. 0 = Move and Size, 1 = Move, 2 = Absolute. 0 Optional

Result

Returns OK or error.

Description

Sets a picture with pictureId identifier at position row and col with custom size and offsets in pixels.
Use XL.Book.AddPictureFile or XL.Book.AddPictureContainer for getting a picture identifier.

Width and height can be -1 (or empty) for default size of picture.

Examples

Add a picture to excel sheet:

# add picture to file
Set Variable [$logoID; Value:MBS( "XL.Book.AddPictureContainer"; $book; Writing data::Logo)]
# position with size:
Set Variable [$r; Value:MBS( "XL.Sheet.SetPictureWithSize"; $book; $sheet; 2; 1; $logoID; 100; 100)]
# or with factor:
Set Variable [$r; Value:MBS( "XL.Sheet.SetPictureWithScale"; $book; $sheet; 2; 1; $logoID; .2)]

Adds picture with proportional scaled image:

Set Variable [ $image ; Value: MBS( "GMImage.NewFromContainer"; Writing data::Logo ) ]
If [ MBS("IsError") = 0 ]
    Set Variable [ $destWidth ; Value: 120 ]
    Set Variable [ $destHeight ; Value: 120 ]
    Set Variable [ $width ; Value: MBS( "GMImage.GetWidth"; $image ) ]
    Set Variable [ $height ; Value: MBS( "GMImage.GetHeight"; $image ) ]
    Set Variable [ $r ; Value: MBS( "GMImage.Release"; $image ) ]
    Set Variable [ $factor ; Value: Min ( $destheight / $height; $destwidth / $width ) ]
    Set Variable [ $dwidth ; Value: $width * $factor ]
    Set Variable [ $dheight ; Value: $height * $factor ]
    #
    Set Variable [ $logoID ; Value: MBS( "XL.Book.AddPictureContainer"; $book; Writing data::Logo) ]
    If [ MBS("IsError") = 0 ]
        Set Variable [ $r ; Value: MBS( "XL.Sheet.SetPictureWithSize"; $book; $sheet; 2; 1; $logoID; $dwidth; $dheight) ]
    End If
End If

See also

Example Databases

Created 18th August 2014, last changed 29th July 2019


XL.Sheet.SetPictureWithScale   -   XL.Sheet.SetPrintArea

Feedback: Report problem or ask question.




Links
MBS FileMaker tutorial videos

Start Chat