Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/258.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# iTextSharp表溢出包装_C#_Itextsharp - Fatal编程技术网

C# iTextSharp表溢出包装

C# iTextSharp表溢出包装,c#,itextsharp,C#,Itextsharp,我正在生成一个两列表。当文本太长时,它不会换行到下一列,而是继续到下一页。当文本溢出时,为什么不换行到同一页的下一列 以下是我所说的: string[] stringList = new string[] {"long string 1", "long string 2"}; Document doc = new Document(PageSize.LETTER); Paragraph paragraph = new Paragraph(); PdfPTable table = new Pdf

我正在生成一个两列表。当文本太长时,它不会换行到下一列,而是继续到下一页。当文本溢出时,为什么不换行到同一页的下一列

以下是我所说的:

string[] stringList = new string[] {"long string 1", "long string 2"};

Document doc = new Document(PageSize.LETTER);
Paragraph paragraph = new Paragraph();
PdfPTable table = new PdfPTable(2);
table.WidthPercentage = 100;
table.SplitLate = false;
foreach (var item in stringList) {
    paragraph.Add(item);
}

PdfPCell cell = new PdfPCell(paragraph);
cell.Colspan = 1;
table.AddCell(cell);
paragraph = new Paragraph();
doc.Add(table);


iTextSharp表的行为方式与HTML或Excel表的行为方式相同。“A列”中的单元格将始终保留在该列中,它永远不会溢出到另一列中。想象一个3行2列的表格,如下图所示,想象一个单元格是否会溢出到另一列:

| Name   | Salary  |
-------------------
| Alice  | 5,000   |
| Bob    | 50,000, |
| 000    | Charlie |
| 10,000
相反,HTML、Excel、iTextSharp和大多数表格软件将执行以下操作:

| Name   | Salary  |
-------------------
| Alice  | 5,000   |
| Bob    | 50,000, |
|        | 000     |
| Charlie| 10,000  |
这种方法保留了表格数据的意图。Adobe InDesign等程序允许您手动指定溢出,但我从未在iTextSharp中见过此功能,如果它确实存在,我会非常惊讶