开发者

How to change file extension from .txt to .rtf in ios programmatically?

开发者 https://www.devze.com 2023-04-11 02:34 出处:网络
开发者_开发百科How do I change a file extension from .txt to .rtf in iOS programmatically? In xml parsing I\'m getting rtf data with rtf tags.

开发者_开发百科How do I change a file extension from .txt to .rtf in iOS programmatically?

In xml parsing I'm getting rtf data with rtf tags.

Is it possible to save data in a rtf file without tags? If we load that file, this was loading with rtf tags in webview.

If we open and save that file physically, it opens in the WebView.

Is there any way to do this task (File Open & Save) programmatically using iOS.

If we load the rtf file from FTP server, upto tables it was loading(only plain text before tables)


using function of NSString

NSString *string2 = [[NSString alloc] initWithContentsOfFile:@"whateverFile.rtf"];

get the text only from the file and save it in .txt format using the

NSMutableString *mutstr2 = [[NSMutableString alloc] init];
[mutstr2 setString: string2];
[mutstr2 writeToFile:@"whatevertxt.txt" atomically:YES encoding:NSUnicodeStringEncoding error:&error];

you could write the file in .txt. format... i guess that is the best way to do what u want

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号