Restrict the TableCellProperties API of a style according to specification.
When table with table border without color set is created (the color is null), and the document is exported to PDF, ArgumentNullException is thrown.
Workaround: Explicitly set a color where the color is null.
private void PdfExport()
{
var tables = this.document.EnumerateChildrenOfType<Table>();
foreach (var table in tables)
{
TableBorders coloredClone = this.CopyTableBorders_SetColorWhenOmitted(table);
table.Borders = coloredClone;
using (Stream output = new FileStream(fileName, FileMode.OpenOrCreate))
{
provider.Export(this.document, output);
}
}
}
private TableBorders CopyTableBorders_SetColorWhenOmitted(Table table)
{
var leftBorder = new Border(table.Borders.Left.Thickness,
table.Borders.Left.Style,
table.Borders.Left.Color ?? new ThemableColor(Colors.Transparent),
table.Borders.Left.Shadow,
table.Borders.Left.Frame,
table.Borders.Left.Spacing);
var rightBorder = new Border(table.Borders.Right.Thickness,
table.Borders.Right.Style,
table.Borders.Right.Color ?? new ThemableColor(Colors.Transparent),
table.Borders.Right.Shadow,
table.Borders.Right.Frame,
table.Borders.Right.Spacing);
var bottomBorder = new Border(table.Borders.Bottom.Thickness,
table.Borders.Bottom.Style,
table.Borders.Bottom.Color ?? new ThemableColor(Colors.Transparent),
table.Borders.Bottom.Shadow,
table.Borders.Bottom.Frame,
table.Borders.Bottom.Spacing);
var topBorder = new Border(table.Borders.Top.Thickness,
table.Borders.Top.Style,
table.Borders.Top.Color ?? new ThemableColor(Colors.Transparent),
table.Borders.Top.Shadow,
table.Borders.Top.Frame,
table.Borders.Top.Spacing);
var insideHorizontalBorder = new Border(table.Borders.InsideHorizontal.Thickness,
table.Borders.InsideHorizontal.Style,
table.Borders.InsideHorizontal.Color ?? new ThemableColor(Colors.Transparent),
table.Borders.InsideHorizontal.Shadow,
table.Borders.InsideHorizontal.Frame,
table.Borders.InsideHorizontal.Spacing);
var insideVerticalBorder = new Border(table.Borders.InsideVertical.Thickness,
table.Borders.InsideVertical.Style,
table.Borders.InsideVertical.Color ?? new ThemableColor(Colors.Transparent),
table.Borders.InsideVertical.Shadow,
table.Borders.InsideVertical.Frame,
table.Borders.InsideVertical.Spacing);
var tableBorders = new TableBorders(leftBorder, topBorder, rightBorder, bottomBorder, insideHorizontalBorder, insideVerticalBorder);
return tableBorders;
}
Center alignment is not respected for list numbering.
Expected:
Actual:
When a document with multiple headings ( Heading 1) are imported and then exported, their type from letters is changed to numbers, for example:
Original content: Part A, Part B, Part C
Exported content: Part 1, Part 2, Part 3
The generated document looks OK before printing:
However, hitting the print preview button in MS Words leads to missing text in the fields:
Add support for importing the text values of the input element. They could be imported as a simple text to preserve the content.
This is the code snippet that reproduces the error:
RadFlowDocument flowDocument = new RadFlowDocument();
RadFlowDocumentEditor editor = new RadFlowDocumentEditor(flowDocument);
Bookmark bookmark = new Bookmark(flowDocument, "Name");
editor.InsertInline(bookmark.BookmarkRangeStart);
Table table = editor.InsertTable(1, 2);
TableCell cell1 = table.Rows[0].Cells[0];
Paragraph cell_paragraph1 = cell1.Blocks.AddParagraph();
editor.MoveToParagraphStart(cell_paragraph1);
editor.InsertText("cell content 01");
TableCell cell2 = table.Rows[0].Cells[1];
Paragraph cell_paragraph2 = cell2.Blocks.AddParagraph();
editor.MoveToParagraphStart(cell_paragraph2);
editor.InsertText("cell content 02");
editor.MoveToTableEnd(table);
editor.InsertInline(bookmark.BookmarkRangeEnd);
RadFlowDocument newFlowDocument = new RadFlowDocument();
RadFlowDocumentEditor editor02 = new RadFlowDocumentEditor(newFlowDocument);
editor.InsertDocument(flowDocument);Workaround: Insert one bookmark before the table and another one after the table:
RadFlowDocument flowDocument = new RadFlowDocument();
RadFlowDocumentEditor editor = new RadFlowDocumentEditor(flowDocument);
//Bookmark bookmark = new Bookmark(flowDocument, "Name");
//editor.InsertInline(bookmark.BookmarkRangeStart);
editor.InsertBookmark("before");
Table table = editor.InsertTable(1, 2);
TableCell cell1 = table.Rows[0].Cells[0];
Paragraph cell_paragraph1 = cell1.Blocks.AddParagraph();
editor.MoveToParagraphStart(cell_paragraph1);
editor.InsertText("cell content 01");
TableCell cell2 = table.Rows[0].Cells[1];
Paragraph cell_paragraph2 = cell2.Blocks.AddParagraph();
editor.MoveToParagraphStart(cell_paragraph2);
editor.InsertText("cell content 02");
editor.MoveToTableEnd(table);
editor.InsertBookmark("after");
//editor.InsertInline(bookmark.BookmarkRangeEnd);
RadFlowDocument newFlowDocument = new RadFlowDocument();
RadFlowDocumentEditor editor02 = new RadFlowDocumentEditor(newFlowDocument);
editor.InsertDocument(flowDocument);