(DIPs) is a unit type used in RadWordsProcessing when setting the FontSize of a Run. If you load a document with font size in WordPad set to 20 points and load it to RadFlowDocument, its value is converted by using the following method. If the RTF content stored from WordPad is saved to HTML format with WordPad, the font size is preserved with the same unit: style='font-size:20.0pt;'. We should add the option to control the font size unit when exporting to HTML format.
<w:r w:rsidRPr="00CB6D35">
<w:rPr>
<w:rFonts w:ascii="Calibri Light" w:hAnsi="Calibri Light"/>
<w:b/>
<w:u w:val="double"/>
</w:rPr>
<w:t>DETTAGLIO SINISTRO</w:t>
</w:r>When you have indented and justified text, it is wrongly exported to PDF:
<w:pPr>
<w:spacing w:after="0" w:line="360" w:lineRule="auto"/>
<w:ind w:left="567" w:right="567" w:firstLine="708"/>
<w:jc w:val="both"/>
<w:rPr>
<w:rFonts w:ascii="Calibri Light" w:hAnsi="Calibri Light"/>
</w:rPr>
</w:pPr>
When converting HTML to DOCX, margins set on an HTML element are ignored. These styles are exported correctly when the HTML passed to the converter is formatted with indents. The following XUnit test demonstrates this behavior with a simplified example.
using Telerik.Windows.Documents.Flow.FormatProviders.Docx;
using Telerik.Windows.Documents.Flow.FormatProviders.Html;
namespace MSPI.Tests.Unit;
public class WordExportTest
{
[Fact]
public async Task TextExport()
{
const string formattedDocumentSavePath = @"C:\Testing\export-test-formatted.docx";
const string formattedContent = """"
<p>Test paragraph</p>
<ol style="margin-left: 100px;">
<li>Item 1</li>
<li>Item 2</li>
</ol>
"""";
const string minifiedDocumentSavePath = @"C:\Testing\export-test-minified.docx";
const string minifiedContent = """"<p>Test paragraph</p><ol style="margin-left: 100px;"><li>Item 1</li><li>Item 2</li></ol>"""";
var htmlFormatProvider = new HtmlFormatProvider();
var docxFormatProvider = new DocxFormatProvider();
await using var minifiedDocumentMemoryStream = new MemoryStream();
var minifiedRadFlowDocument = htmlFormatProvider.Import(minifiedContent, TimeSpan.FromSeconds(30));
docxFormatProvider.Export(minifiedRadFlowDocument, minifiedDocumentMemoryStream, TimeSpan.FromSeconds(30));
var minifiedBytes = minifiedDocumentMemoryStream.ToArray();
await File.WriteAllBytesAsync(minifiedDocumentSavePath, minifiedBytes);
await using var formattedDocumentMemoryStream = new MemoryStream();
var formattedRadFlowDocument = htmlFormatProvider.Import(formattedContent, TimeSpan.FromSeconds(30));
docxFormatProvider.Export(formattedRadFlowDocument, formattedDocumentMemoryStream, TimeSpan.FromSeconds(30));
var formattedBytes = formattedDocumentMemoryStream.ToArray();
await File.WriteAllBytesAsync(formattedDocumentSavePath, formattedBytes);
}
}The minified HTML produces the following document:
The formatted HTML produces the following document:
Import the following HTML content and export it to DOCX format:
<p>Here is my list</p>
<ol start="108" style="list-style-type: lower-latin;">
<li>Item 1</li>
<li>Item 2</li>
</ol>Expected result:
Actual result:
Paragraphs with a bulleted "Normal" style, but with bullets removed inline, revert to showing bullets after import/export with Telerik Document Processing (DPL)—is not the intended behavior. Inline overrides, such as manually removing bullets from specific paragraphs, should be preserved after processing:
RadFlowDocumentEditor.InsertDocument throws NullReferenceException when inserting a document with incorrectly paired permission range elements.
Valid (Nested):
<w:permStart w:id="1"/>
<w:permStart w:id="2"/>
... content ...
<w:permEnd w:id="2"/>
<w:permEnd w:id="1"/>Invalid (Overlapped):
<w:permStart w:id="1"/>
<w:permStart w:id="2"/>
<w:permEnd w:id="1"/>
<w:permEnd w:id="2"/>Workaround - Remove all Permission Ranges before inserting:
var startPermissionRanges = contentDocument.EnumerateChildrenOfType<PermissionRangeStart>().ToList();
var endPermissionRanges = contentDocument.EnumerateChildrenOfType<PermissionRangeEnd>().ToList();
foreach (PermissionRangeStart rangeStart in startPermissionRanges)
{
rangeStart.Paragraph.Inlines.Remove(rangeStart);
}
foreach (PermissionRangeEnd rangeEnd in endPermissionRanges)
{
rangeEnd.Paragraph.Inlines.Remove(rangeEnd);
}
When imported in the WordsProcessing model, the current HTML doesn't respect the defined column width and all columns have identical width:
<colgroup>
<col span="1" style="width: 33.3302%;">
<col span="1" style="width: 17.5658%;">
<col span="1" style="width: 49.104%;">
</colgroup>Observed result:
Expected result:
Workaround: use the width property as follows:
<colgroup>
<col span="1" width="33.3302%">
<col span="1" width="17.5658%">
<col span="1" width="49.104%">
</colgroup>