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