FlowDocument 表中的单线边框

发布于 2024-09-24 06:47:17 字数 229 浏览 4 评论 0原文

我有一个 FlowDocument 表,我想在其中稍微增加布局的趣味性。我正在考虑用一条细线将发票上的子金额与总额分开,或者像标准 Word 2007+ 表格样式中典型的标题行下的线一样。 我希望我可以添加一个空的 TableRow 并将高度设置为几个像素单位,但我发现没有属性可以强制行的高度达到我的愿望。

有没有办法(或破解)在 System.Windows.Documents.Table 中的整行下方或上方制作细边框线?

I have a FlowDocument table where I want to spice up the layout a bit. I'm thinking something like a thin line separating the sub amounts on an invoice from the total or something like the line under the header row typically featured in the standard Word 2007+ table styles.
I was hoping that I could just add an empty TableRow and set the height to a few pixel units, but I find no property to force the height of a row to my desire.

Is there a way (or hack) to make a thin border line under or over an entire row in a System.Windows.Documents.Table?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

放我走吧 2024-10-01 06:47:17

当我打印出来时,它看起来就像一条微弱的线。

<TableRow FontSize="0.008">
    <TableCell Padding="0" BorderBrush="Gray" BorderThickness="0.5" ColumnSpan="5" />
</TableRow>

确保表格具有 CellSpacing="0"

我为列之间的垂直线定义TableColumns:

<Table.Columns>
    <TableColumn Width="140" Name="colItems" />
    <TableColumn Width="0" Name="colSpace1" />
    <TableColumn Name="colDescription" />
    <TableColumn Width="0" Name="colSpace2" />
    <TableColumn Width="150" Name="colAmount"/>
</Table.Columns>

然后在标题行的TableRowGroup中:

<TableRow FontSize="14">
    <TableCell TextAlignment="Center" Padding="0,4,0,2">
        <Paragraph>ITEMS</Paragraph>
    </TableCell>
    <TableCell BorderBrush="Gray" BorderThickness="0.5" />
    <TableCell TextAlignment="Center" Padding="0,4,0,2">
        <Paragraph>DESCRIPTION</Paragraph>
    </TableCell>
    <TableCell BorderBrush="Gray" BorderThickness="0.5" />
    <TableCell TextAlignment="Center" Padding="0,4,0,2">
        <Paragraph>AMOUNT</Paragraph>
    </TableCell>
</TableRow>

Oliver

When I print this out it just looks like a faint line.

<TableRow FontSize="0.008">
    <TableCell Padding="0" BorderBrush="Gray" BorderThickness="0.5" ColumnSpan="5" />
</TableRow>

Make sure the Table has CellSpacing="0"

I define TableColumns for vertical lines between columns:

<Table.Columns>
    <TableColumn Width="140" Name="colItems" />
    <TableColumn Width="0" Name="colSpace1" />
    <TableColumn Name="colDescription" />
    <TableColumn Width="0" Name="colSpace2" />
    <TableColumn Width="150" Name="colAmount"/>
</Table.Columns>

Then in a TableRowGroup for the Header row:

<TableRow FontSize="14">
    <TableCell TextAlignment="Center" Padding="0,4,0,2">
        <Paragraph>ITEMS</Paragraph>
    </TableCell>
    <TableCell BorderBrush="Gray" BorderThickness="0.5" />
    <TableCell TextAlignment="Center" Padding="0,4,0,2">
        <Paragraph>DESCRIPTION</Paragraph>
    </TableCell>
    <TableCell BorderBrush="Gray" BorderThickness="0.5" />
    <TableCell TextAlignment="Center" Padding="0,4,0,2">
        <Paragraph>AMOUNT</Paragraph>
    </TableCell>
</TableRow>

Oliver

╰◇生如夏花灿烂 2024-10-01 06:47:17

我自己设计了一个 hack。将 FontSize 设置为较小的值使我能够压缩行高。

<TableRow Background="Black" FontSize="0.01">
    <TableCell ColumnSpan="2"  />
</TableRow>

上面的方法有效,但是线条仍然很粗。有什么建议可以进一步降低高度吗?

Worked out a hack myself. Setting the FontSize to something small enabled me to compress the row height.

<TableRow Background="Black" FontSize="0.01">
    <TableCell ColumnSpan="2"  />
</TableRow>

The above works, but the line is still rather thick. Any suggestions to reduce the height even further?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文