The difference between old and newer confused me

When I used the new version 22.11 to operate the tables in the Office. Word 2007 document, I found that there were differences between the new version and the old version.

Use the new version to delete all rows of the table, and then save it as a file. When you open it using Office, you will be prompted that the file is damaged and cannot be opened.

If I execute the Document.Save method twice in the code, the Word document can be opened normally.

I won’t have the same code in the old version 20.12. However, this problem will not occur when working with documents in Office. Word 2016.

@wengyeung Could you please attach your input and output documents here for testing along with code that will allow us to reproduce the problem? We will check the issue and provide you more information.

I have tested with a simple code like the following:

Document doc = new Document(@"C:\Temp\in.docx");

Table table = (Table)doc.GetChild(NodeType.Table, 0, true);
while(table.HasChildNodes)
    table.FirstRow.Remove();

doc.Save(@"C:\Temp\out.docx");

And the output document is valid.

Hi guy
The problem occurs at the document which version is office word 2003

@wengyeung Do you mean DOC format? I have tested the same with DOC file and everything works fine. Please attach your problematic documents and code, which will allow us to reproduce the problem.

Dear Alexey
please use our document to reproduce the problem .

old.zip (72.4 KB)

and bellow is my code

Aspose.Words.Document doc = new Aspose.Words.Document(@"D:\old.doc", new Aspose.Words.Loading.LoadOptions() { LoadFormat = LoadFormat.Auto });
foreach (var sec in doc.Sections)
{
    var tables = (sec as Section).Body.GetChildNodes(NodeType.Table, false);
    foreach (var tb in tables)
    {
        var rows = (tb as Aspose.Words.Tables.Table).GetChildNodes(NodeType.Row, false);
        foreach (var rw in rows)
        {
            rw.Remove();
        }
    }
}
doc.Save("d:\\old_saved.doc");

@wengyeung
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-25159

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.

The issues you have found earlier (filed as WORDSNET-25159) have been fixed in this Aspose.Words for .NET 23.4 update also available on NuGet.