Hi,
Hi,
Thanks for your posting and considering Aspose.Cells.
Please create some sample excel file having this feature (i.e hide formula by protection) for our reference. We will analyze your sample excel file and achieve the same thing using Aspose.Cells APIs. You can create your sample excel file manually and attach it here for our analysis. Thanks for your cooperation.
Hi,
Dear Tiago,
Thanks for your excellent finding, we appreciate it and using Aspose.Cells.
We have further explored the style.setFormulaHidden(true); property and was able to successfully hide the formulas.
We have tested this issue with the latest version: Aspose.Cells
for Java v8.6.0.4.
Please see the following sample code and its output excel file for your reference. We have also attached the screenshot of the output excel file for you to view.
Java
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.getWorksheets().get(0);
Cell cell = worksheet.getCells().get(“A3”);
cell.setFormula(“=Sum(A1:A2)”);
Style style = cell.getStyle();
style.setFormulaHidden(true);
cell.setStyle(style);
worksheet.protect(ProtectionType.ALL);
workbook.save(“output.xlsx”);