Center align contents of merged regions

May 16, 2010 at 4:10 PM
Edited May 16, 2010 at 4:29 PM


Is there a way to align the contents of a merged set of cells centered horizontally and vertically?

I saw in this thread that there's HSSFRegionUtil class, which I cannot find.

Maybe there I can find a solution?


May 16, 2010 at 4:42 PM
Edited May 19, 2010 at 5:35 PM

fixed it,

but I bumped into another problem

How can I add a new line in the same cell?



doesn't work



Jul 28, 2010 at 5:27 PM

In VB if you want to insert a newline character into a cell then simply concatenate your string with the ChrW(10) command. So it would look like this:

sheet1.GetRow(0).GetCell(0).SetCellValue("Line1" & ChrW(10) & "Line2")

 Hope that helps.