Putting two dynamic grids beside each other with JXLS

£可爱£侵袭症+ 提交于 2019-12-22 19:25:10

问题


I want to define an Excel template to be used with JXLS (current version 2.2.5) in such a way that there is a dynamic grid (i.e. I do not know the number of columns before-hand), and to the right side of it, another grid:

Header 1.1 | Header 1.2 |    | Header 2.1 | Header 2.2 | Header 2.3
-------------------------    --------------------------------------
A            B                 C            D            E
F            G                 H            I            J

The two grids have the same number of rows, but I'd prefer to not merge them because they have separate styles.

Is it possible, and if yes: how?

I tried the GridCommandDemo from the jxls-demo collection and put some static text (to start with) into a cell right of the area with the grid, but it was simply overwritten. I had expected it to be moved to the right.


回答1:


You can have as many grids as you want on the right or bottom side. But you should be transforming the parent area which contains both of them.

GridCommandDemo from jxls-demo collection demonstrates the simple use case with a single grid. To adjust it for two grids you should modify your template to add additional grids and also modify the parent area (via lastCell attribute of jx:area command) to include all those grids.

In this case during the parent area transformation all the grids and static data will be properly shifted.



来源:https://stackoverflow.com/questions/32826794/putting-two-dynamic-grids-beside-each-other-with-jxls

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!