ワークシートで値ではなく数式を表示する

Contents
[ ]

Aspose.Cellsは**Worksheet.setShowFormulas()**プロパティを提供します。これを**true**に設定すると、Microsoft Excelが数式を表示するようになります。

次の画像は、セルA3に数式=Sum(A1:A2)があるワークシートを示しています。

セルA3に数式があるワークシート

todo:image_alt_text

次の画像は、Aspose.Cellsを使用して**Worksheet.setShowFormulas()**プロパティを**true**に設定することで、計算された値の代わりに数式を表示しているワークシートを示しています。

ワークシートには、計算値の代わりに数式が表示されています

todo:image_alt_text

// 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");