Re: Convert MS Word to HTML
Re: Convert MS Word to HTML
- Subject: Re: Convert MS Word to HTML
- From: Deivy Petrescu <email@hidden>
- Date: Wed, 12 Nov 2003 19:53:24 -0500
On Nov 12, 2003, at 10:36 AM, Mats-Olof Liljegren wrote:
I'm trying to build a chain of actions to automate new articles on my
website.
I would never ever use Word to do any HTML but my users use it
(teachers and worse; principals) and they do not know anything about
HTML.
This means you are a sensible guy.
This is my scenario:
A teacher or principal places a word (or excel) file in a folder with
a folder action. Then the folder action takes over and moves the
original to The_orignal_folder. Open the original saves it as HTML in
The_HTML_folder.
BBEdit grabs the file and clean it up using regexp.
The clean content goes into the webservers MySQL-database.
A copy the original files will be place on my webserver and on the
newly created post in MySQL there will be a link to the original file.
That is what I want to achieve.
All I want from the original file is the text and it's formatting, eg
<b>Bold</b> no dirty MS Word code!
You can create a folder action that converts the word files into
Tex-Edit Plus or TextEdit. TextEdit, I have been avoiding since it was
really hard to script.
Tex-Edit Plus on the other hand is a great scriptable application.
Here is a script recorded from word
________
tell application "Microsoft Word"
activate
do Visual Basic " Selection.WholeStory"
copy
end tell
tell application "Tex-Edit Plus"
activate
select insertion point before contents of window 1
paste
end tell
_________
This keeps the formatting of word in TE+. From here, I think i have
scripts that convert the text into html, keeping the same formatting.
To convert Excel to HTML I can help you out, I have done that.
If anyone could point out another way to do that without using Word it
would be great ( the originals will be in Word, not much to do about
that.)
Alternatively, you can save as html from word. The code is miserable,
but it is done for you.
Again, the recorded code:
______________
tell application "Microsoft Word"
do Visual Basic " ActiveDocument.SaveAs
FileName:=\"NameGoesHere.htm\", FileFormat:= _
wdFormatHTML, LockComments:=False, Password:=\"\",
AddToRecentFiles:=True, _
WritePassword:=\"\", ReadOnlyRecommended:=False,
EmbedTrueTypeFonts:=False, _
SaveNativePictureFormat:=False, SaveForms
Data:=False,
SaveAsAOCELetter:= _
False, HTMLDisplayOnlyOutput:=False"
close window 1
end tell
_______________
/Mats-Olof
Hope this helps.
BTW what system are you using?
Regards
Deivy
http://www.dicas.com/
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.