Problems with a SPFileStream

Hi Aspose



In my code I get an Excel file from Sharepoint in a SPFileStream (which inherits from Stream) and use workbook.Open(filestream) but get an exception:



Aspose.Cells.CellsException: This file’s format is not supported or you don’t specify a correct format.



I have tried using the .Open(Stream, FileFormatType) method but it produced the same result.



I have tried to save the file to a filestream and then open it but still no luck.



A small facet of this could be that the file is made in Excel 2007 and then saved in 2003 format. It contains some text, some colored cells, a few numbers, a autosum formula, and a pie chart based on the numbers. Nothing special.



Do you have any suggestions regarding my error? I was quite surprised to experience this error as the Words doc2pdf conversion worked like a charm (I’m loading the file in order to convert it).



Regards

Ryan Hougaard

Netcompany A/S, DK

Hi,

Thanks for considering Aspose.

Could you post your template excel file here, we will check it soon.

Thank you.

This file is added to a Sharepoint document library, adorned with meta data, and then opened as a stream with the SPFile.OpenBinaryStream().

Hi,

Well, I tested your file with the following code, opened it and put a value into a cell and save as the file. All works fine.

Sample code:

Workbook workbook = new Workbook();
workbook.Open(@"f:\test\Testof2003format.xls");
Worksheet ws = workbook.Worksheets[0];
ws.Cells["B1"].PutValue("Hello...");
workbook.Save("f:\\test\\out_Testof2003format.xls");

Which version of Aspose.Cells for .NET you are using. Could you try the attached version.

Thank you.