إظهار علامة الفتح في الخلايا
إظهار الترويسة الرئيسية في الخلايا
في Microsoft Excel، يتم إخفاء الترويسة الرئيسية في قيمة الخلية. توفر Aspose.Cells ميزة عرض الترويسة الرئيسية افتراضيًا. يوفر الواجهة البرمجية للتطبيق الخاصية Workbook.Settings.QuotePrefixToStyle. تُشير هذه الخاصية ما إذا كان تعيين الخاصية QuotePrefix عند إدخال قيمة سلسلة تبدأ بعلامة اقتباس واحدة إلى الخلية. سيؤدي تعيين الخاصية Workbook.Settings.QuotePrefixToStyle إلى القيمة false إلى عرض الترويسة الرئيسية في ملف إكسل الناتج.
الصورة الملتقطة التالية تُظهر ملف إكسل الناتج مع علامة الفتح المرئية.
الكود المقتطف التالي يظهر هذا عن طريق إضافة البيانات بواسطة العلامات الذكية في ملف إكسل المصدر. يتم إرفاق ملفات إكسل المصدر والإخراج للرجوع إليها.
الكود المثالي
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java | |
//directories | |
String sourceDir = Utils.Get_SourceDirectory(); | |
String outputDir = Utils.Get_OutputDirectory(); | |
// Instantiating a WorkbookDesigner object | |
WorkbookDesigner designer = new WorkbookDesigner(); | |
Workbook workbook = new Workbook(sourceDir + "AllowLeadingApostropheSample.xlsx"); | |
workbook.getSettings().setQuotePrefixToStyle(false); | |
// Open a designer spreadsheet containing smart markers | |
designer.setWorkbook(workbook); | |
ArrayList<DataObject> list = new ArrayList<>(); | |
list.add(new DataObject(1, "demo")); | |
list.add(new DataObject(2, "'demo")); | |
// Set the data source for the designer spreadsheet | |
designer.setDataSource("sampleData", list); | |
// Process the smart markers | |
designer.process(); | |
designer.getWorkbook().save(outputDir + "AllowLeadingApostropheSample_out.xlsx"); |
يتم تقديم تنفيذ فئة DataObject تحت:
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java | |
public class DataObject | |
{ | |
private int id; | |
private String name; | |
public DataObject(int id, String name) | |
{ | |
this.id = id; | |
this.name = name; | |
} | |
public int getId() | |
{ | |
return this.id; | |
} | |
public void setId(int value) | |
{ | |
this.id = value; | |
} | |
public String getName() | |
{ | |
return this.name; | |
} | |
public void setName(String value) | |
{ | |
this.name = value; | |
} | |
} |