jxl pivot tables issue

Discussion in 'Java' started by Pedro Pinto, Jul 20, 2007.

  1. Pedro Pinto

    Pedro Pinto Guest

    Hi there,

    I'm trying to create a java program that reads an XLS (excel) file and
    performs some modifications. The issue here is, the final version of
    the workbook needs to have pivot tables and when i save the new file
    it saves without the pivot tables. Is there a way to overcome this
    issue? I'll paste de necessary code do view this issue. Thanks in
    advance for any help.

    option 1 (trying to write directly to the xls file without performing
    a copy)

    class Main
    {
    public static void main(String[] args)
    {
    try{
    WritableWorkbook copy = Workbook.createWorkbook(new
    File("SalesByOperador1.xls"));
    WritableSheet sheet2 = copy.getSheet(0); // error while getting
    index ArrayOutOfBounds, file already exists and is the final version.
    Label label = new Label(7, 0, "New label record");
    sheet2.addCell(label);
    copy.write();
    copy.close();


    option 2 (doesn't store the pivot tables on output.xls)


    class Main
    {
    public static void main(String[] args)
    {
    try{
    Workbook workbook = Workbook.getWorkbook(new
    File("SalesByOperador1.xls"));
    WritableWorkbook copy = Workbook.createWorkbook(new
    File("output.xls"), workbook);
    WritableSheet sheet2 = copy.getSheet(0);
    //WritableCell cell = sheet2.getWritableCell(1, 2);
    Label label = new Label(7, 0, "New label record");
    sheet2.addCell(label);
    copy.write();
    copy.close();
     
    Pedro Pinto, Jul 20, 2007
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. David W.

    HSSF and Excel Pivot Tables

    David W., Jul 28, 2003, in forum: Java
    Replies:
    0
    Views:
    2,449
    David W.
    Jul 28, 2003
  2. alexjcasol

    jxl out of memory error

    alexjcasol, Sep 16, 2005, in forum: Java
    Replies:
    2
    Views:
    3,749
    Roedy Green
    Sep 16, 2005
  3. Chad

    JXL and Date Time Zones

    Chad, Nov 11, 2005, in forum: Java
    Replies:
    1
    Views:
    5,076
    P.Hill
    Nov 12, 2005
  4. George Sakkis

    OLAP and pivot tables

    George Sakkis, May 26, 2006, in forum: Python
    Replies:
    3
    Views:
    970
    Tim Churches
    May 26, 2006
  5. gilou

    jxl+picture

    gilou, Sep 8, 2006, in forum: Java
    Replies:
    0
    Views:
    574
    gilou
    Sep 8, 2006
  6. Proton Projects - Moin

    Jxl arrayIndexOutofBoundException

    Proton Projects - Moin, Sep 11, 2007, in forum: Java
    Replies:
    1
    Views:
    2,278
  7. ChrisW

    jxl / java heap space error

    ChrisW, Mar 27, 2008, in forum: Java
    Replies:
    1
    Views:
    1,357
    Roedy Green
    Mar 28, 2008
  8. Jens Hofmeier

    interactive Pivot-tables with OWC11

    Jens Hofmeier, Apr 4, 2006, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    242
    Jens Hofmeier
    Apr 4, 2006
Loading...