TextEdit sources in /Developer/Examples/AppKit/TextEdit may be
useful. TextEdit's document types are set up to read/write RTF and
RTFD, in addition to a number of other types.
Ali
On Jul 2, 2009, at 14:04 , Ian Piper wrote:
bump bump :-)
Ian.
--
ianpi...@mac.com
07590 685840 | 01926 811383
Begin forwarded message:
From: Ian Piper <ianpi...@mac.com>
Date: 1 July 2009 3:53:52 pmBST
To: Cocoa-dev@lists.apple.com
Subject: Reading and writing rtf(d) files
Hi all,
I have a question about reading and writing file types. I have been
following an old Apple text editor example (http://developer.apple.com/documentation/Cocoa/Conceptual/TextArchitecture/Tasks/TextEditor.html
), and want to extend it to allow me to read and write rtf files.
At least, I want it to be able to round-trip rich text files with
TextEdit. From the example:
"At this stage of its development, your editor opens and saves
documents only with an extension of ????. To enable your
application to save and open documents with a recognized file type,
you need to use Xcode to configure the application’s document types
settings as described in “Storing Document Types Information in the
Application's Property List” in Document-Based Applications
Overview. For complete details about application property lists,
see Runtime Configuration Guidelines."
I read the documents, and an example from 2001 by Mike Beam () and
also looked at the settings for the TextEdit example. I ended up
setting it like so:
Creator: ttxt
Name: DocumentType
Extensions: rtfd
MIME Types: text/rtfd
OS Types: rtfd
My program writes files with rich content and reads them OK. But it
won't read rtfd files that I have created elsewhere (I can select
such files but they just don't open - nothing happens). Also,
TextEdit will read files that I have created using my editor, but
they are in plain text with lots of tutti-frutti.
Can anyone point me to an example that describes how I am supposed
to tell my application that it should read and write rtf (or rtfd)
files?
Ian.
--
ianpi...@mac.com
07590 685840 | 01926 811383
_______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/aozer%40apple.com
This email sent to ao...@apple.com
_______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to arch...@mail-archive.com