تحديث قيم الأشكال المرتبطة باستخدام C++

مثال

يظهر لقطة الشاشة التالية ملف إكسل المصدر المستخدم في الشفرة أدناه. يحتوي على صورة مرتبطة مرتبطة بخلايا A1 إلى E4. سنغير قيمة الخلية B4 باستخدام Aspose.Cells ثم نستدعي طريقة Worksheet.Shapes.UpdateSelectedValue() لتحديث قيمة الصورة وحفظها بتنسيق PDF.

todo:image_alt_text

يمكنك تنزيل ملف إكسل المصدر و ملف PDF الناتج من الروابط المعطاة.

كود C++ لتحديث قيم الأشكال المرتبطة

#include <iostream>
#include "Aspose.Cells.h"

using namespace Aspose::Cells;

int main()
{
    Aspose::Cells::Startup();

    // Source directory
    U16String srcDir(u"..\\Data\\01_SourceDirectory\\");

    // Output directory
    U16String outDir(u"..\\Data\\02_OutputDirectory\\");

    // Create workbook from source file
    Workbook workbook(srcDir + u"sampleRefreshValueOfLinkedShapes.xlsx");

    // Access first worksheet
    Worksheet worksheet = workbook.GetWorksheets().Get(0);

    // Change the value of cell B4
    Cell cell = worksheet.GetCells().Get(u"B4");
    cell.PutValue(100);

    // Update the value of the Linked Picture which is linked to cell B4
    worksheet.GetShapes().UpdateSelectedValue();

    // Save the workbook in PDF format
    workbook.Save(outDir + u"outputRefreshValueOfLinkedShapes.pdf", SaveFormat::Pdf);

    std::cout << "Linked shapes value refreshed successfully!" << std::endl;

    Aspose::Cells::Cleanup();
}