Open spreadsheet xml, save as Excel by default -
in web application, generating spreadsheet xml using xsl template. want spreadsheet xml open in excel default. so, add below properties response:
response.contenttype = "application/vnd.ms-excel"; response.addheader("content-disposition", "attachment;filename=export.xls"); response.charset = "";
this however, has 2 issues, first message below:
the file trying open, 'response.xls', in different format specified file extension. verify file not corrupted , trusted source before opening file. want open file now?
and 2nd, when try save it, tries save .xml file default. want save excel file default, know of way this?
an excel xls file not same format open spreadsheet xml file, why excel moans @ when tries open xls , find not one. excel can, of course, open open spreadsheet xml files, why still opens in excel. xml file, , when save again, still xml file. way around issue, think, save as, , change format manually .xls.
for first issue though, there may can do. rename file export.xml, make sure following processing instruction appears @ top of xml file
<?mso-application progid="excel.sheet"?>
this should make xml file opened in excel, opposed internet explorer.
in terms of xslt though, output such processing instruction, you'll need add code xslt stylesheet before elements output
<xsl:processing-instruction name="mso-application"> <xsl:text>progid="excel.sheet"</xsl:text> </xsl:processing-instruction>
Comments
Post a Comment