Stream to the client and open in Excel When you pass an HttpResponse object to Save , ExcelWriter will stream the generated Excel file to the client. The browser will display a File Download dialog asking the user to open or save the file. The method's second parameter specifies a file name to display in the File Download dialog. If the method's third parameter - openInBrowser - is false and the user chooses to open the Excel file, the file will open in Microsoft Excel. Code Block |
---|
|
//--- Stream to the client
//--- "Output.xls" will appear in the Save As dialog
//--- The file will open in Excel
xlTemplate.Save(Page.Response, "Output.xls", false);
//--- Stream to the client
//--- "Output.xlsx" will appear in the Save As dialog
//--- The file will open in Excel 2007 only
xlTemplate.Save(Page.Response, "Output.xlsx", false);
|
Code Block |
---|
|
'--- Stream to the client
'--- "Output.xls" will appear in the Save As dialog
'--- The file will open in Excel
xlTemplate.Save(Page.Response, "Output.xls", False)
'--- Stream to the client
'--- "Output.xlsx" will appear in the Save As dialog
'--- The file will open in Excel 2007 only
xlTemplate.Save(Page.Response, "Output.xlsx", False)
| Stream to the client and open in the browser window When you pass an HttpResponse object to Save , ExcelWriter will stream the generated Excel file to the client. The browser will display a File Download dialog asking the user to open or save the file. The method's second parameter specifies a file name to display in the File Download dialog. If the method's third parameter - openInBrowser - is True and the user chooses to open the Excel file, the file will open in the browser window. Code Block |
---|
|
//--- Stream to the client
//--- "Output.xls" will appear in the Save As dialog
//--- The file will open in the browser's Excel plug-in
xlTemplate.Save(Page.Response, "Output.xls", true);
...
//--- Stream to the client
//--- "Output.xlsx" will appear in the Save As dialog
//--- The file will open in the browser's Excel 2007 plug-in
xlTemplate.Save(Page.Response, "Output.xlsx", true);
|
Code Block |
---|
|
'--- Stream to the client
'--- "Output.xls" will appear in the Save As dialog
'--- The file will open in the browser's Excel plug-in
xlTemplate.Save(Page.Response, "Output.xls", True)
...
'--- Stream to the client
'--- "Output.xlsx" will appear in the Save As dialog
'--- The file will open in the browser's Excel 2007 plug-in
xlTemplate.Save(Page.Response, "Output.xlsx", True)
|
|