> From: Chris Tazewell [mailto:chris@;tazewell.co.uk]
>
> Anyone know if there's a tag that strips out microsoft crap
> tags out of text?
Here's a useful message I saved from some other list a while back:
When using publishing tools (eg. like SOEditor or ActivEdit) i guess you
/ your clients often publish MS-Office documents. One big problem is
that these documents often contain huge amounts of "useless" data like:
- XML tags
- Stylesheets / Definitions
Luckily, MS has a "fix" for this, and released a utility called "HTML
Filter 2.0 for Office 2000" This nifty little thing can be used from the
command prompt as well, and for us that means: <CFEXECUTE>
This is a little snippet I wrote, cleaning up a form field, before
inserting it into a database.
<!--- CODE --->
<!--- Make some temporary files for the MSFilter to use --->
<!--- MSFilter (Filter.exe) is also present in that directory --->
<!--- The form field to be cleaned is called form.body --->
<cfset fileroot = "d:\temp\">
<!--- Make some temporary filenames for MSFilter to use, with path and
unique names--->
<cfset badfile = fileroot & dateformat(now(),"ddmmyy") &
timeformat(now(),"hhmmss") & "1" & ".tmp"> <cfset goodfile = fileroot &
dateformat(now(),"ddmmyy") & timeformat(now(),"hhmmss") & "2" & ".tmp">
<!--- Write the HTML-content of the form field to be cleaned into file:
badfile---> <cffile action="write" file="#badfile#" output =
"#trim(form.body)#">
<!--- Call MSfilter with arguments, ths makes a new file called
#goodfile#---> <cfexecute
name="#fileroot#Filter.exe"
arguments="-c -r -f -l -s -t #badfile# #goodfile#" timeOut="60">
</cfexecute>
<!--- Reads the cleaned HTML in file goodfile into a variable--->
<cffile action="read" file="#goodfile#" variable="cleaned_field">
<!--- Delete the temp files --->
<cffile action="delete" file="#badfile#">
<cffile action="delete" file="#goodfile#">
<!--- Insert cleaned HTML into database --->
<cfquery name="article_insert" datasource="#applicationdsn#">
insert into article
(
body_user_id
)
values
(
'#cleaned_field#'
)
</cfquery>
<!--- CODE END --->
Happy publishing :)
Office HTML Filter 2.0
http://office.microsoft.com/downloads/2000/Msohtmf2.aspx
Using Office HTML Filter at the Command Prompt
http://office.microsoft.com/Assistance/2000/wDosPeeler.aspx
--
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]