如何在Objective-C for iOS中创建和保存.rtf,.doc,.docx [英] How to create and save a .rtf, .doc, .docx in Objective-C for iOS

查看:518
本文介绍了如何在Objective-C for iOS中创建和保存.rtf,.doc,.docx的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望在iPad(iOS)上创建并保存rtf,doc或docx文件。

I am looking to create and save either a rtf, doc or docx file on an iPad (iOS).

情节是我们想帮助用户在他们的iPad上创建内容,然后让他们通过电子邮件发送这个可编辑的文档跨平台(OS X, WIN)。

The scenario is that we'd like to assist a user in creating content on their iPad and then let them email this as an editable document cross-platform (OS X, WIN).

我对除rtf,doc或docx文件格式之外的其他解决方案持开放态度。

I am open to other solutions besides the rtf, doc or docx file format.

谢谢,

James

推荐答案

RTF将是最简单的,因为它是纯文本格式。它有点像HTML,但没有关闭标签。 这里是一个用于编写RTF的类,但它需要很多依赖项来自框架中的其他地方。

RTF is going to be the easiest, because it's a plain text format. It's kind of like HTML, but without closing tags. Here is a class for writing an RTF, but it requires a lot of dependencies from elsewhere in the framework.

DOCX相当困难。它实际上是一个zip文件,包含一些XML文件。您可以通过将.docx扩展名更改为.zip并解压缩来自行检查格式。但即使XML是一种相当容易编写的格式,文本属性的组织方式仍然相当复杂。此外,我记得它必须以非常具体的方式进行拉链才能正确读取。

DOCX would be rather difficult. It's actually a zip file, containing a few XML files. You can examine the format yourself by changing the .docx extension to .zip and unzipping it. But even though XML is a fairly easy to write format, the way the text attributes are organized is still rather complicated. Also, I recall that it has to be zipped in a very specific way to be read properly.

至于DOC,这将是非常困难的,因为它是如此复杂的格式。您可以查看一些开源项目,例如 Abiword Word2x 。请小心使用他们的代码,因为许可证可能与App Store规则不一致。

As for DOC, it will be very difficult because it's such a complex format. You could look into some open source projects, like Abiword or Word2x. Be careful using their code because the licenses may not agree with the App Store rules.

这篇关于如何在Objective-C for iOS中创建和保存.rtf,.doc,.docx的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆