You cannot use a variable in XML mapping file.
But you can set a condition in <loop> tag to indicate where to stop reading Excel records.
For example if you have in your mapping file something like
<loop startRow="2" endRow="2" items="hrDepartment.staff" var="employee" varType="net.sf.jxls.reader.sample.Employee">
<section startRow="2" endRow="2">
<mapping row="2" col="0">employee.name</mapping>
<mapping row="2" col="1">employee.age</mapping>
<mapping row="2" col="2">employee.payment</mapping>
<mapping row="2" col="3">employee.bonus</mapping>
</section>
<loopbreakcondition>
<rowcheck offset="0">
<cellcheck offset="0">Employee Payment Totals:</cellcheck>
</rowcheck>
</loopbreakcondition>
</loop>
it means jxls-reader will read the rows into Employee instances until it meets "Employee Payment Totals:" text in first column cell.
If you need to stop reading rows when no data is available you can set empty row and cell checks like this
<loopbreakcondition>
<rowcheck offset="0">
<cellcheck offset="0"/>
</rowcheck>
</loopbreakcondition>
You can check JUnit tests in jxls-reader source code to find more examples.
--
Leo
Saturday, January 1, 2011, 5:50:11 PM, you wrote:
Hi, Using, JXLS reader jxls-reader-1.0-RC-1.jar I am able to read a fixed set of data from each sections by providing fixed startRow and endRow in the XML mapping file, but there are scenarios where in the no of records in a particular section may vary because of which while reading the next section in same worksheet the startRow and endRow needs to be change every time manually in the mapping XML file. Is there a way, where in I can mapped an excel file with dynamic values of startRow and endRow by storing their location of the same in a variable and then use that variable as a reference as startRow and endRow for the next section mapping in my XML mapping file? Or Is there any other way in which I can mapped dynamic rows location in my XML mapping file. Please explain the same with an example. Thanks, Jahannu. |
------------------------------------------------------------------------------ Learn how Oracle Real Application Clusters (RAC) One Node allows customers to consolidate database storage, standardize their database environment, and, should the need arise, upgrade to a full multi-node Oracle RAC database without downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________ jXLS-user mailing list jXLS-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jxls-user