首先,我將數據放在粗糙的gridview中。
數據是在數據庫上運行存儲過程的結果而獲得的。
然後,我嘗試在表格中添加此數據並嘗試將數據導出爲pdf。使用iText將數據放入表格中
這是我的代碼:
Dim GridView1 As New GridView
Dim pdfDoc As New iTextSharp.text.Document(iTextSharp.text.PageSize.A1, 10.0F, 10.0F, 10.0F, 0.0F)
pdfDoc.Open()
Dim pdfTable As New PdfPTable(3)
For Each row As GridViewRow In GridView1.Rows
Dim Val1 As String = row.Cells(0).Text
Dim Val2 As String = row.Cells(1).Text
Dim Val3 As String = row.Cells(2).Text
Next
pdfDoc.Add(pdfTable)
pdfDoc.Close()
現在我該怎樣將這些值(VAL1,VAL2,VAL3)添加到表,然後導出爲PDF?
請幫忙嗎?
PS:此代碼是通過Google搜索「iText如何創建表格」獲得的。我得到的第一個鏈接是iText7的代碼示例,第二個鏈接是iText5的示例。 請考慮將**更多的努力**在未來自己解決問題。 –