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. Advertising

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,114
    David W.
    Jul 28, 2003
  2. George Sakkis

    OLAP and pivot tables

    George Sakkis, May 26, 2006, in forum: Python
    Replies:
    3
    Views:
    719
    Tim Churches
    May 26, 2006
  3. Jens Hofmeier

    interactive Pivot-tables with OWC11

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

Share This Page