Unplanned
Last Updated: 11 Jul 2025 09:57 by Jennifer
This is the code for generating the document from scratch: 
        static void Main(string[] args)
        {
          
            Telerik.Windows.Documents.Flow.Model.RadFlowDocument document = CreateDocument();
            Telerik.Windows.Documents.Flow.FormatProviders.Docx.DocxFormatProvider provider = new Telerik.Windows.Documents.Flow.FormatProviders.Docx.DocxFormatProvider();
            string outputFilePath = "output.docx";
            File.Delete(outputFilePath);

            using (Stream output = File.OpenWrite(outputFilePath))
            {
                provider.Export(document, output, TimeSpan.FromSeconds(10));
            } 

            Process.Start(new ProcessStartInfo() { FileName = outputFilePath, UseShellExecute = true });
        }

        //Not working example
        private static RadFlowDocument CreateDocument()
        {
            int FullPercentWidth = 100;
            var document = new RadFlowDocument();
            var editor = new RadFlowDocumentEditor(document);

            editor.InsertSection();

            var header = document.Sections.First().Headers.Add().Blocks.AddParagraph();
            header.TextAlignment = Alignment.Center;

            editor.MoveToParagraphStart(header);
            editor.InsertLine("Dissemination Label");

            var br = new Break(document);
            header.Inlines.Add(br);

            editor.MoveToParagraphEnd(header);
            editor.InsertText("Test");

            editor.MoveToParagraphStart(document.Sections.First().Blocks.AddParagraph());

            editor.InsertParagraph();
            editor.InsertLine("First Header");
            editor.InsertLine("Second Header");

            editor.TableFormatting.StyleId = BuiltInStyleNames.TableGridStyleId;
            document.StyleRepository.AddBuiltInStyle(BuiltInStyleNames.TableGridStyleId);

            Table table = editor.InsertTable();
            table.PreferredWidth = new TableWidthUnit(TableWidthUnitType.Percent, FullPercentWidth);
            table.LayoutType = TableLayoutType.AutoFit;

            TableRow headerRow = table.Rows.AddTableRow();

            var cell = headerRow.Cells.AddTableCell();
            var cellParagraph = cell.Blocks.AddParagraph();
            _ = cellParagraph.Inlines.AddRun("ID");

            var cell2 = headerRow.Cells.AddTableCell();
            var cellParagraph2 = cell2.Blocks.AddParagraph();
            _ = cellParagraph2.Inlines.AddRun("Title");

            var cell3 = headerRow.Cells.AddTableCell();
            var cellParagraph3 = cell3.Blocks.AddParagraph();
            _ = cellParagraph3.Inlines.AddRun("Page Number");

            for (var i = 0; i < 3; i++)
            {
                var dataRow = table.Rows.AddTableRow();

                string id = "ID-" + i;

                var cell4 = dataRow.Cells.AddTableCell();
                var cellParagraph4 = cell4.Blocks.AddParagraph();
                _ = cellParagraph4.Inlines.AddRun(id);

                var cell5 = dataRow.Cells.AddTableCell();
                var cellParagraph5 = cell5.Blocks.AddParagraph();
                _ = cellParagraph5.Inlines.AddRun($"Fake Title {i}");

                var cell6 = dataRow.Cells.AddTableCell();
                var cellParagraph6 = cell6.Blocks.AddParagraph();
                editor.MoveToParagraphStart(cellParagraph6);
                editor.InsertField($"PAGEREF bookmark-{id}", string.Empty);
            }

            for (var i = 0; i < 3; i++)
            {
                var id = "ID-" + i;

                var section = document.Sections.AddSection();

                section.SectionType = SectionType.NextPage;

                var header2 = document.Sections.Count == 1
                    ? document.Sections.AddSection().Headers.Add().Blocks.AddParagraph()
                    : document.Sections.Last().Headers.Add().Blocks.AddParagraph();

                editor.MoveToParagraphStart(header2);
                editor.InsertLine("Dissemination Label");
                editor.InsertBreak(BreakType.LineBreak);

                editor.InsertLine("Fake Header");
                editor.InsertText("Display name");

                var table2 = new Table(document)
                {
                    PreferredWidth = new TableWidthUnit(TableWidthUnitType.Percent, FullPercentWidth),
                    LayoutType = TableLayoutType.AutoFit
                };

                var headerRow2 = table2.Rows.AddTableRow();

                headerRow2.CanSplit = false;

                var headerCell = headerRow2.Cells.AddTableCell();
                var headerParagraph = headerCell.Blocks.AddParagraph();

                headerParagraph.Inlines.AddRun("Title").FontWeight = FontWeights.Bold;
                headerParagraph.Spacing.SpacingAfter = 0;

                headerCell.ColumnSpan = 3;

                table2.LayoutType = TableLayoutType.FixedWidth;

                var row = InsertRow(table2);

                var cell7 = row.Cells.AddTableCell();
                var cellParagraph7 = cell7.Blocks.AddParagraph();
                _ = cellParagraph7.Inlines.AddRun("Stuff and things");

                var cell8 = row.Cells.AddTableCell();
                var cellParagraph8 = cell8.Blocks.AddParagraph();
                _ = cellParagraph8.Inlines.AddRun($"Stuff and things-{id}");
                editor.InsertBookmark($"bookmark-{id}");

                _ = InsertRow(table2);
                _ = InsertRow(table2);

                document.Sections.Last().Blocks.Add(table2);

                var table3 = new Table(document)
                {
                    PreferredWidth = new TableWidthUnit(TableWidthUnitType.Percent, FullPercentWidth),
                    LayoutType = TableLayoutType.AutoFit
                };

                var fakeText = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed laoreet finibus nulla sit amet consectetur. Fusce dignissim sapien congue augue hendrerit, eu rutrum orci lacinia. Maecenas sit amet augue ut arcu consequat molestie ac pretium nulla. Donec venenatis rhoncus pulvinar. Aliquam vel est vitae lacus porta aliquam. Morbi aliquet vulputate turpis, ut vulputate elit accumsan at. Vivamus interdum dictum arcu vel euismod. Curabitur commodo eu nisi ut ultrices. Duis at auctor eros. Vivamus et metus ligula. Vestibulum feugiat velit a feugiat sodales. Sed vitae urna sodales, faucibus felis non, sagittis diam.\r\n\r\nPraesent turpis est, aliquet consectetur felis et, pharetra placerat ipsum. Sed at consectetur metus. Integer dictum iaculis libero, interdum vehicula ipsum convallis a. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed pretium ac quam id finibus. Maecenas bibendum magna vel rhoncus eleifend. Etiam nec ante nulla. Etiam lacinia vulputate quam, et ullamcorper magna fermentum quis. Suspendisse potenti. Quisque quis nulla non velit lacinia laoreet. Fusce et lacinia enim, sit amet rhoncus eros. Etiam placerat fringilla nibh ac commodo.\r\n\r\nMorbi ac commodo elit. Sed a leo quis sem convallis volutpat eget et nunc. In laoreet eleifend ullamcorper. Phasellus pharetra molestie eleifend. Cras consequat risus ac est accumsan sagittis. Suspendisse facilisis ultrices ipsum, vitae porttitor augue tincidunt ac. Ut sagittis nisl tristique efficitur aliquam. Pellentesque molestie mauris id ipsum lacinia, a vehicula eros molestie. Aliquam quis sagittis tellus.";

                for (var j = 0; j < 2; j++)
                {
                    var row2 = InsertRow(table3);
                    var cell9 = row2.Cells.AddTableCell();
                    var cellParagraph9 = cell9.Blocks.AddParagraph();
                    _ = cellParagraph9.Inlines.AddRun(fakeText);
                }

                document.Sections.Last().Blocks.Add(table3);
            }

            FlowExtensibilityManager.NumberingFieldsProvider = new NumberingFieldsProvider();
            foreach (var s in document.Sections)
            {
                 s.Footers.Add();
                Footer f = s.Footers.Default;

                Paragraph paragraph = f.Blocks.AddParagraph();
                paragraph.TextAlignment = Alignment.Right;

                editor.MoveToParagraphStart(paragraph);

                editor.InsertText("Page ");
                editor.InsertField("PAGE", string.Empty);
                editor.InsertText(" of ");
                editor.InsertField("NUMPAGES", string.Empty);

                var paragrpah2 = s.Blocks.AddParagraph();
                editor.MoveToParagraphStart(paragrpah2);
            }



            document.UpdateFields();

            return document;
        }
        private static TableRow InsertRow(Table table)
        {
            TableRow row = new TableRow(table.Document);
            table.Rows.Add(row);
            return row;
        }
Unplanned
Last Updated: 02 Jul 2025 08:39 by Kris

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:

Unplanned
Last Updated: 23 Jun 2025 13:16 by ADMIN

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:

 

Unplanned
Last Updated: 09 Jun 2025 10:20 by Heidi

NullReferenceException when inserting a document containing a table with a document variable having a line break (\n) in its value.

Unplanned
Last Updated: 20 May 2025 11:38 by Babu
Background color is lost when formatting tags (<strong> and <u>) are applied to the content of a nested span.
Unplanned
Last Updated: 05 May 2025 09:23 by Robert

Import a document that contains a picture content control and the following error occurs: 

Telerik.Windows.Documents.Flow.Model.Annotations.StructuredDocumentTags.Builders.SdtBuilderFailureException: 'Picture control cannot be used in selection that contains any non-image content, or more than a single image.'

Unplanned
Last Updated: 30 Apr 2025 13:24 by Sujanphanikumar

PdfFormatProvider: Add support for the "Automatically resize to fit contents" table property.

Unplanned
Last Updated: 29 Apr 2025 10:39 by Kruparao

Multiple CSS classes on an element are not correctly resolved when converted to inline styles.

Before:

.TelerikNormal {font-family: Calibri;font-size: 14.6666666666667px;margin-top: 0px;margin-bottom: 0px;line-height: 100%;color: #000000;}
.TelerikHeading3 {font-family: Calibri Light;font-size: 22.6666666666667px;}
<p class="TelerikNormal TelerikHeading3"><span>Test</span></p>

Due to order priority, the TelerikHeading3 values override the TelerikNormal values. The font-size becomes 22.6666666666667px.

Convert:

provider.ExportSettings.StylesExportMode = StylesExportMode.Inline;
After:
<p style="font-family: Calibri;font-size: 14.6666666666667px;margin-top: 0px;margin-bottom: 0px;line-height: 100%;color: #000000;"><span>Test</span></p>
ResultTelerikHeading3 and its properties are ignored and not applied during the conversion to inline styles. The font-size is now 14.6666666666667px.

 

Unplanned
Last Updated: 05 Mar 2025 12:03 by Jason
Unplanned
Last Updated: 03 Mar 2025 09:09 by Vijayaprasad
Created by: Vijayaprasad
Comments: 0
Category: WordsProcessing
Type: Feature Request
1
Preserve the comments when exporting the DOCX file to PDF format
Unplanned
Last Updated: 21 Jan 2025 16:20 by ADMIN

Getting an exception message when trying to view a document as a PDF using the PdfFormatProvider which started happening only after upgrading Telerik to the latest version, 7.1.0 in Telerik UI for Blazor.

Exception Message:

width should be greater or equal than 0. (Parameter 'width')

I have copied the stack trace and source of the exception below:

 

Source: Telerik.Documents.Fixed

Stack Trace:    at Telerik.Windows.Documents.Fixed.Model.Editing.Layout.ContentElementLayoutElementBase`1.DrawHighlights(DrawLayoutElementContext context)
   at Telerik.Windows.Documents.Fixed.Model.Editing.Layout.ContentElementLayoutElementBase`1.Draw(DrawLayoutElementContext context)
   at Telerik.Windows.Documents.Fixed.Model.Editing.Block.Draw(IEnumerable`1 lineElements, DrawLayoutElementContext context)
   at Telerik.Windows.Documents.Fixed.Model.Editing.Block.DrawInternal(FixedContentEditor editor, Rect boundingRect)
   at Telerik.Windows.Documents.Fixed.Model.Editing.Block.Telerik.Windows.Documents.Fixed.Model.Editing.Flow.IDrawArrangedElement.DrawArrangedElement(FixedContentEditor editor, Rect boundingRect)
   at Telerik.Windows.Documents.Fixed.Model.Editing.Flow.SectionInfo.DrawArrangedElement(IBlockElement blockElement, Double horizontalOffset, Double verticalOffset)
   at Telerik.Windows.Documents.Fixed.Model.Editing.Utils.SectionInfoExtensions.DrawArrangedElements(SectionInfo section, IList`1 elements)
   at Telerik.Windows.Documents.Fixed.Model.Editing.RadFixedDocumentEditor.Draw()
   at Telerik.Windows.Documents.Fixed.Model.Editing.RadFixedDocumentEditor.StartNewPage(SectionProperties sectionProperties)
   at Telerik.Windows.Documents.Fixed.Model.Editing.RadFixedDocumentEditor.StartNewPage()
   at Telerik.Windows.Documents.Fixed.Model.Editing.RadFixedDocumentEditor.AddBlock(IBlockElement blockElement, CancellationToken cancellationToken)
   at Telerik.Windows.Documents.Flow.FormatProviders.Pdf.Export.PdfExporter.ExportSection(Section section, RadFixedDocumentEditor editor)
   at Telerik.Windows.Documents.Flow.FormatProviders.Pdf.Export.PdfExporter.ExportDocument(RadFlowDocument document, RadFixedDocumentEditor editor)
   at Telerik.Windows.Documents.Flow.FormatProviders.Pdf.Export.PdfExporter.ExportInternal()
   at Telerik.Windows.Documents.Flow.FormatProviders.Pdf.Export.PdfExporter.Export()
   at Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider.ExportToFixedDocument(RadFlowDocument document, CancellationToken cancellationToken)
   at Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider.ExportOverride(RadFlowDocument document, Stream output, CancellationToken cancellationToken)
   at Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider.ExportOverride(RadFlowDocument document, Stream output)
   at Telerik.Windows.Documents.Common.FormatProviders.FormatProviderBase`1.Export(T document, Stream output)
   at Telerik.Windows.Documents.Common.FormatProviders.BinaryFormatProviderBase`1.Export(T document)

Unplanned
Last Updated: 17 Jan 2025 13:25 by Yim
NetFramework: HtmlFormatProvider: VerificationException is thrown when importing specific HTML document.
Unplanned
Last Updated: 17 Jan 2025 11:42 by Simone

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>

Unplanned
Last Updated: 14 Jan 2025 12:15 by Simone
			<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>

Unplanned
Last Updated: 14 Jan 2025 11:52 by Simone
Export a DOCX file with a header containing image and multiline text. After exporting it to PDF format, the header text is smashed. 
Unplanned
Last Updated: 23 Dec 2024 11:38 by Xiao
Importing a DOCX file (produced by the WPF RichTextBox) and exporting it to PDF format results in changed font from Arial to Verdana for some parts of the document.
Unplanned
Last Updated: 13 Dec 2024 11:18 by Deepak Subhedar
Created by: Deepak Subhedar
Comments: 0
Category: WordsProcessing
Type: Feature Request
0
TxtFormatProvider: Expose Encoding settings.
Unplanned
Last Updated: 27 Nov 2024 14:34 by Robert

(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.

Unplanned
Last Updated: 12 Nov 2024 08:51 by IT
Created by: IT
Comments: 0
Category: WordsProcessing
Type: Feature Request
0
Add support for diagrams.
1 2 3 4 5 6