Accessing cell borders properties of a specific TableStyle

Hello,

Actually when i load some docx document containing standard tables, i am unable to retrieve cell borders informations like linewidth or linestyle. It seems to be set in the TableStyle but i can’t get them.
Is there a way to access cell borders properties of a specific TableStyle programmatically ?

Thanks

Hi Jean,


Thanks for your inquiry. Please refer to the following article:

Working with Table Styles

Could you please also attach your word document here for testing? We will investigate the scenario further and provide you code to achieve this.

Best regards,

I already read this page about TableStyle and also lots of others about Table, CellFormat, and more, available through your online support.
However that did not answer me.

I attached a file as you suggested.
This Word file only contains an empty table with visible borders. In Word it says the borders linewidth of this table is 0.5pt. How can i retrieve this information with Aspose API.

table.getRows().get(0).getCells().get(0).getCellFormat.getBorders().getLineWidth() return 0.0
table.getRows().get(0).getCells().get(0).getCellFormat.getBorders().getTop().getLineWidth() return 0.0
table.getRows().get(0).getRowFormat().getBorders().getLineWidth() return 0.0
table.getRows().get(0).getRowFormat().getBorders().getTop().getLineWidth() return 0.0
table.getStyle().getParagraphFormat().getBorders().getLineWidth() return 0.0

When accessing xml file of the word document, this information is stored inside the style of the table.
So :

Is there a way to access cell borders properties of a specific TableStyle programmatically ?


Best regards

Hi Jean,


Thanks for your inquiry. We will provide ways in Aspose.Words’ API to access information of table styles in future. Your thread has been linked to the appropriate issue (WORDSNET-9641) and you will be notified as soon as this issue is resolved. Sorry for the inconvenience.

Best regards,

Hi Jean,


As a workaround you can convert formatting specified in table styles into direct formatting on tables in the document. After calling the following method, you can access the border properties using normal API:

Document.ExpandTableStylesToDirectFormatting Method

I hope, this helps.

Best regards,

Thanks a lot.

The workaround is working well :slight_smile:
I will use it until the ticket is fixed.

I think you should put theses informations on the TableStyle page in addition to the page about Document.


Best regards

Hi Jean,


Thanks for your inquiry. We will be sure to improve that part of the online Java documentation shortly. We will also let you know once this issue is resolved.

Best regards,

The issues you have found earlier (filed as WORDSNET-9641) have been fixed in this Aspose.Words for .NET 19.6 update and this Aspose.Words for Java 19.6 update.