PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old January 11th, 2005, 11:53 AM
confirm045 confirm045 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 26 confirm045 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 1 m 54 sec
Reputation Power: 0
can a php script read ASCII characters?

is it possible to read ASCII characters using php?? what about Java?

Reply With Quote
  #2  
Old January 11th, 2005, 02:48 PM
kode_monkey kode_monkey is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 367 kode_monkey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 21 sec
Reputation Power: 15
I'm not sure what you mean, could you elaborate a bit please?

-KM-

Reply With Quote
  #3  
Old January 12th, 2005, 11:46 AM
confirm045 confirm045 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 26 confirm045 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 1 m 54 sec
Reputation Power: 0
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

Reply With Quote
  #4  
Old January 12th, 2005, 02:41 PM
kode_monkey kode_monkey is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 367 kode_monkey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 21 sec
Reputation Power: 15
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-

Reply With Quote
  #5  
Old January 12th, 2005, 07:46 PM
confirm045 confirm045 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 26 confirm045 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 1 m 54 sec
Reputation Power: 0
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.

Reply With Quote
  #6  
Old January 13th, 2005, 09:53 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,886 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 19 m 35 sec
Reputation Power: 18
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

Reply With Quote
  #7  
Old January 13th, 2005, 08:17 PM
confirm045 confirm045 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 26 confirm045 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 1 m 54 sec
Reputation Power: 0
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 ^_^

Reply With Quote
  #8  
Old January 14th, 2005, 06:25 AM
kode_monkey kode_monkey is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 367 kode_monkey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 21 sec
Reputation Power: 15
You can change the extension name but the result produced will be pure garbage as it will still contain the same data.

-KM-

Reply With Quote
  #9  
Old January 14th, 2005, 06:45 AM
confirm045 confirm045 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 26 confirm045 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 1 m 54 sec
Reputation Power: 0
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?

Reply With Quote
  #10  
Old January 14th, 2005, 08:32 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,886 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 19 m 35 sec
Reputation Power: 18
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.

Reply With Quote
  #11  
Old January 14th, 2005, 11:26 AM
confirm045 confirm045 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 26 confirm045 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 1 m 54 sec
Reputation Power: 0
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 ^_^

Reply With Quote
  #12  
Old January 14th, 2005, 12:28 PM
kode_monkey kode_monkey is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 367 kode_monkey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 21 sec
Reputation Power: 15
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-

Reply With Quote
  #13  
Old January 14th, 2005, 01:00 PM
confirm045 confirm045 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 26 confirm045 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 1 m 54 sec
Reputation Power: 0
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

Reply With Quote
  #14  
Old January 14th, 2005, 05:04 PM
kode_monkey kode_monkey is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 367 kode_monkey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 21 sec
Reputation Power: 15
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-

Reply With Quote
  #15  
Old January 15th, 2005, 02:43 PM
confirm045 confirm045 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 26 confirm045 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 1 m 54 sec
Reputation Power: 0
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 ^_^

Reply With Quote
  #16  
Old January 15th, 2005, 03:00 PM
kode_monkey kode_monkey is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 367 kode_monkey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 21 sec
Reputation Power: 15
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-

Reply With Quote
  #17  
Old January 15th, 2005, 03:51 PM
confirm045 confirm045 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 26 confirm045 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 1 m 54 sec
Reputation Power: 0
Thanx KM. Your contribution is greatly appreciated ^_^

Reply With Quote
  #18  
Old January 15th, 2005, 04:06 PM
kode_monkey kode_monkey is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 367 kode_monkey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 21 sec
Reputation Power: 15
You're welcome, just sorry I couldn't be of more help.

-KM-

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > can a php script read ASCII characters?


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap