本文介绍了iPhone SDK - 将数据导出到XLS(而不是通过CSV)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将一些数据导出到.XLS文件,pdf和打印。

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

我已经尝试过简单的解决方案:将它导出到.CSV, href =https://github.com/davedelong/CHCSVParser =nofollow> CHCSVWriter 。它的工作原理打印和保存到pdf(我打开CSV在UIWebView和或从那里打印)。然而,要使用CSV在Excel中打开有两个主要的问题:

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 - 首先,如名称所示,在CSV中的值用逗号分隔,和在某些版本的Excel中,它需要用户。

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 - 我有希伯来语characteres,我已经尝试了所有的字符串编码,不能同时有希伯来语和拉丁字符。

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

因此,在试图使用CSV解决上面的问题后放弃了,我放弃了。有人可以给我一些提示,说明如何将我的数据导出到XLS?

So, after giving up after days of trying to use CSV to solve the issues above, I gave up. Someone can give me some hint on how I can export my data to XLS?

推荐答案

本文介绍了如何以编程方式创建一个Excel( .xls )文件,而不使用任何外部库。它只是打开一个文件流,它直接写入XML内容。

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.

它是用C#编写的,但是它的核心信息是用于创建节点和填充相应单元格值和格式的属性的XML格式。

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.

请考虑我自己没有尝试过,我在搜索时发现了。请随时问一些C#位是否不清楚。 HTH

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

这篇关于iPhone SDK - 将数据导出到XLS(而不是通过CSV)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!