Danny Mui wrote:

Let's take a little closer look.


My test files are attached.


The poi I use is poi2.0 pre3

The simplest modifications I made is in HSSFRow i added 2 methods:
public void setOutlineLevel(short ol) {
row.setOutlineLevel(ol); row.setLastCol((short) 10);
row.setXFIndex((short) 15); }

       /**
        * @return
        */
       public short getOutlineLevel() {
           return row.getOutlineLevel();
       }



Then I made a simple program that create the "saved with poi.xls" file :

public class Step1 {
public static void main(String[] args) throws IOException {
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet();
// sheet.setGridsPrinted(false);
// sheet.setColumnWidth((short)0, (short) 300);
// sheet.setColumnWidth((short)1, (short) 300);
// sheet.setColumnWidth((short)2, (short) 300);
// sheet.setColumnWidth((short)3, (short) 300);
// sheet.setColumnWidth((short)4, (short) 300);
// sheet.setColumnWidth((short)5, (short) 300);
// sheet.setColumnWidth((short)6, (short) 300);
// sheet.setColumnWidth((short)7, (short) 300);
// // sheet.addMergedRegion(new Region( (short)2, (short)0, (short)2, (short)10));
// sheet.addMergedRegion(new Region( (short)3, (short)2, (short)3, (short)9));
// sheet.addMergedRegion(new Region( (short)4, (short)2, (short)4, (short)9));
{
// HSSFFont boldFont = wb.createFont();
// boldFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
// HSSFCellStyle boldStyle = wb.createCellStyle();
// boldStyle.setFont(boldFont);
// // HSSFDataFormat format = wb.createDataFormat();
// short ss = format.getFormat("\"yes\"; \"no\"");
// boldStyle.setDataFormat(ss);
HSSFRow row = sheet.createRow((short)2);
HSSFCell cel = row.createCell((short)0);
cel.setCellValue("Master");
// cel.setCellStyle(boldStyle);
}
{
HSSFRow row = sheet.createRow((short)3);
HSSFCell cel = row.createCell((short)2);
}


{
HSSFRow row = sheet.createRow((short)3);
HSSFCell cel = row.createCell((short)2);
cel.setCellValue("Slave 1");
row.setOutlineLevel((short) 1); }
{
HSSFRow row = sheet.createRow((short)4);
HSSFCell cel = row.createCell((short)2);
cel.setCellValue("Slave 2");
row.setOutlineLevel((short) 1);
}
// sheet.setGridsPrinted(false);
// sheet.setDisplayGridlines(false);
FileOutputStream fileOut = new FileOutputStream("p:\\1.xls");
wb.write(fileOut);
fileOut.close(); }
}


If I open the result in OpenOffice or StarOffice all is ok.

I also modified HSSFSerializer to understand some tags around outline and the HideGrid attribute of the sheet. If somebody needs i can share the code.

Thanx
   Marius

--
"Why program by hand in five days what you can spend five years of your life 
automating." - Terence Parr


Attachment: saved with openoffice.xls
Description: application/msexcell

Attachment: saved with poi.xls
Description: application/msexcell

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to