Xojo PDF Table Basic Syntax

Hello all,

I’m updating a Xojo app. I’m using Xojo’s server based PDF implementation.

Would someone be so kind as to tell me what I’m doing wrong here in attempting to construct a basic table.

Var d As New PDFDocument(PDFDocument.PageSizes.A4)
Var g As Graphics = d.Graphics
Var t As New PDFTable
t.ColumnCount = 3
t.ColumnWidths = "150,150,150"
Var tds As PDFTableDataSource
tds.PaintHeaderContent(g.DrawText("ColOneHeader", 10, 25, 150), 0)
tds.PaintHeaderContent(g.DrawText("ColTwoHeader", 10, 25, 150), 1)
tds.PaintHeaderContent(g.DrawText("ColThreeHeader", 10, 25, 150), 2)

tds.PaintCell(g.DrawText("RowOneColOne", 10, 50, 150), 0, 0)
tds.PaintCell(g.DrawText("RowOneColTwo", 160, 50, 150), 0, 1)
tds.PaintCell(g.DrawText("RowOneColThree", 310, 50, 150), 0, 2)

tds.PaintCell(g.DrawText("RowTwoColOne", 10, 75, 150), 0, 0)
tds.PaintCell(g.DrawText("RowTwoColTwo", 160, 75, 150), 0, 1)
tds.PaintCell(g.DrawText("RowTwoColThree", 310, 75, 150), 0, 2)

t.DataSource = tds
d.AddTable(t, 40, 40)

wf = New WebFile
wf.Data = d.ToData
wf.MIMEType = "application/pdf"
WebDialog11.HTMLViewer1.LoadURL(wf.URL)
WebDialog11.Show

I’m not 100% sure on how to correctly use PaintHeader / PaintCell.

I couldn’t find a basic example in the docs.

Thank you!

Kind regards, Andrew

Sorry everything I’ve done has been around for some time and is based on DynaPDF from MBS

Thank you Norman, I appreciate your response.

I’ve used a bunch of other solutions as well, however I had previously coded this particular document (a long legal template) in Xojo’s PDF implementation, and just hoped to add a few bespoke tables to update it.

To be fair Javier Menendez (Xojo) had produced some really nice blogs on the more complex features (including using RowSet/s to populate tables - which @DaveS referred to in another post), however the basic docs are really lacking in respect of basic table implementations.

I’m sure it’s something obvious…

Kind regards, Andrew

BTW…I didn’t get a chance to comment on the question you recently posed on the future of INN…I’m an avid reader, infrequent poster but do really enjoy the format and discussion. Particularly like hearing what people are experimenting with or moving too.