ComponentOne FlexGrid for WinForms
Using the C1FlexGrid Control / Saving, Loading, and Printing / Saving and Loading Microsoft Excel Files
In This Topic
    Saving and Loading Microsoft Excel Files
    In This Topic

    Starting with version 2.5, you can use the SaveGrid and LoadGrid methods to save and load Microsoft Excel files (.xls) as well as text files. This allows you to save formatting information in addition to the data.

    To save and load Excel files using the SaveGrid and LoadGrid methods, simply set the format parameter to FileFormatEnum.Excel and call the methods as usual. You don't need to have Microsoft Excel installed on your computer.

    Excel files contain "workbooks", which are made up of "worksheets". The SaveGrid and LoadGrid methods always save books with a single sheet, and load the first sheet from existing books. If you want additional control over which sheets to load or save, use the SaveExcel, LoadExcel, and LoadExcelSheetNames methods instead. The process of saving and loading Excel files will convert most data types and formatting information, including row and column dimensions, fonts, colors, formats, and cell alignment. However, not all formatting elements can be converted. For example, the grid will load the values in Excel cells, but it will not load the underlying formulas. Other features such as frozen and merged cells, images, data maps, and cell borders are not translated either.

    Note: If you use any of the extension methods (such as SaveExcel, SaveGrid, LoadExcel, LoadGrid), FileFlags and FileFlagEnum enumerations, then add reference to C1.Win.C1FlexGrid.ImportExport.dll.4.
    See Also