An exception occurred when the docx template was used to create a report

Hello,
I customized a word template, the format is as follows:
image
The bands in the report are as follows:
image
image
Now the problem is that the result after running is such that the number of data can be parsed successfully, but the contents inside can not be filled in.
image

Jmix Version: 2.1
Jmix Studio Version: 2.1.0-232

Hi team,

This issue was firstly submitted in Chinese forum. But we are not able to find a solution.

The entity:

import io.jmix.core.entity.annotation.JmixGeneratedValue;
import io.jmix.core.metamodel.annotation.InstanceName;
import io.jmix.core.metamodel.annotation.JmixEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import jakarta.validation.constraints.NotNull;

import java.util.UUID;

@JmixEntity
@Table(name = "STUDENT")
@Entity
public class Student {
    @JmixGeneratedValue
    @Column(name = "ID", nullable = false)
    @Id
    private UUID id;

    @InstanceName
    @Column(name = "NAME", nullable = false)
    @NotNull
    private String name;

    @Column(name = "AGE")
    private String age;

    @Column(name = "HOBBY")
    private String hobby;

    public String getHobby() {
        return hobby;
    }

    public void setHobby(String hobby) {
        this.hobby = hobby;
    }

    public String getAge() {
        return age;
    }

    public void setAge(String age) {
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public UUID getId() {
        return id;
    }

    public void setId(UUID id) {
        this.id = id;
    }
}

The exported report configuration:
stuReports.zip (26.9 KB)

Note: There are 2 tables in the template, the 1st one was created using MS office home version 2016, and I modified it to add the 2nd table with MS office for Mac.

The 2nd table works, but the 1st one is not work.

What happens if you use an Excel template (XLSX)? Defined ranges in the template correspond to bands.

Hi,
Using Excel is normal, but Excel templates are not as flexible as Docx templates, because I need to insert some fixed text in the template, and I need to convert the exported report to PDF, but Excel templates will have some formatting problems when exporting to PDF. So I didn’t use an Excel template.

I think it may be this limitation:

https://docs.jmix.io/jmix/reports/creation/templates.html

Horizontal bands in DOC(X) cannot contain sub-bands. If you need sub-bands, use XLS(X) format.

Maybe Jasper or HTML template will work for you then.
image

Kind regards,
Mladen

Hi,
I noticed it here, but my template had nothing to do with it, and jasper was a bit of a nuisance, so he didn’t use it. I have solved it now, and I can analyze it successfully with an office software. But it’s not clear yet why MS Office doesn’t work. Thank you for your reply.

Hello,

I created a test project with student and teacher reports. The problem has not been reproduced. Can you send an archive with a report that reproduces the problem?

But this problem was reproduced, I created a ticket. Thanks for reporting the problem.

Regards,
Nikita

Hello Nikita,
I can’t find my previous template, this is the new template I created with MS office, this template can reproduce the problem, and the template I created with WPS Office just now can be parsed normally. You can use my template to try to reproduce it.
stuBand.docx (12.7 KB)

Entities are also student and teacher.
Student.java (1.3 KB)
Teacher.java (1.4 KB)