1

I am programmatically generating SpreadsheetML, bundling in a .xlsx file. The files open perfectly on Excel on Windows, OSX, and iOS. But when using Preview or Numbers on OSX or iOS, the files do not display any content. It appears Preview and Numbers support only a subset of SpreadsheetML. Does anyone know of specifications for the subset of SpreadsheetML which is supported by Preview?

lschult2
  • 588
  • 2
  • 5
  • 16

1 Answers1

1

I have a little experience in this, having written parts of a .Net SML exporter that we ported to iOS using Xamarin. Our exporter deliberately uses as few features of the full format as possible, as our role for this code is exporting reports with minimum formating and a lack of any real "multimedia" like charts, etc. This format did open in both Excel and Numbers on iOS.

At an absolute minimum, an SML sheet needs a workbook.xml, at least one sheetNN.xml and then zip them up. However, I do not believe that description will actually work, even on Windows.

The minimum set we developed has an outer folder containing a [Content_Types].xml file, a _rels folder, and an xl folder. _rels contains a single file, .rels, which basically just points to the worksheet.xml. xl contains another _rels containing a single file workbook.xml.rels, pointing to the sheets. And finally xl also has a worksheets folder with each sheetNNN.xlm, and the styles.xml and workbook.xml at the root.

I would suggest doing this:

  1. Make a very simple workbook on Windows Excel. Change the extension to .zip, and extract it to a folder, and make a copy.
  2. Find an item that is not in the list above, and delete it. Edit the other files in a text editor and remove any links to the file you removed.
  3. Re-zip the folder (which can be annoying, you'll likely end up with the folder in the zip if you do it outside the command line) and try opening it in Excel.
  4. If it opens, try it on the Mac in Numbers.
  5. Repeat (2) and (3)

This will be time consuming and annoying, but I'm not sure there's any other way to be sure. I suspect that the _rels data is not really required, but I have not gone that far into the rabbit hole.

Maury Markowitz
  • 9,082
  • 11
  • 46
  • 98