// Create a new workbook Workbook workbook = new Workbook(); InputStream fileStream = this.getResourceStream("xlsx/defaultValue.xlsx"); workbook.open(fileStream); IWorksheet worksheet = workbook.getActiveSheet(); //set default value for standard reduction worksheet.getRange("C4:C8").setDefaultValue("=B4 - B4*0.12"); //set normal value for specific percent reduction worksheet.getRange("C6").setFormula("=B6 - B6*0.08"); worksheet.getRange("C8").setFormula("=B8 - B8*0.05"); //calculate total on default value and specific values worksheet.getRange("C9").setFormula("=SUM(C4:C8)"); // Save to an excel file workbook.save("DefaultValue.xlsx");