When a document containing a field without a separator is inserted using the RadFlowDocumentEditor.InsertDocument(*) method, NullRferenceException is thrown.
Workaround: Fix the document before inserting:
private static void WorkaroundFieldsIssue(RadFlowDocument flowdocument)
{
foreach (FieldCharacter fieldCharacter in flowdocument.EnumerateChildrenOfType<FieldCharacter>().ToList())
{
// only for start
if (fieldCharacter.FieldCharacterType == FieldCharacterType.Start)
{
if (fieldCharacter.FieldInfo.Separator != null && fieldCharacter.FieldInfo.Separator.Parent == null)
{
Paragraph parent = fieldCharacter.FieldInfo.End.Paragraph;
int index = parent.Inlines.IndexOf(fieldCharacter.FieldInfo.End);
fieldCharacter.FieldInfo.End.Paragraph.Inlines.Insert(index, fieldCharacter.FieldInfo.Separator);
}
}
}
}
When the value in the document variable collection and the argument of the DOCVARIABLE fields are with different casing, the field is not updated. Available in LIB Version 2018.3.1029.
When a HTML has a wrong encoding set (content="text/html; charset=utf-16") we use the UTF-16 encoding when importing this HTML. This leads to wrong import. Microsoft Word detects that the set encoding is wrong and uses UTF-8 instead so that the imported result is correct. The HTML5 specification forbids the use of the meta element to declare UTF-16, because the values must be ASCII-compatible: https://www.w3.org/International/questions/qa-html-encoding-declarations#utf16
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>