B4J Question Help with jPOI : Error Object should first be initialized

incendio

Well-Known Member
Licensed User
Longtime User
Hello guys,

I have a problem with jPOI, here are my codes :
B4X:
Sub btnStart_Action
    wb.InitializeExisting(File.DirApp,"RcpMonthly.xlsx","")
    ws = wb.GetSheet(0)
    Private row As PoiRow
    Private Cell As PoiCell
   
    row = ws.GetRow(7)
    row.IsInitialized

    Cell = row.GetCell(1)
    Cell.IsInitialized

    Cell.ValueString =  "Java"
    wb.Save(File.DirApp,"test.xlsx")
    fx.Msgbox(MainForm,"OK","Info")
End Sub

It raised an error :
Error occurred on line: 38 (Main)
java.lang.RuntimeException: Object should first be initialized (PoiRow).

Line 38 point to Cell = row.GetCell(1).
Where am I missing here?

Thanks in advance.
 

incendio

Well-Known Member
Licensed User
Longtime User
You mean ws.CreateRow.

I am modifying existing excel sheet, do not want to create new row.
 
Last edited:
Upvote 0

incendio

Well-Known Member
Licensed User
Longtime User
How to modifying existing excel cell? Create New row will lose existing cell format.
 
Upvote 0

incendio

Well-Known Member
Licensed User
Longtime User
Found the reason.

My first codes for modifying cell will work only on an non empty cell.

For an empty cell, no other choice, must use CreateRow, cause there is no initialized method for cell.
 
Last edited:
Upvote 0
Top