hi,
I build a exel file using jexcel library in a page, but this file can't be deleted! the system show that the file is in use."the operation could not be completed because the file is already open in java(TM)Plateform SE binary." (translated into English,MY operation system language is Chinese),any suggestions will be aprreciated! thanks!
I build a exel file using jexcel library in a page, but this file can't be deleted! the system show that the file is in use."the operation could not be completed because the file is already open in java(TM)Plateform SE binary." (translated into English,MY operation system language is Chinese),any suggestions will be aprreciated! thanks!
B4X:
Sub SaveTable 'ignore
'first we create a writable workbook.
'the target file should be a NEW file.
Dim newWorkbook As WritableWorkbook
newWorkbook.Initialize(File.DirApp, "1.xls")
Dim sheet1 As WritableSheet
sheet1 = newWorkbook.AddSheet("Movies", 0)
'add the headers to the sheet
'we create a special format for the headers
Dim cellFormat As WritableCellFormat
cellFormat.Initialize2(cellFormat.FONT_ARIAL, 12, True, False, False, _
cellFormat.COLOR_GREEN)
cellFormat.HorizontalAlignment = cellFormat.HALIGN_CENTRE
cellFormat.SetBorder(cellFormat.BORDER_ALL, _
cellFormat.BORDER_STYLE_MEDIUM, cellFormat.COLOR_BLACK)
cellFormat.SetBorder(cellFormat.BORDER_BOTTOM, cellFormat.BORDER_STYLE_THICK, _
cellFormat.COLOR_BLUE)
cellFormat.VertivalAlignment = cellFormat.VALIGN_CENTRE
cellFormat.BackgroundColor = cellFormat.COLOR_GREY_25_PERCENT
Dim col As Int = 0
For i = 0 To 10
Dim cell As WritableCell
cell.InitializeText(col, 0, "test"&i)
cell.SetCellFormat(cellFormat)
sheet1.AddCell(cell)
sheet1.SetColumnWidth(col, 15)
col = col + 1
Next
sheet1.SetColumnWidth(1, 40)
sheet1.SetRowHeight(0, 15)
'add the data
Dim rowsFormat As WritableCellFormat
rowsFormat.Initialize
rowsFormat.HorizontalAlignment = rowsFormat.HALIGN_CENTRE
Dim rowCounter, colCounter As Int
' For Each row() As Object In Table1.Items
' colCounter = 0
' For Each value As Object In row
' Dim cell As WritableCell
' cell.InitializeText(colCounter, rowCounter + 1, value)
' cell.SetCellFormat(rowsFormat)
' sheet1.AddCell(cell)
' colCounter = colCounter + 1
' Next
' rowCounter = rowCounter + 1
' Next
'Must call write and close to save the data.
newWorkbook.Write
newWorkbook.Close
End Sub
......
Sub connectpage()
SaveTable
end sub