Page 1 of 1

Word to HTML converter

Posted: Wed Feb 14, 2007 7:09 pm
by vchris
Anyone know of a good Word to HTML converter? I would prefer a php or coldfusion app.

Posted: Thu Feb 15, 2007 3:36 am
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; 

?>

Posted: Thu Feb 15, 2007 10:17 am
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.

Posted: Thu Feb 15, 2007 11:31 am
by RobertGonzalez
And these docs are on the server?

Posted: Fri Feb 16, 2007 12:40 pm
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.

Posted: Sat Feb 17, 2007 1:43 pm
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.

Posted: Tue Feb 20, 2007 1:27 pm
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.