I am trying to find the magic incantation to take an .RTFD document with a jpg 
attachment and convert it to a .DOC document. (in code)


My first lazy thought was to use textutil -convert doc mydocument.rtfd
This does not work. (10.7.5)
It creates a perfect good Word document without the image.

Then I tried creating an instance of NSAttributedString using initWith 
RTFDFileWrapper.
The resulting string contains an NSFileAttachment for my jpg image as I would 
expect.

The next step is to save the NSAttributed string, with attachment, as a .doc 
document.

using -docFormatFromRange:documentAttributes: and saving the resulting NSData 
object created a perfectly good Word document without the attachment.


using -fileWrapperFromRange:documentAttributes:error and saving the result also 
creates a perfectly good Word document, again without the attachment.

BOOL written = [destWrapper writeToURL:destURL 
options:NSFileWrapperWritingWithNameUpdating originalContentsURL:sourceURL 
error:&writeError];


Am I missing something?

Pages can export to Word with the attachment. Why can't I?




_______________________________________________

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to