convert html to excel using hssf poi???

Joined
Aug 16, 2009
Messages
1
Reaction score
0
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top