1
我需要在Telerik中的Report中動態創建表格及其列。 我正在嘗試創建的表的NeedDataSource事件。 我的代碼來創建列是:如何在Telerik報表中動態創建表格
Telerik.Reporting.HtmlTextBox textboxGroup;
Telerik.Reporting.HtmlTextBox textBoxTable;
this.table1.ColumnGroups.Clear();
this.table1.Body.Columns.Clear();
this.table1.Body.Rows.Clear();
// int i = 0;
this.table1.ColumnHeadersPrintOnEveryPage = true;
int ColCount = dt.Columns.Count;
for (int j = 1; j <= ColCount - 1; j++)
{
var tableGroupColumn = new Telerik.Reporting.TableGroup();
this.table1.ColumnGroups.Add(tableGroupColumn);
this.table1.Body.Columns.Add(new Telerik.Reporting.TableBodyColumn(Unit.Inch(1)));
textboxGroup = new Telerik.Reporting.HtmlTextBox();
textboxGroup.Style.BorderColor.Default = Color.Black;
textboxGroup.Style.BorderStyle.Default = BorderType.Solid;
textboxGroup.Value = dt.Columns[j].ColumnName;
textboxGroup.Size = new SizeU(Unit.Inch(1.1), Unit.Inch(0.3));
tableGroupColumn.ReportItem = textboxGroup;
textBoxTable = new Telerik.Reporting.HtmlTextBox();
textBoxTable.Style.BorderColor.Default = Color.Black;
textBoxTable.Style.BorderStyle.Default = BorderType.Solid;
textBoxTable.Value = "=Fields." + dt.Columns[j].ColumnName;
textBoxTable.Size = new SizeU(Unit.Inch(1.1), Unit.Inch(0.3));
this.table1.Body.SetCellContent(0, j++, textBoxTable);
this.table1.Items.AddRange(new ReportItemBase[] { textBoxTable, textboxGroup });
}
的表的首部示出正確,但不與數據信息的行。 任何提示?感謝
是的,你是對的,我在幾個月前做過。謝謝 – Suminch 2015-07-29 11:54:00