foreach
(var section
in
this
.document.Sections)
{
bool
shouldInsert =
false
;
foreach
(var block
in
section.Blocks.ToList())
{
var paragraph = block
as
Paragraph;
if
(paragraph !=
null
&& paragraph.ListId > -1)
{
shouldInsert =
true
;
}
else
if
(shouldInsert)
{
var paragraphToInsert =
new
Paragraph(
this
.document);
paragraphToInsert.Spacing.LineSpacing = 1;
paragraphToInsert.Spacing.LineSpacingType = HeightType.Exact;
paragraphToInsert.Spacing.SpacingAfter = 0;
block.BlockContainer.Blocks.Insert(section.Blocks.IndexOf(block), paragraphToInsert);
shouldInsert =
false
;
}
}
}
For example, <h1> is imported as Heading 1 with font the following properties:
While MS Word imports it as:
document.DefaultTabStopWidth = 0.1;
Importing document with invalid bookmarks throws System.Collections.Generic.KeyNotFoundException. The issue is caused by an invalid bookmark having missing BookmarkRangeStart/bookmarkStart or BookmarkRangeEnd/bookmarkEnd elements.
The construct <link rel=
"stylesheet"
href=
"main.min.css"
/>
doesn't raise the HtmlImportSettings.LoadFromUri event on import, as we currently require type="text\css" to be specified explicitly.
type
attribute, but is actually now recommended practice.
Think of improving the message of the exception we throw if no data is loaded.
Workaround: set type explicitly:<link rel=
"stylesheet"
type=
"text/css"
href=
"main.min.css"
/>
foreach (var style in this.document.StyleRepository.Styles)
{
if (style.StyleType == StyleType.Table)
{
if (style.LinkedStyleId != null)
{
style.LinkedStyleId = null;
}
}
}
The empty lines are not converted properly from RTF to HTML
Workaround:
private static void FixEmptyParagraphs(RadFlowDocument document)<ul>
<li>
<div>Text</div>
</li>
</ul>
When nested div elements are imported the WordsProcessing library creates separate paragraph elements for each div. However, if the outer div doesn't contain any inline children preceding the inner div element, the first created paragraph will be removed and only the second paragraph will be left. This leads to losing any style properties of the outer div.
Example:
<div style="margin-top: 50px;">
<div>Text</div>
</div>