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

Free Support Forum - aspose.com

Different Word and PDF output when table auto fit is set to true

Hi,

I am trying to generate a simple document with table. When I set the table.setAllowAutoFit to false both word and pdf are same, but when I set table.setAllowAutoFit to false word and pdf outputs are different.

Here is my standalone program:

    public static void main(String[] args) throws Exception {
        License license = new License();
        license.setLicense("Aspose.Words.lic");
        Document doc = new Document();

        DocumentBuilder builder = new DocumentBuilder(doc);
        Table table = builder.startTable();
        Cell cell = builder.insertCell();
        cell.getCellFormat().setWidth(64.4);
        builder.write("Data");

        cell = builder.insertCell();
        cell.getCellFormat().setWidth(49);
        builder.write("Versão");

        cell = builder.insertCell();
        cell.getCellFormat().setWidth(255.2);
        builder.write("Descrição");

        cell = builder.insertCell();
        cell.getCellFormat().setWidth(85);
        builder.write("Autor");

        cell = builder.insertCell();
        cell.getCellFormat().setWidth(85.0667);
        builder.write("Revisor");

        cell = builder.insertCell();
        cell.getCellFormat().setWidth(140.733);
        builder.write("Aprovado por");
        builder.endRow();
        table.setAllowAutoFit(true);
        builder.writeln();

        doc.save("test.doc");
        doc.save("test.pdf");
        System.out.println("done");
    }

Can anyone please check and let us know the reason?

Regards,
Shikha

Hi Shikha,

Thanks for your inquiry. I tested the scenario and have managed to reproduce the same problem. For the sake of correction, I have logged this problem in our issue tracking system as WORDSNET-11349. Our development team will further look into the details of this problem and we will keep you updated on the status of correction. We apologize for your inconvenience.

Best regards,

Hi Awais,

Is there a work around for such issue? like setting any table properties, etc…

Thanks,

Kumar

Hi Kumar,

Thanks for your inquiry. The issue occurs because Aspose.Words currently fails to calculate table column widths correctly in absence of tblGrid element.

The issue is to be addressed per WORDSNET-832. However, the current code of WORDSNET-832 does not work in this scenario, so, we have postponed the fix until WORDSNET-832 is ready.

In the meantime while you’re waiting for fix, you may remove explicit setWidth() calls as a workaround. The output without the calls is still not perfect but it is much better, because Aspose.Words tries to calculated missing column widths from contents width. I hope, this helps.

Best regards,

We cannot use the workaround since we are processing xhtml with it and it causes other tables to render badly. Can you let us know when would the fix be available? Regards Nithya

This message was posted using Email2Forum by Justin Anderson. (private)

Hi Nithya,

Regarding WORDSNET-11349, this problem actually requires us to implement a new feature in Aspose.Words and we regret to share with you that implementation of this issue has been postponed for now. However, the fix of this problem may definitely come onto the product roadmap in the future. Unfortunately, we can not promise a resolution any time soon. We apologize for your inconvenience.

Best regards,

Hi Awais,

Any update on WORDSNET-11349 ? Is this issue solved or planned for future release. We have some critical issues blocked by this, so just wanted to know when can we get it fixed.

Regards,

Shikha

Hi Shikha,

Thanks for your inquiry and being patient. Unfortunately, there is no further news about this issue and we can’t provide any estimates either. Keeping in view the complexity of this issue, I am afraid, we won’t be able to fix it near future. We will inform you as soon as this issue is resolved. We apologize for your inconvenience.

Best regards,

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


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