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;
}
}
When inserting content in an empty paragraph, the styles applied to it are the default document styles. However, if the properties are present in the last paragraph symbol, the content should inherit them.
Workaround: Copy the properties of the marker after inserting the content:
run.Properties.CopyPropertiesFrom(paragraph.Properties.ParagraphMarkerProperties);