0
對於這條線的成員:widthPercentage寬度百分比不是iTextSharp的
c.WidthPercentage = 100F
我收到此錯誤:
錯誤1 'widthPercentage寬度百分比' 不是 'iTextSharp.text.Table' 的成員。
這是整個代碼。它是直接取自教程
進口系統 進口System.Drawing中 進口System.IO 進口iTextSharp.text 進口iTextSharp.text.pdf 命名空間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
末命名空間
也許你可以回答這個問題呢? http://stackoverflow.com/questions/1331253/i-did-an-imports-error-type-expected – 2009-08-25 22:43:20
也可以請請有你的聯繫方式,我想問你更多的問題itextsharp – 2009-08-25 22:44:01
爲什麼不讓大家看到問題?這就是爲什麼。 – Rowan 2009-08-26 10:15:03