Post by P.A.U.L on Mar 10, 2008 15:05:22 GMT
Have been asked for this a number of times. So published here.
Here is an easy way to construct a forum table from exported excel - or any other delimeterred table:
Copy the green text below into a new file called : c:\formatTable.html
Save it
Then
[Start]->[Run]->[ c:\formattable.html ]
(note: you may have to allow active content or possibly not. Depends on your machine settings.)
So
Name,P,W,L,D,F,A,Pts
Paul,10,10,0,0,10,0,100
Timmy,10,0,10,0,0,10,-1
Becomes
Here is an easy way to construct a forum table from exported excel - or any other delimeterred table:
Copy the green text below into a new file called : c:\formatTable.html
Save it
Then
[Start]->[Run]->[ c:\formattable.html ]
(note: you may have to allow active content or possibly not. Depends on your machine settings.)
<html>
<head>
<script>
var oCell = '[t'+'d]';
var cCell = '[/t'+'d]';
var oRow = '[t'+'r]';
var cRow = '[/t'+'r]';
var oTABLE = '[ta'+'ble]';
var cTABLE = '[/ta'+'ble]';
function formatText()
{
x = inTxt.value.replace(/\n/g, cCell+cRow+'\n'+oRow+oCell);
x = x.replace(/[\t,]/g, cCell+oCell);
x = x.replace(/\[td\]\[\/td\]/g, oCell+'&nb'+'sp;'+cCell);
x = oTABLE+oRow+oCell + x + cCell+cRow+cTABLE;
outTxt.value = x;
x = x.replace(/\[/g, '<').replace(/\]/g, '>');
x = x.replace('<table', '<table border=1');
tstTxt.innerHTML = x;
}
function clipText()
{
outTxt.focus();
outTxt.select();
alert('press OK and then press CTRL+C');
}
</script>
</head>
<body>
Columns are split using TABS or COMMAS (you can export this format directly from excel.)<br/>
<br/><br/>
Copy the table for formatting into the box below.<br/>
<table><tr><td><textarea id='inTxt' cols=60 rows=10></textarea></td><td><textarea id='outTxt' cols=60 rows=10></textarea></td></tr></table>
Press <button onclick='formatText()'>Build</button> and if it looks right below <button onclick='clipText()'>Copy to clipboard</button><br/>
If not, then there is something wrong above ( try adding some comma's rebuilding.).
<div id='tstTxt'></div><br/>
<br/>
</body>
</html>
So
Name,P,W,L,D,F,A,Pts
Paul,10,10,0,0,10,0,100
Timmy,10,0,10,0,0,10,-1
Becomes
Name | P | W | L | D | F | A | Pts |
Paul | 10 | 10 | 0 | 0 | 10 | 0 | 100 |
Timmy | 10 | 0 | 10 | 0 | 0 | 10 | -1 |