Newbie question: forcing data format during saveDocumentTo:
Newbie question: forcing data format during saveDocumentTo:
- Subject: Newbie question: forcing data format during saveDocumentTo:
- From: Jerry <email@hidden>
- Date: Fri, 29 Aug 2003 16:03:09 -0700
I have an application that saves data using the normal archiving most
of the time, but I need the ability to export as RTF.
I have methods that are invoked by my Save As... and Export RTF... menu
items:
- (IBAction)saveDocumentAs:(id)sender
{
saveType = @"jrwr";
[super saveDocumentAs:sender];
}
- (IBAction)saveDocumentTo:(id)sender
{
saveType = @"rtf";
[super saveDocumentTo:sender];
}
That way when the save dialog opens I can constrain the file type:
- (BOOL)prepareSavePanel:(NSSavePanel *)panel
{
NSLog(@"preparing save panel");
[panel setRequiredFileType:saveType];
[panel setExtensionHidden:NO];
return [super prepareSavePanel:panel];
}
The save dialog opens with the correct file extension. After the dialog
is closed, dataRepresentationOfType: is called. I expected the type to
be rtf or jrwr, depending on what had been set for the save dialog.
However, aType below is always "DocumentType".
- (NSData *)dataRepresentationOfType:(NSString *)aType
{
// aType is always "DocumentType" here.
}
While I can work around this, I think I'm missing something. What
determines the document type sent to dataRepresentationOfType:?
Jerry
_______________________________________________
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.