Я создаю большую таблицу в iTextsharp
У меня есть одна родительская таблица, когда я добавляю все дочерние таблицы в виде строки.Поскольку у меня нет контроля над данными, которые заполняются в таблице.Я использую table.splitLate = false.
Также я устанавливаю это свойство для всех дочерних таблиц
Последняя строка страницы расширяется, если следующая не помещается там.
Я установил это свойство
Table.setExtendedLastRow = false
Но это не поможет
Если я использую по умолчанию splitLate и splitRows и KeepTogether= false, таблица разбивается, но появляется много пробелов из-за больших строк.Ребята, пожалуйста, помогите
public void GetBodyPTables()
{
yield return AggregateStudentsInformation();
}
public void AggregateStudentsInformation()
{
var stuTable = PdfPTableHelper.Create(1);
stuTable.KeepTogether = false;
stuTable.splitLate = false;
stuTable.SpacingBefore = 15f;
GetStudentsPostGradInformation(ref stuTable);
GetStudentsGradInformation(ref stuTable);
GetStudentsPlus2Information(ref stuTable);
GetStudentsSecondaryInformation(ref stuTable);
}
private void GetStudentsPostGradInforamtion(ref stuTable)
{
var postGradTable = PdfPTableHelper.Create(1);
postGradTable.KeepTogether = false;
postGradTable.SplitLate = false;
//Getting info from Xml Schema
var postGradInfos = XElement.Elements.value("StudentPostGradInfo");
var headerCell = CellHelper.CreatePdfPCell("Student Graduation Information",this.ReportFonts.SectionFont,Element.ALIGN_CENTER,Element.ALIGN_TOP,1); headerCell.PaddingBottom = 3f;
postGradTable.AddCell(headerCell);
foreach(var gradElement in postGradInfo)
{
var postgradStudentInfo = gradElement.Element.value("PostGradStudentInfo");
GetSingleStudentPostGradInformation(ref postGradTable,XElement postGradStudentInfo);
}
stuTable.AddCell(gradTable);
}
private void GetSingleStudentPostGradInformation(ref postGradTable,XElement postGradStudentInfo)
{
var topTable = PdfPTableHelper.Create(18);
topTable.KeepTogether = false;
topTable.SplitLate = false;
topTable.SpacingBefore = 15f;
//18 column table is divided into 2 cells ,one 4 column cell and another 14 column cell
topTable.AddCell(CellHelper.CreatePdfPCell("Student Id:" ),postGradStudentInfo.Element("StudentId").Value,_defaultBoldFont,_defaultPlainFont,CellHelper.CellBorder.None,Element.ALIGN_LEFT,Element.ALIGN_TOP,4);
topTable.AddCell(CellHelper.CreatePdfPCell("Student Name:" ),postGradStudentInfo.Element("StudentName").Value,_defaultBoldFont,_defaultPlainFont,CellHelper.CellBorder.None,Element.ALIGN_LEFT,Element.ALIGN_TOP,14);
topTable.AddCell(CellHelper.CreatePdfPCell("CGPA:" ),postGradStudentInfo.Element("cgpa").Value,_defaultBoldFont,_defaultPlainFont,CellHelper.CellBorder.None,Element.ALIGN_LEFT,Element.ALIGN_TOP,4);
topTable.AddCell(CellHelper.CreatePdfPCell("Instructor Comments:" ),postGradStudentInfo.Element("StudentId").Value,_defaultBoldFont,_defaultPlainFont,CellHelper.CellBorder.None,Element.ALIGN_LEFT,Element.ALIGN_TOP,14);
postGradTable.AddCell(topTable);
}
//Similar Implementation
GetStudentsGradInformation(ref stuTable);
GetStudentsPlus2Information(ref stuTable);
GetStudentsSecondaryInformation(ref stuTable);
Я использовал table.SplitLate = false в каждой таблице.И по умолчанию table.SplitRows = true.
Сгенерированный отчет состоит из нескольких страниц.Так что для некоторых заголовков разделов последний ряд расширяется до нижнего поля, если следующий ряд там не помещается.
Как избавиться от этой проблемы.