回复 7楼taoke的帖子
当前调查进度:
- private void InitReport()
- {
- this.c1PrintDocument1.DefaultUnit = UnitTypeEnum.Pixel;
- this.c1PrintDocument1.PageLayout.PageSettings.Height = new Unit(2000, UnitTypeEnum.Pixel);
- RenderParagraph codeLine = new RenderParagraph();
- ParagraphText p1 = new ParagraphText("MessageBox");
- codeLine.Content.Add(p1);
- codeLine.X = new Unit(0, UnitTypeEnum.Pixel);
- codeLine.Y = new Unit(10, UnitTypeEnum.Pixel);
- codeLine.Height = new Unit(100, UnitTypeEnum.Pixel);
- c1PrintDocument1.Body.Children.Add(codeLine);
- #region table
- int n;
- // make a table
- rt1 = new RenderTable();
- rt1.Rows.Count = 10;
- rt1.Cols.Count = 6;
- rt1.RowSizingMode = TableSizingModeEnum.Fixed;
- rt1.Style.GridLines.All = LineDef.Default;
- for (int i = 0; i < 10; i++)
- {
- for (int j = 0; j < 6; j++)
- {
- rt1.Cells[i, j].Text = "行" + i.ToString() + "列" + j.ToString();
- }
- }
- rt1.X = new Unit(0, UnitTypeEnum.Pixel);
- rt1.Y = new Unit(111, UnitTypeEnum.Pixel);
- rt1.Height = new Unit(1000, UnitTypeEnum.Pixel);
- #endregion
- //添加表格
- this.c1PrintDocument1.Body.Children.Add(rt1);
- }
复制代码
需要预置好 Page、Table和文本等高度,才可以获取。
- double totalHeight = 0;
- foreach (RenderObject item in this.c1PrintDocument1.Body.Children)
- {
- totalHeight += item.Height.Value;
- }
复制代码
目前我还没能成功添加 Table 行,先把进度共享给你。 |