itextsharp表格宽度有问题 [英] itextsharp having problem with table width
本文介绍了itextsharp表格宽度有问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这就是我创建表格的方式,创建表格并发布到pdf中。这个表有5行5列。
我遇到的问题是显示在pdf顶部的表格,我在顶部有一些标题和描述,我怎样才能手动设置位置桌子?
以及我如何调整每列的宽度?
this is how i create my table, the table is created and post into pdf. this table have 5 rows and 5 columns.
the problem i having is the table showing at the top of the pdf, i have some title and description at the top, how can i manually set the position of the table?
and also how can i resize the width of each column?
PdfPTable table = new PdfPTable(5);
PdfPTable pdft;
for (int j = 1; j < 6; j++)
{
for (int i = 1; i < 6; i++)
{
pdft = new PdfPTable(1);
pdft.WidthPercentage = 100f;
pdft.DefaultCell.Border = 0;
pdft.AddCell("C" + j.ToString() + i.ToString());
table.AddCell(pdft);
}
}
pdfDoc.Add(table);
推荐答案
解决,定位,使用
Solved, for positioning, use
Paragraph paragraphTable = new Paragraph();
paragraphTable.SpacingAfter = 10f;
现在仍然存在每列宽度的问题
now still having problem with the width of each column
这篇关于itextsharp表格宽度有问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文