> I noticed that startRow should be (short) and not (int)
> as suggested. If I use (short), that error disappears.

Hmm actually, I think its short in 1.5.1, but was changed to int in 2.0

-----Original Message-----
From: yangontha Maung [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 30, 2003 11:07 PM
To: POI Users List
Subject: RE: Footer

Hi,

Thanks for your suggestions.

I have not tried version 2.0 since it is still RC.

However, as you mentioned, I tried to compile the
basic minimum stage. But there are errors as before.

It is run on RedHat Linux 9.0.
Java version is 1.4.2.
poi is 1.5.1 (jakarta-poi-1.5.1-final.bin.tar.gz.tar)

I noticed that startRow should be (short) and not
(int) as suggested. If I use (short), that error
disappears.

HSSFFooter still has the same error.

Does it mean that I must use version 2.0 to use
Footer?

Just to make sure that I have the correct jar files,
here is my .jar files in poi/build directory

jakarta-poi-1.5.1-final-20020615.jar
jakarta-poi-contrib-1.5.1-final-20020615.jar
jakarta-poi-examples-1.5.1-final-20020615.jar
jakarta-poi-scratchpad-1.5.1-final-20020615.jar

+++++++++

import org.apache.poi.hssf.usermodel.*;
import java.io.*;

public class FooterTest
{

  public FooterTest()
  {
    HSSFWorkbook wb = new HSSFWorkbook();
    HSSFSheet sheet = wb.createSheet("Sheet1");
    int startRow = 1;
   
    HSSFRow row = sheet.createRow(startRow);

    short startLine = 1;
    String string = "abc";
    short col = 1;

    HSSFCell cell = row.createCell(col);
    cell.setCellValue(string);
    HSSFFooter footer = sheet.getFooter();

  
    try
    {
      FileOutputStream fileOut =
          new
FileOutputStream("/www/htdocs/data/xls/footer.xls");
 
      wb.write(fileOut);
      fileOut.close();
    } catch(IOException ioex)
    {

      // do something
    }

  }


  public static void main(String[] args)
  {
    FooterTest app = new FooterTest();
  }
}

+++++++++
Errors:


"FooterTest.java" 55L, 976C written
[EMAIL PROTECTED] domino]$ javac FooterTest.java
FooterTest.java:22: createRow(short) in
org.apache.poi.hssf.usermodel.HSSFSheet
cannot be applied to (int)
    HSSFRow row = sheet.createRow(startRow);
                       ^
FooterTest.java:30: cannot resolve symbol
symbol  : class HSSFFooter
location: class FooterTest
    HSSFFooter footer = sheet.getFooter();
    ^
FooterTest.java:30: cannot resolve symbol
symbol  : method getFooter ()
location: class
org.apache.poi.hssf.usermodel.HSSFSheet
    HSSFFooter footer = sheet.getFooter();
                             ^
3 errors

++++
rgds,


****************************

--- Michael Zalewski <[EMAIL PROTECTED]> wrote:
> This should work fine.
>
> 1) The HSSFSheet.getFooter() method exists in 1.5.1,
> but you really might
> have better luck with 2.0. There are many serious
> bugs fixed in between
> 1.5.1 and 2.0.
>
> 2) Your import statements should work AFAIK. But
> 'import
> org.apache.poi.hssf.usermodel.HSSFWorkbook.*' is
> incorrect (there is no such
> package - HSSFWorkbook is a class).
>
> 3) Try compiling something as simple as what you
> have included below and
> work backwards. The code you supplied has many
> missing pieces (which shows
> that you have not yet done this). For instance,
> 'startRow = 1' s/b 'int
> startRow = 1'. Once you get a complete class to
> fail, you have something
> that we can reproduce and therefore help you.
>
> However, I was able to compile the following:
>
> import org.apache.poi.hssf.usermodel.*;
>
> public class TestFooter {
>
>    public TestFooter()
>    {
>      HSSFWorkbook wb = new HSSFWorkbook();
>      HSSFSheet sheet = wb.createSheet("Sheet1");
>      int startRow = 1;
>
>      HSSFRow row = sheet.createRow(startRow);
>
>      short startLine = 1;
>      String string = "abc";
>
>      short col = 1;
>      HSSFCell cell = row.createCell(col);
>      cell.setCellValue(string);
>      HSSFFooter footer = sheet.getFooter();
>    }
> }
>
> See if the above compiles in your environment. Note
> that you don't need all
> those import statements (although I don't think
> including them should hurt).
>
> Mike Zalewski
>
> -----Original Message-----
> From: yangontha Maung [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, December 30, 2003 12:07 AM
> To: [EMAIL PROTECTED]
> Subject: Footer
>
> Hi,
>
> I am using poi version 1.5.1 on Red Hat Linux 9.0
> Java version 1.4.2
>
> The import statements and the errors are as
> follows:-
>
>
> import java.io.*;
> import org.apache.poi.hssf.usermodel.*;
> import org.apache.poi.hssf.usermodel.HSSFWorkbook.*;
> import org.apache.poi.hssf.util.*;
> import org.apache.poi.hssf.record.*;
> import java.sql.*;
> import java.util.*;
>
> public class FooterTest
> {
>
>   public FooterTest()
>   {
>     HSSFWorkbook wb = new HSSFWorkbook();
>     HSSFSheet sheet = wb.createSheet("Sheet1");
>     startRow = 1;
>
>     row = sheet.createRow(startRow);
>
>     short startLine = 1;
>     string = "abc";
>
>     HSSFCell cell = row.createCell(col);
>     cell.setCellValue(string);
>     HSSFFooter footer = sheet.getFooter();
>
>    xxxx
>   }
>
> Compilation Error:
> {Note: Don't refer to the line number. I extracted
> the
> relevant program lines only.}
>
> FooterTest.java:35: cannot resolve symbol
> symbol  : class HSSFFooter
> location: class FooterTest
>     HSSFFooter footer = sheet.getFooter();
>     ^
> FooterTest.java:35: cannot resolve symbol
> symbol  : method getFooter ()
> location: class
> org.apache.poi.hssf.usermodel.HSSFSheet
>     HSSFFooter footer = sheet.getFooter();
>                              ^
> 2 errors
>
> rgds,
>
>
>
> __________________________________
> Do you Yahoo!?
> Find out what made the Top Yahoo! Searches of 2003
> http://search.yahoo.com/top2003
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
>


__________________________________
Do you Yahoo!?
Find out what made the Top Yahoo! Searches of 2003
http://search.yahoo.com/top2003

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


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

Reply via email to