استخدام معلمة الصيغة في حقل العلامة الذكية
Contents
[
Hide
]
سيناريوهات الاستخدام الممكنة
في بعض الأحيان ، تريد تضمين الصيغة في حقل العلامة الذكية. توضح هذه المقالة كيفية الاستفادة من معلمة الصيغة لتضمين الصيغة في حقل العلامة الذكية.
استخدام معلمة الصيغة في حقل العلامة الذكية
يقوم نموذج التعليمات البرمجية التالي بتضمين الصيغة في متغير العلامة الذكية المسمى Test واسم مصدر البيانات الخاص به هو أيضًا Test ، لذلك يبدو الحقل الكامل مع معلمة الصيغة مثل**& = $ Test (الصيغة)** وبعد تنفيذ الكود ، فإنملف إكسل الناتج النهائي سيكون لها صيغ في الخلايا من A1 حتى A5.
عينة من الرموز
This file contains hidden or 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 | |
//Create array of strings that are actually Excel formulas | |
String str1 = "=\"01-This \" & \"is \" & \"concatenation\""; | |
String str2 = "=\"02-This \" & \"is \" & \"concatenation\""; | |
String str3 = "=\"03-This \" & \"is \" & \"concatenation\""; | |
String str4 = "=\"04-This \" & \"is \" & \"concatenation\""; | |
String str5 = "=\"05-This \" & \"is \" & \"concatenation\""; | |
String[] TestFormula = new String[]{str1, str2, str3, str4, str5}; | |
//Create a workbook | |
Workbook wb = new Workbook(); | |
//Access first worksheet | |
Worksheet ws = wb.getWorksheets().get(0); | |
//Put the smart marker field with formula parameter in cell A1 | |
Cells cells = ws.getCells(); | |
Cell cell = cells.get("A1"); | |
cell.putValue("&=$Test(formula)"); | |
//Create workbook designer, set data source and process it | |
WorkbookDesigner wd = new WorkbookDesigner(wb); | |
wd.setDataSource("Test", TestFormula); | |
wd.process(); | |
//Save the workbook in xlsx format | |
wb.save(outDir + "outputUsingFormulaParameterInSmartMarkerField.xlsx"); |