Convert/normalize HTML table containing colspan & rowspan...

Get help with installation and running here.

Moderators: DataMystic Support, Moderators

alnico
Posts: 74
Joined: Fri Oct 12, 2007 11:57 pm

Convert/normalize HTML table containing colspan & rowspan...

Postby alnico » Tue Jul 07, 2009 2:38 am

Has anybody already created such a script?
I am looking for a script filter that can take a cleaned HTML table containing colspan & rowspan attributes and un-combine/split them into their own cell.

Input would look something like this:

Code: Select all

<table>
  <tr>
    <td colspan="4">abcd</td>
    <td>e</td>
  </tr>
  <tr>
    <td>f</td>
    <td>g</td>
    <td>h</td>
    <td colspan="2">ij</td>
  </tr>
  <tr>
    <td>k</td>
    <td>l</td>
    <td colspan="2" rowspan="2">mnrs</td>
    <td>o</td>
  </tr>
  <tr>
    <td rowspan="2">pu</td>
    <td>q</td>
    <td>t</td>
  </tr>
  <tr>
    <td>v</td>
    <td>w</td>
    <td>x</td>
    <td>y</td>
  </tr>
</table>


Output would look like this:

Code: Select all

<table>
  <tr>
    <td>abcd</td>
    <td>abcd</td>
    <td>abcd</td>
    <td>abcd</td>
    <td>e</td>
  </tr>
  <tr>
    <td>f</td>
    <td>g</td>
    <td>h</td>
    <td>ij</td>
    <td>ij</td>
  </tr>
  <tr>
    <td>k</td>
    <td>l</td>
    <td>mnrs</td>
    <td>mnrs</td>
    <td>o</td>
  </tr>
  <tr>
    <td>pu</td>
    <td>q</td>
    <td>mnrs</td>
    <td>mnrs</td>
    <td>t</td>
  </tr>
  <tr>
    <td>pu</td>
    <td>v</td>
    <td>w</td>
    <td>x</td>
    <td>y</td>
  </tr>
</table>


colspan would be pretty easy to handle...simply insert...<td colspan="4">abcd</td>...four times in succession and remove the colspan attributes.
Exp: <td>abcd</td><td>abcd</td><td>abcd</td><td>abcd</td>

rowspan is a little more tricky, as you need to track the placement of the rowspan containing tag and insert it x times in the same location in rows below it.

Thanks for any help,

Brent

User avatar
DataMystic Support
Site Admin
Posts: 2154
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Convert/normalize HTML table containing colspan & rowspan...

Postby DataMystic Support » Tue Jul 07, 2009 9:54 am

You'll have to use a VBScript filter to generate this.
Regards,

Simon Carter, http://DataMystic.com/forums/index.php
http://PredictBGL.com - Insulin dose calculator for Type 1 diabetes
http://DownloadPipe.com - 250,000 free software downloads
http://DetachPipe.com - send huge email attachments

alnico
Posts: 74
Joined: Fri Oct 12, 2007 11:57 pm

Re: Convert/normalize HTML table containing colspan & rowspan...

Postby alnico » Wed Jul 08, 2009 1:47 am

Yep, I meant to inquire if anybody that built such a VBScript as it seems somewhat of a standard task.

If not, anybody do it on commission?

Thanks, Brent


Return to “TextPipe Tips and Tricks, Questions and Support”

Who is online

Users browsing this forum: No registered users and 1 guest