Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Single line borders in FlowDocument Tables

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?

like image 268
Holstebroe Avatar asked Sep 23 '10 08:09

Holstebroe


2 Answers

When I print this out it just looks like a feint 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

like image 195
Oliver Slay Avatar answered Oct 15 '22 22:10

Oliver Slay


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?

like image 28
Holstebroe Avatar answered Oct 15 '22 23:10

Holstebroe