diff options
author | Glen Stampoultzis <glens@apache.org> | 2002-03-12 10:38:26 +0000 |
---|---|---|
committer | Glen Stampoultzis <glens@apache.org> | 2002-03-12 10:38:26 +0000 |
commit | 8fa2da53dafbec6c3db0c9604b45db068ece078a (patch) | |
tree | 1ce5a5ba8fe654679815f2038d6170564f0816b7 /src | |
parent | f6f795559560ccc058d2f28d33b70f05f4850364 (diff) | |
download | poi-8fa2da53dafbec6c3db0c9604b45db068ece078a.tar.gz poi-8fa2da53dafbec6c3db0c9604b45db068ece078a.zip |
Merged region example
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352205 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r-- | src/examples/src/org/apache/poi/hssf/usermodel/examples/MergedCells.java | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/examples/src/org/apache/poi/hssf/usermodel/examples/MergedCells.java b/src/examples/src/org/apache/poi/hssf/usermodel/examples/MergedCells.java new file mode 100644 index 0000000000..de72bb7620 --- /dev/null +++ b/src/examples/src/org/apache/poi/hssf/usermodel/examples/MergedCells.java @@ -0,0 +1,34 @@ +package org.apache.poi.hssf.usermodel.examples; + +import org.apache.poi.hssf.usermodel.*; +import org.apache.poi.hssf.util.Region; + +import java.io.IOException; +import java.io.FileOutputStream; + +/** + * An example of how to merge regions of cells. + * + * @author Glen Stampoultzis (glens at apache.org) + */ +public class MergedCells +{ + public static void main(String[] args) + throws IOException + { + 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(); + + } +} |