jxl pivot tables issue

P

Pedro Pinto

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();
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top