We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Convert WordML with table with colspan to PDF => Problem in table

Hi,

For our customer application, we need to convert an Word ML (XML) document to PDF.
We do dis using your Aspose Words component (V10.8.0.0) and in most cases it works great.

Unless, when we use a table with a cell spanned over 2 columns (like colspan in html), then the conversion goes wrong.

In attachment you find the source file (.doc extension) and also the output file in PDF/A.
On page 3 of the document everything goes wrong... The table gets extended and you cannot read the output anymore because it falls of the page...

The source code we use to convert is:

var stream = new MemoryStream();
var doc = new Document(fileToconvert.FullName);

foreach (Section section in doc.Sections)
{
// Set PaperSize to A4
section.PageSetup.PaperSize = PaperSize.A4;
}

//Set PDF Options
var pdfoptions = new Words.Saving.PdfSaveOptions()
{
Compliance = PdfCompliance.PdfA1b,
SaveFormat = SaveFormat.Pdf,
TextCompression = PdfTextCompression.None
};

//Save the Pdf
doc.Save(stream, pdfoptions);

// Rewind the stream
stream.Position = 0;

Can you tell us what's wrong with it ?

Best regards,

Steven

Hi
Steven,


Thanks for your inquiry.

You can call UpdateTableLayout method before exporting DOC to PDF (or any other fixed-page format), only in rare cases where you confirmed that tables appear incorrectly laid out in the output document. In your case, calling this method will help to correct the output. e.g:

var
stream = new MemoryStream();
var doc =
new Document(fileToconvert.FullName);

foreach (Section section in
doc.Sections)
{
// Set PaperSize
to A4
section.PageSetup.PaperSize = PaperSize.A4;
}

//Set PDF Options
var
pdfoptions = new Words.Saving.PdfSaveOptions()
{
Compliance = PdfCompliance.PdfA1b,
SaveFormat = SaveFormat.Pdf,
TextCompression = PdfTextCompression.None
};

doc.UpdateTableLayout();

//Save the Pdf
doc.Save(stream,
pdfoptions);

// Rewind the stream
stream.Position
= 0;

I hope, this will help.

Best Regards,

Hi,

Thanks for the quick reply to this issue.

The table fits now on my page indeed. But the colspanned columns are no more spread over more than 1 column. Is there a way to do this and have the same layout as the original one?

In attachment you find the current output. The issue is still located at page 3

Best regards,

Steven

Hi Steven,


Thanks for your inquiry.

While using the latest version of Aspose.Words i.e. 10.8.0, I managed to reproduce this issue on my side. I have logged this issue in our bug tracking system. Your request has also been linked to the appropriate issue and you will be notified as soon as it is resolved. Sorry for inconvenience.

Moreover, As a temporary work around, I would suggest you please open and save this Word document file using MS WORD to DOC (97~2003) format. Then please try loading this DOC file using Aspose.Words for further document processing tasks. I hope, this will help.

Best Regards,

The issues you have found earlier (filed as WORDSNET-5771) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.