Hi frnds....

i am working on file handling..
I need to display text from my file...
here i got everything, but the alighnment is totally looks like notepad...i want to display same clarity(styles) which my original file having...

plz give me any solutions asap..

Thanks & Regards..

show the code you are using, and the file structure of the text file

Alignment like notepad, add styles? Your question is way too vague for anyone to know how to help you. Some details would be quite useful!

show the code you are using, and the file structure of the text file

Hi almost...
Sorry for ur inconvinince...

i need to download a file frm .rtf..It contains some styles like bold,underlines....
this is my code.....
if u have any simple ways rather than this try to post it...

<?php
// read recipe file into array
$data = file('test.rtf') or die('Could not read file!');

?>

<h2><?php echo $title; ?></h2>

<?php
/* iterate over content and print it */
foreach ($data as $line) {
    echo nl2br($line);
}
?>

Thank u...

the same thing, bold <b> this text</b> in a string</p>
the same thing, bold {\b this text} in a string \par

to accomplish the same thing, bold this text in a string
to display rtf codes in html you have to use something to parse the rtf escape codes to html tags
you already use nl2br which creates <br> tags for (#0d;#0a; pairs) or (\n) in the file
there is a class rtf2html, have no idea how good it is or how $.
or you could google search or search sourceforge

write a parser to search each line and replace each {\code{space} with <code> and each } with </lastcode>
and \code{space} with <code>
but, the opening of each enhanced block could be on a preceeding $line so you have to drop the 'open' codes in a temp array until they are closed. I experimented with simple search replace and got bogged, way better if someone has already done it

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.