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.

Wed Jun 12, 2019 7:17 am

Hello everybody.

I have a question for converting an excel file to pdf on .net core 2 on a linux OS. While saving I get following exception:

Code: Select all
spr᭵: Object reference not set to an instance of an object.
   at spr⍰.ᜀ(Stream A_0)
   at Spire.Xls.Core.Spreadsheet.XlsWorkbook.SaveToPdf(Stream stream, ConverterSetting convertSetting)
   at Spire.Xls.Core.Spreadsheet.XlsWorkbook.SaveToPdf(Stream stream, FileFormat fileFormat, ConverterSetting convertSetting)
   at Spire.Xls.Workbook.SaveToStream(Stream Stream, FileFormat fileFormat)


I just saw, that the pro version got an update which should fix such an exception. Does the free version get one too?

NiSch
 
Posts: 9
Joined: Wed Jun 12, 2019 7:07 am

Wed Jun 12, 2019 7:56 am

Hello,

Thank you for contacting.
Sorry there is no hotfix update for free version, we only upgrade our free version irregularly. Thus, I recommend you test your case with our latest Spire.XLS Pack(Hotfix) Version:9.6.1. If your issue still occurs after trying, please provide your input excel file to help us further investigate it. You could send your file to us via email (support@e-iceblue.com).

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Wed Jun 12, 2019 11:02 am

Indeed it does fix the issue. So when is it planned to release a new version of FreeSpire.XLS?

Next issue is a Index out of range exception after loading from a stream and save to stream. I tested the code on a Windows which works fine. This issue only occurs on a linux system.

Code: Select all
spr᭵: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
   at spr⍰.ᜀ(Stream A_0)
   at Spire.Xls.Core.Spreadsheet.XlsWorkbook.SaveToPdf(Stream stream, ConverterSetting convertSetting)
   at Spire.Xls.Core.Spreadsheet.XlsWorkbook.SaveToPdf(Stream stream, FileFormat fileFormat, ConverterSetting convertSetting)
   at Spire.Xls.Workbook.SaveToStream(Stream Stream, FileFormat fileFormat)

NiSch
 
Posts: 9
Joined: Wed Jun 12, 2019 7:07 am

Thu Jun 13, 2019 1:59 am

Hello,

Thanks for your feedback.
We don't maintain/upgrade our Free version regularly. Sorry I can't provide an accurate time about when the Free Spire.XLS will be released. I suggest that you use our commercial version (Spire.XLS Pack(Hotfix) Version:9.6.1), our sales team just sent a license of Spire.XLS to your email. You could apply the license by license key to remove the warning message.

As for your new issue "Index was out of range", does this problem also appear in our commercial edition? Please provide your testing file to help us better investigate your issue. You could send it to us via email (support@e-iceblue.com). Thanks in advance.

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1182
Joined: Tue Sep 27, 2016 1:06 am

Thu Jun 13, 2019 7:43 am

Thanks for the license!

The new issue still exists with the pro version. I found out, that if an "Umlaut" like 'ö' is in the file, the exception occurs. UTF8 problems? Is there any setting to define the encoding? A single worksheet has the possibility to save a stream with encoding, but no FileFormat.

Saving Stream with PDF and i just check some different formats like PostScript do not work. Saving to stream with Excel Version2016 does work.
Attachments
test_file.zip
(5.62 KiB) Downloaded 214 times

NiSch
 
Posts: 9
Joined: Wed Jun 12, 2019 7:07 am

Thu Jun 13, 2019 11:07 am

Hi,

Thanks for your sharing.
I will test your file on Linux and then give you an update ASAP.

Sinecrely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1182
Joined: Tue Sep 27, 2016 1:06 am

Fri Jun 14, 2019 3:14 am

Hi,

Thanks for your patient waiting.
I converted your Excel file to PDF and PostScript in Linux with the Spire.XLS Pack(Hotfix) Version:9.6.1, but neither of them could reproduce your issue. Below is my full testing code. If your code is different from mine, please share us with yours. Also I attached my generated results for your reference. To help us better investigate your issue, please provide more information such as the specific version of your Linux.Thanks in advance.
Code: Select all
string excelFile = "../test_file.xlsx";
Workbook workbook = new Workbook();
var inputStream=new MemoryStream(File.ReadAllBytes(excelFile));
workbook.LoadFromStream(inputStream);
//convert to PDF
var streamPdf=new MemoryStream();
workbook.SaveToStream(streamPdf,FileFormat.PDF);
string outputPdf="../PdfResult.pdf";
File.WriteAllBytes(outputPdf,streamPdf.ToArray());
//convert to PostScript
var streamPs=new MemoryStream();
workbook.SaveToStream(streamPs,FileFormat.PostScript);
string outputPs="../PsResult.ps";
File.WriteAllBytes(outputPs,streamPs.ToArray());

Sincerely,
Nina
E-iceblue support team
Attachments
results.zip
(58.04 KiB) Downloaded 232 times
User avatar

Nina.Tang
 
Posts: 1182
Joined: Tue Sep 27, 2016 1:06 am

Fri Jun 14, 2019 5:42 am

Hello Nina, thanks for trying to help me!

The exact code which you send, does not work for me. I try the code on a CentOS 7 system. (libgdplus library installed, compiled with .net core 2.2 - self contained application)

NiSch
 
Posts: 9
Joined: Wed Jun 12, 2019 7:07 am

Fri Jun 14, 2019 9:32 am

Hello,

Thanks for your feedback.
When converting Excel file to PDF, our Spire.XLS needs to read the font that used in Excel file. I noticed that the font of the specific characters is Arial, which corresponds the font named "Garuda" in Linux. Hence, please check if your Linux system has installed the Garuda font.

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1182
Joined: Tue Sep 27, 2016 1:06 am

Mon Jun 17, 2019 5:46 am

Hello, sorry for my late response, but I didn't get access to my mail account/password during the weekend.

If I understand that correct, every file with some data in it should throw this exception correct? But if I have a file without Umlaute (special chars) the saving works like a charme. (see example, which works great)
Attachments
test_file_without_special_chars.zip
(5.66 KiB) Downloaded 214 times

NiSch
 
Posts: 9
Joined: Wed Jun 12, 2019 7:07 am

Mon Jun 17, 2019 9:29 am

Hello,

Thanks for your feedback.
Sorry we can't reproduce your issue on our Linux. As I said before, our Spire.XLS needs to read the font when converting Excel to Pdf, please make sure that your Linux system has installed the corresponding font that the Umlaute (special chars) used. Or you can have a test on your other Linux system like Ubuntu. In addition, we will do more investigations, if there is any finding, we will let you know.

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1182
Joined: Tue Sep 27, 2016 1:06 am

Mon Jun 17, 2019 1:29 pm

Hello again,

it was really a font issue. Fixed the issue with installing the package "liberation-fonts". Thanks for your help in the right direction.

Code: Select all
yum install liberation-fonts


Does the free version receive an update anytime? The current version cannot be used on a linux system, so it would be in your own interest to do so ;)
In the meantime I can use the pro package with the sent license for a month now, but then I need to buy it?

NiSch
 
Posts: 9
Joined: Wed Jun 12, 2019 7:07 am

Tue Jun 18, 2019 2:31 am

Hello,

I' m so delighted to hear that your issue has been resolved.
As we said before, we don't maintain our free version regularly. Sorry for that. I recommend that you continue to use our commercial version since new fixes and features are included in it. And if the temporary license we sent to you expires, the Evaluation warning will appear again. To remove the evaluation, you need to own a formal license by purchasing our Spire.XLS. Hope you can understand. If there is other question, just feel free to write back.

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1182
Joined: Tue Sep 27, 2016 1:06 am

Tue Jun 18, 2019 5:46 am

Alright, thanks for your support!

NiSch
 
Posts: 9
Joined: Wed Jun 12, 2019 7:07 am

Tue Jun 18, 2019 5:48 am

Hi,

You are welcome.
If there is anything we can do for you in the future, please feel free to contact us.
Wish you a nice day!

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1182
Joined: Tue Sep 27, 2016 1:06 am

Return to Spire.XLS