Spread for ASP.NET 10 Product Documentation > Developer's Guide > Managing File Operations > Saving Data to a File > Saving to a Text File |
You can save the data or the data and formatting in a sheet to a text file, using either default tab delimiters or custom delimiters.
Saving to a text file is done for individual sheets. If you want to save all the sheets in the component, you must save each sheet to a text file.
There are multiple SaveTextFile methods each with several options. For instance, you can specify whether headers are saved with the data using the setting of the IncludeHeaders enumeration.
Tab-delimited files saved from the component contain data separated by tabs and carriage returns. Tab-delimited files can be opened, modified, and saved using any standard text editor. Delimited files contain data separated by user-defined delimiters, such as commas, quotation marks, or other delimiters.
You can save the entire spreadsheet or a portion of the spreadsheet data from the component to tab-delimited and delimited files.
You can also save a file from inside Spread Designer. The Spread Designer saves the current sheet.
For instructions for opening text files, see Opening a Text File.
This example code saves a range of data and formatting to a text file, including headers and using custom delimiters.
C# |
Copy Code
|
---|---|
// Save a range of data and formatting to a text file. FpSpread1.Sheets[0].SaveTextFileRange(1, 1, 1, 2, "C:\\filerange.txt", false, FarPoint.Web.Spread.Model.IncludeHeaders.BothCustomOnly, "#", "%", "^"); |
VB |
Copy Code
|
---|---|
' Save a range of data and formatting to a text file. FpSpread1.Sheets(0).SaveTextFileRange(1, 1, 1, 2, "C:\filerange.txt", False, FarPoint.Web.Spread.Model.IncludeHeaders.BothCustomOnly, "#", "%", "^") |
The Save As dialog appears.