Re: doc (MS Word) integration in panther
Re: doc (MS Word) integration in panther
- Subject: Re: doc (MS Word) integration in panther
- From: Ali Ozer <email@hidden>
- Date: Sat, 1 Nov 2003 19:07:09 -0800
Is there an equivalent to replaceCharactersInRange:withRTFD: for
MSWord files, whose format is supposed to be integrated in panther?
What do I need to do to allow my app to recognize and fill an
NSTextView with .doc data? Anyone experimented with this yet?
You'll need to use NSTextStorage methods (although it might have been
nice for us to provide a convenience method in NSTextView). Below is
from the AppKit release notes. You can also see a real-world usage in
the TextEdit sources, which calls
readFromURL:options:documentAttributes: to do its text loading.
Ali
A new text document type is now supported,
NSString *NSDocFormatTextDocumentType;
corresponding to Microsoft Word documents. These documents may be read
using any of the existing NSAttributedString/NSMutableAttributedString
methods for reading text documents. They may be also be read and
written using the new NSAttributedString methods
- (id)initWithDocFormat:(NSData *)data
documentAttributes:(NSDictionary **)dict;
- (NSData *)docFormatFromRange:(NSRange)range
documentAttributes:(NSDictionary *)dict;
Currently the two most recent major revisions of the format are
supported for reading (corresponding roughly to Word 6 and later), but
only the most recent major revision is supported for writing. Note
that this does not imply support for all of the features expressible
in such a document, any more than the existing RTF reading implies
support for all features potentially expressible in RTF. In fact,
Cocoa's feature support for doc format reading and writing is very
nearly equivalent to its support for RTF reading and writing. This
support has, however, been enhanced to include the features described
in the sections on additional text attributes and additional paragraph
style features.
The "Converted" key in the document properties dictionary has been
reinterpreted, in a way that is consistent with its previous
definition. Previously positive values specified that the document had
been converted to the format specified by a filter service, and all
other values specified that the file was originally in the format
specified. That is still the case, but now there is a distinction
between negative values and 0 (or not present). Now negative values
imply that the file was originally in the format specified, but that
the conversion from the format specified to NSAttributedString may
have been lossy. In addition there are two new document property keys:
"DefaultTabInterval", which specifies the document-wide default tab
interval for the document. and "BackgroundColor", which specifies the
document-wide background color for pages.
_______________________________________________
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.