How to create and save a .rtf, .doc, .docx in Objective-C for iOS

后端 未结 3 1773
小蘑菇
小蘑菇 2020-12-10 09:03

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

The scenario is that we\'d like to assist a user in creating content on their iPad

相关标签:
3条回答
  • 2020-12-10 09:15

    I've seen doc & docx readers for iPhone (App store entry linked here), but I don't know of any open source frameworks you can make use of.

    RTF format should be pretty simple to write, if you're up to the challenge. There is no built in framework support for it (here's a related question, b.t.w.).

    Maybe you could write out something in a regular TEXT format and e-mail that?

    0 讨论(0)
  • 2020-12-10 09:16

    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 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.

    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.

    0 讨论(0)
  • 2020-12-10 09:32

    Docmosis has a cloud service that you can reach from iOS. You can ask it to render a doc in various formats (doc, rtf, pdf, odt etc) and email it off or stream it back - though you have to be connected. Previewing DOC on iOS is possible but a little flaky. One option is to stream PDF back for display on iOS and email editable document (which can be done in one call).

    0 讨论(0)
提交回复
热议问题