【发布时间】:2011-07-06 10:25:57
【问题描述】:
我正在尝试在 asp.net c# 中使用 itextsharp 生成一个 pdf 文件。
我在 itextsharp 中遇到了表概念,我正在尝试使用它,即我的应用程序。我在使用表格时遇到以下问题。
包含Name of treasery 单词treasery 的pdf 单元格出现在下一行。我正在为每个单元格设置宽度。如果我增加宽度比也没有变化。下图中使用箭头显示的间隙始终保持不变。为什么会有这个差距?如何消除这个差距?
我想要一条虚线作为一个单元格的边框。怎么做?这是我的代码
PdfPTable line6table = new PdfPTable (3);
float[] width = new float[] { 2.5F, 1.5F, 3.0F };
line6table.SetWidths(width);
line6table.HorizontalAlignment = 0;
line6table.WidthPercentage = 100.0f;
line6table.SpacingBefore = 6.0f;
PdfPCell a1 = new PdfPCell(new Phrase("Head Of Account"));
a1.Border = 1;
a1.Indent = 2.2f;
a1.PaddingTop = 5.0f;
line6table.AddCell(a1);
PdfPCell a2 = new PdfPCell(new Phrase("CHARGED"));
a2.Border = 1;
a2.PaddingTop = 5.0f;
line6table.AddCell(a2);
PdfPCell a3 = new PdfPCell(new Phrase("Name of the treasry"));
a3.Border = 0;
a3.Indent = 15.0f;
a3.RightIndent = 0.0f;
a3.HorizontalAlignment = 1;
line6table.AddCell(a3);
pdfDocument.Add(line6table);
请帮我解决我的问题。
【问题讨论】:
标签: c# asp.net pdf-generation itextsharp