Aggiorna i valori delle forme collegate

Esempio

La seguente schermata mostra il file Excel di origine utilizzato nel codice di esempio qui sotto. Ha una Immagine 1 collegata alla cella A1. Cambieremo il valore della cella A1 con Aspose.Cells e poi chiameremo il metodo Worksheet.getShapes().updateSelectedValue() per aggiornare il valore di Immagine 1 e salvarlo in formato PDF.

todo:image_alt_text

Puoi scaricare il file Excel di origine e il PDF di output dai link forniti.

Codice Java per aggiornare i valori delle forme collegate

// 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(RefreshValuesOfLinkedShapes.class);
// Create workbook from source file
Workbook workbook = new Workbook(dataDir + "LinkedShape.xlsx");
// Access first worksheet
Worksheet worksheet = workbook.getWorksheets().get(0);
// Change the value of cell A1
Cell cell = worksheet.getCells().get("A1");
cell.putValue(100);
// Update the value of the Linked Picture which is linked to cell A1
worksheet.getShapes().updateSelectedValue();
// Save the workbook in pdf format
workbook.save(dataDir + "output.pdf", SaveFormat.PDF);