I\'m writing a Cocoa application and I\'m trying to export to the Excel XML format (ISO/IEC 29500-1) which is basically a zip file with a bunch of XML files in it named with
I've worked with the OpenOffice API and it works great. I would suggest you work with that to create your Excel files. If you don't have time time/patience to do that, a workaround could be to have 2 links to export files, the XLSX version hack for the Excels of the world and then a separate exported CSV file for the Numbers application.
Wikipedia offers some links to libraries, which would probably give you a good start.
If the Office Open XML format isn't a requirement, and you don't need overly complex files exported, I also suggest checking saving the files as stylesheet formatted HTML which Excel can also read. A simple way to learn how to format the HTML you want as a spreadsheet is creating the file in Excel, and saving it as HTML.
How about encapsulating HTML table in Excel file? I have checked that this works and I can open it with Excel.
NSURL * documentsDirectory = [NSFileManager.defaultManager URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask].lastObject;
NSURL *file = [documentsDirectory URLByAppendingPathComponent:@"contacts.xls"];
NSString* string = @"<table><tr><td>FOO</td><td>BAR</td></tr></table>";
[string writeToFile:file.path atomically:YES encoding:NSUTF8StringEncoding error:nil];