If a TOC field uses TC fields only (with the \f switch) and there is a tab in the text of the TC field, after mail merge, the tab becomes really wide. If the file is opened in word and the field is updated, everything goes back to normal.
Expected:
Actual:
A possible workaround is to set the fields to be updated on opening of the document:
DocxFormatProvider provider = new DocxFormatProvider();
provider.ExportSettings.AutoUpdateFields= true;
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;
}
Similar to https://feedback.telerik.com/reporting/1356710-rendering-to-xlsx-should-not-add-bom-to-xml-files :
DOCX files exported with DocxFormatProvider contain a BOM in every exported XML file. Some programs fail to load those DOCX files.
Please remove the BOM, or add a toggle in DocxExportSettings.
Updating a Table of Contents field with a custom TOC Style does not respect it.
As a workaround modify the style after the TOC fields are updated.
With the current implementation of the RadFlowDocumentEditor`s CharacterFormatting.FontWeight.LocalValue accepts only FontWeights.Bold and FontWeights.Normal and throws an exception when setting different weights (ex. Black, Thin, etc.).
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.