4

Looking at https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSAttributedString_AppKitAdditions/Reference/Reference.html, there are quite a few document formats that AppKit makes it easy to export to, including even MS Word. It seems strange that Apple wouldn't also provide easy export functionality like this for their own word processing software.

Am I missing something in the documentation? Or should this be done using some other set of tools? I know I could export to pretty much any of those other formats and Pages would import it, but it would be nice to export directly to that format.

Alternatively, if there's a specification out there that would help in developing an export method like the ones above, that would also be useful.

Or should I be looking into AppleScript hooks to do this sort of thing?

David Ackerman
  • 472
  • 4
  • 11
  • I had almost the exact same [question](http://stackoverflow.com/questions/9472701/is-there-a-way-to-export-a-textview-to-a-pages-document) today. There has got to be some easy way to do this! – jroyce Feb 27 '12 at 22:06

1 Answers1

0

No, you are not missing anything. There is no API to programmatically create Pages files and no public spec for the format. Unless there is specific reason you need Pages files, your best bet is to create RTF files. You can write code to create formatted RTF files, and Pages will open them and you'll see the correct formatting.

Ken Aspeslagh
  • 11,484
  • 2
  • 36
  • 42
  • Depending on what you need this for, you might even be able to programatticaly open that RTF in Pages and then hit it was an AppleScript to save the file as a Pages document. – Ken Aspeslagh Apr 21 '12 at 13:34