我正在使用GemBox.Presentation并在我的 PPTX 文件中创建一个大表。与此示例类似,例如:
PresentationDocument presentation = new PresentationDocument();
Slide slide = presentation.Slides.AddNew(SlideLayoutType.Custom);
int rowCount = 100;
int columnCount = 4;
int columnWidth = 5;
Table table = slide.Content.AddTable(1, 1, columnCount * columnWidth, 0, LengthUnit.Centimeter);
for (int i = 0; i < columnCount; i++)
table.Columns.AddNew(Length.From(5, LengthUnit.Centimeter));
for (int r = 0; r < rowCount; r++)
{
TableRow row = table.Rows.AddNew(0);
for (int c = 0; c < columnCount; c++)
{
TableCell cell = row.Cells.AddNew();
TextParagraph paragraph = cell.Text.AddParagraph();
TextRun run = paragraph.AddRun(string.Format("Cell {0}-{1}", r + 1, c + 1));
}
}
presentation.Save("output.pptx");
正如预期的那样,表格不适合幻灯片:
所以我需要将此表拆分为多个表或多个幻灯片,以便每个表都适合其幻灯片并且所有行都是可见的。
我怎样才能做到这一点?
我怎样才能知道新TableRow
的是否会超过Slide
高度?