在 itextsharp 中使用表时出现问题
我正在尝试在 asp.net c# 中使用 itextsharp 生成 pdf 文件。
我在 itextsharp 中遇到了表概念,我正在尝试使用它,即我的应用程序。我在使用表格时遇到以下问题。
包含 Name of 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);
请帮助我解决我的问题。
i am trying to generate a pdf file using itextsharp in asp.net c#.
I came across table concept in itextsharp n i am trying to use it ie my application. I am having the following problem while using tables.
The pdf cell which contains Name of treasery
the word treasery comes on next line. I am setting width for each cell. if i increase the width than also no changes come. The gap which is shown using arrow in below image remain as it is al the time. Why is that gap?How to remove that gap?
I want a dotted line as a border to only one cell. how to do that?here is my code
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);
Please help me to resolve my problem.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这对我来说是这样的。
This did it for me.
增加列的宽度。
Increase the width of the column.