[]
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.
Create a new or open an existing Windows Forms App in Visual Studio project.
Go to the Project Explorer, right-click the project and select Add > New Item.
Select ActiveReports 19 Standalone Report > Add and choose a report type, RDLX, RDLX Dashboard, or Page report and then click Finish.
Add reference to MESCIUS.ActiveReports.Export.Xml package in the project.
On the Form.cs or Form.vb that opens, double-click the title bar to create the Form_Load event.
Add the following code inside the Form_Load event.
' Provide the Page Report you want to render.
Dim rptPath As System.IO.FileInfo = New System.IO.FileInfo("..\..\..\Report1.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)
// Provide the Page Report you want to render.
System.IO.FileInfo rptPath = new System.IO.FileInfo(@"..\..\..\Report1.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: * Consolas * Courier New * Lucida Console |
FontSize | Specifies the font height in points. Recommended values are Consolas 11, Courier New 10, or Lucida Console 10. |
HorizontalPaddings | Specifies the horizontal padding: * Keep: Retain the original padding * Adjust: Adjust the padding * Remove: Remove the padding |
LineEnding | Specifies the end of a line. |