B4J Question jPOI SetImage

Fernando Solá

Member
Licensed User
I've been working without any issue using jPOI to build Excel Workbooks and Sheets. Haven't found any issue with CellStyles and everything works pretty good. BUT I've encountered problems with images. The images are added to the workbook no problem, but when I place them on the sheet I can't seem to make them fall into the area specified by the rows and columns on the SetImage method for the PoiSheet Object. Am I missing something? I'm attaching a screen capture showing the issue. The image is always shown way smaller than it's original and intended size (of 11 columns and 6 rows). Thanks in advance for any help and pointers.

Image inserting into Excel sheet sample:
    Dim workbook_Temp As PoiWorkbook
    Dim sheet_Temp As PoiSheet
    Dim int_ImageNumber As Int
    
    workbook_Temp.InitializeNew(True)
    int_ImageNumber=workbook_Temp.AddImage(File.DirApp,"testimage.png")
    
    sheet_Temp = workbook_Temp.AddSheet("Testing sheet",0)
    
    For i = 0 To 10
        Dim row_Temp As PoiRow = sheet_Temp.CreateRow(i)
        For j = 0 To 10
            Dim cell_Temp As PoiCell = row_Temp.CreateCellString(j,"")
        Next
    Next

    sheet_Temp.SetImage(int_ImageNumber,0,0,10,5)
    
    workbook_Temp.Save(File.DirApp,"test.xlsx")
    workbook_Temp.Close
    fx.ShowExternalDocument(File.Combine(File.DirApp,"test.xlsx"))

Best regards.
 

Attachments

  • ScreenCap.png
    ScreenCap.png
    13.1 KB · Views: 181
Top