java - How to add the row num to the employee loop variable? -


i want add current row number of excel row mapped employee variable.

from example below: want know employee "yuri" in excel row number 8.

but can't find way access it. xlsrowcursor has how can add mapped bean? know reader uses current processing row number when writing exceptions , poi has too.

a simple self row counting solution on side isn't valid idea, because use skip row @ error mechanism.

any tips or hints?

the xml file:

 <?xml version="1.0" encoding="iso-8859-1"?>    <workbook>      ....     <loop startrow="7" endrow="7" items="department.staff" var="employee" vartype="net.sf.jxls.reader.sample.employee">       <section startrow="7" endrow="7">        <mapping row="7" col="0">employee.name</mapping>        <mapping row="7" col="1">employee.age</mapping>        <mapping row="7" col="3">employee.payment</mapping>        <mapping row="7" col="4">employee.bonus</mapping>      </section>   ...  </loop>  </worksheet> </workbook> 

the excel file: employees

6 name  age birth date  payment bonus   total   superior name 7 oleg  32  2-jan-74    2000    20,00%  2400    maxim 8 yuri  29  26-sep-77   1800    15,00%  2070    oleg 9 leonid    30  12-feb-76   1700    20,00%  2040    oleg 10 alex 28  18-aug-78   1600    20,00%  1920    oleg 11 employee payment totals:         7100        8430     

you can extend simpleblockreaderimpl , override read(xlsrowcursor cursor, map beans) method use teh xlsrowcursor current excel row , inject bean.

currently there no automatic way inject own customblockreader implementation via xml have manually getting sheet readers xlsreader , replacing inner block readers custom instances.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -