Word to HTML converter
Moderator: General Moderators
Word to HTML converter
Anyone know of a good Word to HTML converter? I would prefer a php or coldfusion app.
You could use the COM function to convert the DOC to HTML.
ONLY WORKS ON WINDOWS SERVER
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;
?>- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
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.
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.
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:
I get this error:
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">It has something to do with the cffile that's about all I know right now.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.
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.
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.