使用JXLS将两个动态网格彼此并排放置 [英] Putting two dynamic grids beside each other with JXLS

查看:284
本文介绍了使用JXLS将两个动态网格彼此并排放置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想定义一个与JXLS(当前版本2.2.5)一起使用的Excel模板,使之具有动态网格(即我不知道事前的列数),并且在它的右侧,另一个网格:

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?

我尝试了jxls-demo集合中的GridCommandDemo并将一些静态文本(以开头)放入带有网格的区域的单元格中,但是它只是被覆盖了.我曾期望它会被移到右边.

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.

推荐答案

您可以在右侧或底部拥有任意数量的网格. 但是您应该转换包含两个区域的父区域.

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演示了具有单个网格的简单用例.要针对两个网格对其进行调整,您应该修改模板以添加其他网格,并修改父区域(通过 jx:area 命令的 lastCell 属性)以包括所有这些网格

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.

这篇关于使用JXLS将两个动态网格彼此并排放置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆