具有多列-WPF的流文档

时间:2014-05-28 10:49:07

标签: c# wpf

我正在研究WPF应用程序。 根据要求,我想以下面的格式打印内容

enter image description here

我正在使用流文档对象来实现打印功能。 我正在使用Section,Paragraph等。 我是如何实现这一点的? 如何在Flow Document中应用多个列?

1 个答案:

答案 0 :(得分:2)

假设您的绘图不仅绘制得很糟糕,并且您真的想要对齐不同高度的部分,您可以使用表格(注意行数和行数):

<FlowDocument>
                <Table>
                    <Table.Columns>
                        <TableColumn/>
                        <TableColumn/>
                    </Table.Columns>

                    <TableRowGroup>
                        <TableRow Background="Aqua">
                            <TableCell ColumnSpan="2">
                                <Paragraph>Cell with text Cell with text Cell with text Cell with text Cell with text Cell with text Cell with text Cell with text</Paragraph>
                            </TableCell>
                        </TableRow>
                        <TableRow>
                            <TableCell Background="Bisque" RowSpan="2">
                                <Paragraph>Cell 1 with a lot of text Cell 1 with a lot of text Cell 1 with a lot of text Cell 1 with a lot of text Cell 1 with a lot of text</Paragraph>
                            </TableCell>
                            <TableCell Background="Bisque">
                                <Paragraph>Cell 2 with a lot of text with a lot of text with a lot of text with a lot of text with a lot of text</Paragraph>
                            </TableCell>
                        </TableRow>
                        <TableRow>
                           <TableCell Background="Bisque" RowSpan="2">
                                <Paragraph>Cell 2 with a lot of text with a lot of text with a lot of text with a lot of text with a lot of text</Paragraph>
                            </TableCell>
                        </TableRow>
                        <TableRow>
                            <TableCell Background="Bisque">
                                <Paragraph>Cell 1 with a lot of text with a lot of text with a lot of text with a lot of text with a lot of text</Paragraph>
                            </TableCell>
                        </TableRow>
                    </TableRowGroup>
                </Table>

            </FlowDocument>

输出: enter image description here