Aspose.Cells te FormulaText Fonksiyonu Kullanma
Contents
[
Hide
]
FormulaText, Excel 2013 ve sonraki sürümler tarafından desteklenen bir fonksiyondur. Excel 2010 veya 2007 gibi önceki sürümler tarafından desteklenmez. Adından da anlaşılacağı gibi, belirli bir hücredeki formülün metnini yazdırır. Bu makale, Aspose.Cells kullanarak bu fonksiyonu nasıl kullanacağınızı gösterecektir.
Aspose.Cells’te FormulaText Fonksiyonu Kullanma
Aşağıdaki örnek kod, önce A1 hücresine bir formül yazıyor ve ardından FormulaText kullanarak formülün metnini A2 hücresine yazdırıyor.
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-Java | |
String dataDir = Utils.getDataDir(UsingFormulaTextfunction.class); | |
// Create a workbook object | |
Workbook workbook = new Workbook(); | |
// Access first worksheet | |
Worksheet worksheet = workbook.getWorksheets().get(0); | |
// Put some formula in cell A1 | |
Cell cellA1 = worksheet.getCells().get("A1"); | |
cellA1.setFormula("=Sum(B1:B10)"); | |
// Get the text of the formula in cell A2 using FORMULATEXT function | |
Cell cellA2 = worksheet.getCells().get("A2"); | |
cellA2.setFormula("=FormulaText(A1)"); | |
// Calculate the workbook | |
workbook.calculateFormula(); | |
// Print the results of A2. It will now print the text of the formula inside cell A1 | |
System.out.println(cellA2.getStringValue()); |
Konsol Çıktısı
Yukarıdaki örnek kodun konsol çıktısı burada gösterilmektedir.
=SUM(B1:B10)