Wpf 删除FlowDocument中两个表之间的空白

Wpf 删除FlowDocument中两个表之间的空白,wpf,xaml,flowdocument,Wpf,Xaml,Flowdocument,在我的流程文档中我需要删除两个表之间的间距。我想我可以通过将Block.Margin设置为0来实现这一点,就像段落一样。虽然这确实起到了作用,但并不能解决问题 这是我的流程文件 <FlowDocument> <FlowDocument.Resources> <Style TargetType="Paragraph" x:Key="{x:Type Paragraph}"> <Style.Resources&

在我的
流程文档中
我需要删除两个表之间的间距。我想我可以通过将
Block.Margin
设置为0来实现这一点,就像
段落一样。虽然这确实起到了作用,但并不能解决问题

这是我的流程文件

<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>

0,0,0,0
0,0,0,0
表1
第2栏
表2
第2栏

只需删除表下的空
段落
标记,您就可以:

<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>

0,0,0,0
0,0,0,0
表1
第2栏
表2
第2栏