docFormatFromRange:documentAttributes:
指定した範囲をWordフォーマットのデータにして返します
-(NSData *)docFormatFromRange:(NSRange )range documentAttributes::
documentAttributes:(NSDictionary *)dict :
解説
指定した範囲をWordフォーマットのデータにして返します。
返り値
( NSData * )
データ
引数
( NSRange )range documentAttributes:
データにする範囲
( NSDictionary * )dict
フレームワーク
ApplicationKit
クラス
NSAttributedStringAdditions
Instance Methods
使用可能
10.3
参照
例文
//注意!!! //testWriteWordというファイルが警告なしで上書きされます。 #import "MyObject.h" @implementation MyObject - (IBAction)myAction:(id)sender { NSAttributedString *aString = [[NSAttributedString alloc] initWithString:@"This document written by method of writeToFile"]; NSData *dat1 = [aString docFormatFromRange:NSMakeRange(0,46) documentAttributes:nil]; if ([dat1 writeToFile:[@"~/testWriteWord" stringByExpandingTildeInPath] atomically:YES]){ NSLog(@"YES"); }else{ NSLog(@"NO"); } } @end