Dale
Give this a go
<cfscript>
function TableToCSV () {
var table = arguments[1];
// stringout the line breaks
table = REReplaceNoCase(table, "[^[:print:]]", "", "ALL");
// convert tr into line breaks
table = replaceNocase(table, "</tr><tr>", chr(10), "ALL");
// convert td into delimiter
table = replaceNoCase(table, "</td><td>", """,""", "ALL");
// get rid of remainding td
table = replaceNoCase(table, "<td>", """", "ALL");
// get rid of remainding /td
table = replaceNoCase(table, "</td>", """", "ALL");
// get rid of table, remaining tr and and other table tags
table = REReplaceNoCase(table,
"<(table|tbody|thead|tfoot|tr)([^>]*)>", "", "ALL");
table = REReplaceNoCase(table,
"</(table|tbody|thead|tfoot|tr)([^>]*)>", "", "ALL");
// convert links into just text
// use /3 to have the href value be used
table = REReplaceNoCase(table, "<a([^(href)]*)
(href="")([^""]*)("")>([^<]*)</a>", "\5", "ALL");
// strinp out any remaining tags
table = REReplaceNoCase(table, "<[^<]*>", "", "ALL");
return table;
}
</cfscript>
<cfsavecontent variable="table">
<p>this is some junk text</p>
<table>
<tr>
<td>Cell 1.1 <a href="sss.html">my link</a></td>
<td>Cell 1.2</td>
<td>Cell 1.3</td>
<td>Cell 1.4</td>
</tr>
<tr>
<td>Cell 2.1</td>
<td>Cell 2.2</td>
<td>Cell 2.3</td>
<td>Cell 2.4</td>
</tr>
</table>
<p>this is some junk text</p>
</cfsavecontent>
<cfset reg = "(<table[^>]*)([\w\W]*)(</table>)" />
<cfset table = reFindNoCase(reg,table, 1, true) />
<cfset theTable = MID(table, tds.pos[1], tds.len[1]) />
<cfoutput>
<pre>#HTMLEditFormat(TableToCSV(table))#</pre>
</cfoutput>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"cfaussie" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cfaussie?hl=en
-~----------~----~----~----~------~----~------~--~---