Unplanned
Last Updated: 30 Sep 2021 11:07 by ADMIN
Hashitha
Created on: 30 Sep 2021 11:07
Category: RichTextBox
Type: Bug Report
0
RicTextBox: Exception when importing a document with an empty table

Exception when importing a document with an empty table.

Workaround: Remove the empty tables:

DocxFormatProvider provider = new DocxFormatProvider();
var doc = provider.Import(File.ReadAllBytes(@"C:\Users\mpc\Downloads\22-51.docx"));

foreach (var section in doc.Sections)
{
    var tables = section.EnumerateChildrenOfType<Table>();
    foreach (var table in tables.ToList())
    {
        if (table.Rows.Count == 0)
        {
            section.Blocks.Remove(table);
        }
    }
}
radRichTextBox.Document = doc;

0 comments