2
我有一個.rtf
文件。它包含圖像Windows Metafile Format(wmf)
。我想在iOS
應用程序中顯示此文件。我試圖用NSAttributedString
和UIWebView
顯示它,但圖像不顯示。 如何在iOS
設備上顯示它?如何在ios中顯示包含wmf圖像的rtf文件
EDIT
NSAttributedString
對於:
var urlpath = NSBundle.mainBundle().pathForResource("txtFile", ofType: "rtf")
var url:NSURL = NSURL.fileURLWithPath(urlpath!)!
if let attributedText = NSAttributedString(fileURL: url, options: [NSDocumentTypeDocumentAttribute:NSRTFTextDocumentType], documentAttributes: nil, error: nil) {
textView.attributedText = attributedText
}
對於UIWebView
:
NSString *path = [[NSBundle mainBundle] pathForResource:@"txtFile" ofType:@"rtf"];
NSURL *url = [NSURL URLWithString:path];
[self.webView loadRequest:[NSURLRequest requestWithURL:url]];
EDIT2
我試圖將.rtf
文件轉換爲.rtfd
文件格式。
RTFD文件創建一個包含TXT.rtf
和文件中的圖像的包。在TXT.rtf
文件中,圖像是作爲參考給出的,它們分別存儲在RTFD中。就像下面:
{{\NeXTGraphic img1.png \width40 \height20}¬}
我轉換的文件到RTFD但是當文件包含.wmf
圖像的問題來了。帶有.wmf
文件格式的圖像未被轉換。
是的,我想這一點。但不工作。 –