|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
can a php script read ASCII characters?
is it possible to read ASCII characters using php?? what about Java?
|
|
#2
|
|||
|
|||
|
I'm not sure what you mean, could you elaborate a bit please?
-KM- |
|
#3
|
|||
|
|||
|
using a Javascript you are able to read txt files only and if you try to open a doc file, lots boxes appear before the actual content of the doc file. i was wondering if there was a way to read the boxes because i assume that those are ASCII characters which are used in formating the doc file. if this could be done then maybe i could convert a Word file into HTML heheh but i want to do it using php
|
|
#4
|
|||
|
|||
|
Microsoft Word uses a binary file format. The characters that you are seeing in your text editor as boxes are just a sequence of bits written to the file to represent something that Microsoft Word understands. Microsoft do no publish a specification for this file format.
PHP does provide COM components to access Office files though, perhaps it would be worth your while looking into that. -KM- |
|
#5
|
|||
|
|||
|
i did try to use the COM function in 1 of my php scripts but it wasnt able to convert/save the Word file into HTML. And another problem was that when ever i use the COM function, my Word application wasn't closed properly. i had to manually close it using Windows Manager.
|
|
#6
|
||||
|
||||
|
Word not closing properly might be a cause of you not closing it, or your application crashing before reaching the close statement.
I think the problem with using COM in the sense that you want it is, if I rememeber correctly, COM strips all formatting and simply presents you with plain text renditions of the file. However, I don't know of a method other than COM to manipulate Word files using PHP |
|
#7
|
|||
|
|||
|
well, i did changed the coding a bit because i wanted it to save as HTML. hmmmm is there a way to change the extension of a file using php? eg. from *.doc to *.html?? this question just crossed my mind ^_^
|
|
#8
|
|||
|
|||
|
You can change the extension name but the result produced will be pure garbage as it will still contain the same data.
-KM- |
|
#9
|
|||
|
|||
|
ok...is there any way to convert a Word file to HTML without running any software behind it because i've search the internet and all of the scripts uses a program running at the background to help the Word file to be converted to HTML?
|
|
#10
|
||||
|
||||
|
Word itself can save as HTML, but I assume you know that and it therefore would not be a valuable solution.
The problem from what I see is getting the styles and formatting out of a word document. The COM object will get the text, but if the text is bold, blue and italic, it won't show up. |
|
#11
|
|||
|
|||
|
yeah.. stripping out the content is easy. its just the formating of the document causing the problem... by the way,the conversion of Word to HTML is one of my university project. if i can do this then im able to connect it to the university's database heheh thanks for your help ^_^
|
|
#12
|
|||
|
|||
|
How much effort are you looking to put into this one? The suggestion below is definitely not for the feint hearted or beginning scripter/programmer but would provide a good starting point if you're looking to invest a fair amount of time and effort.
OpenOffice (the Linux Open Source alternative to Microsoft Office) allows you to read and write to Microsoft word files and so must have reverse engeineered the file format. Thus the source code for this product would make a good starting point for writing a tool to convert from it into another form. -KM- |
|
#13
|
|||
|
|||
|
i think i've heard about OpenOffice in one of the forums. But i only have until March to complete my project and that i'm allowed to use either php or Javascript. Maybe i'll try to use OpenOffice when i have loads of free time. ^_^ thanks KM
|
|
#14
|
|||
|
|||
|
The OpenOffice stuff is written in C/C++ so you would need to do some substancial porting to PHP or look into writing PHP extensions. If you only have a couple of months though this probably isn't an option. Just thinking out loud really.
-KM- |
|
#15
|
|||
|
|||
|
Hey KM, what about a PERL script? i know that it uses Win32 OLE or something like that but can it do the job of converting Words to HTML without using any background software? just wondering ^_^
|
|
#16
|
|||
|
|||
|
I don't know much Perl but imagine you'd run into much the same problems with it as you would with PHP tbh. Although I could be wrong.
-KM- |
|
#17
|
|||
|
|||
|
Thanx KM. Your contribution is greatly appreciated ^_^
|
|
#18
|
|||
|
|||
|
You're welcome, just sorry I couldn't be of more help.
-KM- |