Can save the excel file

Technical support for Spire.DataExport

Moderators: iceblue support, DataExport, Manager

Can save the excel file

Postby pabloerba » Tue Aug 09, 2011 4:38 pm

When trying to save a excel empty file, i received this error:

Exception Details: System.Exception: Create object error.
TextExport::SaveToFile,var:
Code:



Dim xls As XLS.CellExport = New XLS.CellExport
Dim workSheet1 As New Spire.DataExport.XLS.WorkSheet()
xls.ExportIfEmpty = True
xls.Sheets.Add(New Spire.DataExport.XLS.WorkSheet)
xls.ActionAfterExport = Spire.DataExport.Common.ActionType.None
xls.FileName = filename


xls.SaveToFile()

Error:

[Exception: Create object error.
TextExport::SaveToFile,var:]
Spire.DataExport.Common.TextExport.SaveToFile() +290
Spire.DataExport.XLS.CellExport.SaveToFile() +89
Admin_XLS.Page_Load(Object sender, EventArgs e) in C:\UsersXXXX\Desktop\XXXXX_WEB\Admin\XLS.aspx.vb:39
System.Web.UI.Control.OnLoad(EventArgs e) +73
System.Web.UI.Control.LoadRecursive() +52
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2184



What could be the reason?
pabloerba
 
Posts: 3
Joined: Tue Aug 09, 2011 2:15 pm

Re: Can save the excel file

Postby Justin Weng » Wed Aug 10, 2011 6:04 am

Dear pabloerba,
Thanks for your inquiry.
There is something wrong with your code.
#1 This is a Asp.net project, so you should use
Code: Select all
xls.SaveToHttpResponse(this.Response);
method.
#2 You want to save a empty file. What's the meaning of this code?
Code: Select all
xls.Sheets.Add(New Spire.DataExport.XLS.WorkSheet)
Justin
Technical Support / Developer,
e-iceblue Support Team
User avatar
Justin Weng
 
Posts: 110
Joined: Mon Mar 28, 2011 5:54 am

Re: Can save the excel file

Postby pabloerba » Tue Aug 23, 2011 12:18 pm

Thanks Justin! Now its working, as I needed to save the file within the web server I just used SaveToStream to a IO Stream object..
pabloerba
 
Posts: 3
Joined: Tue Aug 09, 2011 2:15 pm


Return to Spire.DataExport

Who is online

Users browsing this forum: No registered users and 0 guests