Re: Formatting report output
Posted in 1995
> trish@paragon.ie (trish mcelvaney) writes: > > Hi, > Can someone please tell me how I can format the output of > a report. > > I need to do things like > > bold on, bold off > italics on, italics off > condensed on, condensed off ........ etc > > I know you can do some thing like > > LET bold_on = ???? > LET bold_off = ???? > > PRINT COLUMN 10, bold_on, "TESTING gkgjgjkg", bold_off > > But what are the "escape codes" > > Thanks for any 'elp. You find the escape codes in your printer manual. They are of course different for every printer. (The printer manufacturers aren't very bright. Even the "standard" printers are quite differently implemented by every manufacturer.) And don't forget support for larger fonts so you can get better headings on your report, and important messages can realy stand out. We dont use bold/italic/underline but font 1=10CPI, 2=12CPI, 3=15CPI, 4=Big letters, 5=Not that big letters (bold/enhanced), 6=Proportional, 7=OCR. This can be mapped with the right on/off escape sequences to any printer. So you put the escape sequences in your database in a table containing the printer name/number and a code for each type of sequence you want. Use a char-type field for the escape sequences. The only problem you'l have is printers requiring HEX 0 code inside their escape sequences. They can't be stored in a char field. They are used to represent NULL and also won't print with the print statement. HP laserprinters don't use HEX 0, and on printers from OKI you can replace them with the digit 0 (zero). If you have to support HEX 0 what we do is store HEX 80 instead and put a small filter in the Unix spooler that translate these to HEX 0. How do you get control codes into char variables/fields? Write a two way translator so you can type in the ascii codes numerically and store them as code. Translating the other way to display. (We can type: $-20-'AAA' which in hex becomes: 27 14 41 41 41 stored in the char field. Anybody interested - there is a bug in our translator, but it's available for the asking, particularly if someone will fix the bug.) If Informix tells you char fields/variables can only store printable characters tell them about 8 bit charactersets and whatever. It has allways been possible to store all codes but HEX 0 in char fields in the various versions we have had. If Informix should ever change this they'l be in for some big trouble from us. You may of course also opt to store the escape sequences in a file and use one of the file I/O liberaries availble to read it. You'l still have trouble with HEX 0 though, as Informix hasn't grasped that it should have been possible to print that. They are of course in trouble as they use HEX 0 to represent NULL even internally - a design flaw, but... When you are at it also put the command to use in start report in the printer table along with a code saying wether this is a printer name or a pipe (using an if-test on this code to do either "start report r_xxx to printer p_printer" or "start report r_xxx to pipe p_printer"). Obviously you also put printer initialization and deinitialization codes in the same table to be sent before and after every report The initialization you print in "page header" where pageno = 1 or in "first page header". Deinitialization must be printed in "page trailer" with a test on a variable set where you print the initialization and again (to another value) after the last printing done in "on last row" so you are sure it's printed on the very last line of the report without any blank lines after it. Deinitialization you print with a ; (semicolon) after it so you also get no new line after it. Initialization we have found it smart to print at a separate blank line at the start of the report. All this does of course require top and bottom margins to be set to 0 and using skip x lines to make these margins instead. We have also put horizontal lines in the same table. Than we can easily use any mechanisme available in the printer to print real lines, not the ugly ------. We have single and double lines availabel of different length. If you do all of the above you can make relatively nice reports. Of course, in the NewEra language we expect Informix to put in support for all these things, including proportional fonts with decimal point allignment, drawing rectangles and printing inside them, "cursor" positioning to anywhere on the current page, printing in functions and so on. (We do print a text at a user selectable position on a page with 4GL - making invoices ++ with user layout - but it's kind of complex.) When can we expect that??? Please push Informix for it. We need reports with the power of the report language but flexibility to make them look like they are printed for humans, not for some computer freek. Nils.Myklebust@ccmail.telemax.no NM-data, Dalsbergstien 7, N-0170 Oslo, Norway My opinions are those of my company