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

Free Support Forum - aspose.com

Cell default width

Hi support,

By using last Aspose.Words library, the cells have their width set by default to 1 inch. Is this expected ?

Regards,
Milan

Hi Milan,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. Yes, this is expected. When you use DocumentBuidler to build table, default width of Cell is 72pt, i.e. 1 inch.

Best regards.

Hi Alexey,

I have a few questions regarding this :
1. Why is that the cell width is now set by default, comparing with the 2.5.0 version where the cell width was not set, and the table had that “fit to contents” look ?
2. Why was this particular “72pt” value chosen ?

Please take a look at the following code, and the corresponding outputs that where made by using Aspose.Words 2.5.0 and Aspose.Words 3.2.1 :

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.getCurrentParagraph();
builder.write(“Begin doc”);
builder.getCellFormat().getBorders().setLineStyle(LineStyle.SINGLE);
builder.getCellFormat().getBorders().setLineWidth(2);
builder.startTable();
builder.insertCell();
builder.write("cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 ");
builder.insertCell();
builder.write("cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 cel1 ");
builder.endRow();
builder.endTable();
builder.write(“End doc”);
doc.save(“C:\Temp\docTextInTable.doc”);

Note the differences between the outputs. The look of docTextInTable_AsposeWords_2_5_0.doc is more compact and more expected versus the docTextInTable_AsposeWords_3_2_1.doc that is a space consumer.

Please give me your thoughts regarding this.
Milan

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. I suppose, the behavior was changed because this is the default behavior of MS Word and Aspose.Words should mimic this behavior. We will add “Auto fit to Content” option in the future. I linked your request to the appropriate issue, you will be notified as soon as this feature is available.

Best regards.

Hi Alexey,

This behavior of MS Word is customizable within Normal.dotm (I’m using Word 2007). At this time, Aspose.Words does not mimic the MS Word behavior, as far as I can see. If you go to the “Insert/Insert Table…” menu in the Normal.dotm, you’ll note that there are options for the AutoFit behavior, that can be modified for all new created documents by selecting one of those three options and checking the “Remember dimensions for new tables” box. Aspose.Words draws the cells with a fix width equal with 1 inch no matter what AutoFit behavior is specified.

Please tell me if I’m missing something.

Regards,
Milan

Hi Milan,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for additional information. All you have just described is correct. But the other reason, why the behavior was changed is that if width of the table cell is not specified, the output document can be corrupted. So to avoid possibility to generate corrupted documents, Aspose.Words specifies fixed width of table cells.

As, I also mentioned, we are going to add auto-fit to content option in one of our future versions. Thanks for your understanding.

Best regards.

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


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