<FlowDocument xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> <Table CellSpacing="5"> <Table.Columns> <TableColumn/> <TableColumn/> <TableColumn/> <TableColumn/> </Table.Columns> <TableRowGroup> <TableRow Background="SkyBlue"> <TableCell ColumnSpan="4" TextAlignment="Center"> <Paragraph FontSize="24pt" FontWeight="Bold">Table</Paragraph> </TableCell> </TableRow> <!-- Header row for the table. --> <TableRow Background="LightGoldenrodYellow"> <TableCell> <Paragraph FontSize="14pt" FontWeight="Bold">Title 1</Paragraph> </TableCell> <TableCell> <Paragraph FontSize="14pt" FontWeight="Bold">Title 2</Paragraph> </TableCell> <TableCell> <Paragraph FontSize="14pt" FontWeight="Bold">Title 3</Paragraph> </TableCell> <TableCell> <Paragraph FontSize="14pt" FontWeight="Bold">Title 4</Paragraph> </TableCell> </TableRow> <!-- Sub-title row --> <TableRow> <TableCell ColumnSpan="4"> <Paragraph FontSize="14pt" FontWeight="Bold">sub title</Paragraph> </TableCell> </TableRow> <TableRow Background="lightgray"> <TableCell> <Paragraph>A</Paragraph> </TableCell> <TableCell> <Paragraph>1</Paragraph> </TableCell> <TableCell> <Paragraph>1</Paragraph> </TableCell> <TableCell> <Paragraph>1</Paragraph> </TableCell> </TableRow> <TableRow> <TableCell> <Paragraph>B</Paragraph> </TableCell> <TableCell> <Paragraph>1</Paragraph> </TableCell> <TableCell> <Paragraph>1</Paragraph> </TableCell> <TableCell> <Paragraph>1</Paragraph> </TableCell> </TableRow> <!-- Sub-title row --> <TableRow> <TableCell ColumnSpan="4"> <Paragraph FontSize="14pt" FontWeight="Bold">sub title</Paragraph> </TableCell> </TableRow> <!-- Four data rows for the major outter planets. --> <TableRow Background="lightgray"> <TableCell> <Paragraph>C</Paragraph> </TableCell> <TableCell> <Paragraph>1</Paragraph> </TableCell> <TableCell> <Paragraph>1</Paragraph> </TableCell> <TableCell> <Paragraph>5</Paragraph> </TableCell> </TableRow> <!-- Footer row for the table. --> <TableRow> <TableCell ColumnSpan="4"> <Paragraph FontSize="10pt" FontStyle="Italic"> <Hyperlink NavigateUri="http://your host">website</Hyperlink> </Paragraph> </TableCell> </TableRow> </TableRowGroup> </Table> </FlowDocument>
Windows Presentation Foundation
Bold text in Flow document
<FlowDocumentPageViewer xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <FlowDocument ColumnWidth="800"> <Paragraph><Rectangle Fill="Black" Height="1" Width="500" HorizontalAlignment="Left" /><LineBreak/></Paragraph> <Paragraph><Bold>XAMLPad</Bold> </Paragraph > </FlowDocument> </FlowDocumentPageViewer>
Adding style to Paragraph
<FlowDocumentPageViewer xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <FlowDocumentPageViewer.Resources> <Style x:Key="HeaderStyle"> <Setter Property="TextBlock.FontFamily" Value="Palatino Linotype" /> <Setter Property="TextBlock.FontWeight" Value="Bold" /> <Setter Property="TextBlock.FontSize" Value="20" /> <Setter Property="TextBlock.Margin" Value="10" /> </Style> <Style x:Key="mainContentStyle"> <Setter Property="TextBlock.FontFamily" Value="Palatino Linotype" /> <Setter Property="TextBlock.FontSize" Value="11" /> <Setter Property="TextBlock.TextWrapping" Value="Wrap" /> <Setter Property="TextBlock.Margin" Value="3,10,3,10" /> </Style> </FlowDocumentPageViewer.Resources> <FlowDocument ColumnWidth="800"> <Paragraph Style="{StaticResource HeaderStyle}">Header</Paragraph> <Paragraph Style="{StaticResource mainContentStyle}"> content<Hyperlink NavigateUri="another.xaml">FlowDocument</Hyperlink> </Paragraph> </FlowDocument> </FlowDocumentPageViewer>
FlowDocument with Hyperlink and List
<FlowDocument xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" FontFamily="Georgia" FontSize="20" PagePadding="30" Background="White" Name="fd1"> <Paragraph> <Hyperlink NavigateUri="http://localhost/XBox/XBox.wba"> test </Hyperlink> </Paragraph> <Paragraph><Figure Width="Content" HorizontalAnchor="ContentLeft" VerticalAnchor="ContentTop" Margin="0,0,0,20" Padding="0"><Paragraph FontSize="35" Margin="0" FontWeight="Bold"> AAA</Paragraph><Paragraph Margin="0">test</Paragraph></Figure> test </Paragraph><Paragraph> test </Paragraph><Paragraph> test </Paragraph><Paragraph> test </Paragraph><List><ListItem><Paragraph> test </Paragraph></ListItem><ListItem><Paragraph> tests </Paragraph></ListItem><ListItem><Paragraph> test </Paragraph></ListItem><ListItem><Paragraph> test </Paragraph></ListItem><ListItem><Paragraph> test </Paragraph></ListItem><ListItem><Paragraph> test </Paragraph></ListItem></List><Paragraph> test </Paragraph> </FlowDocument>
Paragraph FontWeight
<FlowDocument xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" FontFamily="Georgia" FontSize="20" PagePadding="30" Background="White" Name="fd1"> <Paragraph> <Figure Width="Content" HorizontalAnchor="ContentLeft" VerticalAnchor="ContentTop" Margin="0,0,0,20" Padding="0"> <Paragraph FontSize="35" Margin="0" FontWeight="Bold">asdf</Paragraph> <Paragraph Margin="0">asdf</Paragraph> </Figure> asdf </Paragraph> <Paragraph> asdf </Paragraph> <Paragraph> asdf </Paragraph> <Paragraph> asdf </Paragraph> <Paragraph FontWeight="Bold"> asdf </Paragraph> <Paragraph> sasdf </Paragraph> <Paragraph> asdf </Paragraph> <Paragraph> asdf </Paragraph> <Paragraph FontWeight="Bold"> The Middle Years </Paragraph> <Paragraph> </Paragraph> <Paragraph> asdf </Paragraph> <Paragraph> asdf </Paragraph> </FlowDocument>
FlowDocument with Figure.xaml
<FlowDocument xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> <Paragraph FontSize="22" FontWeight="Bold">Chapter 1</Paragraph> <Paragraph FontSize="35" FontWeight="Bold">Why WPF?</Paragraph> <Paragraph> <Figure Width="130"> <BlockUIContainer> <Image Source="c:image.png"/> </BlockUIContainer> </Figure> test </Paragraph> </FlowDocument>
Span and FlowDoucment
<FlowDocument xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> <Paragraph> <Bold>bold</Bold> <Italic>italic</Italic> <Underline>underline</Underline> <Hyperlink>hyperlink</Hyperlink> <Span BaselineAlignment="Superscript">superscript</Span> <Span BaselineAlignment="Subscript">subscript</Span> <Span> <Span.TextDecorations> <TextDecoration Location="Strikethrough"/> </Span.TextDecorations> strikethrough </Span> </Paragraph> </FlowDocument>