for this line:
c.WidthPercentage = 100F
i am getting this error:
Error 1 'WidthPercentage' is not a member of 'iTextSharp.text.Table'.
here's the entire code. it's taken directly from the tutorial
Imports System Imports System.Drawing Imports System.IO Imports iTextSharp.text Imports iTextSharp.text.pdf Namespace iTextSharp.tutorial.Chap05
Public Class Chap0514
Public Sub New()
Console.WriteLine("Chapter 5 example 14: nested tables")
Dim document As Document = New Document
Try
PdfWriter.GetInstance(document, New FileStream("Chap0514.pdf", FileMode.Create))
document.Open
Dim secondTable As Table = New Table(2)
secondTable.AddCell("2nd table 0.0")
secondTable.AddCell("2nd table 0.1")
secondTable.AddCell("2nd table 1.0")
secondTable.AddCell("2nd table 1.1")
Dim aTable As Table = New Table(4, 4)
aTable.AutoFillEmptyCells = True
aTable.AddCell("2.2", New Point(2, 2))
aTable.AddCell("3.3", New Point(3, 3))
aTable.AddCell("2.1", New Point(2, 1))
aTable.InsertTable(secondTable, New Point(1, 3))
document.Add(aTable)
Dim thirdTable As Table = New Table(2)
thirdTable.AddCell("3rd table 0.0")
thirdTable.AddCell("3rd table 0.1")
thirdTable.AddCell("3rd table 1.0")
thirdTable.AddCell("3rd table 1.1")
aTable = New Table(5, 5)
aTable.AutoFillEmptyCells = True
aTable.AddCell("2.2", New Point(2, 2))
aTable.AddCell("3.3", New Point(3, 3))
aTable.AddCell("2.1", New Point(2, 1))
aTable.InsertTable(secondTable, New Point(1, 3))
aTable.InsertTable(thirdTable, New Point(6, 2))
document.Add(aTable)
Dim a As Table = New Table(2)
a.Widths = New Single() {85, 15}
a.AddCell("a-1")
a.AddCell("a-2")
Dim b As Table = New Table(5)
b.Widths = New Single() {15, 7, 7, 7, 7}
b.AddCell("b-1")
b.AddCell("b-2")
b.AddCell("b-3")
b.AddCell("b-4")
b.AddCell("b-5")
Dim c As Table = New Table(3, 1)
c.WidthPercentage = 100F
c.Widths = New Single() {20, 2, 78}
c.InsertTable(a, New Point(0, 0))
c.InsertTable(b, New Point(0, 2))
document.Add(c)
Dim t1 As Table = New Table(3)
t1.AddCell("1.1")
t1.AddCell("1.2")
t1.AddCell("1.3")
Dim t2 As Table = New Table(2)
t2.AddCell("2.1")
t2.AddCell("2.2")
t1.InsertTable(t2)
t1.AddCell("new cell")
document.Add(t1)
t1 = New Table(2, 2)
Dim i As Integer = 0
While i < 4
t1.AddCell("t1")
System.Math.Min(System.Threading.Interlocked.Increment(i),i-1)
End While
t2 = New Table(3, 3)
i= 0
While i < 9
If i = 4 Then
t2.InsertTable(t1)
Else
t2.AddCell("t2")
End If
System.Math.Min(System.Threading.Interlocked.Increment(i),i-1)
End While
Dim t3 As Table = New Table(4, 4)
i= 0
While i < 16
If i = 10 Then
t3.InsertTable(t2)
Else
t3.AddCell("t3")
End If
System.Math.Min(System.Threading.Interlocked.Increment(i),i-1)
End While
document.Add(t3)
Catch de As DocumentException
Console.Error.WriteLine(de.Message)
Catch ioe As IOException
Console.Error.WriteLine(ioe.Message)
End Try
document.Close
End Sub
End Class
End Namespace