On Tue, 2002-03-12 at 05:40, Glen Stampoutlzis wrote:
> Sure is.  Here's some code.  Don't be confused by setMergeCells() in

+1 - its only there because its in the XF record.  It seems to have only
worked in old Excel files or something.  +1 = rip it out (even for 1.5)


> HSSFCellStyle; that does nothing.  I may remove it.
> 
> 
> 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();
> 
>     }
> }
> 
> 
> ----- Original Message -----
> From: "Kim Wegerle" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, March 12, 2002 9:18 PM
> Subject: Merged Cells ?
> 
> 
> > Hello,
> >
> > I want to produce a sheet that contains merged cells, cells that span over
> > more than one column/row. Is this possible with the current POI version or
> > do
> > I have to wait and if it's possible how can I do it ?
> >
> > Thanks Kim
> >
> > --
> > GMX - Die Kommunikationsplattform im Internet.
> > http://www.gmx.net
> >
> 
> 
-- 
http://www.superlinksoftware.com
http://jakarta.apache.org/poi - port of Excel/Word/OLE 2 Compound
Document 
                            format to java
http://developer.java.sun.com/developer/bugParade/bugs/4487555.html 
                        - fix java generics!
The avalanche has already started. It is too late for the pebbles to
vote.
-Ambassador Kosh

Reply via email to