• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Newbie question: forcing data format during saveDocumentTo:
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Newbie question: forcing data format during saveDocumentTo:
      • From: Scott Anguish <email@hidden>
  • Prev by Date: Re: C
  • Next by Date: ATSUI in NSView
  • Previous by thread: How can I tell when my window has finished drawing?
  • Next by thread: Re: Newbie question: forcing data format during saveDocumentTo:
  • Index(es):
    • Date
    • Thread