FileDocCategorySizeDatePackage
MergedCells.javaAPI DocApache Poi 3.0.11849Mon Jan 01 12:39:42 GMT 2007org.apache.poi.hssf.usermodel.examples

MergedCells

public class MergedCells extends Object
An example of how to merge regions of cells.
author
Glen Stampoultzis (glens at apache.org)

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

        HSSFWorkbook wb = new HSSFWorkbook();
        HSSFSheet sheet = wb.createSheet("new sheet");

        HSSFRow row = sheet.createRow((short) 1);
        HSSFCell cell = row.createCell((short) 1);
        cell.setCellValue("This is a test of merging");

        sheet.addMergedRegion(new Region(1,(short)1,1,(short)2));

        // Write the output to a file
        FileOutputStream fileOut = new FileOutputStream("workbook.xls");
        wb.write(fileOut);
        fileOut.close();