About this document.
From version 5.3.3. of Rpv Reports, new functionalities are added to give more tools and possibilities to integrate Rpv to existing projects easier and faster.
We strongly recommend to read this article to evaluate the facilities that Rpv Reports offers with reports generated using text files.
About the TXT files
Is important to remmark that the reports referred by this article are those reports that are generated to a plain file that later is sent to the printer. This plain file has no format. Eventually contain some specific commands that are recognized by the printer but they do not offer great grapical possibilities.
These files are "TXT files" or "text files" and are readable by programs like "Notepad" of Windows, "Vi" of Unix or any other viewer/editor of plain files.
Possibly you know that TXT files do not have any format. In fact, they are only characters that are sent to the printer but they do not accept any kind of effect.
Depending on the printer that is necessary to use, is possible to send some commands (escape codes, PCL, PJL, etc.) that indicate the printer what to do in specific cases. Ussually what is possible to do with the TXT files is really limited and the results will vary depending on the printer to be used.
What is possible to do with Rpv in this situation?
Just imagine that you are generating a text file with a program and then, you open it with the program Wordpad of Windows. You format it, assign different text effects, fonts, colors, barcodes, chart and once the file is ready, you save it and send to any printer accepted by Windows.
This is what Rpv can do automatically.
How to do it?
First of all, the information generated by the program must be redirected to a file instead the printer. The file must have TXT, LST or PRN file.
TXT, LST and PRN files are basically the same. They have the same internal format. The difference between them is that Rpv recognizes each extension separatelly. Then, is possible to assign three diferent configurations to each extension.
There are three different methods to obtain graphical reports from text files. These methods can be used separatelly or combined according your needs.
A) Configuration of each extension
This action will be executed using the RpvConfig.exe utility or the configuration panel of Rpv. This utility modifies the file RPV.INI.
B) Configuration of the conversion tables
The conversion tables are used to explain Rpv that there are some sequences or characters that are contained within a file that mean an specific action. Once the conversion table have been configured properly, the characters or sequences that the file contains will be changed by the desired effect.
C) Insert effects to the text
Additionally, is possible to add effects or Rpv commands in the text files. This allows to add to the text files several advantages: barcodes, images, charts and all those font effects accepted by Windows: font bold, size, underline, color, etc.
A) Configuration of each extension.
The configuration of these extensions is really simple. When executing RpvConfig.exe program, you will see the "files configuration" button. The following screen will appear:
B) Configuration of the conversion tables.
The conversion tables are files with CNV extension that are intended to make specific changes to the reports.
This feature is very important in the following situations:
1) When the reports are generated with a language based on Ms-Dos or Unix and use special characters. For example the special characters of Spanish, Portuguese, Italian, German and other languages.
2) When the reports contain "escape codes", PCL commands or any other string that indicates the printer a command and not a text.
For example, let's suppose that the command "ESC+4" mean italic font. These two characters are in the middle of the text file but when the report is printed they must be interpreted by the printer.
The Rpv command to set the italic font is "i=y" (italic = yes). To mean this, the conversion file must contain the following string:
27,52=1,73,61,89,2
What does this mean? This means the source and destination strings in ASCII (decimal) where 27 means ESC, 52 means "4", 73 is "I", etc.
When the destination string contains Rpv commands, the brackets "{" and "}" must be replaced by 1 and 2 like the example.
There is another alternative that is also used to ignore the commands. This means not to show them and not to execute them either. In this case the example is the following:
27,52=0
In this case, when Rpv finds the sequence 27, 52 it will replace it by a char 0.
Additionally, is possible to configure the special characters that are not read by Windows properly. This would be the case of the "Ñ" of Spanish for example, accents and other special characters.
C) Inserting effects in a text file.
This is a new feature of Rpv Reports 5.3.3 and it is really useful for a fast integration of the program obtaining great results.
To insert commands in the middle of a text, they will have to be expressed between double brackets. Using this feature will be possible {{B=Y}} to set font bold {{U=Y}} or underlined {{B=N;U=N}} when needed.
When Rpv finds double brackets it will not print or show the string inside but it will execute the commands inside.
Using this method is possible not only to insert effects for fonts, but also images, links, barcodes and every command accepted by Rpv: lines, page breaks, boxes, etc.
Direct commands
It is also possible to insert direct commands in a text file.
These commands are used basically to set the parameters of the reports and to define [HEADER] and [DATA]sections.
To insert a direct command is necessary to start a line with the character ">" (greater than). This symbol must be placed in the first position of the line.
Example:
>REPORT_TITLE=Test for TXT files
>ORIENTATION=2
>[HEADER]
>[DATA]
The rest of the text here.....
..............
..............
..............
It is remmarkable that if you use direct commands to declare parameters, it is required to specify [HEADER] and [DATA].
Fixed width fonts
Even when it is possible to insert variable width fonts, we always recommend to use fixed width fonts to see the columns properly.
The fixed width fonts are those fonts that have the same width for all the characters. For example Courier New.
For example, the font of this article is not fixed width. Here we will show you displaying five "i" and five "w" to see the difference:
iiiii
WWWWW
The difference is really important. Now, if we use a fixed width font the effect will be completelly different:
iiiii
WWWWW
Font: Courier New
Examples
Here we have three easy examples generated from a DIR of Ms-Dos that is a report very familiar to all the users.
Note: the examples will open an instance of the Rpv Reports viewer.
Example #1. TEXT_ORIGINAL.TXT file
Example #2. Modified file: TEXT_01.TXT
Example #3. Modified file: TEXT_02.TXT
Download the files in ZIP format to see the sources of the reports.
|