https://issues.apache.org/bugzilla/show_bug.cgi?id=53207

          Priority: P2
            Bug ID: 53207
          Assignee: [email protected]
           Summary: A formula can not clear by [setCellFormula(null)] in
                    Shared formulas.
          Severity: normal
    Classification: Unclassified
                OS: Windows Vista
          Reporter: [email protected]
          Hardware: PC
            Status: NEW
           Version: 3.8
         Component: XSSF
           Product: POI

Created attachment 28749
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=28749&action=edit
files for test input

[attachment : files.zip]
ok.xlsx : D1-D12 has formula
ng.xlsx : D1-D12 has shared formula

A result file[result_ng.xlsx] has break formula.
Open and Rescue by Excel, cells[D11-D12] formula is gone.

The setCellFormula method can not clear formula like this.
(*Exclude the case where only D1 is cleared.)
----------------------------------------------------
<sheetData>
 ..
 <c r="D1" s="2">
  <f t="shared" ref="D1:D12" si="0">B1*C1</f>
 ..
----------------------------------------------------

Test code.

public static void test() {
  formulaTest("ok.xlsx");
  formulaTest("ng.xlsx");
}

public static void formulaTest(String file) {
  ConditionalFormattingTest test = new ConditionalFormattingTest(file);
  test.init();
  XSSFSheet sheet = (XSSFSheet)test.getSheet(0);        
  for (int i=0; i<10; i++) {
    sheet.getRow(i).getCell(3).setCellFormula(null);
  }        
  test.writeBook("result_" + file);
}

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

Reply via email to