Created attachment 28749 [details] 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); }
POI V5.1.0 has fixes for shared formulas. Reopen this if they do not help.