在工作表中显示公式而不是值
Contents
[
Hide
]
可以使用公式选项来显示Microsoft Excel中公式而不是计算值。当显示公式时,Microsoft Excel在工作表中显示公式。您可以使用Aspose.Cells实现相同的功能。
Aspose.Cells提供了一个Worksheet.ShowFormulas属性。将其设置为true可以使Microsoft Excel显示公式。
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"); |