CustomDocumentPropertyCollection.UpdateLinkedRange

CustomDocumentPropertyCollection.UpdateLinkedRange method

Update custom document property value to linked range.

public void UpdateLinkedRange()

Examples

using System;
using Aspose.Cells;
using Aspose.Cells.Properties;

namespace AsposeCellsExamples
{
    public class CustomDocumentPropertyCollectionMethodUpdateLinkedRangeDemo
    {
        public static void Run()
        {
            Workbook workbook = new Workbook();
            Worksheet worksheet = workbook.Worksheets[0];
            
            // Set a value in cell A1 that will be linked
            worksheet.Cells["A1"].PutValue("Linked Cell Value");

            CustomDocumentPropertyCollection customProperties = workbook.Worksheets.CustomDocumentProperties;
            
            // Add a linked property
            customProperties.AddLinkToContent("LinkedRange", "Sheet1!A1");
            
            // Update all linked properties
            customProperties.UpdateLinkedRange();
            
            // Get and display the linked property value
            DocumentProperty linkedProp = customProperties["LinkedRange"];
            Console.WriteLine($"Linked Property Value: {linkedProp.Value}");

            // Save the workbook
            workbook.Save("LinkedRangeExample.xlsx");
        }
    }
}

See Also