Dear JXLS team,

I want to achieve printing all of items in a collection in a single cell
instead of generating dynamic columns based on the collection size. Does
jXLS support this feature? I tried to put "<jx:forEach
items="${phoneNumbers}" var="${phoneNumber}">${phoneNumber.value},
</jx:forEach>" in the single cell but I got the error. May I know the
correct way to achieve this if the library supports this feature?

Here is my object models. Attached is the result I expected.

public class PhoneNumber {
    public String value;
    public String ext;
}

public class ExcelUtils {
    public static void renderExcel(String templateName, Map<String, Object>
beans) {
        InputStream is = new FileInputStream(templateName);
            org.apache.poi.ss.usermodel.Workbook workbook = new
XLSTransformer().transformXLS(is, beans);
            workbook.write(response.out);
            is.close();
    }
}

public class TestReport() {

    @Test
    public void testReport() {
        List<PhoneNumber> phoneNumbers = new ArrayList<PhoneNumber>();

    PhoneNumber phoneNumber1 = new PhoneNumber();
    phoneNumber1.value = "9889 7777";
    phoneNumber1.ext = "345";

    PhoneNumber phoneNumber2 = new PhoneNumber();
    phoneNumber2.value = "9223 4445";
    phoneNumber2.ext = "123";

    phoneNumbers.add(phoneNumber1);
    phoneNumbers.add(phoneNumber2);

        Map<String, Object> beans = new HashMap<String, Object>();
        maps.add("phoneNumbers", phoneNumbers);

        ExcelUtils.renderExcel("excel.xls", beans);
    }
}


Thanks and best regards,
may

Attachment: excel.xls
Description: MS-Excel spreadsheet

------------------------------------------------------------------------------
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
_______________________________________________
jXLS-user mailing list
jXLS-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jxls-user

Reply via email to