Issue with table borders


#1

Hi Team,

We are doing html to word conversion using Aspose Words cloud.

The html files contains tables with borders. After conversion, the tables are coming with borders type as “Custom”. Please refer image.png (343.8 KB)

However, if we add tables directly in word, the borders comes as “Plain Tables”. Please refer image.png (363.6 KB)

How can we achieve the same while doing html to word conversion?

The html file and the converted word are attached herewith.
tableborders.zip (10.7 KB)

Regards,
Nipun Jain


#2

Hi team,

We need to fix a live issue. Can you please look into this asap.

Regards,
Nipun Jain


#3

@nipunjain1964

We are right in our assumption that you want table style to be “Plain” instead of “Custom” when converting HTML document to Word?


#4

Hi Team,

Yes, we ant tables styles to be “Plain” instead of “Custom”. How can we achieve that?

Can you please have a look at this on a priority basis, as we have live users who are being affected.

Regards,
Nipun Jain


#5

@nipunjain1964

In order to change the table style of each table in the converted document, you need to call the following API for each table:

POST /words/{name}/{nodePath}/tables/{index}/properties

and set the following value of the properties parameter:

{
  "StyleIdentifier": "TableGrid"
}

For example, in order to change the table style of a table in the cellborders.docx document, set following values of the API’s parameters:

name = cellborders.docx
index = 1
properties = { “StyleIdentifier”: “TableGrid” }

Output Document: cellborders_output.docx.zip

All possible values of the StyleIdentifier are given here: https://github.com/aspose-words-cloud/aspose-words-cloud-dotnet/blob/26e868c31a83698bc202301a45bca92e1acb94a2/Aspose.Words.Cloud.Sdk/Model/TableProperties.cs#L69


#6

@nipunjain1964

All table properties and their descriptions are given below:

Property Name Type Description RO/RW Mapped to Aspose.Words.Table property
Alignment TableAlignment Specifies how an inline table is aligned in the document. RW Aspose.Words.Table.Alignment
AllowAutoFit bool Allows Microsoft Word and Aspose.Words to automatically resize cells in a table to fit their contents. RW Aspose.Words.Table.AllowAutoFit
Bidi bool Gets or sets whether this is a right-to-left table. RW Aspose.Words.Table.Bidi
BottomPadding double Gets or sets the amount of space (in points) to add below the contents of cells. RW Aspose.Words.Table.BottomPadding
CellSpacing double Gets or sets the amount of space (in points) between the cells. RW Aspose.Words.Table.CellSpacing
LeftIndent double Gets or sets the value that represents the left indent of the table. RW Aspose.Words.Table.LeftIndent
LeftPadding double Gets or sets the amount of space (in points) to add to the left of the contents of cells. RW Aspose.Words.Table.LeftPadding
PreferredWidth PreferredWidth Gets or sets the table preferred width as a percentage, number of points or a special “auto” value. RW Aspose.Words.Table.PreferredWidth
RightPadding double Gets or sets the amount of space (in points) to add to the right of the contents of cells. RW Aspose.Words.Table.RightPadding
StyleIdentifier StyleIdentifier Gets or sets the locale independent style identifier of the table style applied to this table. RW Aspose.Words.Table.StyleIdentifier
StyleName string Gets or sets the name of the table style applied to this table. RW Aspose.Words.Table.StyleName
StyleOptions TableStyleOptions Gets or sets bit flags that specify how a table style is applied to this table. RW Aspose.Words.Table.StyleOptions
TextWrapping TextWrapping Get or sets TextWrapping for table. RW Aspose.Words.Table.TextWrapping
TopPadding double Gets or sets the amount of space (in points) to add above the contents of cells. RW Aspose.Words.Table.TopPadding