Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FRX to HTML

Status
Not open for further replies.

JRB-Bldr

Programmer
May 17, 2001
3,281
US
I need to 'print' a VFP Report Form to an HTML document.

Over the last few days I have been struggling with FRX2Any. It is not running as expected and while it does indeed generate an HTML document, it does not 'show' the Report Form output at all. I am currently corresponding with the FRX2Any support people to find an answer, but if anyone has experience with this while creating an HTML document and can pass on some advice, it would be welcome.

While waiting for an answer to get FRX2Any working, I have also been looking at xFRX. The documentation for this is terribly sparse so if anyone has gotten it to work for creating HTML documents, that advice would also be very welcome.

Your suggestions and/or advice would be most welcome.

Thanks,
JRB-Bldr
 
Have you toyed with the htmllistener of the \ffc\_reportlistener.vcx library?

Cd Home()
oRep = NewObject("htmllistener",".\ffc\_reportlistener.vcx")
Report Form Home()+"\tools\filespec\60frx1.frx" Object oRep

Bye, Olaf.
 
Olaf - thanks for the reply.

The Reportlistener only works with VFP9, doesn't it?

The application that I am working with is VFP7 (sorry for not mentioning it before) and just for this it isn't worth converting.

But thanks again and keep those ideas/suggestions/advice coming in....

Thanks,
JRB-Bldr

 
Can you elaborate on this?

it does not 'show' the Report Form output at all

I ask because there's frequently an impedance mismatch between expectation and what's possible. Simple HTML just isn't capable of reproducing some of the formatting that VFP's fancy report writer can do.

What are you actually seeing?
 
JRB-Bldr,

Using XFRX, it should be very easy - just a few lines of code, as follows:

Code:
loXFRX = XFRX("XFRX#LISTENER")
WITH loXFRX
  .TargetType = "HTML"	
  .targetFileName = < output file name >
ENDWITH 

REPORT FORM < report file name> OBJECT loXFRX

This assumes that XFRX.PRG is in the search path.

I've used XFRX for several years, and find that it works well.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Okay Mike, I don't use XFRX or FRX2Any, but this XFRX example looks, as if it needs a reportlistener too, not doable in VFP7.

Well the other thing that comes to mind is doing the HTML on your own, even without the frx but via Textmerge TEXT ... ENDTEXT.

And overall it doesn't seem a bad idea to move this project to VFP9, even "just" to use this one feature of VFP9. It's not a small new feature, it's a thing you would need to program hundreds of lines in VFP7 for. Don't underrate this.

Bye, Olaf.
 
this XFRX example looks, as if it needs a reportlistener too, not doable in VFP7.

Olaf, you're right that it needs VFP 9. It also needs the VFP 9-specific version of XFRX. I didn't notice where JRB-Bldr said he was using VFP 7.

It's also possible to export FRX to HTML using the pre-9 version of XFRX. I used to do that, but I don't have the code to hand, and don't remember how to go about it.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
danfreeman - "it does not 'show' the Report Form output at all" means that the entire HTML page is blank with the exception of a grayed out page header indicating that the HTML document was created using the FRX2Any ver: nnnn Demo text.

Using this same data table and this very same Report Form and going into VFP7 Preview shows a fully populated and readable VFP Report.

Mike - thanks for the code. I'll look through the xFRX documentation (such as it is) to see if they have some VFP7 replacement code for: loXFRX = XFRX("XFRX#LISTENER") But without a 'listener' in VFP7 I am not sure how xFRX would intercept the REPORT FORM command and send it to the desired output file.

It would be great if it were that simple - although somehow history has taught me to be dubious. Perhaps that's just the cynicism from 30+ years in the business - although I must have had it easy since I don't remember having to trudge out "into the snow without shoes to dig out the bits we needed from the hard frozen ground" - we wore snowshoes.

Thanks,
JRB-Bldr
 
So it DOES produce an HTML document but there's no data displayed. Hm, that sounds like a demo version to me. ;-)
 
danfreeman - Yes it DOES create an HTML document, but when I explained the behavior to the support folks at FRX2Any, they said it was not normal even for the DEMO version.

In fact I sent them the Report Form, a sample data table and the code I was testing and it all worked just fine for them. They even sent me back a copy of the HTML document that they output and, while it too showed the grayed-out DEMO header, it also showed the entire VFP Report Form output like it had appeared for me in 'normal' VFP Report Preview mode.

One of the problem symptoms that I am encountering with FRX2Any which I neglected to mention above, was that despite my SELECT'ing a data table before attempting to use the FRX2Any and by using the Data Session debug window and watching things confirming that the data table stays SELECT'd, the FRX2Any tosses up a GETFILE window as though it is looking for a data table. The FRX2Any support folks say that should not be happening.

Thanks,
JRB-Bldr
 
I'm glad I goaded you into providing more information. All of this is new in this thread, and most salient is the GetFile() dialog.

I've been using FoxPro long enough to know when that comes up (and to avoid it). It sounds like you're running the tool from a directory where the tool can't find its support files.

Their support people wouldn't do that because they know it needs to be able to find its files so even given your report and data files they'd run it from a directory where it can find its files (at the very least on the search path).

But all of this is a wild guess because I've never used the product. I just know what causes that dialog.
 
JRB-Bldr,

Regarding XFRX with VFP 8.0 and below, the following is adapted from the example given in para. 6.1 of the developer's manual:

Code:
loSession= xfrx("XFRX#INIT")
lnRetVal = loSession.SetParams("output.htm",,,,,,"HTML")
If lnRetVal = 0
   loSession.ProcessReport("report1")
   loSession.finalize()
Else
  ? lnRetVal
Endif

In other words, you don't execute REPORT FORM (as you would with the 9.0 version). Rather, you call the session's Finalize method.

As I said before, it's a long time since I used that version of XFRX, and I don't have any of my old code to hand, but, as far as I remember, there were no particular difficulties with it.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
One other possibility (just to confuse things further) ....

If the body of the report can be represented in a single cursor (in other words, if all formatting of fields, conditional printing, etc. can be embodied in the cursor):

Then you could use the VFP Web Publishing Wizard to generate a PRG file that will generate an HTML table that contains the data for the body of the report.

You could then write some code to generate the headings, etc. for the report, and also the surrounding HTML (like the <head> and <body> tags) and merge this with above VFP code.

And, finally, you would use STRTOFILE() to get the whole thing into an HTML file.

Just a thought.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Mike = Thanks for the code. I'll try it on Monday when I am next in my client's office.

As to your other suggestion....
"you could use the VFP Web Publishing Wizard..."

What I am trying to do will most likely need more flexibility than can be produced by a PRG created around a specific Report Form and a specific data table.

The various customers all have customer-specific Report Forms and each of them use different data tables for each day's production run. While I have not used that Wizard before, I am guessing that the PRG file results from it would not be flexible enough to support the numerious variations.

But I will look into it. Perhaps once I have the Wizard resultant PRG file for one customer I will be able to see if it can be modified to support various customers via PARAMETERS being passed. Thanks for the suggestion.

Thanks,
JRB-Bldr


 
Mike - I tested your VFP7 code for xFRX and it worked pretty well.

The only thing that I need to do now is to suppress the Preview/View that occurs automatically after creating the new HTML document.

In the xFRX documentation the Finalize() method is defined as:
This method finishes the document generation and displays the generated document (unless the document preview was explicitly suppressed).

So the Finalize() method is necessary to execute, but now I am trying to find out how to explicitly suppress the Preview/View.

I see in the xFRX ListenerClass a property called DoNotOpenViewer, but I am guessing that is only applicable to VFP9. Where is the same thing in the xFRX Session Class?

Thanks,
JRB-Bldr

 
As Rosanna Rosanna Danna used to say in Saturday Night Live "Never Mind!"

I found the means to explicitly suppress the automatic opening of the Preview/View.

In the xFRX.SetParams() method there is a flag for tlNotOpenViewer.
Once I set that to TRUE, I am now getting what I needed.

Thanks,
JRB-Bldr
 
JRB-Bldr,

You beat me to it. I was going to direct you to the SetParams() method. In general, you always use that method to set the various options in the pre-VFP 9 version.

Glad to hear you're making progress. Let us know if you finally manage to crack it.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Mike - actually to the extent that I need things to work, it is now 'cracked'.

Using the xFRX Session object in the code that you have suggested above and having added the flag to eliminate the automatic opening of the Preview/View, I am now creating the necessary HTML file(s) from the VFP7 FRX Report Form output.

It now remains to be determined if the recipient of these files who want everything sent using SOAP is satisfied with the results. Things look good on my side, so I've done my part.

Thanks for all the help.
JRB-Bldr




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top