Inserisci un'immagine collegata dall'indirizzo web
Contents
[
Hide
]
volte è necessario inserire un’immagine dal Web (http://) in un foglio di lavoro. Per fare ciò, specifica l’URL dell’immagine e l’immagine verrà scaricata ogni volta che il foglio di calcolo viene aperto in Microsoft Excel. L’immagine non è fisicamente incorporata nel documento Excel, ma punta a una risorsa web.
Inserimento di un’immagine collegata da un indirizzo Web
Utilizzando Microsoft Excel
In Microsoft Excel (ad esempio 2007):
- Clicca ilInserire menu e selezionareImmagine.
- Specificare l’indirizzo Web per l’immagine nella finestra di dialogo Inserisci immagine.
L’immagine viene inserita.
Utilizzando Aspose.Cells for Java
Aspose.Cells for Java supporta l’aggiunta di un’immagine collegata utilizzando il metodoShapeCollection.addLinkedPicture(int upperLeftRow, int upperLeftColumn, int altezza, int larghezza, java.lang.String sourceFullName).
Il metodo restituisce aImmagineoggetto.
L’esempio seguente mostra come aggiungere un’immagine collegata da un indirizzo Web a un foglio di lavoro.
Dopo aver eseguito il codice, il file Excel generato contiene un’immagine collegata nel primo foglio di lavoro.
Il file di output
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 | |
// The path to the documents directory. | |
String dataDir = Utils.getDataDir(InsertLinkedPicturefromWebAddress.class); | |
// Instantiate a new Workbook. | |
Workbook workbook = new Workbook(); | |
// Insert a linked picture (from Web Address) to B2 Cell. | |
Picture pic = (Picture) workbook.getWorksheets().get(0).getShapes().addLinkedPicture(1, 1, 100, 100, | |
"http://www.aspose.com/Images/aspose-logo.jpg"); | |
// Set the source of the inserted image. | |
pic.setSourceFullName("http://www.aspose.com/images/aspose-logo.gif"); | |
// Set the height and width of the inserted image. | |
pic.setHeightInch(1.04); | |
pic.setWidthInch(2.6); | |
// Save the Excel file. | |
workbook.save(dataDir + "LinkedPicture.xlsx"); |