In my FlowDocument
I need to remove the spacing between two Tables. I figured I can do this by setting the Block.Margin
to 0 like a Paragraph
. While this does make a difference it does not fix the problem.
What my FlowDocument looks like
Here is my FlowDocument;
<FlowDocument>
<FlowDocument.Resources>
<Style TargetType="Paragraph" x:Key="{x:Type Paragraph}">
<Style.Resources>
<ResourceDictionary/>
</Style.Resources>
<Setter Property="Block.Margin">
<Setter.Value>
<Thickness>0,0,0,0</Thickness>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="Table" x:Key="{x:Type Table}">
<Style.Resources>
<ResourceDictionary/>
</Style.Resources>
<Setter Property="Block.Margin">
<Setter.Value>
<Thickness>0,0,0,0</Thickness>
</Setter.Value>
</Setter>
</Style>
</FlowDocument.Resources>
<Table CellSpacing="0">
<Table.Columns>
<TableColumn/>
</Table.Columns>
<TableRowGroup>
<TableRow>
<TableCell>
<Table CellSpacing="0">
<Table.Columns>
<TableColumn/>
<TableColumn/>
</Table.Columns>
<TableRowGroup>
<TableRow FontSize="10" FontWeight="Normal" Foreground="#FF000000">
<TableCell>
<Paragraph>Table 1</Paragraph>
</TableCell>
<TableCell>
<Paragraph>Column 2</Paragraph>
</TableCell>
</TableRow>
</TableRowGroup>
</Table>
<Paragraph/>
</TableCell>
</TableRow>
</TableRowGroup>
</Table>
<Table CellSpacing="0">
<Table.Columns>
<TableColumn/>
</Table.Columns>
<TableRowGroup>
<TableRow>
<TableCell>
<Table CellSpacing="0">
<Table.Columns>
<TableColumn/>
<TableColumn/>
</Table.Columns>
<TableRowGroup>
<TableRow FontSize="10" FontWeight="Normal" Foreground="#FF000000">
<TableCell>
<Paragraph>Table 2</Paragraph>
</TableCell>
<TableCell>
<Paragraph>Column 2</Paragraph>
</TableCell>
</TableRow>
</TableRowGroup>
</Table>
<Paragraph/>
</TableCell>
</TableRow>
</TableRowGroup>
</Table>
</FlowDocument>
Just remove the empty Paragraph
tags under table and you should be fine:
<FlowDocument>
<FlowDocument.Resources>
<Style TargetType="Paragraph" x:Key="{x:Type Paragraph}">
<Style.Resources>
<ResourceDictionary/>
</Style.Resources>
<Setter Property="Block.Margin">
<Setter.Value>
<Thickness>0,0,0,0</Thickness>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="Table" x:Key="{x:Type Table}">
<Style.Resources>
<ResourceDictionary/>
</Style.Resources>
<Setter Property="Block.Margin">
<Setter.Value>
<Thickness>0,0,0,0</Thickness>
</Setter.Value>
</Setter>
</Style>
</FlowDocument.Resources>
<Table CellSpacing="0">
<Table.Columns>
<TableColumn/>
</Table.Columns>
<TableRowGroup>
<TableRow>
<TableCell>
<Table CellSpacing="0">
<Table.Columns>
<TableColumn/>
<TableColumn/>
</Table.Columns>
<TableRowGroup>
<TableRow FontSize="10" FontWeight="Normal" Foreground="#FF000000">
<TableCell>
<Paragraph>Table 1</Paragraph>
</TableCell>
<TableCell>
<Paragraph>Column 2</Paragraph>
</TableCell>
</TableRow>
</TableRowGroup>
</Table>
</TableCell>
</TableRow>
</TableRowGroup>
</Table>
<Table CellSpacing="0">
<Table.Columns>
<TableColumn/>
</Table.Columns>
<TableRowGroup>
<TableRow>
<TableCell>
<Table CellSpacing="0">
<Table.Columns>
<TableColumn/>
<TableColumn/>
</Table.Columns>
<TableRowGroup>
<TableRow FontSize="10" FontWeight="Normal" Foreground="#FF000000">
<TableCell>
<Paragraph>Table 2</Paragraph>
</TableCell>
<TableCell>
<Paragraph>Column 2</Paragraph>
</TableCell>
</TableRow>
</TableRowGroup>
</Table>
</TableCell>
</TableRow>
</TableRowGroup>
</Table>
</FlowDocument>