- #region 填充页内容 Detail
- Field f;
- s = c1r.Sections[SectionTypeEnum.Detail];
- s.Visible = true;
- double RelativeLeft = 50; //列左边距
- for (int j = 0; j < dataTable.Columns.Count; j++)
- {
- string label = "Fld" + dataTable.Columns[j].ColumnName;
- f = s.Fields.Add(label, dataTable.Columns[j].ColumnName, RelativeLeft, 50, 1000, 500);
- f.WordWrap = true;
- f.Align = FieldAlignEnum.CenterMiddle;
- f.Calculated = true;
- RelativeLeft += 1000;
- }
- #endregion
复制代码
我用上述代码,试图创建 Detail 部分的Field。但预览时发现,结果全是1、2、3等数字……
- var dataTable = new DataTable();
- //初始化列
- for (int c = 1; c <= 10; c++)
- {
- dataTable.Columns.Add(c.ToString(), typeof(string));
- }
- //逐行填充内容……
复制代码 |