Excel Yorumuna Resim Ekle

Microsoft Excel ile Excel Yorumuna Resim Ekleme

Microsoft Excel 2007 ile bir hücre yorumuna bir resim arka plan olarak eklemek mümkündür. Excel 2007’de bu (yorum zaten eklenmişse) şu şekilde gerçekleşir:

  1. Yorum içeren hücreye sağ tıklayın.
  2. Yorumları Göster/Gizle‘yi seçin ve yorumdan herhangi bir metni temizleyin.
  3. Yorumun kenarına tıklayın.
  4. Biçim, ardından Yorum‘u seçin.
  5. Renkler ve Çizgiler sekmesinde, Renk için oku tıklayın.
  6. Dolgu Efektleri‘ni tıklayın.
  7. Resim sekmesinde, Resim Seç‘i tıklayın.
  8. Resmi bulun ve seçin
  9. Tamam‘a tıklayın.

Aspose.Cells ile Excel Yorumuna Resim Ekleme

Aspose.Cells bu değerli özelliği sağlar.

Aşağıdaki örnek kod, baştan bir XLSX dosyası oluşturur ve A1 hücresine arka plan resimli bir yorum ekler.

Kodun çalıştırılmasından sonra, A1’in arka plan resimli bir yorumu vardır.

Çıkış dosyası

todo:image_alt_text

Örnek Kod

// 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");