Android Tutorial Read / Write Excel files on Android

Status
Not open for further replies.

Pilar-JLSineriz

Active Member
Licensed User
Longtime User
It's possible to change the header name of each column?? For example, change "A", "B".. by "Type 1", "Type 2" since the code? Thanks
 

Bimal Gautam

New Member
Hi! I'm new in b4a. I've download the sample and try to run. I've got following error message.

B4A version: 5.80
Parsing code. Error
Error parsing program.
Error description: Unknown type: readableworkbook
Are you missing a library reference?
Occurred on line: 37 (Main)
Dim workbook1 As ReadableWorkbook

I've download ExcelLibrary.zip and copied both file to library folder.
I also copied the jxl.jar into library folder.

please help me.
 

sailorgg

New Member
Licensed User
Longtime User
Dear Erel
Title line item number for a long time, can not fully display the content, how to add about worksheet scroll bar, thank you!
 

joop

Active Member
Licensed User
Longtime User
I tried the example with book1.xls file , see image excel_on_PC.jpg
every column is adjusted to the right column-width on the PC screen.





When I try this on a tab, the screen is like the image excel_on_tab.jpg
Now all the columns widths are changed and not adjusted to the column widths.



When I try to change the column widths in the source nothing happens .
(first save and then load)
cellFormat.HorizontalAlignment = cellFormat.HALIGN_FILL
or sheet1.SetColumnWidth(1, Width) .

The only thing I can change is the cell value.

How can I change the columnwidth for each column ?.
 

joop

Active Member
Licensed User
Longtime User
Ah now I understand why nothing happened .

Yes I got it ,found the TableExample ,thanks.
 
Last edited:

Wolli013

Well-Known Member
Licensed User
Longtime User
Sorry for my English
What is wrong?

B4X:
Sub TestEmail

    Dim Testbook1 As WritableWorkbook
    Testbook1.Initialize(File.DirRootExternal, "Excel.xls")

    Dim TestSheet As WritableSheet
    TestSheet = Testbook1.AddSheet("Test", 0)
   
    Dim TestCell As WritableCell
   
    TestCell.InitializeNumber(0, 0, 1)
    TestSheet.AddCell(TestCell)
    TestCell.InitializeNumber(1, 0, 2)
    TestSheet.AddCell(TestCell)
    TestCell.InitializeNumber(2, 0, 3)
    TestSheet.AddCell(TestCell)
    TestCell.InitializeNumber(3, 0, 4)
    TestSheet.AddCell(TestCell)
    TestCell.InitializeNumber(4, 0, 5)
    TestSheet.AddCell(TestCell)
    TestCell.InitializeNumber(5, 0, 6)
    TestSheet.AddCell(TestCell)
    TestCell.InitializeFormula(5, 2, "8+5") 'Geht
    TestCell.InitializeFormula(5, 2,"sum(B1+D1)") 'Geht nicht
    TestSheet.AddCell(TestCell)
    Testbook1.Write
    Testbook1.Close

End Sub
 

rboeck

Well-Known Member
Licensed User
Longtime User
Ohne es zu prüfen: entweder du verwendest B1+D1 oder sum(B1:d1); das Innere der Summenformel sollte eine Bereichsangabe sein und nicht selbst eine Summe bilden...
 

Wolli013

Well-Known Member
Licensed User
Longtime User
Danke, das erste geht B1+D1
TestCell.InitializeFormula(5, 3,"B1+D1") 'Geht

das zweite leider nicht sum(B1:d1)
TestCell.InitializeFormula(5, 4,"SUM(B1:d1)") 'Geht nicht
 

rboeck

Well-Known Member
Licensed User
Longtime User
Falls man es in Excel direkt schreibt, müsste man es so schreiben: "=summe(B1:d1)". Vielleicht klappt das.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…