The official documents about Excelutils are here http://excelutils.sourceforge.net/ Userguide.html, it is a good way to export excel with POI and struts2, we do not need to generate Excel document through the POI API code, just need to create a new Excel document, and then through some syntax to take out the background pass over the value, this tool is really simple, easy to use.
However, today in the Excel export, you need to output the line number of each line, to get this problem, naturally want to go to the official website to find, but in the official website only find the index to remove the traversal (starting from 0), but I need to output serial number from 1, I whimsical with arithmetic operators plus 1 (that is, ${rowid+1}), Unfortunately Excelutils does not support this operation, if excelutils support this operation is good ( if who knows how to do this operation, but also trouble to tell me, the younger brother first here first thanks ).
For example, we wrote in Excel that:
#foreach row in ${userlist}${row.username} ${row.nickname} ${row.lastloginip} #end
If you want to remove the current index from the beginning of 0, you can write ${rowid}, to remove the index starting from 1, you can write ${rowindex}, note: The ID or the row before index is the identity name of the current object, that is #foreach row in ${ UserList} inside the row.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Excelutils gets the current index when iterating through the collection