NSAttributtedString initWithHTML skip styles
NSAttributtedString initWithHTML skip styles
- Subject: NSAttributtedString initWithHTML skip styles
- From: Gustavo Pizano <email@hidden>
- Date: Thu, 11 Feb 2010 11:45:21 +0100
Hello,
Im creating an HTMLString form a NSTextView like this:
NSArray * exclude = [NSArray arrayWithObjects:@"doctype", @"html", @"head", @"body",@"xml",nil];
NSDictionary * htmlAtt = [NSDictionary dictionaryWithObjectsAndKeys:NSHTMLTextDocumentType,NSDocumentTypeDocumentAttribute,exclude,NSExcludedElementsDocumentAttribute,nil];
NSError * error;
NSData * htmlData = [_mString dataFromRange:NSMakeRange(0, [_mString length]) documentAttributes:htmlAtt error:&error];
NSString * sdat = [[[NSString alloc] initWithData:htmlData encoding:NSUTF8StringEncoding] autorelease];
andIts being created perfectly.
now I need to do the inverse operation.. and Im doping the follwoing:
NSDictionary * attributesOfString;
NSArray * exclude = [NSArray arrayWithObjects:@"doctype", @"html", @"head", @"body",@"xml",nil];
NSDictionary * htmlAtt = [NSDictionary dictionaryWithObjectsAndKeys:NSHTMLTextDocumentType,NSDocumentTypeDocumentOption,exclude,NSExcludedElementsDocumentAttribute,nil];
NSAttributedString * valueString = [[NSAttributedString alloc] initWithHTML:[[specificComponent objectValue] dataUsingEncoding:NSUTF8StringEncoding]
options:htmlAtt documentAttributes:&attributesOfString];
[(XWSDefaultComponentView *)[component view] setTypingAttributes:attributesOfString];
[(XWSDefaultComponentView *)[component view] setString:[valueString string]];
But when I display the NSTextViuew all the string its without any style, no bold, no colors no nothing..
Any ideas what might I being doing wrong?
Thanks a lot.
Gustavo
_______________________________________________
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