Hi there,
I have noticed something extremely odd. It seems like TextBox or is choosing heights in unexpected ways when they are children of a table.
What I have is a loop iterates over some data rows and adds TextBoxes to a table. The reason I am doing this is because by requirements are to build a report based on report configuration data stored in the data base. So a report template would not work for me (as most of your examples are).
So what I have is the following.
I have noticed something extremely odd. It seems like TextBox or is choosing heights in unexpected ways when they are children of a table.
What I have is a loop iterates over some data rows and adds TextBoxes to a table. The reason I am doing this is because by requirements are to build a report based on report configuration data stored in the data base. So a report template would not work for me (as most of your examples are).
So what I have is the following.
private
void
BuildReport()
{
Table tbl =
new
Table();
Unit columnWidth = Unit.Inch(0.5);
tbl.Body.Columns.AddRange(
new
TableBodyColumn[] {
new
TableBodyColumn(columnWidth),
new
TableBodyColumn(columnWidth),
new
TableBodyColumn(columnWidth),
new
TableBodyColumn(columnWidth),
new
TableBodyColumn(columnWidth),
new
TableBodyColumn(columnWidth),
new
TableBodyColumn(columnWidth),
new
TableBodyColumn(columnWidth),
new
TableBodyColumn(columnWidth),
new
TableBodyColumn(columnWidth),
new
TableBodyColumn(columnWidth),
new
TableBodyColumn(columnWidth)
}.AsEnumerable());
tbl.Style.BorderWidth.Top =
new
Unit(1D, UnitType.Pixel);
tbl.Style.BorderWidth.Bottom =
new
Unit(1D, UnitType.Pixel);
tbl.Style.BorderWidth.Left =
new
Unit(1D, UnitType.Pixel);
tbl.Style.BorderWidth.Right =
new
Unit(1D, UnitType.Pixel);
tbl.Style.BorderStyle.Top = BorderType.Solid;
tbl.Style.BorderStyle.Bottom = BorderType.Solid;
tbl.Style.BorderStyle.Left = BorderType.Solid;
tbl.Style.BorderStyle.Right = BorderType.Solid;
for
(
int
idx = 0; idx < tbl.Body.Columns.Count; idx++)
{
TableGroup group =
new
TableGroup();
tbl.ColumnGroups.Add(group);
}
this
.DetailSection.Items.AddRange(
new
ReportItemBase[] { tbl });
int
rowNumber = 0;
for
(
int
idx = 0; idx < fieldComps.Count; idx++)
{
ModelTableFieldComposition_Flatten field = fieldComps[idx];
GetLabelRow(field, ds, tbl,
ref
rowNumber);
}
}
private
void
GetLabelRow(ModelTableFieldComposition_Flatten field, Table tbl,
ref
int
rowNumber)
{
TableGroup tableGroupRow =
new
TableGroup();
tbl.RowGroups.Add(tableGroupRow);
tbl.Body.Rows.Add(
new
TableBodyRow(Unit.Inch(0.1D)));
int
colIndex = 0;
Telerik.Reporting.TextBox labelTextBox =
new
TextBox();
labelTextBox.Name =
"labelField"
;
labelTextBox.Size =
new
SizeU(Unit.Inch(0.1), Unit.Inch(0.1));
labelTextBox.Style.BorderStyle.Bottom = Telerik.Reporting.Drawing.BorderType.Solid;
labelTextBox.Style.BorderStyle.Left = Telerik.Reporting.Drawing.BorderType.Solid;
labelTextBox.Style.Font.Name =
"Segoe UI"
;
labelTextBox.Style.Font.Size = Unit.Point(10);
labelTextBox.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Middle;
labelTextBox.Value = field.DisplayName;
labelTextBox.Visible = field.FieldLabelVisible;
labelTextBox.Style.BackgroundColor = Color.Wheat;
labelTextBox.Style.Color = Color.Black;
tbl.Body.SetCellContent(rowNumber, 0, labelTextBox, 0, field.ReportFieldLabelColumnSpan);
tbl.Items.AddRange(
new
ReportItemBase[] { labelTextBox });
int
columnSpanCounter = field.ReportFieldLabelColumnSpan;
colIndex = field.ReportFieldLabelColumnSpan;
while
(columnSpanCounter < 12)
{
Telerik.Reporting.TextBox emptyLabelTextBox =
new
TextBox();
emptyLabelTextBox.Name =
"emptyField"
;
emptyLabelTextBox.Size =
new
SizeU(Unit.Inch(0.1), Unit.Inch(0.1));
emptyLabelTextBox.Visible =
true
;
emptyLabelTextBox.Value =
string
.Empty;
emptyLabelTextBox.Style.BorderStyle.Bottom = Telerik.Reporting.Drawing.BorderType.Solid;
emptyLabelTextBox.Style.BorderStyle.Left = Telerik.Reporting.Drawing.BorderType.Solid;
emptyLabelTextBox.Style.Font.Name =
"Segoe UI"
;
emptyLabelTextBox.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Middle;
tbl.Body.SetCellContent(rowNumber, colIndex, emptyLabelTextBox, 0, 1);
tbl.Items.AddRange(
new
ReportItemBase[] { emptyLabelTextBox });
columnSpanCounter++;
colIndex++;
}
rowNumber++;
}