Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: HTML PHP
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
$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 22-Mar-11 4:18am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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[^]
  Permalink  
Comments
MuthuGanesh D at 22-Mar-11 9:36am
   
i can't understand this concept. If have any other ideas for deal this.
 
Thanks....
SAKryukov at 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.
--
SAKryukov at 22-Mar-11 12:05pm
   
Good answer, my 5.
--SA
Mika Wendelius at 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.
SAKryukov at 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
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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...
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 460
1 Peter Leow 260
2 OriginalGriff 245
3 Maciej Los 175
4 John C Rayan 146
0 Sergey Alexandrovich Kryukov 7,203
1 OriginalGriff 5,587
2 Peter Leow 4,097
3 Mika Wendelius 2,850
4 CHill60 2,818


Advertise | Privacy | Mobile
Web04 | 2.8.150224.1 | Last Updated 11 Dec 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100