Hi Roger,
It seems to me the bigger problem is the conversion of nested html
tables, which are pretty common. That said, here is a button script that
converts a 'simple' html table to a tab-delimited text file. From there
the sky is the limit. ;-) NOTE: This code works with only the simplest
of tables, but it gives you a starting point if you want to go this way.
on mouseUp
-- get the file
answer file "Pick a file that contains an HTML table:"
if it = empty then exit to top
put url ("file:" & it) into tData
-- make each html table start at the beginning of a line
replace cr with empty in tData
replace "<table>" with (cr & "<table>") in tData
-- make each table end at the end of a line
replace "</table>" with ("</table>" & cr) in tData
-- remove all lines but those with complete html tables
filter tData with "<table>*</table>"
-- exit if there are no unnested tables
if tData = empty then
answer "No unnested tables found."
exit to top
end if
-- convert tables to tab-delimited lines of data
replace tab with empty in tData
replace "</tr>" with cr in tData
replace "</td>" with tab in tData
replace (tab & cr) with cr in tData
-- eliminate unused table tags
replace "<table>" with empty in tData
replace "</table>" with empty in tData
replace "<tr>" with empty in tData
replace "<td>" with empty in tData
-- display the converted data
put tData into fld 1
end mouseUp
Here is the test data I used (in a file of its own):
<table>
<tr>
<td>Table Cell</td>
<td>Table Cell</td>
</tr>
<tr>
<td>Table Cell</td>
<td>Table Cell</td>
</tr>
</table>
Merry Christmas!
Phil Davis
On 12/22/09 3:51 PM, roger.e.el...@sealedair.com wrote:
What is the most direct way to convert the data in an html table into data
to fill a 'basic table field' (not a dataGrid)? I have tried stripping
away tags and plucking data from between<table><tr><td>cell
data</td></tr></table>. This is tedious, and I'm sure there must be a
better way.
Thanks.
~Roger
---
Roger Eller<roger.e.el...@sealedair.com>
_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
--
Phil Davis
PDS Labs
Professional Software Development
http://pdslabs.net
_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution