How to create a fixed width report?

edited 11:30AM in FastReport 4.0
I am trying to create a report where the columns are fixed width in a text file.

Here is what I tried:

1) Write my SQL with no string manipulation and format the column using the memoview object's Format property and using the Format function specifying the width in the format string, like %125s. This failed on both counts. I tried with AutoWidth set to true and false.

2) Pad strings using SQL. Example: select cast(FName as char(40)) FName ... I know for sure the data is padded to the width I want. I then put one field right after another in a memo object. I set the font to Courier New. This looks great in preview. It even exports to PDF correctly. I can copy the PDF text to clipboard and examine in a text editor. All the spaces used for padding are there.

This solution fails because the text export comes up with its own interpretation of the data. A column 25 wide ends up being 13 characters wide. The last 2 records don't even look like they do in the preview window.

So, is it possible to create a tabular report in FR4 with fixed width columns which exports to text correctly? How do you do it?

Comments

  • kamiller42 wrote: »
    I am trying to create a report where the columns are fixed width in a text file.

    Here is what I tried:

    1) Write my SQL with no string manipulation and format the column using the memoview object's Format property and using the Format function specifying the width in the format string, like %125s. This failed on both counts. I tried with AutoWidth set to true and false.

    2) Pad strings using SQL. Example: select cast(FName as char(40)) FName ... I know for sure the data is padded to the width I want. I then put one field right after another in a memo object. I set the font to Courier New. This looks great in preview. It even exports to PDF correctly. I can copy the PDF text to clipboard and examine in a text editor. All the spaces used for padding are there.

    This solution fails because the text export comes up with its own interpretation of the data. A column 25 wide ends up being 13 characters wide. The last 2 records don't even look like they do in the preview window.

    So, is it possible to create a tabular report in FR4 with fixed width columns which exports to text correctly? How do you do it?


    Looks like there are bugs in the text export filters. I have similar issues as well, both in FastReports4 and still in the updated FastReports5 [img]style_emoticons/<#EMO_DIR#>/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /> Checking the forum I found some other people are also strugging with these text export filters (eg:[/img] https://www.fast-report.com/en/forum/index....hl=text+export).
    There are 3 filters, simpleText, dotMatrix and Text... I did not find any clear explanation what is exactly the diference between them, and looks some features of them are broken for a long time already. For people who have also de sources, trying to understand the code that is doing the export is very hard because the code is far from easily readable for the ones not in the project).

    I still dont have a solution for my problem as well... hopping FR staff come to the help.



  • gpigpi
    edited February 2017
    Create support ticket (https://support.fast-report.com) and send your report template (fr3), saved preview pages (fp3) and result (txt). Tell what export filter do you use
    wrote:
    I am trying to create a report where the columns are fixed width in a text file.
    It seems FR's export filters to TXT doesn't have such feature

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.