Spread Windows Forms 6.0 Product Documentation
Saving to an Excel File
Support Options
Spread Windows Forms 6.0 Product Documentation > Developer's Guide > Managing File Operations > Saving Data to a File > Saving to an Excel File

Glossary Item Box

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...

The following picture uses the OpenExcel method from the SpreadWinDemo project folder that is located in the samples folder.

Example of OpenExcel

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

Return to Saving Data to a File.

Return to the overview of Managing File Operations.

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.


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.
© 2002-2012 ComponentOne, a division of GrapeCity. All Rights Reserved.