Word to HTML converter

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
vchris
Forum Contributor
Posts: 204
Joined: Tue Aug 30, 2005 7:53 pm
Location: Canada, Quebec

Word to HTML converter

Post by vchris »

Anyone know of a good Word to HTML converter? I would prefer a php or coldfusion app.
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

You could use the COM function to convert the DOC to HTML.

ONLY WORKS ON WINDOWS SERVER

Code: Select all

<? 

// starting word 
$word = new COM("word.application") or die("Unable to instanciate Word"); 

// if you want see thw World interface the value must be '1' else '0' 
$word->Visible = 1; 

//doc file location 
$word->Documents->Open("E:\\first.doc"); 

//html file location  '8' mean HTML format 
$word->Documents[1]->SaveAs("E:\\test_doc.html",8); 

//closing word 
$word->Quit(); 

//free the object from the memory 
$word->Release(); 
$word = null; 

?>
vchris
Forum Contributor
Posts: 204
Joined: Tue Aug 30, 2005 7:53 pm
Location: Canada, Quebec

Post by vchris »

I only have access to a coldfusion server here. I need something that I can config to my liking since there's lots of things in these docs that are specific to my work.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

And these docs are on the server?
vchris
Forum Contributor
Posts: 204
Joined: Tue Aug 30, 2005 7:53 pm
Location: Canada, Quebec

Post by vchris »

Yes they are. I found that the best way to have the cleanest code is to copy from MS word and paste into Dreamweaver design mode. This way all the p, ul, table... tags are all copied over and pretty cleanly too. I still need to modify the tables a bit to what and a couple bugs with the headers that are not the size I need.

Anyone one of you know how to remove a tag but not it's content with regular expressions? For example if I have <td><p align="center"><strong>table header</strong></p></td> I want it to be <th>table header</th>. So basically when there is <p align="center"> with <strong> it's a <th>.

I guess what I want is what is the search and replace function in dreamweaver except I wanna do it as a batch instead of 1 by 1 operations.
vchris
Forum Contributor
Posts: 204
Joined: Tue Aug 30, 2005 7:53 pm
Location: Canada, Quebec

Post by vchris »

I'm almost done with my coldfusion converter. I got an error that I don't understand and I have searched google and macromedia website.

Here is the code:

Code: Select all

<form method="post" action="index.cfm" name="uploadForm">
	<input name="FileUploaded" type="file"><br />
	<input name="submit" type="submit" value="Convert File">
</form>



<cfif isDefined('FileUploaded')>
<cfoutput>#FileUploaded#</cfoutput>
	<cfset filename = FileUploaded>
	<cffile action="read"
	file="C:\CFusionMX7\wwwroot\converter\docs\#filename#"
	variable="myfile">
I get this error:
Complex object types cannot be converted to simple values.
The expression has requested a variable or an intermediate expression result as a simple value, however, the result cannot be converted to a simple value. Simple values are strings, numbers, boolean values, and date/time values. Queries, arrays, and COM objects are examples of complex values.

The most likely cause of the error is that you are trying to use a complex value as a simple one. For example, you might be trying to use a query variable in a <CFIF> tag. This was possible in ColdFusion 2.0 but creates an error in later versions.
It has something to do with the cffile that's about all I know right now.
vchris
Forum Contributor
Posts: 204
Joined: Tue Aug 30, 2005 7:53 pm
Location: Canada, Quebec

Post by vchris »

I just found out that in DreamWeaver MX 2004 I can save my search and replace queries and reload them to execute them. That's great and all but I can only do one query at a time. Is there a way to execute a batch of queries within DW? If not, do you know of another software that could execute search and replace queries, with regular expression support, on a text file in batch?

EDIT: Actually the queries saved with DW creates xml code. If you know of a software that can use XML queries that'd be awesome too.
Post Reply