Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I want to read and display MS word document with out changing its formates (like paragraph, color, bold, etc).

I already try the following code.

PHP
<?php
$id=$_GET["id"];
include("config/opendb.php");

$sql="SELECT path FROM job_apply WHERE id= '$id'";
$result=mysql_query($sql);
while($row=mysql_fetch_array($result))
{
header('Content-Type: text/html');
$file = $row['path'];
$data = file($file) or die('Could not read file!');
foreach ($data as $line) {
echo nl2br($line);
};
}
include("config/closedb.php");
?>



but this code given following output:


ÐÏࡱá>þÿ •—
þÿÿÿ“”ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿì¥Á[€ ð¿Abjbj¬ú¬ú .Tΐ
ΐ
Aÿÿÿÿÿÿ·èè+++++ÿÿÿÿ????T“¤?3©t
77777Ö¨بببببب§ª¢I­zب+ب++77Ûí¨¶¶¶^+7+7Ö¨¶Ö¨¶¶&šœ°®§7ÿÿÿÿ —¸KÚ™Ë
?pJ d¨©03©® í†0
íȮ§Ã­+®§
¶بب¶3©ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿíè ñ:

HALL MASTER
Hall Id
Hall Name
Class
Section
Hall Capacity (No. of Student sit while exam).
CLASS MASTER
Class Id
Class Name (Standard)
SECTION MASTER
Section
DESIGNATION MASTER
Desg Id
Desg. Name
SUBJECT MASTER
Subj. Id
Subj. Name
Class Id
TERM MASTER
Term Id
Term Name
FEES MASTER
Fee Id
Class Id
Term Id
Fees Amount
-------------------------------------------------------------
Some undefined codes are display. Here i also use bold, color, etc.

I want to display that formates also.

Anybody have ideas....

Thanks.....
Posted
Updated 8-Aug-20 16:57pm

I have also same problem but My sir guide me that he was say you can produce content of word document with its formats like bold,color,etc using antiword php download it and implement its step...
 
Share this answer
 
If you're opening a doc file, it's in binary format so you would have to use Office libraries (or similar) to interpret it.

If you're opening a docx-file then it's in XML format (multiple zipped files) so you would have to create (or use a solution) which breaks it down to text.

For example for DOCX-format see: Basics of OpenXML (Word 2007) for Beginners[^]
 
Share this answer
 
Comments
MuthuGanesh D 22-Mar-11 9:36am    
i can't understand this concept. If have any other ideas for deal this.

Thanks....
Sergey Alexandrovich Kryukov 22-Mar-11 12:05pm    
Don't throw the idea only because you cannot understand it. In this way -- you're done. There is no other idea for you, except... live you job. You attitude does not allow you to do it (at the moment, until you rethink it).
Best wishes.
--
Sergey Alexandrovich Kryukov 22-Mar-11 12:05pm    
Good answer, my 5.
--SA
Wendelius 22-Mar-11 12:21pm    
Thanks :) Totally off-topic: It would be great to hear your opinions about UI designs (pros/cons) at some point. Yesterday we kinda started a discussion about it but it'd be great if we could continue at some time.
Sergey Alexandrovich Kryukov 22-Mar-11 14:06pm    
Why not, if I can. Give me a reference: which discussion do you mean?
See my posts on the similar topics: http://www.codeproject.com/Answers/151247/GUI-Apperance-Csharp-Net.aspx
http://www.codeproject.com/Answers/150899/Zom-Out-malfunctions-when-Screen-resolution-change.aspx

--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900