When the imported html contains an attribute of the type width="", Wordsprocessing throws ArgumentException and does not import the document.
Importing an image from HTML with URI as a source, which has applied only width or height and exporting it to PDF (which forces getting the image data so it can be drawn) leads to an incorrect value of 1 (a default value) for the dimension that is not specified.
When the document contains an image with extension, which is not among the supported ones, a KeyNotFoundException is thrown during Import.
An ArgumentException is thrown when importing HTML containing standard and non-standard pseudo classes or pseudo elements. The concreete scenario is the following: .myclass::-webkit-scrollbar or .myclass::-ms-expand The message of the exception is similar to this: "Unexpected character found at position [X]: ".. scrollbar::>>-<<webkit-scrollbar"".
document.DefaultTabStopWidth = 0.1;
Implement support for pictures with references represented with the r:link attribute in the schema.
Form fields are the legacy way to insert an editable controls in a document (text boxes, checkboxes, dropdowns) by using the FORMTEXT, FORMCHECKBOX and FORMDROPDOWN fields. Do not confuse with content controls (structured document tags) (see https://feedback.telerik.com/Project/184/Feedback/Details/190057 ) and with ActiveX controls.
These file formats are very similar to DOCX, and can be easily imported with loss of some information (e.g. macros).
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;
}
}
In a DOCX document, the users can define an image which is bigger than the size of the page. When such an image is at the beginning of the document and is converted with PdfFormatProvider, an additional page is added in the result PDF.
foreach (var image in document.EnumerateChildrenOfType<ImageInline>()) { var section = image.Paragraph.Parent as Section; if (image.Image.Height > section.PageSize.Height - section.PageMargins.Top - section.PageMargins.Bottom) { var height = section.PageSize.Height - section.PageMargins.Top - section.PageMargins.Bottom - (image.Paragraph.Spacing.SpacingAfter * (image.Paragraph.Spacing.LineSpacing - 0.97)); image.Image.Size = new System.Windows.Size(image.Image.Width, height); } }
Add support for INCLUDEPICTURE fields. Such fields should work with nested MERGEFIELD, as this is common scenario. Workaround: Manually insert images over specific placeholderRadFlowDocument document =
new
RadFlowDocument();
RadFlowDocumentEditor editor =
new
RadFlowDocumentEditor(document);
editor.InsertText(
"1"
);
editor.InsertText(
"EXAMPLE_IMAGE"
);
editor.InsertText(
"2"
);
foreach
(var run
in
editor.Document.EnumerateChildrenOfType<Run>().ToArray())
{
if
(run.Text ==
"EXAMPLE_IMAGE"
)
{
Paragraph paragraph = run.Paragraph;
int
indexOfCurrentRun = paragraph.Inlines.IndexOf(run);
paragraph.Inlines.RemoveAt(indexOfCurrentRun);
ImageInline imageInline =
new
ImageInline(document);
imageInline.Image.ImageSource = newTelerik.Windows.Documents.Media.ImageSource(imageData,
"png"
);
paragraph.Inlines.Insert(indexOfCurrentRun, imageInline);
}
}
When MergeField is present in the document, and this merge field is evaluated to an empty string - this, for example, happens when the property in the data source is set to null, empty string, or is missing at all - the result fragment remains in the result document. Instead, it should be removed. Steps to reproduce: - Create document with merge field, the field should contain result fragment, and set data source which contains null or string.Empty value for the field: RadFlowDocument document = new RadFlowDocument(); RadFlowDocumentEditor editor = new RadFlowDocumentEditor(document); editor.InsertField("MERGEFIELD FirstName ", "«FirstName»"); List<Person> source = new List<Person>() { new Person() { FirstName = string.Empty } }; RadFlowDocument mergedDocument = document.MailMerge(source); Expected: The result document is empty. Actual: The result document contains "«FirstName»" string. Available in LIB Version 2017.3.1120.