Output to browser

Hi ,

When i try to fill an excel template and push it to the browser with an open (in excel) / save dialog and choose open , excel tells me that it cannot find (no more?) the excel file and thus cannot open it.

saving is not any problem.

I use the following line of code and do not wish to save anything to disk before presenting it to the client (if possible).

designer.Save("test.xls", SaveType.OpenInExcel, FileFormatType.Default, this.Response);

Thanx a lot.

Tom.

Hi Tom,

Could you please post your template file and sample code here? I will check it ASAP.

Hi,

Thank you for the quick response.

sample code :


DataSet ds = CreateDataSource();

// open the template and fill in the data
ExcelDesigner designer = new ExcelDesigner();
designer.Open(MapPath("export") + "\\templates\\excel\\guestlist\\guestlists.xlt");
designer.SetDataSource(ds);
designer.Process();

// push filled in excel to client
designer.Save(strFileName, SaveType.OpenInBrowser, FileFormatType.Default, this.Response); // i already tried every method of the SaveType class without any luck :(

the template is an empty excel workbook

thanx alot in advance, Tom.

Could you post your guestlists.xlt file here? And which version of Aspose.Excel are you using?

Laurence,

Please find guestlist.xlt in attachment;

The used versions :

Assembly version : 3.6.1.0

Product version : 2005.12.19

Kind regards, Tom.

In what event you call the Excel.Save method to send the file to browser? Please try to put it in Page_Load event.

Thats where it is implemented now.

Please create a simple aspx page with the following code in Page_Load event:

ExcelDesigner designer = new ExcelDesigner();
designer.Open(MapPath("export") + "\\templates\\excel\\guestlist\\guestlists.xlt");
designer.Save("book1.xls", SaveType.OpenInBrowser, FileFormatType.Default, this.Response);

Please check if it works fine.

By the way, I don't see any smart markers in your template file.

Hi,

I created a testpage as proposed.

I get a dialog box asking me to open / save "book1.xls" , but when i select open , it still opens it in the same web browser screen...

Am i doing anything wrong ?

ps : I know that there are (not yet) smart markers in my template file, im testing around. :)

Kind regards, Tom.

What's your requirement?

If you use OpenInBrowser option, the generated file will be open in the same web browser. If you want to open it in MS Excel, please use OpenInExcel option.