Aggiungi un'immagine a un commento di Excel
Microsoft Excel consente agli utenti di personalizzare in larga misura l’aspetto dei fogli di calcolo. È anche possibile aggiungere immagini di sfondo ai commenti.
I commenti vengono aggiunti alle celle per registrare commenti, qualsiasi cosa, dai dettagli su come funziona una formula, da dove proviene un valore o domande dei revisori. L’aggiunta di un’immagine di sfondo può essere una scelta estetica o essere utilizzata per rafforzare il marchio.
Aggiungi immagine a Excel Comment con Microsoft Excel
Con Microsoft Excel 2007, è possibile avere un’immagine come sfondo di un commento di cella. In Excel 2007, ciò viene eseguito (supponendo che il commento sia già stato aggiunto) in questo modo:
- Fare clic con il pulsante destro del mouse sulla cella che contiene il commento.
- ScegliereMostra/Nascondi commenti e cancella qualsiasi testo dal commento.
- Fare clic sul bordo del commento per selezionarlo.
- ScegliereFormato , poiCommento.
- Nella scheda Colori e linee, fare clic sulla freccia perColore.
- ClicEffetti di riempimento.
- Nella scheda Immagine fare clic suSeleziona Immagine.
- Individua e seleziona l’immagine
- ClicOK.
Aggiungi immagine al commento Excel con Aspose.Cells
Aspose.Cells fornisce questa preziosa caratteristica.
Il codice di esempio seguente crea un file XLSX da zero e aggiunge un commento con uno sfondo di immagine alla cella A1.
Dopo aver eseguito il codice, A1 ha un commento con un’immagine di sfondo.
Il file di output
Codice d’esempio
// 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"); |