This is the code for import/export which result is illustrated below:
string inputFilePath = "test1.doc";
Telerik.Windows.Documents.Flow.Model.RadFlowDocument document;
Telerik.Windows.Documents.Flow.FormatProviders.Doc.DocFormatProvider doc_provider = new Telerik.Windows.Documents.Flow.FormatProviders.Doc.DocFormatProvider();
using (Stream input = File.OpenRead(inputFilePath))
{
document = doc_provider.Import(input, TimeSpan.FromSeconds(10));
}
Telerik.Windows.Documents.Flow.FormatProviders.Docx.DocxFormatProvider docx_provider = new Telerik.Windows.Documents.Flow.FormatProviders.Docx.DocxFormatProvider();
string outputFilePath = "Exported.docx";
using (Stream output = File.OpenWrite(outputFilePath))
{
docx_provider.Export(document, output, TimeSpan.FromSeconds(10));
}
Process.Start(new ProcessStartInfo() { FileName = outputFilePath, UseShellExecute = true });HtmlFormatProvider: Styles are not correctly preserved when a <b> tag is applied to the same styled element.
Workaround: Apply bold through CSS instead of using <b>.
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>
<w:sdt>
<w:sdtPr>
<w:text w:multiLine="1"/>
</w:sdtPr>
<w:sdtContent>
<w:r>
<w:t>Line 1</w:t>
</w:r>
<w:r>
<w:br/>
</w:r>
<w:r>
<w:t>Line 2</w:t>
</w:r>
</w:sdtContent>
</w:sdt>Import/export strips w:colFirst and w:colLast from table's <w:permStart> elements.
Expected:
Actual:
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);
}
Hyperlinks with fragment identifiers are not resolved correctly.
Example:
https://docs.telerik.com/devtools/document-processing/libraries/radwordsprocessing/overview#key-features