RTFFromRange:documentAttributes:
RTFのデータを返します
-(NSData *)RTFFromRange:(NSRange)aRange:
documentAttributes:(NSDictionary *)docAttributes:
解説
RTFのデータ(NSDataオブジェクト)を返します。
【docAttributes】
BottomMargin = 72;
CocoaRTFVersion = 102;
DefaultTabInterval = 0;
HyphenationFactor = 0;
LeftMargin = 72;
PaperSize = <4414c000 44528000 >;
RightMargin = 72;
TopMargin = 72;
ViewSize = <440bc000 444d4000 >;
返り値
( NSData * )
RTFデータ
引数
( NSRange )aRange
範囲
( NSDictionary * )docAttributes
文書属性辞書
フレームワーク
ApplicationKit
クラス
NSAttributedStringAdditions
Instance Methods
使用可能
10.1
参照
- RTFDFromRange:documentAttributes:
- RTFDFileWrapperFromRange:documentAttributes:
例文
#import "MyObject.h" @implementation MyObject - (IBAction)myAction:(id)sender {//開けるファイル拡張子の配列 NSArray *fileTypes = [ NSArray arrayWithObject : @"rtf" ]; //OpenPanelを作る NSOpenPanel *opPanel = [ NSOpenPanel openPanel ]; NSAttributedString *aString; //OpenPanelの結果のボタン番号 int opRet; NSData *data; //OpenPanelでファイル選択 opRet = [ opPanel runModalForDirectory : NSHomeDirectory() //どこのディレクトリを出すか file : @"Documents" //どのどのファイルを選択しておくか types : fileTypes ];//選べるファイルタイプ if ( opRet == NSOKButton ) { // OPENPanelのボタンがOKなら aString = [[NSAttributedString allocWithZone:[self zone]] initWithPath:[opPanel filename] documentAttributes:NULL]; data = [aString RTFFromRange:NSMakeRange(0,8) documentAttributes:nil]; } } @end