Table Auto fit to window support

Hi,

Are there any ways to make a table auto fit to window? I tried the below method:

docBuilder.getRowFormat().setAllowAutoFit(true);

but it can not work for me. Please reference the below cdoe:

DocumentBuilder docBuilder = new DocumentBuilder();
com.aspose.words.Style style = docBuilder.getDocument().getStyles().get(“Normal”);
if (style != null)
{
docBuilder.getParagraphFormat().setStyle(style);
}

docBuilder.clearRunAttrs();
// begin table
docBuilder.startTable();
docBuilder.getParagraphFormat().clearFormatting();

docBuilder.getCellFormat().clearFormatting();
docBuilder.getRowFormat().clearFormatting();

// The first row
docBuilder.getRowFormat().setHeight(0);
docBuilder.getRowFormat().setAllowAutoFit(true);

// The first cell
docBuilder.insertCell();
docBuilder.getCellFormat().clearFormatting();
docBuilder.getCellFormat().getBorders().setColor(Color.black);
docBuilder.getCellFormat().getBorders().setLineStyle(LineStyle.SINGLE);
docBuilder.getParagraphFormat().clearFormatting();
docBuilder.write(“111”);

// The second cell
docBuilder.insertCell();
docBuilder.getCellFormat().clearFormatting();
docBuilder.getCellFormat().getBorders().setColor(Color.black);
docBuilder.getCellFormat().getBorders().setLineStyle(LineStyle.SINGLE);
docBuilder.getParagraphFormat().clearFormatting();
docBuilder.write(“222”);

// End the first row
docBuilder.endRow();

// end table
Table table = docBuilder.endTable();

docBuilder.getDocument().save(“c:\test.doc”);
docBuilder.getDocument().save(“c:\test.pdf”);

Hi Vincent,

Thanks for your inquiry.

You can try using code provided on this article here to fit a table to the page.

If you have any troubles, please feel free to ask.

Thanks,

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


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