Link to home
Start Free TrialLog in
Avatar of OMyStuckAgin
OMyStuckAgin

asked on

Putting data into merged cells using POI

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);            
cell.setCellValue("data");

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?
ASKER CERTIFIED SOLUTION
Avatar of Peter Kwan
Peter Kwan
Flag of Hong Kong image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of OMyStuckAgin
OMyStuckAgin

ASKER

Thanks for the explanation. The POI documentation is a little subpar, and does not carry nearly enough examples.