إضافة صورة إلى تعليق Excel

إضافة صورة إلى تعليق Excel مع Microsoft Excel

مع Microsoft Excel 2007، يمكن أن يكون لديك صورة كخلفية لتعليق الخلية. في Excel 2007، يتم ذلك (بشرط أن تمت إضافة التعليق بالفعل) بهذه الطريقة:

  1. انقر بزر الماوس الأيمن على الخلية التي تحتوي التعليق.
  2. اختر عرض/إخفاء التعليقات وامسح أي نص من التعليق.
  3. انقر على الحد للتعليق لتحديده.
  4. اختر تنسيق، ثم تعليق.
  5. في علامات الألوان والخطوط، انقر على السهم للون.
  6. انقر على ملء الآثار.
  7. في علامة الصورة، انقر على حدد الصورة.
  8. العثور على الصورة وتحديدها
  9. انقر على موافق.

إضافة صورة إلى تعليق Excel مع Aspose.Cells

تقدم Aspose.Cells هذه الميزة القيمة.

يقوم الكود العينة أدناه بإنشاء ملف XLSX من البداية، ويضيف تعليقًا بخلفية صورة إلى الخلية A1.

بعد تنفيذ الكود، يحتوي A1 على تعليق بخلفية صورة.

ملف الإخراج

todo:image_alt_text

كود عينة

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java
// The path to the documents directory.
String dataDir = Utils.getSharedDataDir(AddPicturetoExcelComment.class) + "articles/";
// Instantiate a Workbook
Workbook workbook = new Workbook();
// Get a reference of comments collection with the first sheet
CommentCollection comments = workbook.getWorksheets().get(0).getComments();
// Add a comment to cell A1
int commentIndex = comments.add(0, 0);
Comment comment = comments.get(commentIndex);
comment.setNote("First note.");
comment.getFont().setName("Times New Roman");
// Load/Read an image into stream
String logo_url = dataDir + "school.jpg";
// Creating the instance of the FileInputStream object to open the logo/picture in the stream
FileInputStream inFile = new FileInputStream(logo_url);
// Setting the logo/picture
byte[] picData = new byte[inFile.available()];
inFile.read(picData);
// Set image data to the shape associated with the comment
comment.getCommentShape().getFill().setImageData(picData);
// Save the workbook
workbook.save(dataDir + "APToExcelComment_out.xlsx");