The Indent property of Table is not respected by PdfFormatProvider.
When table cell preferred width is smaller than the first word in the cell the actual exported width should fit the word width when exporting to PDF. Currently in such case the word is split into two lines. The width has to be equal to the word width so the word stays on a single row.
This is done due to wrong column widths weights calculations.
Exporting to PDF of a table with a first cell having preferred width of 100% and a second cell having preferred width of auto will result in missing the second cell.
When the table width is set to fixed with the value of zero:
<w:tblW w:w="0" w:type="dxa"/>
Importing HTML tables with mixed inline width styles and auto-width cells, then exporting to PDF, can produce missing/narrow columns or wrapped labels.
For example, a 4-cell row with td style="width: 60%" and td style="width: 40%" causes the unlabeled cells to collapse in PDF output, even though the HTML renders correctly in browser.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<table>
<tr>
<td align="right">Customer:</td>
<td style="width: 60%;">Angel Popov</td>
<td align="right">Date:</td>
<td style="width: 40%;">4/4/2004</td>
</tr>
</table>
</body>
</html>Expected: all cells keep visible widths and text stays on one line.
Actual: auto columns shrink too much or disappear during PDF export after HTML import.
HtmlFormatProvider: Styles are not correctly preserved when a <b> tag is applied to the same styled element.
Workaround: Apply bold through CSS instead of using <b>.
When there is an abstractNum defined with the same abstractNumId in word\glossary\numbering.xml and in the word\numbering.xml, a "System.ArgumentException: An item with the same key has already been added." exception is thrown.
In other cases, the import overwrites the styles from the main document part with the ones defined in the glossary or fails to import different parts of the content.
Workaround: Delete the glossary files:
string path = "File.docx";
using (Stream str = new FileStream(path, FileMode.OpenOrCreate, FileAccess.ReadWrite))
{
using (ZipArchive archive = ZipArchive.Update(str, null))
{
foreach (ZipArchiveEntry entry in archive.Entries.ToList())
{
if (entry.FullName.Contains("glossary/"))
{
entry.Delete();
}
}
}
DocxFormatProvider provider = new DocxFormatProvider();
RadFlowDocument flowDocument = provider.Import(str, null);
}
LineInfo objects are not cleared when there are tables in the document being exported to PDF which leads to OutOfMemoryException.
Text frames are paragraphs of text in a document which are positioned in a separate region or frame in the document and can be positioned with a specific size and position relative to non-frame paragraphs in the current document. More information about it is available in section 22.9.2.18 ST_XAlign (Horizontal Alignment Location) of Open Office XML.
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;
}
<w:pict w14:anchorId="324D5836">
<v:rect id="_x0000_i1025" style="width:0;height:1.5pt" o:hralign="center" o:hrstd="t" o:hr="t" fillcolor="#a0a0a0" stroked="f"/>
</w:pict>