Spread ASP.NET 17
Spread for ASP.NET 17 Product Documentation / Developer's Guide / Managing File Operations / Opening Existing Files / Opening a Text File
In This Topic
    Opening a Text File
    In This Topic

    You can open existing text files that are delimited, either files saved from Spread or delimited text files from other sources. The data from the file you open is placed in the sheet you specify. There are multiple LoadTextFile methods each with several options.

    If the file uses custom delimiters, you must specify the delimiters so the component can correctly place the data within the sheet. If your file uses standard tab-delimited format, you need not use a method that lets you specify delimiters.

    You can also open a file from inside Spread Designer.

    For instructions for saving to text files, see Saving to a Text File.

    Using a Shortcut

    Use one of the SheetView object’s LoadTextFile methods, specifying the path and file name or stream, whether data or data and formatting was saved, whether headers are included, and the custom delimiters, depending on the particular method you choose.

    Example

    This example code loads a text file that contains formatted data, headers, and custom delimiters.

    C#
    Copy Code
    // Load a text file with headers and custom delimiters.
    FpSpread1.Sheets[0].LoadTextFile("c:\textfile.txt", False, FarPoint.Web.Spread.Model.IncludeHeaders.BothCustomOnly, "#", "%", "^"); 
    
    VB
    Copy Code
    ' Load a text file with headers and custom delimiters.
    FpSpread1.Sheets(0).LoadTextFile("c:\textfile.txt", False, FarPoint.Web.Spread.Model.IncludeHeaders.BothCustomOnly, "#", "%", "^") 
    

    Using the Spread Designer

    1. Select the File menu.
    2. Choose the Open option.
    3. The Open dialog appears.
    4. Change the Files of type box to Text files (*.txt).
    5. Specify the path and file name of the file to open, and then click Open.
    6. Click OK to close the Spread Designer.
    See Also