Retain data after executing Workbook.RemoveExternalLinks in .NET

Dear Team,

We are using Aspose.cells in our application and we are facing issue while removing external excel links. We are not able to retain data in one scenario. Please help

Attached are the two examples of different types external links.

Book2.xlsx – Contains external links created by referring data cells from a different workbook, directly from the Formula bar.

Book3.xlsx – Contains the broken links created by referring a data cells from a different workbook via Name Manager.

Please refer to the code snippet below that we have created to remove such external links.

If wbUpLoaded.HasExernalLinks Then

wbUpLoaded.RemoveExternalLinks()

m_TraceMessage = "Broken Links in Excel"

LogTrace()

wbUpLoaded.Save(m_UpFile, Aspose.Cells.SaveFormat.Excel97To2003)

End If

The code properly removes the external links from Book2.xlsx and the data in the corresponding cells also gets retained. However, the same code fails to retain the data in the cell for Book3.xlsx(external links however, gets removed).

Is there a way to retain the data in the entire spreadsheet for reports which have broken links across the entire sheet (for Book3.xlsx)?

Thanks
Anish

Hi Anish,

Thanks for using Aspose.Cells.

Please download and use the latest version: Aspose.Cells
for .NET v7.7.2.6
it works fine.

I have tested your files with the following code and check the output xls files, they are correct. I have attached the output xls files for your reference.

C#


string filePath = @“F:\Shak-Data-RW\Downloads\Book3.xlsx”;


Workbook workbook = new Workbook(filePath);


workbook.RemoveExternalLinks();


workbook.Save(filePath + “.out.xls”);


Dear Team,


Thanks for the reply. We are currently using Aspose.Cells 7.3.5. We are not in a position to upgrade to the new version right away as this is a production scenario. Can you please confirm the above scenario is a recent fix from Aspose.

Thanks
Anish

Hi Anish,


Thank you for writing back.

We have recently fixed a problem with RemoveExternalLinks method where removing the external links was causing the removal of corresponding formula (=[Book2.xlsx]Sheet1’!$A$1) from the spreadsheet. Please note, the problem was reported with Aspose.Cells for .NET 7.5.3.5 and was got fixed with 7.6.0.

We hope this is what you meant. Please let us know if you require more information or have questions for us.