4

I need to export some data to an .XLS file, pdf, and print.

I already tried the simple solution: exporting it to .CSV with CHCSVWriter. It works for printing and saving it to pdf (I open the CSV in a UIWebView and get the PDF or print from there). However, to use the CSV to be open in excel has two main problems:

1 - First, as the name says, in the CSV the values are separated by commas, and in some versions of Excel, it requires the user to separate 'manually' in cells.

2 - I have hebrew characters, and I already tried all the string encodings, and can't have both hebrew and latin characters.

So, after giving up after days of trying to use CSV to solve the issues above, I gave up. How can I export my data to XLS?

3
  • @davedelong might be able to shed some light. Commented Jul 18, 2012 at 7:10
  • Hi Natan, finally did you managed to export data to .xls file? Commented Dec 2, 2014 at 9:15
  • Hey Yogesh - In the end I think I did that in CSV.. Commented Dec 2, 2014 at 9:18

2 Answers 2

3

The LibXL library provides this functionality for both xls and xlsx formats. There is no iOS version, but people say the iOS version is coming. You may want to contact LibXL support to confirm this.

EDIT: The iOS version is available now.

Sign up to request clarification or add additional context in comments.

4 Comments

Thanks, Adam. Any other possible approach?
@NatanR. I would recommend using xlsx format, if possible. It can be open with older Excel versions with add-on installed. It's an open, xml based format and the files are smaller compared to xls.
Thanks for the comments, @Adam. But I still need to know how to do it =(
I have succesfully created the .xls (xml based), and it can be opened normally in excel. But it doesn't open in a UIWebView or in Numbers. Do you have any idea why? Trying to save as .xlsx doesn't solves the problem...
2

This article explains how to programmatically create an Excel (.xls) file without using any external library. It just opens a file stream and it writes XML contents straight to it.

It is written in C#, but the core information coming out of it is the XML formatting used to create nodes and fill attributes for corresponding cell values and formatting.

Please consider I have not tried this myself, I found it while doing a search. Please feel free to ask if some C# bits are not clear. HTH

3 Comments

I worked on this today and I'm starting to have something good. I'll try to build some sort of XLS writer and I'll post here the answer. Thanks a lot.
The only problem is that preview in iOS (UIWebView) and Numbers are not able to open this file =( So I am still searching another solution, but it was, no doubt, a good idea.
Having a look at this thread and at this article it should possible with Numbers 2009. Never ever tried though

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.