getworkbook byte array
I am not sure if this question belongs here. Please advice where should it be posted if not here.
I have written the following lines of code in my web app using excel services api.
wbname=filename.xlsx;
ES.
Status[] status;xlService.Timeout = 1200000;
string sessionId =null;xlService.Credentials = System.Net.CredentialCache.DefaultCredentials;sessionId = xlService.OpenWorkbook(invworkbookLoc,
"en-US","en-US",out status);status = xlService.SetCellA1(sessionId,
"sheetname","namerange", somevalue);xlService.CalculateWorkbook(sessionId,
CalculateType.Recalculate);workbook = xlService.GetWorkbook(sessionId,WorkbookType.PublishedItemsSnapshot,out status);
status = xlService.CloseWorkbook(sessionId);
Response.Clear();
Response.AppendHeader(
"Content-Disposition","attachment;filename=" + wbname);Response.Charset =
"";Response.ContentType =
"application/x.ms-excel";BinaryWriter binaryWriter =newBinaryWriter(Response.OutputStream);binaryWriter.Write(workbook);
This opens up the open/save dialog box when i choose either, the excel 2007 client pops up the information window with "Excel found unreadable content in 'wbname'. Do you want to recover the contents of this workbook? If you trust the source of this workbook, click Yes."
When I select yes, the client opens the workbook with the operation "open and repair wbname" and pops the message "Excel completed file level validation and repair. Some parts of this workbook may have been repaired or discarded" at the end and file name is called "wbname[repaired].xlsx".
There is no error when I create a sharepoint folder object and add the file to sharepoint library using
SPWeb site =SPControl.GetContextWeb(this.Context);
site.Files.Add(excelfilepath, workbook,
true);site.Files.Folder.Update();
hyperlink.navigateURL = excelfilepath;
I can download the excel file in excelfilepath without any error.
what setting am i missing here?
Thanks for your time.

