You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2015/12/17 10:51:19 UTC

[Bug 58746] New: Formula: changed sheet name after re-order

https://bz.apache.org/bugzilla/show_bug.cgi?id=58746

            Bug ID: 58746
           Summary: Formula: changed sheet name after re-order
           Product: POI
           Version: 3.13-FINAL
          Hardware: PC
                OS: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: HSSF
          Assignee: dev@poi.apache.org
          Reporter: michele.bissoli.83@gmail.com

Hi all,
when I create a xls that contains a cell formula that refers to other cells in
others sheets AND after I re-order the sheet with this formula, the cell
doesn't contain the correct formula: POI has changed the sheet names into the
formula!

Example code:

HSSFWorkbook workbook = new HSSFWorkbook();
HSSFSheet first = workbook.createSheet("first");
first.createRow(0).createCell(0).setCellValue(1);
HSSFSheet second = workbook.createSheet("second");
second.createRow(0).createCell(0).setCellValue(2);
HSSFSheet third = workbook.createSheet("third");
HSSFRow row = third.createRow(0);
row.createCell(0).setCellFormula("first!A1");
row.createCell(1).setCellFormula("second!A1");
// re-order for sheet "third"
workbook.setSheetOrder("third", 0);

What I obtain into the sheet "third":
- A1: "=second!A1" > it must be "=first!A1"!!
- B1: "=first!A1" > it must be "=second!A1"!!

Could you please correct this bug as soon as possible? This is very important
for the work i'm doing.

This bug is the same of 57474 but here I provide a simple code for reproduce
the problem.

Thanks very much,
Michele

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 58746] Formula: changed sheet name after re-order

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58746

Dominik Stadler <do...@gmx.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |chiranjeeviavvaru@amberroad
                   |                            |.com

--- Comment #2 from Dominik Stadler <do...@gmx.at> ---
*** Bug 57474 has been marked as a duplicate of this bug. ***

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 58746] Formula: changed sheet name after re-order

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58746

Dominik Stadler <do...@gmx.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #3 from Dominik Stadler <do...@gmx.at> ---
Fixed via r1722410, we now try to adjust references to sheets in formulas
correctly when sheets are re-ordered.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 58746] Formula: changed sheet name after re-order

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58746

--- Comment #1 from Michele <mi...@gmail.com> ---
For everyone who have this problem, I have found a workaround: at start create
all the sheets and only after insert all the data, so without execute a
re-order.

Example:
HSSFWorkbook workbook = new HSSFWorkbook();
HSSFSheet first = workbook.createSheet("first");
HSSFSheet second = workbook.createSheet("second");
HSSFSheet third = workbook.createSheet("third");
first.createRow(0).createCell(0).setCellValue(1);
second.createRow(0).createCell(0).setCellValue(2);
HSSFRow row = third.createRow(0);
row.createCell(0).setCellFormula("first!A1");
row.createCell(1).setCellFormula("second!A1");

This is only a workaround, the problem still exists.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 58746] Formula: changed sheet name after re-order

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58746

Javen O'Neal <on...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |onealj@apache.org

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org