将WPF FlowDocument表转换为HTML表

时间:2013-06-07 13:25:06

标签: wpf html-table flowdocument

我很难理解如何让WPF表扩展到父FlowDocument的PageHeight的大小。以下是我认为它在CSS& HTML。

CSS(styles.css):

#content{
    width:10.5in;
    height:72in;
    border:2px solid black;
    position: relative;
}
#details {
    position:absolute;
    bottom:0;
    width:100%;
    border:1px solid navy;
    border-collapse:collapse;
}
td,th {
    border:1px solid navy;
}

和HTML:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title></title>
        <link href="styles.css" rel="Stylesheet" type="text/css" />
    </head>
    <body>
        <div id="content">
            <table id="details">
                <tr>
                <th>id</th><th>name</th><th>description</th>
                </tr>
                <tr><td>1</td><td>tool</td><td>long tool</td></tr>
                <tr><td>2</td><td>tool</td><td>short tool</td></tr>
                <tr><td>3</td><td>tool</td><td>temporary tool</td></tr>
            </table>
        </div>
    </body>
</html>

现在有人可以帮我提出一些在渲染时看起来相同的XAML。我希望使用WPF FlowDocument和Table,这样我就可以使用XLST在运行时将XAML转换为HTML页面。现在,WPF表不会展开以填充页面。

1 个答案:

答案 0 :(得分:0)

这应该适合你:

<FlowDocument>
  <Table Width="Auto" Height="Auto">
    <Table.Columns>
      <TableColumn />
      <TableColumn />
      <TableColumn />
    </Table.Columns>
    <TableRowGroup>
      <TableRow>
        <TableCell>
          <Paragraph>Cell at Row 1 Column 1</Paragraph>
        </TableCell>
        <TableCell>
          <Paragraph>Cell at Row 1 Column 2</Paragraph>
        </TableCell>
        <TableCell>
          <Paragraph>Cell at Row 1 Column 3</Paragraph>
        </TableCell>
      </TableRow>
    </TableRowGroup>
  </Table>
</FlowDocument>