Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using "each" and "merge" cause problem #62

Open
Younsion opened this issue Oct 19, 2020 · 8 comments
Open

Using "each" and "merge" cause problem #62

Younsion opened this issue Oct 19, 2020 · 8 comments
Assignees
Labels
mergecells jx:mergeCells question Further information is requested

Comments

@Younsion
Copy link

Younsion commented Oct 19, 2020

hi,jxls team
when i am using 'each' and 'mergeCells' at the same time,i found the problem below here。
my template:
image

what i want:
image

But what I actually got is:
image

am i wrong or it is a bug?
waiting for your reply...thank you.

@Younsion Younsion added the bug Something isn't working label Oct 19, 2020
@SoltauFintel
Copy link
Member

I don't know. But I see that you have 5 extra rows and have a +5 in your formula!?

@SoltauFintel SoltauFintel added question Further information is requested and removed bug Something isn't working labels Oct 19, 2020
@Younsion
Copy link
Author

yes...as you see,what i want is the piture 2,the each-loop include the '分组平均水平'(the extra 5 rows),so i do '+5' in the merge command...

@SoltauFintel
Copy link
Member

Because of Corona, we are currently spending significantly less time on JXLS. Therefore an answer or processing can take longer.

@SoltauFintel
Copy link
Member

You could upload an example template and a piece of source code. But please with no Chinese chars.

@Younsion
Copy link
Author

hi,here is a example of it:
sample.zip

@SoltauFintel SoltauFintel self-assigned this Oct 31, 2020
SoltauFintel added a commit that referenced this issue Oct 31, 2020
@SoltauFintel SoltauFintel assigned leonate and unassigned SoltauFintel Oct 31, 2020
@SoltauFintel SoltauFintel added this to the 2.9.1 milestone Oct 31, 2020
@SoltauFintel SoltauFintel modified the milestones: 2.9.1, 2.11.0 Feb 21, 2021
@SoltauFintel SoltauFintel removed this from the 2.11.0 milestone Dec 27, 2021
@howiewant
Copy link

这个问题解决了吗

@gastendonk
Copy link
Member

Nein.

@SoltauFintel SoltauFintel added the mergecells jx:mergeCells label Feb 22, 2024
@fitzyyf
Copy link

fitzyyf commented Mar 30, 2024

I just happened to encounter the same problem, which might be an issue. It could be that after merging the cells , the mergeCells command adjusts the Size, not using the default template cell Size. This leads to an increase in row or column index labels during subsequent loops, which results in new rows. You can customize a merge command that only performs the merge without changing the columns.

 @Override
  public Size applyAt(CellRef cellRef, Context context) {
    int rows = getVal(this.rows, context);
    int cols = getVal(this.cols, context);

    if (rows > 1 || cols > 1) {
      getTransformer().mergeCells(cellRef, rows, cols);
    }
    area.applyAt(cellRef, context);
    return area.applyAt(cellRef, context);
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mergecells jx:mergeCells question Further information is requested
Projects
None yet
Development

No branches or pull requests

6 participants