B4J Question XLUtils: read or view images in XLS

peacemaker

Expert
Licensed User
Longtime User
Hi, All

I did not try it yet, but there is the task to embedd to B4J app a XLS-sheet view, to see pictures column and pick the cell text up near the picture.

Possible with this lib ?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
You can use this code to get the images:
B4X:
Private Sub GetPictures (jworkbook As JavaObject) As List
    Dim lst As List = jworkbook.RunMethod("getAllPictures", Null)
    Dim images As List
    images.Initialize
    For Each pic As JavaObject In lst
        Dim data() As Byte = pic.RunMethod("getData", Null)
        Dim in As InputStream
        in.InitializeFromBytesArray(data, 0, data.Length)
        Dim img As Image
        img.Initialize2(in)
        images.Add(img)
    Next
    Return images
End Sub

Usage example:
B4X:
Dim workbook As XLWorkbookWriter = xl.CreateWriterFromTemplate("C:\Users\H\Downloads\1.xlsx", "")
For Each bmp As B4XBitmap In GetPictures(workbook.jWorkbook)
 '
Next

It doesn't include the picture position. This is more complicated and there could be all kinds of different cases.
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
Yes, it seems it needs to make something like here:

Just getting all the pictures is ... useless, without address.
But it seems, most of POI classes are not wrapped, so it's impossible now to get...

Anyway thanks.
 
Last edited:
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
code to get the images:

Strange situation - after swapping 2 pictures: the order of receiving is not changed. Even If to re-save the file in MS Excel.
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
SOLVED: the code to work with pictures in .XLSX is commercially ordered and written.
If anyone is interested - it can be purchased from me.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…