Spread Windows Forms 8.0 Product Documentation
Saving to an Excel File

You can save data to an Excel-formatted file (BIFF8 format) or the Excel 2007 XML format (xlsx) using the UseOOXMLFormat option of the ExcelSaveFlags enumeration. By default when you save to Excel, whatever is stored in the data model of the Spread is written out to a file or stream in BIFF8 format.

If you put a number or date in an Excel cell and the width of the column is not large enough to display the data, then Excel shows the cell filled with ###. Make sure the width of the column is set wide enough to display the data in the exported Excel-formatted file.

For more details on the methods used, refer to SaveExcel methods of the FpSpread class. There are many different SaveExcel methods. Some of the methods have a saveFlags option. This allows you to specify headers and other options. Headers are exported as frozen columns and rows.

The Document caching option in the ExcelOpenFlags or ExcelSaveFlags enumeration allows users to open, edit, and save without the loss of advanced document content and formatting. The content can be lossless only if the opening file format is similar to the saving file format. If the advanced document content uses files besides the xls(x) file, then the additional files need to be in the same folder with the xls(x) file. Advanced content could be macros, ActiveX controls, data connections, etc...

For more information about how the data is saved to an Excel-formatted file, see the Import and Export Reference.

Using Code

Use one of the SaveExcel methods of the FpSpread class, providing the path and file name for the file to save, and any additional parameters depending on the particular method.

Example

This example code saves the data in a Spread component to an Excel-formatted file and specifies that both row and column headers are included in the output.

C#
Copy Code
// Save the data to an Excel-formatted file, including headers.
fpSpread1.SaveExcel("C:\\excelfile.xls", FarPoint.Win.Spread.Model.IncludeHeaders.BothCustomOnly);
VB
Copy Code
' Save the data to an Excel-formatted file, including headers.
FpSpread1.SaveExcel("C:\excelfile.xls", FarPoint.Win.Spread.Model.IncludeHeaders.BothCustomOnly)

Using the Spread Designer

  1. From the File menu icon, choose Save.

    The Save As dialog appears.

  2. Change the Save as type box to Excel files (*.xls).
  3. Specify the path and file name to which to save the file, and then click Save.

    If the file is saved successfully, a message appears stating the file has been saved.

  4. Click OK to close the Spread Designer.

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options | Documentation Feedback