Free Support Forum - aspose.com

Problem with external reference for data validation

Hi,


There is a problem with merging workbooks if a cell within one of the workbooks contains an external reference in data validation formula (it is E12 in the s.xlsx attached). Please look at the example code below - there are two tests: with/without trying removing external references. As a result of both tests the files generated cannot be opened in Excel (“Excel found unreadable content…”).

string sourseFileName = “s.xlsx”;
string mergeFileName = “t.xlsx”;
string resultFileName1 = “result1.xlsx”;
string resultFileName2 = “result2.xlsx”;

AC.Workbook sourceWorkbook;
AC.Workbook mergeWorkbook;

//--------------
//----TEST 1----
//--------------
using (FileStream fstream = new FileStream(sourseFileName, FileMode.Open))
{
sourceWorkbook = new AC.Workbook(fstream);
}

using (FileStream fstream = new FileStream(mergeFileName, FileMode.Open))
{
mergeWorkbook = new AC.Workbook(fstream);
}

mergeWorkbook.Combine(sourceWorkbook);
mergeWorkbook.Save(resultFileName1, AC.SaveFormat.Xlsx);

//--------------
//----TEST 2----
//--------------
bool hasExternalReferences = sourceWorkbook.HasExernalLinks();
//At this point hasExternalReferences is True
sourceWorkbook.RemoveExternalLinks();
hasExternalReferences = sourceWorkbook.HasExernalLinks();
//At this point hasExternalReferences is still True
//However the code below still reprodues the problem
using (FileStream fstream = new FileStream(mergeFileName, FileMode.Open))
{
mergeWorkbook = new AC.Workbook(fstream);
}

mergeWorkbook.Combine(sourceWorkbook);
mergeWorkbook.Save(resultFileName2, AC.SaveFormat.Xlsx);


Thanks,
Leo Veriga

Hi,


Thanks for providing us the template files and sample code.

After an initial test, I can find the issue as you have pointed out. The output files do show error when opening the file into Ms Excel.

I have logged a ticket with an id “CELLSNET-41375”. We will look into it and figure it out soon.

Thank you.

Hi,


Please try the new fix/version: Aspose.Cells for .NET v7.4.0.2.

We have fixed your issue now. Let us know your feedback.


Thank you.

The issues you have found earlier (filed as CELLSNET-41375) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.