We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Excel input string was not in a correct format

Hello,

I use Aspose.Cells to read data from Excel File.

if i use the code in console is ok but when i use my code in SharePoint i receive an error : input string was not in a correct Format

Code :

string URL: `http://xxxxx/file.xlt`;

WebClient Client= new WebClient();

MemoryStream stream = new MemoryStream(Client.Download(URL));

Workbook book = new Workbook();

book.Open(stream, FileFormatType.TabDelimited); ///// Error

note: this code is Ok in Console but SharePoint no

Best regards,

Nacata

Hi,


Well, we have another component named Aspose.Cells for SharePoint which is used for spreadsheet conversion to convert MS Excel documents within the Microsoft SharePoint applications, so you may try it. See the Wiki docs for your reference:
http://www.aspose.com/docs/display/cellssharepoint/Home

Regarding your error with Aspose.Cells for .NET, well, Aspose.Cells is not specifically created for SharePoint. I think you are not getting the file into memory stream fine using your code segment, you may try to confirm if the file is retrieved or not. I think you should try our latest version/fix: Aspose.Cells for .NET v8.0.2.3 if it makes any difference. Also, see the sample code for your reference which may work at your end @ SharePoint:
e.g
Sample code:

private void ConvertFile(SPFile sourceFile, SPFolder destFolder, string destFileName, SaveFormat destFileFormat, bool overwrite)
{


try
{

Stream inputStream = sourceFile.OpenBinaryStream();

Stream outputStream = new MemoryStream();

string sourceExt = Path.GetExtension(sourceFile.Name).ToLower();


try
{


Workbook book = new Workbook(inputStream);
//…

}
catch (Exception e)
{

throw new ApplicationException("Convertion Failed. " + e.Message, e);


}

}


Thank you.

Hallo,

thank you for your Response, but my file string URL: `http://xxxxx/file.xlt`; is not in SharePoint

my file is located in another Location.

Best regards,

Nacata

Hi,


Did you try our latest version?

We will also check it soon.

By the way, may be you could try the following sample code with the latest version/fix:
e.g
Sample code:

stream = new MemoryStream(Client.DownloadData(URL));

Workbook book = new Workbook(stream);



Thank you.

Hello,

i use Aspose v2.0.50727, then i can only use my code in this Format :

string URL: `http://xxxxx/file.xlt`;

WebClient Client= new WebClient();

MemoryStream stream = new MemoryStream(Client.Download(URL));

Workbook book = new Workbook();

book.Open(stream, FileFormatType.TabDelimited); ///// Error

Best Regards,

Nacata

Hi,


Well, the the version you mentioned i.e. “v2.0.50727” is the .NET framework compiled version and not Aspose.Cells version. It looks like you are using some older version of the product so you are using Workbook.Open method instead of Workbook constructor to open the file. Also in your line of code:
e.g
Sample code:

book.Open(stream, FileFormatType.TabDelimited); ///// Error
your specified file format of your file is XLT but while opening it via Aspose.Cells, you wrongly mentioned to load the file as Tab Delimited, please correct it accordingly.

We recommend you to kindly just give the latest version a try with updated codes, if it works on your end.

Thank you.