ActiveReports 15 .NET Edition
ActiveReports 15 User Guide / Export Reports / Rendering Extensions / Rendering to Text Print
In This Topic
    Rendering to Text Print
    In This Topic

    The Text Print is a format recommended for printing the RDLX reports with Table and Tablix data regions in the tabular format, preserving the grouping, layout, and formatting. The export is a cross-platform replacement for Text Only printers and is suitable for printing reports in ASCII format, especially on the Dot Matrix printers.

    Use the TxtRenderingExtension to render your report in Text Print format.

    The following steps provide an example of rendering a report in the Text Print format.

    1. Create a new Visual Studio project.
    2. In the New Project dialog that appears, select ActiveReports 15 Page Report Application and specify a name for the project in the Name field.
    3. Click OK to create a new ActiveReports 15 Page Report Application. By default, a Page report is added to the project.
    4. Add reference to GrapeCity.ActiveReports.Export.Xml package in the project.
    5. On the Form.cs or Form.vb that opens, double-click the title bar to create the Form_Load event.
    6. Add the following code inside the Form_Load event.         
      Visual Basic.NET code. Paste INSIDE the Form Load event.
      Copy Code
      ' Provide the page report you want to render.
      Dim rptPath As System.IO.FileInfo = New System.IO.FileInfo("..\..\PageReport1.rdlx")
      Dim pageReport As GrapeCity.ActiveReports.PageReport = New GrapeCity.ActiveReports.PageReport(rptPath)
      ' Create an output directory.
      Dim outputDirectory As New System.IO.DirectoryInfo("C:\MyTextPrint")
      ' Provide settings for your rendering output.
      Dim txtSettings = New GrapeCity.ActiveReports.Export.Text.Page.Settings()
      txtSettings.HorizontalPaddings = GrapeCity.ActiveReports.Export.Text.Page.PaddingsType.Keep
      txtSettings.LineEnding = "\r\n"
      txtSettings.CharHeight = 13
      txtSettings.CharWidth = 7
      ' Set the rendering extension and render the report.
      Dim txtRenderingExtension As GrapeCity.ActiveReports.Export.Text.Page.TxtRenderingExtension = New GrapeCity.ActiveReports.Export.Text.Page.TxtRenderingExtension()
      Dim outputProvider As New GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider(outputDirectory, System.IO.Path.GetFileNameWithoutExtension(outputDirectory.Name))
      ' Overwrite output file if it already exists.
      outputProvider.OverwriteOutputFile = True
      pageReport.Document.Render(txtRenderingExtension, outputProvider, txtSettings)
      C# code. Paste INSIDE the Form Load event.
      Copy Code
      // Provide the page report you want to render.
      System.IO.FileInfo rptPath = new System.IO.FileInfo(@"..\..\PageReport1.rdlx");
      GrapeCity.ActiveReports.PageReport pageReport = new GrapeCity.ActiveReports.PageReport(rptPath);
      // Create an output directory.
      System.IO.DirectoryInfo outputDirectory = new System.IO.DirectoryInfo(@"C:\MyTextPrint");
      // Provide settings for your rendering output.
      var txtSettings = new GrapeCity.ActiveReports.Export.Text.Page.Settings();
      txtSettings.HorizontalPaddings = GrapeCity.ActiveReports.Export.Text.Page.PaddingsType.Keep;
      txtSettings.LineEnding = "\r\n";
      txtSettings.CharHeight = 13;
      txtSettings.CharWidth = 7;
      // Set the rendering extension and render the report.
      GrapeCity.ActiveReports.Export.Text.Page.TxtRenderingExtension txtRenderingExtension = new GrapeCity.ActiveReports.Export.Text.Page.TxtRenderingExtension();
      GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider outputProvider = new GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider(outputDirectory, System.IO.Path.GetFileNameWithoutExtension(outputDirectory.Name));
      // Overwrite output file if it already exists.
      outputProvider.OverwriteOutputFile = true;
      pageReport.Document.Render(txtRenderingExtension, outputProvider, txtSettings);


    Text Print Rendering Properties

    The following options are available while rendering to Text Print format.

    Property Description
    CharHeight Specifies the character height in points.
    CharWidth Specifies the character width in points.

    Specifies the monospace font family. The available options are:

    • Consolas
    • Courier New
    • Lucida Console

    Specifies the font height in points. Recommended values are Consolas 11, Courier New 10, or Lucida Console 10.


    Specifies the horizontal padding:

    • Keep: Retain the original padding
    • Adjust: Adjust the padding
    • Remove: Remove the padding
    LineEnding Specifies the end of a line.