• 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
creating docx file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

creating docx file


  • Subject: creating docx file
  • From: Philip White <email@hidden>
  • Date: Mon, 20 Sep 2010 14:57:22 -0500

Hello,
  I've tried using the following code to save an attributed string as a docx file.

//the attributed string is 'contents'

NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys: NSOfficeOpenXMLTextDocumentType, NSDocumentTypeDocumentAttribute, nil];
NSRange range = {0,[contents length]};

NSError *error=nil;
NSFileWrapper *wrapper = [contents fileWrapperFromRange: range documentAttributes: attributes error: &error];

[wrapper writeToFile:[path stringByExpandingTildeInPath] atomically:YES updateFilenames:NO];


What I end up with is what appears to be an unzipped docx file (my understanding is that docx files are zipped archives), i.e a folder full of various resource files. I then try zipping it and changing the extension to docx but I don't seem to end up with a valid docx file, or at least not something that Pages 2008 can open. Maybe that version of Pages can't open that format anyway, but still that code clearly isn't creating what I would call a docx file. Any thoughts?

Thanks,
  Philip
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: creating docx file
      • From: Douglas Davidson <email@hidden>
  • Prev by Date: Re: What's the point of @properties?
  • Next by Date: Re: NSView resizing problems.
  • Previous by thread: Re: NSInvocationOperation problem with a signal exc_bad_access
  • Next by thread: Re: creating docx file
  • Index(es):
    • Date
    • Thread