B4J Question [XLUtils] It can draw a table(word) like this?

liulifeng77

Active Member
Licensed User
Longtime User
hi,
I came to ask for your help again.
can each cell have a different width?
 

Attachments

  • pu.PNG
    pu.PNG
    3.6 KB · Views: 136

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User
An strict table, as excel defines it, no.

But you could draw such layout with borders. whether that's useful to you its another issue.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
1625815319354.png


B4X:
    doc.Append($"[p]lksadjfklasdjflksdjflksdjkflsdf
    sd
    fsdf klsdfjlksdkfljsdjfklsd[/p]
[table rows=3 cols=20]
    [row]
        ${FirstRow}
    [/row]
    [row]
        [cell ColSpan=2][p Alignment=Center] [/p][/cell]
        [cell ColSpan=4][p Alignment=Center] [/p][/cell]
        [cell ColSpan=6][p Alignment=Center] [/p][/cell]
        [cell ColSpan=4 ][p Alignment=Center] [/p][/cell]
        [cell ColSpan=4 ][p Alignment=Center] [/p][/cell]
    [/row]
    [row]
        [cell ColSpan=1][p Alignment=Center] [/p][/cell]
        [cell ColSpan=8][p Alignment=Center] [/p][/cell]
        [cell ColSpan=2][p Alignment=Center] [/p][/cell]
        [cell ColSpan=4][p Alignment=Center] [/p][/cell]
        [cell ColSpan=5][p Alignment=Center] [/p][/cell]
    [/row]
[/table]
    "$)

Sub FirstRow As String
    Dim sb As StringBuilder
    sb.Initialize
    For i = 1 To 20
        sb.Append("[cell Width=20][p Alignment=Center] [/p][/cell]")
    Next
    Return sb.ToString
End Sub

It might be possible without the first row. The few tests I did without it, didn't work.
 
Upvote 0

liulifeng77

Active Member
Licensed User
Longtime User
thank you for your quick reply. first row must be preserved, otherwise the table format is very strange.but if can't removed the first row, the table is not what I want. ????, Is there a way to hide the first row?
捕获.PNG
 
Upvote 0

Sandman

Expert
Licensed User
Longtime User
Perhaps one could simply set the height of the first row to zero? Or remove the border lines that makes it visible? (Yeah, I know, it's dirty hacks. ?)
 
Upvote 0
Top