【问题标题】:Add Table to FlowDocument In Code Behind在后面的代码中将表添加到 FlowDocument
【发布时间】:2017-05-05 04:12:42
【问题描述】:

这个我试过.....

_doc = new FlowDocument();

Table t = new Table();
for (int i = 0; i < 7; i++)
{
    t.Columns.Add(new TableColumn());
}

TableRow row = new TableRow();
row.Background = Brushes.Silver;
row.FontSize = 40;
row.FontWeight = FontWeights.Bold;

row.Cells.Add(new TableCell(new Paragraph(new Run("I span 7 columns"))));
row.Cells[0].ColumnSpan = 6;

_doc2.Blocks.Add(t);

当我查看此文档时,该表格从不显示.....尽管我在添加此表格之前添加到此文档的边框图像和文档标题输出正常。

【问题讨论】:

标签: c# wpf flowdocument


【解决方案1】:

您将列添加到表中,但添加行的代码在哪里?它只是没有连接。

添加类似:

...
var rg = new TableRowGroup();
rg.Rows.Add(row);
t.RowGroups.Add(rg);
_doc2.Blocks.Add(t);

【讨论】:

  • Holterman,是的,现在可以完美运行,非常感谢!!美国。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-03-15
  • 2012-03-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-01-04
相关资源
最近更新 更多