LibXL SetPicture

Geert Landuyt Geert at royalbotania.com
Fri May 21 11:28:19 UTC 2021


I'll try that.

Tnx,
Geert

-----Original Message-----
From: omnisdev-en <omnisdev-en-bounces at lists.omnis-dev.com> On Behalf Of Kelly Burgess
Sent: Friday, 21 May 2021 13:26
To: OmnisList <omnisdev-en at lists.omnis-dev.com>
Subject: Re: LibXL SetPicture

Hi Geert,

I see the tip for workbook.$addPicture says "Adds a picture to the workbook. Returns a picture identifier. Supports BMP, DIB, PNG, JPG and WMF picture formats. Use picture identifier with Worksheet.$setPicture(). Returns -1 if error occurs."

Then, in a contradiction to that tip, I see a cell.$setPicture(LongInt pictureID, -- Number scale -or- LongInt height, LongInt width) Sets a picture at position with row and col with scale factor or with custom size.

So it looks to me like $setPicture was originally a sheet method with row and column parameters, but then to simplify that, it became a cell method where the row and column are implicit, and they neglected to change the $addPicture tip's reference to a worksheet method.  $setPicture's tip could have been worded better too, to omit the references to row and col.  There's also error text if parameter 1 is missing that says "First parameter, row, is required.", which might have been true when it was a sheet method, but now parameter 1 is the pictID returned by $addPicture.

The source code shows that if you pass two parameters to $setPicture, it assumes the second is the scale, and if you pass three it assumes the second is height and the third is width.

It does end up calling a sheet API in the LibXL library, i.e. sheet->setPicture(row, col, pictID, width, height); or sheet->setPicture(row, col, pictID, scale); - but you'll need to come up with a cell object in order to use the method.

Kelly
_____________________________________________________________
Manage your list subscriptions at http://lists.omnis-dev.com Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com 


More information about the omnisdev-en mailing list