Show Formulas Instead of Values in a Worksheet
Contents
[
Hide
]
It is possible to show formulas instead of calculated values in Microsoft Excel using the Show Formulas option from the Formulas ribbon. When formulas are shown, Microsoft Excel displays formulas in the worksheet. You can achieve the same thing using Aspose.Cells.
Aspose.Cells provides a Worksheet.ShowFormulas property. Set this to true to set Microsoft Excel to display formulas.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | |
string filePath = dataDir+ "source.xlsx"; | |
// Load the source workbook | |
Workbook workbook = new Workbook(filePath); | |
// Access the first worksheet | |
Worksheet worksheet = workbook.Worksheets[0]; | |
// Show formulas of the worksheet | |
worksheet.ShowFormulas = true; | |
// Save the workbook | |
workbook.Save(dataDir+ ".out.xlsx"); |