ActiveReports 16 .NET Edition
ActiveReports 16 User Guide / Export Reports / Export Filters / Text Export
In This Topic
    Text Export
    In This Topic

    Plain Text is a format that opens in Notepad or Microsoft Excel depending on the file extension you use in the filePath parameter of the Export method. Use the extension .txt to open files in Notepad, or use .csv to open comma separated value files in Excel. The Text export filter has a number of useful properties that allow you to control your output. You can set the properties either in code using the TextExport object after adding reference to the following package in your project:

    Text Export Properties

    Property Valid Values Description
    Encoding System.Text.ASCIIEncoding (default), System.Text.UnicodeEncoding, System.Text.UTF7Encoding, or System.Text.UTF8Encoding This property can only be set in code. Enter an enumerated system encoding value to use for character encoding.
    PageDelimiter String Enter a character or sequence of characters to mark the end of each page.

    QuotationMode 

    AutoQuote

    AlwaysQuote

    Specifies whether to add double quotes to the exported data. The AutoQuote option (by default) specifies that quotes are added when the data contains the page delimiter, text delimiter, or newline characters (CRLF). If set to AlwaysQuote, exported values will always be quoted.

    QuotationSymbol

     

    Char Enter a character to use as quotation mark in the exported text file. Only fields with delimiter characters are quoted.
    SuppressEmptyLines True (default) or False Set to False if you want to keep empty lines in the exported text file. Otherwise, white space is removed.
    TextDelimiter String Enter a character or sequence of characters to mark the end of each text field. This is mainly for use with CSV files that you open in Excel.

    Text

    Usage:

    Does not support anything but plain fields and labels:

    Export Report using Text Export Filter

    Use the following steps to export reports with the Text export filter.

    1. Create a new or open an existing Visual Studio project.
      • If you are creating a new project,
        - select ActiveReports 16 Section Report (xml-based) Application in Create a New Project dialog, and then
        - specify a name for the project, and click OK.
      • If you are using an existing project,
        - go to the Solution Explorer and right-click the project and select Add > New Item, and then
        - select ActiveReports 16 Section Report (xml-based) and click Add.
    2. Add a reference to GrapeCity.ActiveReports.Export.Xml package in the project. See Manage ActiveReports Dependencies for more information.
    3. In your project's Bin>Debug folder, place the report.rpx (Section Report).
    4. On the Form.cs or Form.vb, double-click the title bar to create the Form_Load event.
    5. In Form_Load event, add the following code to export a Section Report.
      Visual Basic.NET code. Paste INSIDE the Form Load event.
      Copy Code
      ' Create a Section report.Dim rpt As New GrapeCity.ActiveReports.SectionReport()
      ' For the code to work, report.rpx must be placed in the bin\debug folder of your project.Dim xtr As New System.Xml.XmlTextReader(Application.StartupPath + "\report.rpx")
      rpt.LoadLayout(xtr)
      rpt.Run()
      ' Export the report in Text format.
      Dim TextExport1 As New GrapeCity.ActiveReports.Export.Xml.Section.TextExport()
      TextExport1.QuotationMode = GrapeCity.ActiveReports.Export.Text.Page.QuotationMode.AlwaysQuote
      TextExport1.QuotationSymbol = """"c
      TextExport1.Export(rpt.Document, Application.StartupPath + "\TextExpt.txt")                                
      
      C# code. Paste INSIDE the Form Load event.
      Copy Code
      // Create a Section Report
      GrapeCity.ActiveReports.SectionReport rpt = new GrapeCity.ActiveReports.SectionReport();
      // For the code to work, report.rpx must be placed in the bin\debug folder of your project.
      System.Xml.XmlTextReader xtr = new System.Xml.XmlTextReader(Application.StartupPath + "\\report.rpx");
      rpt.LoadLayout(xtr);
      rpt.Run();
      // Export the report in Text format.
      GrapeCity.ActiveReports.Export.Xml.Section.TextExport TextExport1 = new GrapeCity.ActiveReports.Export.Xml.Section.TextExport();
      TextExport1.QuotationMode = GrapeCity.ActiveReports.Export.Text.Page.QuotationMode.AlwaysQuote;
      TextExport1.QuotationSymbol = '"';
      TextExport1.Export(rpt.Document, Application.StartupPath + "\\TextExpt.txt");;                                
      
    See Also