Why do I get the following error for the code below with the attached document?
I understand, thanks
Thanks for your posting and using Aspose.Cells.
It is good to know that you were able to understand the root cause of this exception. Let us know if you encounter any other issue, we will be glad to look into it and help you further.
Please also see this article that will help you determine the format of your excel file on runtime.
( http://www.aspose.com/docs/display/cellsnet/How+to+Detect+a+File+Format+and+Check+if+the+File+is+Encrypted )
Actually i am facing this issue can you help me in overcoming in it.
So ,basically my main goal is to save a file coming from formdata to my server.So for that i am using FileUploadBean to get my file from the front end and then using Workbook to save the CSV file on my server.
FileUploadBean bean;//So this is the object which is storing the file coming from the front end
MultipartFile uploadFile= bean.getFile();
Workbook workbook = new Workbook(uploadFile.getInputStream());//the error is getting
thrown over here
In new versions (e.g Aspose.Cells v20.4.x) we also started supporting older BIFF7 (e.g “Microsoft Excel 5.0/95 Workbook” file format for certain feature. So, kindly do try latest version of the product. If you still find the issue with v20.4, kindly attach your template file, we will check it soon.
PS. please zip the file prior attaching.
fileData.zip (658 Bytes)
Thanks for the template file.
Since you are loading a CSV file from streams, so you need to specify the loadoptions for it, see the lines of code that would work fine for your needs:
........ TxtLoadOptions opts = new TxtLoadOptions(LoadFormat.CSV); Workbook workbook = new Workbook(uploadFile.getInputStream(), opts);
Thanks @Amjad_Sahi now it’s not throwing that error. But, now the issue is when its creating the file in the server it’s adding this line in the file at the end(Evaluation Only. Created with Aspose.Cells for Java.Copyright 2003 - 2020 Aspose Pty Ltd.).due to which when i am reading this file its trying to read the line above it which is null.I have also shared the screenshot.Is there a way that we can avoid this line?Screenshot (57).png (112.8 KB)
It seems that your license is expired and not valid for the latest version. Please note that you can use all the versions of the products which are released before the expiry of the license. You may open the license in some text editor and check its expiry date. If the product version which you are using is released after the license expiry, then this evaluation message cannot be removed. You have to upgrade the license to use the latest versions of the product.
A post was split to a new topic: “This file’s format is not supported or you don’t specify a correct format” exception on loading the saved XLSM by Aspose.Cells