Re: saving rtf data in non-document based app
Re: saving rtf data in non-document based app
- Subject: Re: saving rtf data in non-document based app
- From: Jeremy Dronfield <email@hidden>
- Date: Sun, 1 Feb 2004 11:48:45 +0000
On 31 Jan 2004, at 9:38 pm, Andrew Kinnie wrote:
I am creating an application which has no real reason to be
document-based. However, I want the app to create reports that I
want to save. I realize I can implement NSCoding to do normal
archiving and unarchiving. However, what I'd like to do is to have
the app be able to save its data as it goes along, but let the user
create rtf reports that can be read in a text editor.
Assuming the RTF you want to save consists of the contents of an
NSTextView, you can write the data straight to file from the view:
if (![myTextView writeRTFDToFile:myFilePath atomically:YES]) {
NSRunAlertPanel(@"Couldn't save file.", @"The file might be
protected.", @"OK", nil, nil);
}
That should do it. How you handle the file path is up to you.
Hope this helps.
-Jeremy
========================================
email@hidden
theLocustFarm.net:
- fractious fiction at
http://freespace.virgin.net/jeremy.dronfield
========================================
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.