Converting reports to plain text

Limitations

The limitations are defined by the nature of the plain text output:

  • Font size and style are not converted (the text alignment is supported)
  • Graphics on the report is ignored
  • Rectangles and vertical lines are ignored, horizontal lines can be optionally converted as a series of dashes, for more information please see the Horizontal lines section below
  • Overlapping objects are removed from the output
  • XFRX needs to be able to split the objects to distinct lines, otherwise some objects would be removed form the output

How it works

During the generation process, XFRX takes each section – one by one – and tries to split into to individual lines. Then each line is added to the output, respecting the vertical position of the line on the paper and horizontal positions of individual objects. Vertically misaligned objects are moved down to the closest baseline, for example:

This report definition:

Will be split to three lines:

And the result would look like this:

                One two  three
               four five
                       six

If XFRX will not be able to create distinct lines or if objects would overlap one another, XFRX will try removing some of the objects.
For example:

will be converted as:

                One two
               Four
                      six

Horizontal lines 

Horizontal lines can optionally be converted to a series of dashes. By default, this option is switched on. To suppress horizontal lines, call the setOtherParams method of XFRXSession object with two parameters: "PLAIN_SHOW_LINES" and .F., before calling processReport() method.

Example:

LOCAL m.loSession, m.lnRetval
m.loSession= xfrx("XFRX#INIT")
m.lnRetVal = m.loSession.SetParams("output.txt",,,,,,"PLAIN")
IF m.lnRetVal = 0
   m.loSession.SetOtherParams("PLAIN_SHOW_LINES", .F.) && do not print horizontal lines
   m.loSession.ProcessReport("report.frx")
   m.loSession.finalize()
ENDIF

Characters per inch setting

To convert the object absolute positions to character positions, XFRX calculates the number of characters per line and the number of lines per page using horizontal and vertical character-per-inch values. By default, these values are 10 characters per horizontal inch and 5.2 characters per vertical inch, which results in approximately 80 characters x 55 lines on a letter size paper.

You may want to change the character density (e.g. when using a condensed font on a dot matrix printer). To do this, send PLAIN_CPI_HORIZONTAL or PLAIN_CPI_VERTICAL as the first parameter of the SetOtherParams() method and the actual value as the second parameter.
Example:

LOCAL m.loSession, m.lnRetval
m.loSession= xfrx("XFRX#INIT")
m.lnRetVal = m.loSession.SetParams("output.txt",,,,,,"PLAIN")
IF m.lnRetVal = 0
   * changing the character density to 12x6 per sq. inch
   m.loSession.SetOtherParams("PLAIN_CPI_HORIZONTAL",12)
   m.loSession.SetOtherParams("PLAIN_CPI_VERTICAL",8)
   m.loSession.ProcessReport("report.frx")
   m.loSession.finalize()
ENDIF

Control Chars

XFRX 17.2 generate control char FF (Form feed) after each page - except last page. You can turn off this feature:

LOCAL m.loSession, m.lnRetval
m.loSession= xfrx("XFRX#INIT")
m.lnRetVal = m.loSession.SetParams("output.txt",,,,,,"PLAIN")
IF m.lnRetVal = 0
   * don't add control chars
   m.loSession.SetOtherParams("DONTADDCONTROLCHARS",.F.)
   m.loSession.ProcessReport("report.frx")
   m.loSession.finalize()
ENDIF

Compact plain text 

Compact plain text is text output with plain mode - equal to XLSPLAIN. 

LOCAL m.loSession, m.lnRetval
m.loSession= xfrx("XFRX#INIT")
m.lnRetVal = m.loSession.SetParams("output.txt",,,,,,"CPLAIN")
IF m.lnRetVal = 0
   m.loSession.ProcessReport("report.frx")
   m.loSession.finalize()
ENDIF