Workbook.Save() Problem throw error: System.ArgumentOutOfRangeException: length ('-1') must be a non-negative value

See the following sample code and demo file, it will throw error as following, please help check it, thanks.

Error:

System.ArgumentOutOfRangeException: length ('-1') must be a non-negative value. (Parameter 'length')
Actual value was -1.
   at Aspose.Cells.Workbook.Save(Stream stream, SaveOptions saveOptions)

sample code:


                using (Workbook document = new Workbook("xxxxx\\test3-4-1-1-2-1-1-1-1-1.xlsx"))
                {
                    // 输出
                    using (var ms = new MemoryStream())
                    {
                        string contentType = "text/html";
                        document.Save(ms, Aspose.Cells.SaveFormat.Html);
                        document.Dispose();

                        return File(ms.ToArray(), contentType);
                    }
                }

test3-4-1-1-2-1-1-1-1-1.7z (28.1 KB)

@davidxiao2008
By using sample file and code for testing, we can reproduce the issue. Discovered that ArgumentOutOfRangeException occurred when saving the file to HTML.

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-54925

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.

Thanks, wait for your reply :grinning:

@davidxiao2008
You are welcome. We will notify you immediately of any updates.

Hi John:
Can you first provide a reason for this problem so that I can explain it to the user?

@davidxiao2008,

This is an issue with Aspose.Cells, we have fixed it now. The fix will be included in an upcoming release (Aspose.Cells v24.1) that we plan to release in the first half of January2024. You will be notified when the next version is released.

The issues you have found earlier (filed as CELLSNET-54925) have been fixed in this update. This message was posted using Bugs notification tool by johnson.shi

This issue is fixed, thanks. :grinning:

@davidxiao2008,

Thanks for your feedback.

Good to know that the latest version fixes your issue now. Please feel free to write us back if you have further queries or comments.