Documents for Excel .NET Edition | GCDocuments
File Operations / Import and Export OLE Objects
In This Topic
    Import and Export OLE Objects
    In This Topic

    GcExcel .NET allows users to preserve OLE objects while opening and saving an Excel file. This feature is extremely useful when users need to deal with import and export of linked objects and embedded objects while working with spreadsheets.

    With extensive support for importing and exporting OLE Objects, users can insert linked and embedded objects in their spreadsheets and then preserve these objects while saving the files with .xlsx or .xlsm extension. This feature also facilitates users to use the object linking and embedding (OLE) in order to load and save data from other programs, such as MS Word or MS Excel.

    Example

    For instance, let's say you work as a business analyst who wants to visualize information using charts.

    You have a source file containing some data. But, you want the chart to be displayed in another file (called a destination file) that picks up data from the source file in order to create charts in the destination file. Now, whenever any changes are done in the data in the source file, obviously you would also want the chart to be updated (or in other words, the destination file to be updated).

    That's where the role of supporting the import and export of OLE objects comes into picture. In such a scenario, GcExcel will ensure that the original data remains intact in the source file and the destination file represents the updated linked information (updated charts in this example) without impacting the storage of the original data.

    Refer to the following example code in order to import and export spreadsheets containing OLE objects.

    C#
    Copy Code
    // Initialize workbook
    Workbook workbook = new Workbook();
    
    // Opening workbook with OLE object
    workbook.Open("OleObjectExcelFile.xlsx");
    
    // Saving workbook with OLE object
    workbook.Save("OleOutExcel.xlsx");