Could someone let me know, if it is possible to open somehow Velocity Excel template and stream to it partially a bigger amount of data on the fly?
Let say I would like to read in a loop from external resource ArrayLists with data. One list with 10 000 items per each iteration. In simple iteration I would like to push the list to Velocity Excel template and forget about it by jumping to the next iteration. At the end of data processing I would do a final merge the Velocity context and template with all data.
So far, I’ve seen ways of generating Excel reports by Velocity engine in a few simple steps:
- create Velocity template
- create Velocity context
- put data to context
- merge context and template
but I need to repeate 3th step several times.
The only option I see with default Velocity would be to implement something like a “streaming Collection” which never holds the complete data in memory, but rather provides the data in the iterator one by one.
You would then put this Collection into the Velocity context and use it in the Velocity Template to iterate over the items. Internally the Collection would retrieve the items in the hasNext()/next() call one after the other from your external source.