OK strange one. I have a 3 files, file consumerlvl1.xls has an ExternalLink to file Datasourcelvl1.xlsx, file consumerlvl1.xlsx also has an ExternalLink to file Datasourcelvl1.xlsx. Why is the formula for both links different?
When I parse the file A I can determine the link is to D:\Link Test Bed[Datasourcelvl1.xlsx]Sheet1 however file B returns [Datasourcelvl1.xlsx]Sheet1. This example is of course for files in same directory. It gets a lot messier for files in more complex file paths.
The problem is not Aspose returning the weird file path for XLSX but that the results are inconsistent between XLS and XLSX. I don’t believe that Excel saves the absolute path, as if you move either the consumer files the corresponding link will be broken, how does Excel resolve these paths and how is Aspose doing it for XLS and not for XLSX.
I’ve attached a series of XLS and XLSX files to illustrate the problem.
Hi Kevin,
We find different strings for external formulas while loading your XLSX and XLS files. We have logged the issue under ID CELLSNET-25346.
We will look into it soon.
Mean while, you can try a workaround by using the ExternalLink API to get the full path of external file.
My sample code is as follows,
Workbook workbook = new Workbook(@“E:\test2\Link Test Bed\consumerlvl1.xlsx”);
Worksheet worksheet = workbook.Worksheets[0];
Cells cells = worksheet.Cells;
ExternalLinkCollection elnks = workbook.Worksheets.ExternalLinks;
MessageBox.Show(elnks.Count.ToString());
MessageBox.Show(elnks[0].DataSource); //It will give full path to the external file.
While it's working for most of my tests it fails on one of our corner cases, a folder with an apostrophe
Formula in Aspose:
='Y:\Test Folder\RISK\LINKS\\Test Folder\SCAN\LINK'S FOLDER\[Link's Data!.xls]Sheet1'!$A$1
Formula in Excel:
='Y:\Test Folder\SCAN\LINK''S FOLDER\[Link''s Data!.xls]Sheet1'!$A$1
Actual file path:
Y:\Test Folder\SCAN\LINK'S FOLDER\Link's Data!.xls
The file we're processing is contained in Y:\TestFolder\RISK\LINKS\
The same occurs for the workaround mentioned above
Hi,
Thanks for your input.
We will look into your issue again and get back to you as soon as possible.
Hi,
Could you please post a sample project? We will check it soon.
Unzipped to D:<div>
Workbook workbook = new Workbook(@“D:\Corner Case Example\Sub Folder 1\Consumer.xlsx”);
Console.WriteLine(workbook.Worksheets[0].Cells[0,0].Formula);
Console.ReadLine();
Aspose sees the formula as
=‘D:\Corner Case Example\Sub Folder 1\Corner Case Example\Sub Folder 2\O’Hara[Top Ten.xlsx]Sheet1’!$B$1
Excel Formula
=‘D:\Corner Case Example\Sub Folder 2\O’‘Hara[Top Ten.xlsx]Sheet1’!$B$1
It would seem I was incorrect with my summation that this was caused by an apostrophe but there is an issue in how Aspose resolves the file path.
Hi Kevin,
Thanks for the sample files with code.
After an initial test, I noticed the issue you have mentioned. We will figure your issue out soon.
Thank you.
Works as expected.
Thanks
The issues you have found earlier (filed as 25346) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by aspose.notifier.