Question: I have an Editable NSTextView,In which user will write using different font style, on certain action i need to prepare the HTML Formate of it, 
Can anyone suggest me, how i can retrieve the data from NSTextView, 
I am able to use 

```
[[pInputText textStorage] words];

```

but it returns NSArray, from which i am not able to get NSMutableString,

Can anyone suggest me the best possible way to retrieve the String/data what user typed and in which format.

Answer: 
Below solutions works for me, 

```
- (NSString *)convertUnderlineTextToHTML:(NSAttributedString *)_mString 
{ 

    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];

    NSLog(sdat);

    return sdat;
} 

```

Where \_mString is 

```
NSMutableAttributedString *pAttributedString = [pInputText textStorage];

NSString *pHtml  = [self convertUnderlineTextToHTML:pAttributedString];

```

Regards
Rohan
`NSTextView` inherits from `NSText`, which has a `-string` method. So `[pInputText string` should do what you want.

Alternately, `TextStorage` is a subclass of `NSMutableAttributedString`, so if you want an attributed string you can just use the return of `[pInputText textStorage]` directly.