Mostrare le Formule invece dei Valori in un Foglio di Lavoro
Aspose.Cells fornisce una proprietà Worksheet.setShowFormulas(). Impostarla su true per impostare Microsoft Excel per mostrare le formule.
L’immagine seguente mostra il foglio di lavoro che ha una formula nella cella A3: =Somma(A1:A2).
Foglio di lavoro con formula nella cella A3
L’immagine seguente mostra la formula invece del valore calcolato, abilitato impostando la proprietà Worksheet.setShowFormulas() su true con Aspose.Cells.
Il foglio di lavoro ora mostra la formula invece del valore calcolato
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java | |
// The path to the documents directory. | |
String dataDir = Utils.getDataDir(ShowFormulas.class); | |
// Load the source workbook | |
Workbook workbook = new Workbook(dataDir + "source.xlsx"); | |
// Access the first worksheet | |
Worksheet worksheet = workbook.getWorksheets().get(0); | |
// Show formulas of the worksheet | |
worksheet.setShowFormulas(true); | |
// Save the workbook | |
workbook.save(dataDir + "out.xlsx"); |