Search code examples
visual-foxprofoxpro

How to convert txt files to FoxPro frx files


Plain text files contain lot of static text divided into paragraphs.

Those texts should convertert into reports (frx,frt) files.

After than those report will be modifined manually to add fields to them and some formatting shoud applied.

Creating reports manually is huge work: Report field maximum size is 255 characters. Thus every sentence in txt file should copied and pasted manually.

How to convert txt files to frx files automatically. E.q. every row in txt file should appear as label element in report.

Is it possible to insert this information to frx file manually ? If yes, how to calculate vpos values? Or is there better solution ?


Solution

  • Like most things in FoxPro metadata, FRX files are just DBF files with a different extension. So you can browse and manipulate them like any other DBF.

    So I can create a simple report:

    create report e:\temp\report1
    

    and then add a text expression to it in the normal way in the report designer.

    I can then open it as a DBF:

    use e:\temp\report1.frx
    

    And then view the relevant type of object:

    brow for objtype = 8
    

    So you see you can add records to it programmatically but you would have to calculate the vertical position based on the font size, handle page breaks and so forth. Big pain.

    So why not create a table with a memo-type field, create some records and put your source text each. Then have one report layout with one text field in the detail band, set to 'stretch with overflow' and the data source as your memo field? Or automate MS Word to do it. Anything would be easier than building the FRX programmatically.