Center align contents of merged regions

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

Hello!

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?

Thanks!

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

fixed it,

but I bumped into another problem

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

 

System.Environment.NewLine

doesn't work

 

thanks!

Jul 28, 2010 at 6: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.