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"
/>
private
static
void
SplitDocument(RadFlowDocument sourceDocument, RadFlowDocument targetDocument)
{
DocumentElementImporter importer =
new
DocumentElementImporter(targetDocument, sourceDocument, ConflictingStylesResolutionMode.UseTargetStyle);
Section section = sourceDocument.EnumerateChildrenOfType<Section>().First();
Section importedSection = importer.Import(section);
targetDocument.Sections.Add(importedSection);
sourceDocument.Sections.Remove(section);
}
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.
document.DefaultTabStopWidth = 0.1;
For example, <h1> is imported as Heading 1 with font the following properties:
While MS Word imports it as:
When exporting, an option of how to create the PDF bookmarks should be provided:
- Using the RadFlowDocument bookmarks
- Using document Headings
The non-breaking hyphen element is currently not supported in the model and is stripped when importing the document.
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
;
}
}
}
The calculations are wrong, leading to single lines on a page. As a result, the content of the PDF document is laid out on a bigger number of pages.
Workaround: Change the line spacing and its type before exporting to PDF:
foreach (var paragraph in this.document.EnumerateChildrenOfType<Paragraph>())
{
HeightType? heightType = paragraph.Properties.LineSpacingType.GetActualValue();
if (heightType == HeightType.Exact || heightType == HeightType.AtLeast)
{
paragraph.Properties.LineSpacingType.LocalValue = Telerik.Windows.Documents.Flow.Model.Styles.HeightType.Auto;
paragraph.Properties.LineSpacing.LocalValue = 2;
}
}