I'm trying to display some table data in RichTextBlock. The data contains several lines of text, and the text contains multiple spaces. I'm adding each line as Run objects to the Paragraph.
string[] lines = tableData;
Paragraph para = this.TextContent.Blocks.First() as Paragraph;
para.Inlines.Add(new LineBreak());
para.Inlines.Add(new LineBreak());
para.Inlines.Add(new LineBreak());
para.Inlines.Add(new LineBreak());
for (int l = 0; l < lines.Length; l++)
{
Run r = new Run()
{
Text = lines[l],
FontSize = 9,
};
para.Inlines.Add(r);
para.Inlines.Add(new LineBreak());
}
RichTextBlock is replacing multiple spaces and keeping one, as shown here
Input text looks like this in Notepad++(enabled special characters to highlight spaces)
I couldn't find any property in the Paragraph or Run classes to avoid this scenario.
What do I miss to get the RichTextBlock to display the exact text displayed in Notedpadd++ like this?
Thank you