DynaPDFTableMBS images

Does anyone know how to insert images into a DynaPDFTableMBS cell?

I keep getting ‘there is more than one item of this name and it is not clear to which this refers’

The SetCellImageData function comes in two forms, one which asks for a memoryblock, and one that asks for a string
(Wish I could just supply the name of a picture!)

[quote]method SetCellImageData(Row as Integer, Column as Integer, ForeGround as boolean, HAlign as Integer, VAlign as Integer, Width as double, Height as Double, ImageData as MemoryBlock, index as integer = 0) as boolean
method SetCellImageData(Row as Integer, Column as Integer, ForeGround as boolean, HAlign as Integer, VAlign as Integer, Width as double, Height as Double, ImageData as string, index as integer = 0) as boolean[/quote]

Doesn’t matter what I provide, it doesn’t seem to be able to work out which version to call.

Here is my current code: (zipp is an image in my project)

dim m as memoryblock m = zipp.GetData(Picture.FormatJPEG) call table.SetCellImageData(rownum,cx,true,0,0,64,64,m.StringValue,0)
Ive also tried this

dim m as memoryblock m = zipp.GetData(Picture.FormatJPEG) call table.SetCellImageData(rownum,cx,true,0,0,64,64,m,0)

Long shot:
try casting m to MemoryBlock in your second example.

The plugin takes image data (JPEG, PNG, TIFF, etc.) as memoryblock or string to avoid extra conversion from string to memoryblock or from memoryblock to string.

ah, and if xojo is confused, try putting the width and height in double variables first and pass those.

       call table.SetCellImageData(rownum,cx,true,0.001,0.001,64.0001,64.00001,m.StringValue,0)

Same error

dim m as memoryblock dim w, h as double w = 64 h = 64 m = zipp.GetData(Picture.FormatJPEG) call table.SetCellImageData(rownum,cx,true,0.001,0.001,w,h,m,0)

same error

[code]    dim w, h as double
    dim s as string
    s = zipp.GetData(Picture.FormatJPEG)
    w = 64
    h = 64
    
    call table.SetCellImageData(rownum,cx,true,0.001,0.001,w,h,s,0)[/code]

same error

[code] dim w, h as double
dim s as string
s = PictureToJPEGStringMBS(zipp, 80)
w = 64
h = 64

    call table.SetCellImageData(rownum,cx,true,0.001,0.001,w,h,s,0)[/code]

These are the right parameter types, but the overload doesn’t seem to be able to distinguish between a string and a memoryblock

Well, looks like we can only categorise this as a bug.
The only worked image example I can find for DynaPDFTableMBS uses a call that inserts an image from a file.
I have lots of different images to insert.
…thinks…

this works:

dim m as memoryblock
dim w, h as double
dim s as string
dim rownum as integer
dim cx as integer

w = 64
h = 64
s = “test”
m = s

dim table as DynaPDFTableMBS

call table.SetCellImageData(rownum,cx,true,table.kcoCenter,table.kcoCenter,w,h,m,0)

call table.SetCellImageData(rownum,cx,true,table.kcoCenter,table.kcoCenter,w,h,s,0)

you had 0.001 for the alignment which is a double, but we need an integer and the right value

I originally had integers until you suggested [quote]try putting the width and height in double variables first and pass those.[/quote]
I had changed 4 parameters to doubles instead of just two.
Strange that I get a message about unclear which, since neither of the variations would have matched: I would have expected a message like Type Mismatch if it was that fussy about integers being used where a double is expected.

But Thanks…

Just a note to say its working fine now.
In the interim I had resorted to using the version that loads images from disc, which meant saving them all to TEMP first.
This is much better, as is the whole DynaPDFTable method of creating tables.
.HasMore is wonderful!

Thanks.