Putting data into merged cells using POI
Posted on 2006-07-01
Hi experts, I have a question about using the POI framework to push data out to a spreadsheet having merged cell regions. I've read the poi documentation and I am fine as long as I am trying to push data out to a single cell. For example
HSSFSheet sheet = wb.getSheet("TDP");
HSSFRow row = sheet.getRow(3);
HSSFCell cell = row.createCell(column);
works just fine.
but putting data into a merged region is quite different entirely and not working for me. I have an Excel template that
has merged cells that cover (A4..H4) and (I4..P4) respectively. I want to data into each to prefill a template according to the users desired layout. I looked at the Region object and that looked promising, but it's MergedRegionAt method takes only a single argument, seemingly a row. So how can you programmatically specify a range and then put data in that range?