Losing Table Border Style when Converting Word to HTML after Accepting Track Changes

Hello Team,

We are using Aspose.Words for .NET v25.1.0.
When converting a Word document (with tracked changes) to HTML, we accept all revisions using AcceptAllRevisions(). After doing so, the table border style is missing in the generated HTML.

Steps to Reproduce

  1. Open a Word document that has tracked changes and table border style updated via Table Design.
  2. Run the following code:
Document doc = new Document("input.docx");
doc.AcceptAllRevisions();
doc.Save("output.html", SaveFormat.Html);
  1. Inspect the <table> style in the generated HTML.

Actual Output

<table cellspacing="0" cellpadding="0" 
 style="-aw-border-insideh:0.5pt single #000000; 
        -aw-border-insidev:0.5pt single #000000; 
        border-collapse:collapse">

Expected Output

(When track changes are manually accepted in MS Word, then saved via Aspose):

<table cellspacing="0" cellpadding="0" 
 style="**border:0.75pt solid #000000;** 
        -aw-border:0.5pt single; 
        -aw-border-insideh:0.5pt single #000000; 
        -aw-border-insidev:0.5pt single #000000; 
        border-collapse:collapse">

Notes

  • The issue occurs only when using AcceptAllRevisions() programmatically.
  • When manually accepting changes in MS Word and then saving via Aspose, the expected border style is preserved.
  • Attachments
  • Original Document with Track changes mode ON -
    Table_Original_Doc.docx (12.5 KB)
  • Updated Document (Table Style changed) -
    Table_Updated_Doc.docx (22.4 KB) (Use this Document to duplicate issue)

How Border Style Updated

Could you please confirm if this is a bug or if there is a workaround?

@nilesh.awtade

It appears you are facing an issue with the table border style being lost when converting a Word document to HTML after programmatically accepting all revisions. This can occur due to the way styles are processed during the conversion.

Cause

The loss of border styles is likely due to the conversion process not retaining certain formatting after revisions are accepted.

Solution

To resolve this issue, you can manually apply the desired border styles after accepting revisions. Below is a modified version of your code that explicitly sets the border styles:

Document doc = new Document("input.docx");
doc.AcceptAllRevisions();

// Assuming the first table in the document
Table table = (Table)doc.GetChild(NodeType.Table, 0, true);
if (table != null)
{
    table.BorderBottom.LineStyle = LineStyle.Single;
    table.BorderBottom.LineWidth = 0.75;
    table.BorderBottom.Color = Color.Black;

    table.BorderTop.LineStyle = LineStyle.Single;
    table.BorderTop.LineWidth = 0.75;
    table.BorderTop.Color = Color.Black;

    // Set other borders similarly...
}

doc.Save("output.html", SaveFormat.Html);

Next Steps

  1. Check for Updates: Ensure you are using the latest version of Aspose.Words, as updates may include bug fixes or improvements that could resolve this issue.
  2. Inspect the Output: After implementing the changes, generate the HTML file and verify if the border styles are now correctly applied.

If you continue to experience issues, I recommend reaching out to Aspose support for further assistance, as this may be a specific bug related to the version you are using.

Please let me know if you need any further help!

I understand that I can manually set table borders in code, e.g.:

table.BorderBottom.LineStyle = LineStyle.Single;
table.BorderBottom.LineWidth = 0.75;
table.BorderBottom.Color = Color.Black;

However, this is not a suitable solution for our case. The table border styles can vary depending on the document, and we don’t want to hard-code these values.

Our requirement is that Aspose.Words should preserve the existing table border formatting when using AcceptAllRevisions().

I also tested with the latest version 25.8.0, and the behavior remains the same — the table border styles are still lost after accepting revisions.

Could you please confirm if this is a known issue, or if there is a recommended way to preserve the border formatting automatically?

@nilesh.awtade
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): WORDSNET-28559

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.