أضف أيقونات إلى ورقة العمل
Contents
[
Hide
]
أضف أيقونات إلى ورقة العمل في Aspose.Cells
إذا كنت بحاجة إلى استخدامAspose.Cells لإضافة “رموز” في ملف Excel ، يمكن أن يوفر لك هذا المستند بعض المساعدة.
تكون واجهة Excel المقابلة لعملية رمز الإدراج كما يلي:
- حدد موضع الرمز المراد إدراجه في ورقة العمل
- الزر الأيسرإدراج->الأيقونات
- في النافذة التي تفتح ، حدد الرمز في المستطيل الأحمر في الشكل أعلاه
- الزر الأيسرإدراج، سيتم إدراجه في ملف Excel.
التأثير كما يلي:
هنا ، أعددناعينة من الرموز لمساعدتك على إدراج الرموز باستخدامAspose.Cells .هناك أيضا ضرورةملف عينة وأيقونةملف الموارد استخدمنا واجهة Excel لإدراج رمز له نفس تأثير العرض مثل ملفملف الموارد في الملف عينة.
Java
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 | |
//Read icon resource file data | |
String fileName = "icon.svg"; | |
FileInputStream fsSource = new FileInputStream(fileName); | |
byte[] bytes = fsSource.readAllBytes(); | |
fsSource.close(); | |
// Create workbook from sample file | |
Workbook workbook = new Workbook("sample.xlsx"); | |
// Access first worksheet from the collection | |
Worksheet sheet = workbook.getWorksheets().get(0); | |
// Add the icon to the worksheet | |
sheet.getShapes().addIcons(3, 0, 7, 0, 100, 100, bytes, null); | |
//Set a prompt message | |
Cell c = sheet.getCells().get(8, 7); | |
c.putValue("Insert via Aspose.Cells"); | |
Style s = c.getStyle(); | |
s.getFont().setColor(Color.getBlue()); | |
c.setStyle(s); | |
//Save.You can check your icon in this way. | |
workbook.save("sample2.xlsx", SaveFormat.XLSX); |
عند تنفيذ الكود أعلاه في مشروعك ، ستحصل على النتائج التالية: