Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Mon Dec 10, 2018 6:51 pm

I am running into an issue, the Excel sheet that I am trying to covert into PDF.

there is formulas on excel sheet, simple ones like (=J18+K18) or a bit of complex (=(SUMPRODUCT(($B18=$T$2:$T$225)*($C18=$U$2:$U$225)*($D18=$V$2:$V$225)*($Y$2:$Z$225)))/249)

my error message is showing..

Object reference not set to an instance of an object.
Error in calculating cell I18 in Worksheet sheet1

Workbook workbook = new Workbook();
workbook.LoadFromStream(new MemoryStream(excelFile));
workbook.CalculateAllValue(); <-- error pops here...

yshaiou
 
Posts: 3
Joined: Mon Dec 10, 2018 5:31 pm

Tue Dec 11, 2018 2:35 am

Hi,

Thanks for your inquiry.
After an initial test, I have not reproduced the issue with the latest Spire.XLS Pack(Hotfix) Version:8.12.3. To help us investigate your issue, please share your sample file here or via email(support@e-iceblue.com).
Sincerely,
Mike
E-iceblue support team
User avatar

Mike.Zhang
 
Posts: 93
Joined: Thu Sep 27, 2018 7:11 am

Tue Dec 11, 2018 1:11 pm

I've emailed just now. meanwhile, can you provide me your sample code on how you make an excel file download to pdf file?

the code that was used was
workbook.SaveToHttpResponse("Excel_One_Pager_" + fileDate.Replace("/", "_") + ".pdf", System.Web.HttpContext.Current.Response, HttpContentType.Excel2010, FileFormat.PDF);

yshaiou
 
Posts: 3
Joined: Mon Dec 10, 2018 5:31 pm

Tue Dec 11, 2018 2:53 pm

Mike.Zhang wrote:Hi,

Thanks for your inquiry.
After an initial test, I have not reproduced the issue with the latest url, To help us investigate your issue, please share your sample file here or via email(support@e-iceblue.com).


can you use 7.12.19.6040

yshaiou
 
Posts: 3
Joined: Mon Dec 10, 2018 5:31 pm

Wed Dec 12, 2018 10:42 am

Hi Yuly,
 
Hope you are doing well.
1. About the exception when using CalculateAllValue, after an initial test with Spire.XLS Version 7.12.19.6040, I am still unable to reproduce it. To help us solve your issue quickly, please share your sample file.
2. As for downloading the file, I tested with the latest version, there is no issue. Besides, there is a workaround. Please refer to following code.
Code: Select all
    string fileName = Server.MapPath("~\\test.xlsx");
    Workbook workbook = new Workbook();
     workbook.CalculateAllValue();
     workbook.LoadFromFile(fileName);
     MemoryStream stream = new MemoryStream();
     workbook.SaveToStream(stream, FileFormat.PDF);
     string outputFileName = string.Format("{0}{1}", "TestResult", ".pdf");
        Response.Clear();
        Response.AppendHeader("Content-Disposition", "attachment; filename=" + outputFileName);
        Response.AppendHeader("Content-Length", stream.ToArray().Length.ToString());
        Response.ContentType = "application/pdf";
        Response.BinaryWrite(stream.ToArray());
        HttpContext.Current.ApplicationInstance.CompleteRequest();
        Response.Flush();
        Response.End();

 
Sincerely,
Mike
E-iceblue support team
Sincerely,
Mike
E-iceblue support team
User avatar

Mike.Zhang
 
Posts: 93
Joined: Thu Sep 27, 2018 7:11 am

Fri Dec 28, 2018 7:06 am

Hi,

Hope you are doing well.
As for the method CalculateAllValue, we have improved it in Spire.XLS Pack(Hotfix) Version:8.12.11.

Best wishes,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Return to Spire.XLS