Uppdatera värden för länkade former

Exempel

Följande skärmdump visar källfilen för Excel som används i exempelkoden nedan. Den har en länkad bild kopplad till cellerna A1 till E4. Vi ändrar värdet på cell B4 med Aspose.Cells och ringer sedanWorksheet.Shapes.UpdateSelectedValue()metod för att uppdatera värdet på bilden och spara den i PDF-format.

todo:image_alt_text

Du kan ladda nerkäll Excel-fil och denutgång PDF från de angivna länkarna.

C# kod för att uppdatera värdena för länkade former

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
//Source directory
string sourceDir = RunExamples.Get_SourceDirectory();
//Output directory
string outputDir = RunExamples.Get_OutputDirectory();
// Create workbook from source file
Workbook workbook = new Workbook(sourceDir + "sampleRefreshValueOfLinkedShapes.xlsx");
// Access first worksheet
Worksheet worksheet = workbook.Worksheets[0];
// Change the value of cell B4
Cell cell = worksheet.Cells["B4"];
cell.PutValue(100);
// Update the value of the Linked Picture which is linked to cell B4
worksheet.Shapes.UpdateSelectedValue();
// Save the workbook in PDF format
workbook.Save(outputDir + "outputRefreshValueOfLinkedShapes.pdf", SaveFormat.Pdf);