B4J Question Poi Excel - Saving

rodmcm

Active Member
Licensed User
My program creates a work book and allows the user multiple data saves, each set of data to a new sheet

The problem is how to call wb.Save(Dir,Filename).

I can't call it after each sheet is populated as I get an error 'Stream Closed" for any subsequent save

I can put a button called Save on the screen to do this, but the problem is that I cannot control when the user will hit it. It could be
after he saves sheet 0, so evoking an error on his next sheet save, or the user could quit the program ( top right cross) at any time so loosing all his data.

I need a way to finally save the workbook when he quits
I tried saving the workbook after each sheet save and reopening at each subsequent sheet save. This also gives the error

Any ideas to get around this?

B4X:
Sub OpenExistWorkbook
    Log("Open Existing Workbook")
    If wb.IsInitialized = False Then
        wb.InitializeExisting(Folder, WorkBookName,"")
    End If
End Sub
 
Top