Recently I was exporting some information to Excel and I came across a problem when displaying complex objects in single cells. For example:
Property1: property1 Property2: property2
From 0 to 5 at rate of 1.1
6 to 10 at rate of 0.9
11+ at rate of 0.5
'(can be many rows here - no maximum row count)
Min 50 and a Max of 100
For now, to display this object I build a String on Java side (and dispay it simply by ${myComplexString}
), but I need to change fonts inside of this string (different fonts, fontsizes, colors and bolding), but I dont know how to change it in current setup (using string).
Is there any way to format it ? Can you give me any idea ?
actually my colleague, found answer for me, so I'm sharing it with you:
Here is custom row processor in jxls library page. http://jxls.sourceforge.net/reference/customprocessor.html#rowprocessor
Using it for cell you are interested in you can access single cell from your workbook.
I mean single net.sf.jxls.parser.Cell that contains property org.apache.poi.ss.usermodel.Cell hssfCell that is interface with method setCellValue(RichTextString value).
RichTextString allows you to set different formatting for diffent ranges in your strings.
I hope that anyone facing same issue that I had will find this knowledge comforting