Corrupted file after Aspose manipulation

I am a licensed Aspose.Cells user. After populating various cells with data in an existing Excel file, I saved the file using .NET C#. Later, I removed reference links from the existing sheets, deleted a few sheets, saved the file, and reopened it. Excel is displaying an error asking if I should fix the issue, and upon clicking ‘OK,’ the file opens. What could be the cause of this error, and how can I prevent it from occurring?

@tuappteam can you please attach your source worksheet file?

@tuappteam
It’s better that you can provide a sample project and template file, then we can quickly locate the issue.

Sample.zip (168.5 KB)
I attached and waiting for your support.

This XML file does not appear to have any style information associated with it. The document tree is shown below.

error015560_01.xml

Errors were detected in file 'G:\RiskManagement\Risk Reporting\DailyReports\20230406\Sample.xlsx'

Repaired Records: Cell information from /xl/worksheets/sheet7.xml part

Repaired Records: Cell information from /xl/worksheets/sheet9.xml part

</recoveryLog

Attached.Sample.zip (168.5 KB)

Sample.zip (168.5 KB)

@tuappteam I noticed that the document is throwing an error when I attempt to open it with the MS Excel app. I’m assuming that it’s the modified file, but I need the file before it was processed by Aspose API. Also, as @simon.zhao pointed out, providing a code sample showing what you are doing would speed up our review process.

@tuappteam
All attached files are result files. It seems that some styles of the cells are wrong.

Can you provide a sample project and template file?
Or you can try to remove unused styles before saving :
workbook.RemoveUnusedStyles();
workbook.Save(…)

Sample Template.zip (167.4 KB)

I will try anc come back soon.Sample Template.zip (167.4 KB)

@tuappteam sorry, I cannot reproduce your problem can you please attach a code example to use as reference.
I used the following code to test:

Workbook workbook = new Workbook(@"C:\Temp\Cells\input.xlsx");

workbook.Worksheets[1].Cells["B6"].Value = 20;
workbook.Worksheets[1].Cells["B7"].Value = 20;
workbook.Worksheets[1].Cells["B8"].Value = 20;
workbook.Worksheets[1].Cells["B9"].Value = 20;
workbook.Worksheets[1].Cells["B10"].Value = 20;
workbook.Worksheets[1].Cells["B11"].Value = "Total";
workbook.Worksheets[1].Cells["B12"].Formula = "=SUM(B6:B10)";

workbook.Worksheets.RemoveAt(0);
workbook.Worksheets.RemoveAt("J");
workbook.Worksheets.RemoveAt(workbook.Worksheets.Count-1);

workbook.RemoveUnusedStyles();

workbook.Save(@"C:\Temp\Cells\output.xlsx")

And get the following outcome:
output.zip (118.8 KB)