• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSAttributtedString initWithHTML skip styles
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: NSAttributtedString initWithHTML skip styles
      • From: Jens Alfke <email@hidden>
    • Re: NSAttributtedString initWithHTML skip styles
      • From: Graham Cox <email@hidden>
  • Prev by Date: Re: -[NSBundle preferredLocalizations]
  • Next by Date: Re: NSAttributtedString initWithHTML skip styles
  • Previous by thread: Re: [iPhone 3.1] NSInvocation on main thread?
  • Next by thread: Re: NSAttributtedString initWithHTML skip styles
  • Index(es):
    • Date
    • Thread