Free Support Forum - aspose.com

Object reference not set to reference of an object on workbook.save

I’m initializing a workbook from an existing excel file, like so:
Workbook workbook = new Workbook(new MemoryStream(bytes));
// where bytes is a byte array

Then, replacing some cells in the sheets:
var targetCell = sheet.Cells[someRow, someColumn];
targetCell.PutValue(newStringValue);

and finally going to save:
var docStream = new MemoryStream();
workbook.Save(docStream, SaveFormat.Xlsx);

which throws a null reference exception.
Attached is the excel file, this is C# using .NET Core and the latest Aspose nuget package.

test.zip (6.0 KB)

New development, this is happening even if I don’t replace any values in the workbook/spreadsheets. This does not happen on my development server, only in production; Ubuntu on EC2 in AWS.

@bkane521,
Please also provide complete stacktrace of null reference exception. We will analyze the problem and provide our feedback accordingly.

hello, the stack trace starts at workbook.save() and then bubbles up through my code, I don’t think it will be useful for you unfortunately

@bkane521,
I am afraid that we could not reproduce this issue in the following environment. The stack trace and exception detail is must be required to proceed further. Please try to provide us with more information which can help to observe the issue here. We will follow the steps to reproduce the scenario and provide assistance accordingly.

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.2 LTS"
NAME="Ubuntu"
VERSION="18.04.2 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.2 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic