views:

148

answers:

1

Hello everybody. I am trying to load the contents of a rtf file in the uiwebview. I am successful in loading the contents, but it is unformatted. the fonts are too large and it doesnt have any format. it displays the color of the rtf content, but not the font or size. So what should i do now. is there anyother way to load the rtf and format it???? I load the rtf in following way:

NSString *path = [[NSBundle mainBundle] pathForResource:@"Home" ofType:@"rtf"];
NSURL *url=[NSURL fileURLWithPath:path];
NSURLRequest *req=[NSURLRequest requestWithURL:url];
[menuWeb loadRequest:req];

So what should i do now. can anybody help me????

A: 

hi everybody. i found a way to load the contents of rtf in webview and format it. but the only problem is, it not being displayed properly. Where the paragraph ends, it shows few forward slash("\"). so the white spaces are replaced by "\". And it also shows some kind of header information of rtf file. something like this.

  {{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf290
{\fonttbl\f0\fnil\fcharset0 LucidaGrande;}
{\colortbl;\red255\green255\blue255;}
\deftab560\pard\tx560\pardeftab560\ql\qnatural\pardirnatural\f0\fs22 \cf0 \CocoaLigature0

so how can i get rid of the rtf header??? I load the rtf file in the following way

NSMutableString *htmlString = [NSMutableString stringWithFormat:@"<font face=\"verdana\" size=\"2\" color=\"red\">%@</font>",[NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:NULL]];
[menuWeb loadHTMLString:htmlString baseURL:url];

So how do i display the content correctly. Thanks in advance

Jayshree