When I import html document to HtmlFormatProvider, I noticed empty line at beginning of each paragraph. When I exported same document as html document. I found empty paragraph is added, which causing extra spacing. Our challenge is to remove such extra spaces, so that all text in columns are same aligned.
Following is actual document content
<body><p class="NormalWeb "><span class="s_B0779B8D">some text here</span></p><p class="Normal "> </p></body>
While following is generated html document (First para is not part of actual document. and same rendered in richtextbox editor. which adds extra space on top)
<p class="NormalWeb ">
<span class="s_DED8E654"> </span>
</p>
<p class="NormalWeb ">
<span class="s_BCF031D1">some text here</span>
</p>
<p class="Normal "> </p>
I am using following code to import html into editor
using (Stream input = new MemoryStream(Encoding.Default.GetBytes(html)))
{
HtmlFormatProvider provider = new HtmlFormatProvider();
provider.ImportSettings = new HtmlImportSettings
{
UseDefaultStylesheetForFontProperties = false,
UseHtmlHeadingStyles = false
};
RadDocument document = provider.Import(input);
editor.Document = document;
editor.Document.StyleRepository["NormalWeb"].ParagraphProperties.SpacingBefore = 0;
editor.Document.StyleRepository["NormalWeb"].ParagraphProperties.SpacingAfter = 0;
editor.Document.StyleRepository["NormalWeb"].ParagraphProperties.AutomaticSpacingAfter = false;
}
For reference I am attaching actual html document, exported html document and rendering in user interface.