Hi, Such kind of collection transformation in a single cell is not currently supported. So you probably should define java property or method which collects all the required information (by iterating the collection) and generates the required output. Then you can just invoke this method in your excel template with usual jxls notation.
-- Leo On Mon, Apr 4, 2011 at 6:08 AM, May Lwin <maylwi...@gmail.com> wrote: > 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 > > > > ------------------------------------------------------------------------------ > 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 > >
------------------------------------------------------------------------------ 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