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.
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") outputDirectory.Create() ' 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"); outputDirectory.Create(); // 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); |
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. |
FontFamily |
Specifies the monospace font family. The available options are:
|
FontSize |
Specifies the font height in points. Recommended values are Consolas 11, Courier New 10, or Lucida Console 10. |
HorizontalPaddings |
Specifies the horizontal padding:
|
LineEnding | Specifies the end of a line. |