AnsweredAssumed Answered

Export to XLSX filetype using XSLT Transformation

Question asked by ManjitSandhu on May 26, 2015
Latest reply on May 27, 2015 by disabled_menno

Title

Export to XLSX filetype using XSLT Transformation

Post

OK, so after some really useful help on getting the XSLT transformation working, I'm now getting the data transformed and it looks as I'd hoped. The only downside is that I'm unable to save the output to the 2007+ filetype.

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:fmp="http://www.filemaker.com/fmpxmlresult"
  xmlns="urn:schemas-microsoft-com:office:spreadsheet"
  xmlns:o="urn:schemas-microsoft-com:office:office"
  xmlns:x="urn:schemas-microsoft-com:office:excel"
  xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
  xmlns:html="http://www.w3.org/TR/REC-html40">

  <xsl:output indent="yes"/>
  <xsl:strip-space elements="*"/>
  <xsl:template match="/">
    <xsl:processing-instruction name="mso-application">progid="Excel.Sheet"</xsl:processing-instruction>

This is the stylesheet in my XSLT file, but if I save the reporting output as a XLSX file, it cannot be opened in Office - Excel reports:

Excel cannot open the file 'my_xls_file.xlsx' because the file format or file extension is not valid. Verify that the file has not been corrupted and the file extension matches the format of the file.

If saved as .XLS, it will open after clicking OK on the following message:

The format and extension of 'my_xls_file.xls' don't match. The file could be corrupted or unsafe. Unless you trust it's source, don't open it. Do you want to open it anyway?

Is there a way to allow the XSLT to output the data correctly for Office 2007 or later? For reference, I don't have Excel installed on the FM server - I did try a batch script to run on the documents folder to open and re-save the files but as Excel is not on the machine hosting FileMaker server, this doesn't work (as it relies on the Excel application object).

When saving the straight XML output from fileMaker as XLSX, it works fine and the files are opened without any error/warning, but the transformation breaks that, so whilst the end users now get a nicer output, they have to open and re-save as XLSX each time.

Any ideas on how to get the file format correct?

Thanks in advance

Martin

Outcomes