Hello,
I'm using a dynamic table to display a schedule on a report. The table is laid out with a header row and a single data row for the scheduled items. As soon as the text in one of the data row's cells is larger than can be displayed the complete row won't be rendered any more. The report contains only the header row and no second page.
Is there a property on the TextBox element that enables PageBreaks inside the Box itself or am I missing something else?
Kind regards
Markus
Here's the code I use to define the table, it's called from the report's constructor:
I'm using a dynamic table to display a schedule on a report. The table is laid out with a header row and a single data row for the scheduled items. As soon as the text in one of the data row's cells is larger than can be displayed the complete row won't be rendered any more. The report contains only the header row and no second page.
Is there a property on the TextBox element that enables PageBreaks inside the Box itself or am I missing something else?
Kind regards
Markus
Here's the code I use to define the table, it's called from the report's constructor:
private
void
BuildTable(ScheduleInfo context) {
//create empty table
var scheduleTable =
new
Table {
Location =
new
PointU(Unit.Cm(0), Unit.Cm(0)),
Name =
"ScheduleTable"
,
RowHeadersPrintOnEveryPage =
true
,
KeepTogether =
false
};
//insert table in detail section
Details.Items.AddRange(
new
ReportItemBase[] { scheduleTable });
var rowGroup =
new
TableGroup();
//add header row
scheduleTable.Body.Rows.Add(
new
TableBodyRow(Unit.Cm(0.8)));
//set page layout
if
(context.Columns.Count<5) {
ToPortrait();
}
else
{
ToLandscape();
}
var columnWidth = Width/context.Columns.Count;
var minWidth = Unit.Mm(30);
if
(columnWidth < minWidth) columnWidth = minWidth;
var rowHeight = Unit.Mm(6);
var i = 0;
foreach
(var column
in
context.Columns) {
scheduleTable.Body.Columns.Add(
new
TableBodyColumn(columnWidth));
var headerText =
new
TextBox {
Value = column.Header,
Size =
new
SizeU(columnWidth, rowHeight)
};
headerText.Style.Font.Bold =
true
;
var cellInfo = column.Appointments !=
null
?
string
.Join(
"\n\n"
, column.Appointments.Select(x => x.ToString()))
:
null
;
var cellText =
new
TextBox {
Value = cellInfo,
Size =
new
SizeU(columnWidth, rowHeight),
KeepTogether =
false
};
scheduleTable.Body.SetCellContent(0, i, cellText);
var colGroup =
new
TableGroup {ReportItem = headerText};
colGroup.GroupKeepTogether =
false
;
scheduleTable.ColumnGroups.Add(colGroup);
scheduleTable.Items.AddRange(
new
ReportItemBase[] { headerText, cellText });
i++;
}
rowGroup.Groupings.AddRange(
new
[] {
new
Grouping(
""
)});
rowGroup.Name =
"DetailGroup"
;
rowGroup.GroupKeepTogether =
false
;
scheduleTable.RowGroups.Add(rowGroup);
Details.Items.Add(scheduleTable);
}