DOC files can be read in to an NSTextStorage, but DOCX files presently cannot.
Reading an Word file using NSTextStorage
-
25-06-2023 - |
Question
I thought I read in the documentation that NSTextStorage could read a Word file. I did this:
textStorage = [[NSTextStorage alloc] initWithFileURL:url
options:0 documentAttributes:&attributes error:&error]
And I get the following error:
2014-04-01 15:08:52.322 Text Display[4665:90b] Error Domain=NSCocoaErrorDomain
Code=256 "The operation couldn’t be completed. (Cocoa error 256.)"
UserInfo=0x8b80d40 {NSFilePath=/Users/Ahab/Library/Application Support/iPhoneSimulator/7.1/Applications/BCFFFD16-41DE-4E09-8E79-0061A0607B91/Text Display.app/sample.docx}
Am I wrong here in that Word documents cannot really be read? Or is something else wrong?
I should have added that reading the same as RTF works. I my through was either DOCX cannot be read or the attributes have to bet set somehow. Unfortunately, the apple omitted that documentation.
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow