This is a migrated thread and some comments may be shown as answers.

Empty table with long text in cells

1 Answer 29 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Markus Wolff
Top achievements
Rank 1
Markus Wolff asked on 05 Dec 2012, 11:49 AM

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

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) {
    else {
    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.Items.AddRange(new ReportItemBase[] { headerText, cellText });
    rowGroup.Groupings.AddRange(new [] {new Grouping("")});
    rowGroup.Name = "DetailGroup";
    rowGroup.GroupKeepTogether = false;

1 Answer, 1 is accepted

Sort by
Markus Wolff
Top achievements
Rank 1
answered on 07 Dec 2012, 11:49 AM
Got it! Seems you have to set the Table's KeepTogether property after configuring.
General Discussions
Asked by
Markus Wolff
Top achievements
Rank 1
Answers by
Markus Wolff
Top achievements
Rank 1
Share this question