Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Guides   Examples
New in version: 8.5   9.0   9.1   9.2   9.3   9.4   9.5   10.0   10.1   10.2    Statistic  

XL.Book.AddPictureContainer

Adds a picture to the workbook from container.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
XL 3.5 Yes Yes Yes Yes Yes
MBS( "XL.Book.AddPictureContainer"; bookRef; container )   More

Parameters

Parameter Description Example value
bookRef The reference to the workbook. Please use XL.LoadBook to load a file. $ref
container The container value with the image inside. $container

Result

Returns image number or error.

Description

Adds a picture to the workbook from container.
Returns a picture identifier. Supports BMP, DIB, PNG, JPG and WMF picture formats.
Use picture identifier with XL_Sheet_setPicture function.

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 25th July 2019


XL.Book.AddFormat   -   XL.Book.AddPictureFile

Feedback: Report problem or ask question.




Links
MBS FileMaker tutorial videos