When deleting a worksheet (RemoveAt method on WorksheetCollection object) I am getting the following error:
Value Cannot be null.
Parameter name: value
This issue for same spreadsheets did not occur in version 20.8.0 but does occur in the latest stable version 23.9.0. I am guessing the latest version is missing some key updates. Can you check this or provide some guidance.
@amjad.sahi Codewise its a simple loop we are doing on list of worksheet names to be deleted that then get removed from the worksheet collection object:
foreach(var sheetName in sheetsToBeDeleted)
{
_workbook.Worksheets.RemoveAt(sheetName);
}
@tufas
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): CELLSNET-54240
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
By the way, are you removing all the worksheets in your provided file? Please note, you cannot remove all the worksheets as a workbook must contain at least a visible worksheet in it. This behavior is same with MS Excel. I tried the following two code segments. The first code works fine but the second one gives an error (rightly so):
1).
Workbook workbook = new Workbook("g:\\test2\\Debug Error.xlsx");
string[] worksheetNames = {"Sheet1", "Sheet2"};
foreach (var name in worksheetNames)
{
workbook.Worksheets.RemoveAt(name);
}
workbook.Save("g:\\test2\\out11.xlsx");
2).
Workbook workbook = new Workbook("g:\\test2\\Debug Error.xlsx");
string[] worksheetNames = {"Sheet1", "Sheet2", "Sheet3"};
foreach (var name in worksheetNames)
{
workbook.Worksheets.RemoveAt(name);
}
workbook.Save("g:\\test2\\out12.xlsx");
Do you use some other code snippet and which sheets you are trying to remove that produces the error? What is complete error trace? What is your environment and project/app type (WinForm, Console, Web application, etc.) and .NET framework version you are using?
Yes understand about the deleting all worksheets. i seem to have sanitized the model too far If you include one more sheet and only delete the 3 i had included can you reproduce the issue? Also what version of aspose are you using(This issue for same spreadsheet did not occur in version 20.8.0 but does occur in the latest stable version 23.9.0)?
This is a console application using .Net 4.8.
Message:
Value cannot be null.
Parameter name: value
StackTrace:
at System.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
at System.BitConverter.ToInt32(Byte[] value, Int32 startIndex)
at
. [1](Byte[] [1], Int32
, Int32 )
at . [1](Byte[] [1], Int32
, Int32 )
at .[1]( [1])
at Aspose.Cells.Workbook.[1]( [1])
at Aspose.Cells.NameCollection.[1](Hashtable [1])
at Aspose.Cells.WorksheetCollection.RemoveAt(Int32 index)
at Baml.Rsch.IQ.Core.SpreadSheet.AsposeSpreadSheet.DeleteWorksheets(IEnumerable`1 needDeletedSheetNameList) in C:\Working\Git\IQClient\iqdesktop_iqribbon_365\IQ.Core.SpreadSheet\Impl\AsposeWorksheet.cs:line 40
@tufas,
Sure, we will provide required information together with the new fix/version. For the released official version, you may check the release notes to trace the changes between different versions.
We would like to inform you that the issue (logged as “CELLSNET-54240”) has been resolved. The fix will be included in the next release (Aspose.Cells v23.10) which is expected to be released in this week or so. You will be notified when a new version is published.
We will get back to you to provide more details on it.
Thank you for the update. It will be great if you could share the details on this. Would like to know about any other areas where backward compatibility issues may arise.
It is just a bug of removing external links from shared formulas and defined names. We fixed the bug now, the fix should have no backward compatibility issue.
The issues you have found earlier (filed as CELLSNET-54240) have been fixed in this update. This message was posted using Bugs notification tool by johnson.shi