Word and Pdf mismatch

Hello,

Pdf and Word files don’t match in case when document has table which has vertical merged cell with long text and “page break before” in next row.
There is an option to save documents in Word with OOXML compliance equals ISO29500:2008 STRICT. There is no compliance in PdfSaveOptions with which save document would work the same way as Word.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.getParagraphFormat().clearFormatting();
builder.insertCell();
builder.getCellFormat().setVerticalMerge(CellMerge.NONE);
builder.write("1");

builder.insertCell();
builder.getCellFormat().setVerticalMerge(CellMerge.NONE);
builder.write("2");

builder.insertCell();
builder.getCellFormat().setVerticalMerge(CellMerge.NONE);
builder.write("3");

builder.insertCell();
builder.getCellFormat().setVerticalMerge(CellMerge.NONE);
builder.write("4");
builder.endRow();

builder.insertCell();
builder.getCellFormat().setVerticalMerge(CellMerge.NONE);
builder.write("5");

builder.insertCell();
builder.getCellFormat().setVerticalMerge(CellMerge.NONE);
builder.write("6");

builder.insertCell();
builder.getCellFormat().setVerticalMerge(CellMerge.FIRST);
builder.write("Text in merged cells. Text in merged cells. Text in merged cells. Text in merged cells. Text in merged cells. Text in merged cells. Text in merged cells. Text in merged cells. Text in merged cells. Text in merged cells. Text in merged cells. Text in merged cells. Text in merged cells. Text in merged cells. Text in merged cells. Text in merged cells. Text in merged cells.");

builder.insertCell();
builder.getCellFormat().setVerticalMerge(CellMerge.NONE);
builder.write("7");
builder.endRow();

builder.getParagraphFormat().clearFormatting();
builder.getParagraphFormat().setPageBreakBefore(true);
builder.insertCell();
builder.getCellFormat().setVerticalMerge(CellMerge.NONE);
builder.write("8");

builder.insertCell();
builder.getParagraphFormat().clearFormatting();
builder.getCellFormat().setVerticalMerge(CellMerge.NONE);
builder.write("9");

builder.insertCell();
builder.getCellFormat().setVerticalMerge(CellMerge.PREVIOUS);

builder.insertCell();
builder.getCellFormat().setVerticalMerge(CellMerge.NONE);
builder.write("10");
builder.endRow();

builder.insertCell();
builder.write("11");

builder.insertCell();
builder.write("12");

builder.insertCell();
builder.write("13");

builder.insertCell();
builder.write("10");
builder.endRow();

builder.endTable();

OoxmlSaveOptions saveOptions = new OoxmlSaveOptions(SaveFormat.DOCX);
saveOptions.setCompliance(OoxmlCompliance.ISO_29500_2008_STRICT);
doc.save("doc.docx", saveOptions);

word.PNG (44.6 KB)
pdf.PNG (67.4 KB)

@ANDREA.FARRIS
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): WORDSNET-25434

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

The issues you have found earlier (filed as WORDSNET-25437) have been fixed in this Aspose.Words for .NET 23.7 update also available on NuGet.

@ANDREA.FARRIS As a workaround, you can try calling CompatibilityOptions.OptimizeFor method like this:

doc.CompatibilityOptions.OptimizeFor(MsWordVersion.Word2013);