我想用iTextSharp將表格添加到文檔。這裏有一個例子:iTextSharp表格寬度100%的頁面
Document document = new Document(PageSize.LETTER,72, 72, 72, 72);
PdfWriter writer = PdfWriter.GetInstance(document, new FileStream("C:\\test.pdf", FileMode.Create));
document.Open();
Table table = new Table (2, 1);
table.Width = document.RightMargin - document.LeftMargin;
// Cell placeholder
Cell cell = new Cell (new Paragraph ("Some Text"));
table.AddCell (cell);
cell = new Cell (new Paragraph ("More Text"));
table.AddCell (cell);
document.Add (table);
document.Close ();
我設置表格的寬度,以便它應該擴展頁邊距。但是,當pdf創建時,表格只佔邊距之間80%的空間。我在這裏做錯了什麼嗎?
[5.5.9] TotalWidth不是一個靜態值 - 它只是對象屬性。 – MaLiN2223 2016-05-03 21:11:15