I am trying to print table using flow-document
I created a table as shown in the figure below, but the cells are not aligned vertically.
I want to center vertical alignment in table cell.
What should I try?
<FlowDocument>
<Table>
<TableRowGroup>
<TableRow>
<TableCell Background="Green" RowSpan="2">
<Paragraph>Cell 1</Paragraph>
</TableCell>
<TableCell>
<Paragraph Background="Yellow">Cell 2</Paragraph>
</TableCell>
</TableRow>
<TableRow>
<TableCell Background="Red">
<Paragraph>Cell 1</Paragraph>
</TableCell>
</TableRow>
</TableRowGroup>
</Table>
</FlowDocument>
If cells always have the same height, you can offset the paragraph by a margin of 10 at the top and get the text centered:
<FlowDocument>
<Table>
<TableRowGroup>
<TableRow>
<TableCell Background="Green" RowSpan="2" TextAlignment="Center">
<Paragraph Margin="0,10,0,0">Cell 1</Paragraph>
</TableCell>
<TableCell>
<Paragraph Background="Yellow">Cell 2</Paragraph>
</TableCell>
</TableRow>
<TableRow>
<TableCell Background="Red">
<Paragraph>Cell 1</Paragraph>
</TableCell>
</TableRow>
</TableRowGroup>
</Table>
</FlowDocument>