Error while opening excel file

Getting following error while opening an excel file which was saved using aspose.cells dll

Relationship tag requires attribute 'Target’

We are using Version (16.11.0.0) of Aspose.Cells.

Please provide the resolution at the earliest.


Hi,

Well, we cannot provide you fix for the issue unless we reproduce it on our end first.

Please try our latest version/fix: Aspose.Cells for .NET (Latest Version) if it makes any difference.

Aspose.Cells for .NET (Latest Version)

(please choose any of the above fixes for your underlying .NET Framework version)

If you still find the issue with this version, kindly create a simple console application, zip the project and post us here to generate such a file on our end, we will check it soon. Also, attach your template files if you are any.

Thank you.

Hi Amjad,

The fix did not work. After the file is saved using aspose.cells dll, we need to open the file using OpenXML (DocumentFormat.OpenXML dll) library as the saved file is needed by another team which consumes that file data.

Hi,


Thanks for your posting and considering Aspose.Cells.

In order to investigate and fix this issue, please provide us some simple console application project that replicate the issue as well as the source excel file(s) used in the code. We will execute your project at our end and after replicating the issue, log it in our database for a fix. Thanks for your cooperation in this regard and have a good day.

Hi,
We could drill down to the line of code which is leading to the issue. We need to add hyperlinks in one of the worksheet. The hyper links take user to other worksheets (in the file itself). If we don’t add the hyperlinks, things work fine.

We are using following method to add the hyperlink
//ws is the worksheet reference

ws.Hyperlinks.Add(CellsHelper.CellIndexToName(i + 1 + j, 1), 1, 1, String.Concat("#", “test”, “!A1”));

Please suggest if there is some other way to add the hyperlink. The above added link works fine when we open the file manually and click on them.

Quick help would be greatly appreciated.

Hi there,


Please note, the last parameter to the HyperlinkCollection.Add method is the reference to the cell (or URL address) where you wish to redirect the focus when the hyperlink is clicked. If you check your code, you will notice that the cell reference being passed to Add method is #testA1 which seems to be invalid. If you load the resultant spreadsheet with Excel application and try to click such hyperlink, the Excel application will complain the same. Please try the following piece of code which adds a valid hyperlink, and at end tries to load the result in an instance of SpreadsheetDocument from OpenXML SDK 2.5.

In case the problem persists, please share an executable sample application along with its dependencies and input spreadsheet for further investigation.

C#

var book = new Workbook(dataDir + “book1.xlsx”);
var ws = book.Worksheets[0];
var index = ws.Hyperlinks.Add(“B1”, 1, 1, String.Concat(ws.Name, “!A1”));
ws.Hyperlinks[index].TextToDisplay = “#TestA1”;
book.Save(dataDir + “output.xlsx”);
using (SpreadsheetDocument spreadsheetDocument = SpreadsheetDocument.Open(dataDir + “output.xlsx”, false))
{

}

Thanks a million Guys. It worked !!!

Really appreciate your help and effort.

Thanks.