I generate a FlowDocument with a Table and replace a Selection inside a WPF RTF box.
But the inserted table uses the last used BorderSettings for all cells. If I load the generated XAML inside a FlowDocumentPageViewer all looks fine.
Please ignore the other formatting, only the Borders are my problem, the last Border is the underline, but in RTF it overwrites all other CellBorders and Color in the table.
Code:
//GetTable returns the Table
FlowDocument tmp_rtf_tabelle_test =new FlowDocument(((Datenblock_Mitte_Tabelle_Typ5)obj).GetTable());
TextRange tr_tabelle = new TextRange(tmp_rtf_tabelle_test.ContentStart,tmp_rtf_tabelle_test.ContentEnd);
MemoryStream ms_tabelle = new MemoryStream();
//if Dataformats XAML or rtf make no difference
tr_tabelle.Save(ms_tabelle, DataFormats.Xaml);
rtf_vorschau.Selection.Load(ms_tabelle, DataFormats.Xaml);
ms_tabelle.Close();
Here's the generated XAML:
<Section
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xml:space="preserve" TextAlignment="Justify" LineHeight="Auto" IsHyphenationEnabled="False" xml:lang="en-us" FlowDirection="LeftToRight" NumberSubstitution.CultureSource="Text" NumberSubstitution.Substitution="AsCulture" FontFamily="Georgia" FontStyle="Normal" FontWeight="Normal" FontStretch="Normal" FontSize="16" Foreground="#FF000000" Typography.StandardLigatures="True" Typography.ContextualLigatures="True" Typography.DiscretionaryLigatures="False" Typography.HistoricalLigatures="False" Typography.AnnotationAlternates="0" Typography.ContextualAlternates="True" Typography.HistoricalForms="False" Typography.Kerning="True" Typography.CapitalSpacing="False" Typography.CaseSensitiveForms="False" Typography.StylisticSet1="False" Typography.StylisticSet2="False" Typography.StylisticSet3="False" Typography.StylisticSet4="False" Typography.StylisticSet5="False" Typography.StylisticSet6="False" Typography.StylisticSet7="False" Typography.StylisticSet8="False" Typography.StylisticSet9="False" Typography.StylisticSet10="False" Typography.StylisticSet11="False" Typography.StylisticSet12="False" Typography.StylisticSet13="False" Typography.StylisticSet14="False" Typography.StylisticSet15="False" Typography.StylisticSet16="False" Typography.StylisticSet17="False" Typography.StylisticSet18="False" Typography.StylisticSet19="False" Typography.StylisticSet20="False" Typography.Fraction="Normal" Typography.SlashedZero="False" Typography.MathematicalGreek="False" Typography.EastAsianExpertForms="False" Typography.Variants="Normal" Typography.Capitals="Normal" Typography.NumeralStyle="Normal" Typography.NumeralAlignment="Normal" Typography.EastAsianWidths="Normal" Typography.EastAsianLanguage="Normal" Typography.StandardSwashes="0" Typography.ContextualSwashes="0" Typography.StylisticAlternates="0">
<Table Padding="0,0,0,0" BorderThickness="1,1,1,1">
<Table.Columns>
<TableColumn Width="300" />
<TableColumn Width="419" />
</Table.Columns>
<TableRowGroup>
<TableRow>
<TableCell ColumnSpan="2" BorderThickness="1,1,1,1" BorderBrush="#FFFF0000">
<Paragraph Background="#FFD3D3D3">
<Run> 5. Weitere Vorgehensweise</Run>
</Paragraph>
</TableCell>
</TableRow>
<TableRow>
<TableCell Padding="0,0,0,0" BorderThickness="1,0,0,0" BorderBrush="#FF0000FF">
<Paragraph LineHeight="1" Margin="0,0,0,0">
<Run> Haftung:</Run>
</Paragraph>
</TableCell>
<TableCell BorderThickness="0,0,0,1" BorderBrush="#FFFFFF00">
<Paragraph>
<Run><Bitte wählen></Run>
</Paragraph>
</TableCell>
</TableRow>
<TableRow>
<TableCell>
<Paragraph>
<Run> Deckung:</Run>
</Paragraph>
</TableCell>
<TableCell>
<Paragraph>
<Run><Bitte wählen></Run>
</Paragraph>
</TableCell>
</TableRow>
<TableRow>
<TableCell>
<Paragraph>
<Run> Plausibilität:</Run>
</Paragraph>
</TableCell>
<TableCell>
<Paragraph>
<Run><Bitte wählen></Run>
</Paragraph>
</TableCell>
</TableRow>
<TableRow>
<TableCell>
<Paragraph>
<Run> Zahlung in €:</Run>
</Paragraph>
</TableCell>
<TableCell>
<Paragraph>
<Run>0,00</Run>
</Paragraph>
</TableCell>
</TableRow>
<TableRow>
<TableCell>
<Paragraph>
<Run> Reserve in €:</Run>
</Paragraph>
</TableCell>
<TableCell>
<Paragraph>
<Run>0,00</Run>
</Paragraph>
</TableCell>
</TableRow>
<TableRow>
<TableCell>
<Paragraph>
<Run> Unterlagen folgen:</Run>
</Paragraph>
</TableCell>
<TableCell>
<Paragraph>
<Run><Bitte wählen></Run>
</Paragraph>
</TableCell>
</TableRow>
<TableRow>
<TableCell ColumnSpan="2">
<Paragraph Margin="3,3,3,3">
<Run></Run>
</Paragraph>
</TableCell>
</TableRow>
</TableRowGroup>
</Table>
</Section>
UPDATE: I created a RTF file with the Tables and loaded them (FileStream), but the result is the same. BorderSettings are lost.



