I would like to be able to programmatically remove all hyperlinks from an Excel worksheet, leaving the cell values as text. Does Aspose.Cells 3.9.0.1 have a way to do this? (I read that VBA offers Cells.Hyperlinks.Delete, so I am hoping that Aspose.Cells supports this, too.) Thanks.
The reason that I need this is that the "excel.Open" call in the code below throws "System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.." at "Aspose.Cells.Hyperlinks.Add(Int32 firstRow, Int32 firstColumn, Int32 rowNumber, Int32 columnNumber, String address)".
I believe the reason is that the Excel input file (edited by a user) has something wrong with it. I'd like to PREVENT this user-related error be removing all hyperlinks prior to my application-specific processing:
string fileName = "c:\\projects\\aspose\\AsposetestFiles\\AsposeCannotReadThisStream.xls";
System.IO.Stream fileContent = File.OpenRead(fileName);
BinaryReader reader = new BinaryReader(fileContent);
byte[] buffer = reader.ReadBytes(Convert.ToInt32(fileContent.Length));
reader.Close();
Workbook excel = new Workbook();
/* Throws:
* System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values..
at Aspose.Cells.Hyperlinks.Add(Int32 firstRow, Int32 firstColumn, Int32 rowNumber, Int32 columnNumber, String address)
*/
excel.Open(new MemoryStream(buffer));
If at all possible, I do NOT want to upgrade from Aspose.Cells 3.9.0.1, because our QA process won't allow it right now.
Actually, what I am properosing won’t fix the problem, because if the file stream cannot be opened by Aspose, I won’t be able to remove the hyperlinks.
It seems that this problem occurs when importing hyperlinks. Could you post a sample file to show your problem? Thank you.