Completed
Last Updated: 21 Mar 2024 05:53 by ADMIN
Release 2024.1.305 (2024 Q1)

Styles with names only different in spaces are treated as one.

Workaround:

var rtf = File.ReadAllText(fileName);
rtf = this.RenameStyleDifferentInOnlySpaces(rtf);
var document = provider.Import(rtf);

...

private string RenameStyleDifferentInOnlySpaces(string rtf)
{
    HashSet<string> styles = new HashSet<string>();

    string pattern = @"{\\(?:\*\\c)?s([0-9]+)[^}]*\n?[^}]*\\[^' ]* ?'?([^;]*)";

    var matches = Regex.Matches(rtf, pattern);
    foreach (Match match in matches)
    {
        string styleName = match.Groups[2].Value.Replace(" ", string.Empty);
        if (styles.Contains(styleName))
        {
            styleName = this.ReplaceOldStyleName(ref rtf, styles, match).Replace(" ", string.Empty);
        }

        styles.Add(styleName);
    }

    return rtf;
}

private string ReplaceOldStyleName(ref string rtf, HashSet<string> styles, Match match)
{
    string oldStyleName = match.Groups[2].Value;
    StringBuilder styleNameBuilder = new StringBuilder(oldStyleName + "0");
    while (styles.Contains(styleNameBuilder.ToString().Replace(" ", string.Empty)))
    {
        styleNameBuilder.Append("0");
    }

    string oldMatch = match.Groups[0].Value;
    string newMatch = oldMatch.Replace(oldStyleName, styleNameBuilder.ToString());
    rtf = rtf.Replace(oldMatch, newMatch);
    return styleNameBuilder.ToString();
}

Completed
Last Updated: 14 Mar 2024 08:59 by ADMIN
Release 2024.1.305 (2024 Q1)

StackOverflowException when importing a document with style based on itself.

Use the following code to strip the faulty "based on" definition from the RTF:

RtfFormatProvider provider = new RtfFormatProvider();
var rtf = File.ReadAllText(ofd.FileName);
rtf = this.ReplaceSelfBasedOnStyle(rtf);
this.flowDocument = provider.Import(rtf);

...

private string ReplaceSelfBasedOnStyle(string rtf)
{
    string pattern = @"{[\n]*\\s[0-9]+[^;]* \\\w* (Normal);}";

    var matches = Regex.Matches(rtf, pattern);
    foreach (Match match in matches)
    {
        string oldValue = match.Value;
        string newValue = oldValue.Replace(@"\sbasedon0 ", string.Empty);

        rtf = rtf.Replace(oldValue, newValue);
    }

    return rtf;
}

Completed
Last Updated: 14 Mar 2024 08:59 by ADMIN
Release 2024.1.305 (2024 Q1)
HtmlFormatProvider: Paragraph property AutomaticSpacingBefore is set to true instead of false.
Completed
Last Updated: 11 Jan 2024 08:24 by ADMIN
Release 2024 Q1
PdfFormatProvider: Inline image surrounded by bookmarks is incorrectly measured when the document contains numbering fields.
Completed
Last Updated: 12 Oct 2023 14:31 by ADMIN
Release R3 2023 SP1

When mailmerging a document, with nested mail merge group which starts inside a table and ends outside the table, a NullReferenceException is thrown: "System.NullReferenceException: 'Object reference not set to an instance of an object.' firstParagraphInTemplate was null."

Workaround: move the group end (EndGroup, TableEnd, RangeEnd, or GroupEnd) merge field inside the table where the group starts.

Completed
Last Updated: 12 Sep 2023 08:16 by ADMIN
Release R3 2023
Exporting a document with a shape containing PictureFill fails with NullReferenceException.
Completed
Last Updated: 27 Sep 2023 10:27 by ADMIN
Release R3 2023
System.InvalidOperationException is thrown on the import of a document containing content control with no content when it is the first item in the current section. The message is: "Sequence contains no elements".
Completed
Last Updated: 08 Sep 2023 12:33 by ADMIN
Release R3 2023
A table cell with a dark background is always exported with a white foreground.
Completed
Last Updated: 28 Aug 2023 12:15 by ADMIN
Release R3 2023
When border styles are both set inline and in CSS they are wrongly evaluated.

Completed
Last Updated: 19 Sep 2023 07:23 by ADMIN
Release R3 2023
Exporting a document to PDF throws a System.ArgumentException: 'Width and Height must be non-negative.' The line height property is calculated to less than zero.
Completed
Last Updated: 19 Jun 2023 07:07 by ADMIN
Release LIB 2023.2.619 (19 Jun 2023)
ArgumentOutOfRangeException: "Index was out of range" when inserting a table right after an empty paragraph.
Completed
Last Updated: 05 Jul 2023 08:14 by ADMIN
Release R2 2023 SP1
PdfFormatProvider: NullReferenceException when exporting bookmarks spanning more than one paragraph.
Completed
Last Updated: 31 Mar 2023 12:26 by ADMIN
Release R2 2023
NullReferenceException when importing a watermark with no opacity
Completed
Last Updated: 17 May 2023 14:44 by ADMIN
Release R2 2023
KeyNotFoundException when importing an rtf that references a font that is not declared. 
Completed
Last Updated: 17 May 2023 11:40 by ADMIN
Release R2 2023

Using a RadFlowDocumentEditor to add a page break and then insert a table, adds an additional paragraph in between.

 

As a workaround you can call the CleanParagraphsBeforeTablesOnNewPage() method:

private void CleanParagraphsBeforeTablesOnNewPage()
{
    List<Paragraph> paragraphs = this.flowDocument.EnumerateChildrenOfType<Paragraph>().ToList();
    foreach (var paragraph in paragraphs)
    {
        BlockContainerBase parent = (BlockContainerBase)paragraph.Parent;
        int paragraphIndex = parent.Blocks.IndexOf(paragraph);
        int blocksCount = parent.Blocks.Count;

        bool isAfterPageBreak = paragraphIndex > 0 && this.PreviousBlockEndsWithPageBreak(parent.Blocks[paragraphIndex - 1]);

        int nextIndex = paragraphIndex + 1;
        bool nextBlockIsTable = nextIndex < blocksCount && parent.Blocks[nextIndex] is Table;

        if (isAfterPageBreak && nextBlockIsTable)
        {
            parent.Blocks.Remove(paragraph);
        }
    }
}

private bool PreviousBlockEndsWithPageBreak(BlockBase blockBase)
{
    bool isLastInlinePageBreak = false;
    bool isParagraph = blockBase is Paragraph;
    if (isParagraph)
    {
        Paragraph paragraph = (Paragraph)blockBase;
        InlineBase lastInline = paragraph.Inlines.Last();

        bool isBreak = lastInline is Break;
        if (isBreak)
        {
            isLastInlinePageBreak = ((Break)lastInline).BreakType == BreakType.PageBreak;
        }
    }

    return isLastInlinePageBreak;
}

Completed
Last Updated: 17 May 2023 12:20 by ADMIN
Release R2 2023
The forecolor of table cells text is not preserved when exporting to PDF.
Completed
Last Updated: 03 Nov 2023 10:46 by ADMIN
Release R3 2023
When a value contains points (w:pos="85.50pt") can't be properly converted. FormatException: 'Input string was not in a correct format.' occurs. 
Completed
Last Updated: 27 Feb 2023 10:40 by ADMIN
Release R1 2023 SP1
Completed
Last Updated: 14 Feb 2023 12:43 by ADMIN
Release R1 2023 SP1
The Table Of Contents (TOC) is populated with additional elements when StyleLevel is set.
Completed
Last Updated: 14 Feb 2023 11:18 by ADMIN
Release R1 2023 SP1
Importing a TOC field with /t switch (containing a style like "Heading 1") causes IndexOutOfRangeException.
1 2 3 4 5 6