Aggiorna i valori delle forme collegate

Esempio

Lo screenshot seguente mostra il file Excel di origine utilizzato nel codice di esempio riportato di seguito. Ha un collegamentoImmagine 1 collegato alla cella A1. Cambieremo il valore della cella A1 con Aspose.Cells e quindi chiameremoWorksheet.getShapes().updateSelectedValue() metodo per aggiornare il valore diImmagine 1 e salvalo nel formato PDF.

cose da fare:immagine_alt_testo

Puoi scaricare ilfile Excel di origine e iluscita PDF dai link indicati.

Java codice 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);