convert html to excel using hssf poi???

Discussion in 'Java' started by davisoski, Aug 16, 2009.

  1. davisoski

    davisoski

    Joined:
    Aug 16, 2009
    Messages:
    1
    Hi.

    Somebody has tried to convert a html table from their definition to an excel file.

    I'm trying to do it using hssf poi and
    sheet.addMergedRegion(new CellRangeAddress(int firstRow, int lasRow, int firstCol, int lastCol)) but I'm getting problem to place the cells with rowspan and colspan, because I have to use index to place exactly the region.

    Let say we have the next definition:
    <table id="11" cols="7">
    <tr>
    <td align="center" styleClass="logo" colspan="2" title="logo" media="/xmlhttp/images/logobd3.gif">
    </td>
    <td styleClass="LCAB" align="center" colspan="5"
    title="header..id_11.title">
    </td>
    </tr>
    <tr>
    <td styleClass="LCAB" rowspan="3" align="center" colspan="2"
    title="header.id_11.row_1">
    </td>
    <td styleClass="LN" rowspan="3" align="center"
    title="header.id_11.row_2">
    </td>
    <td styleClass="LN" colspan="3" align="center"
    title="header.id_11.row_3">
    </td>
    <td rowspan="3" align="center" styleClass="LN2"
    title="header.id_11.row_4">
    </td>
    </tr>

    <tr>
    <td styleClass="LN" rowspan="2" align="center"
    title="header.id_11.row_5">
    </td>
    <td styleClass="LN" colspan="2" align="center"
    title="header.id_11.row_6">
    </td>
    </tr>
    <tr>
    <td styleClass="LN" align="center"
    title="header.id_11.row_7">
    </td>
    <td styleClass="LN" align="center"
    title="header.id_11.row_8">
    </td>
    </tr>
    </table>

    Parsing using DOM I know when I get a new row, a new column, etc.. but I'm not be able to do. Maybe there is another way to deal with it.

    Any suggestions?

    Thanks
    davisoski, Aug 16, 2009
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Joe C

    Jakarta POI HSSF

    Joe C, Jul 26, 2004, in forum: Java
    Replies:
    2
    Views:
    3,390
    Shane Mingins
    Jul 27, 2004
  2. Barbara Vernaeve

    POI HSSF generate 2nd excel worksheet.

    Barbara Vernaeve, Feb 1, 2005, in forum: Java
    Replies:
    0
    Views:
    561
    Barbara Vernaeve
    Feb 1, 2005
  3. thomprl

    POI HSSF and Images

    thomprl, Feb 4, 2005, in forum: Java
    Replies:
    0
    Views:
    593
    thomprl
    Feb 4, 2005
  4. vidhya
    Replies:
    0
    Views:
    459
    vidhya
    Jul 20, 2005
  5. ipy2006

    using HSSF and POI with Java

    ipy2006, Apr 3, 2008, in forum: Java
    Replies:
    3
    Views:
    972
    RedGrittyBrick
    Apr 3, 2008
Loading...

Share This Page