Hi, I am using loadFileWrapperRepresentation to implement a RTF/RTFD reader. My code for RTF and RTFD support works, but I can't figure out how to load in .txt files. the basic flow of the reader is, determine the file type, set a NSAttributedString to a certain value depending on the file type, and then load it into a textView. see the following code.(rtfData is an NSAttributedString; textView is my TextView).

        if ([type isEqualToString:@"Rich-Text With Attachments"]) {
rtfData = [[NSAttributedString alloc]initWithRTFDFileWrapper:wrapper documentAttributes:nil];
        }
        else if ([type isEqualToString:@"Rich-Text"]) {
rtfData = [[NSAttributedString alloc]initWithRTF:[wrapper regularFileContents] documentAttributes:nil];
        }
        else
        {
                //code for plain text   
        }

    if (textView) {
[[textView textStorage]replaceCharactersInRange:NSMakeRange(0, [[textView string] length])withAttributedString:rtfData];
        [rtfData release];
     return YES;
         }
Any suggestions?

Lincoln Green - Head of BinkWorks - the rather unskilled programmer - etc
http://binkworks.com/
_______________________________________________

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

This email sent to [EMAIL PROTECTED]

Reply via email to