【发布时间】:2017-04-27 19:52:55
【问题描述】:
大家下午好。我有一个问题,涉及在 tablelayoutpanel 中获取数据并使用 iTextSharp 将其放入 .pdf 中(除非有人知道更好的技术)。 tableLayout 面板默认包含 1 列和 1 行,并且根据数据返回的内容动态添加行。
这是我要打印的:
private void btnPrint_Click(object sender, EventArgs e)
{
try
{
SaveFileDialog dialog = new SaveFileDialog();
dialog.Title = "Save file as...";
dialog.Filter = "Pdf File |*.pdf";
if (dialog.ShowDialog() == DialogResult.OK)
{
Document doc = new Document(PageSize.LETTER);
PdfWriter writer = PdfWriter.GetInstance(doc, new FileStream(dialog.FileName, FileMode.Create));
doc.Open();
Paragraph entry1 = new Paragraph("Hello World!");
//Page 1 Printing
PdfPTable LegendsForTable = new PdfPTable(this.tblPnlLayLFT.ColumnCount);
doc.Add(entry1);
doc.Close();
MessageBox.Show("File saved");
}
}
catch (Exception exception)
{
MessageBox.Show(@"ERROR: Issue encountered while trying to print. " + Environment.NewLine
+ @"Contact ITSupport with the following the following error" + Environment.NewLine
+ exception);
}
}
有人知道将tablelayoutpanel 复制到.pdf 的方法吗?
【问题讨论】:
-
“我有一个问题” - 究竟是哪个问题?
-
我的道歉认为这很清楚。问题是有没有人可以将 tablelayoutpanel 复制到 .pdf 的方法?
标签: c# winforms pdf itext tablelayoutpanel