Android Question Read / Write Excel files on Android

fabio55

Member
Licensed User
Longtime User
I did follow the example given at:
https://www.b4x.com/android/forum/threads/read-write-excel-files-on-android.25632/
I need the excel table to be drawn a little bit down the page. This to allow an editing text box on top of the table itself. There is a Table class in the example but if a change the SV (the internal scroll view) top property I get an error..The best wold be to place the table inside a panel or a TabHost, but how to do that?
 

fabio55

Member
Licensed User
Longtime User
See "similar threads" above this post :)
Ok, thanks very much for the suggestion. Looking on the links I found the table has a AddToActivity method where I can set the inner panel position.
For example: table1.AddToActivity(Activity, 0, 20%y, 100%x, 75%y)
 
Upvote 0

KMatle

Expert
Licensed User
Longtime User
There is a sub you can call (you can find it in the "Table" module:

B4X:
Public Sub SetColumnsWidths(Widths() As Int)
    Dim v As View
    For i = 0 To Widths.Length - 1
        v = Header.GetView(i)
        v.Width = Widths(i) - 1dip
        If i > 0 Then
            v.Left = Header.GetView(i-1).Left + Widths(i-1) + 1dip
        End If
    Next
    Dim lbls() As Label
    For i = 0 To visibleRows.Size - 1
        lbls = visibleRows.GetValueAt(i)
        For lbl = 0 To lbls.Length - 1
            lbls(lbl).SetLayout(Header.GetView(lbl).Left, lbls(lbl).Top, _
                Header.GetView(lbl).Width, RowHeight)
        Next
    Next
End Sub

You can set the culumn width's by calling it with an array.

B4X:
Table1.SetColumnsWidths(Array As Int(100dip, 30dip, 30dip, 100%x - 160dip)

In the module you can modify the code to set anything you want (almost)
 
Upvote 0
Top