Crystal Reports and MFC
Luke Stephens -- luker@tfs.net Saturday, November 16, 1996 Environment: VC++ 4.2-flat, Win 95, WinNT 4.0 Has anyone used the Crystal Reports Library that comes with VC? If so, have you had any problems or found any bugs when using it with MFC? I'm wanting to pass parameters to the reports from my MFC app. For example, I want to pass a start/end date for the report filter. Any source code examples would be greatly appreciated. Thanks in advance Luke Stephens luker@tfs.net
Dong Chen -- d_chen@ix.netcom.com Tuesday, November 19, 1996 [Mini-digest: 2 responses] At 05:25 PM 11/16/96 -0600, you wrote: >Environment: VC++ 4.2-flat, Win 95, WinNT 4.0 > >Has anyone used the Crystal Reports Library that comes with VC? If so, >have you had any problems or found any bugs when using it with MFC? > >I'm wanting to pass parameters to the reports from my MFC app. For >example, I want to pass a start/end date for the report filter. Any source >code examples would be greatly appreciated. > >Thanks in advance > >Luke Stephens >luker@tfs.net > > I used stand alone Crystal Reports(v.4.0) in one of my VC++ 16-bit projects. I don't think there is any big difference as the mater of its report engine library. The library is just a plain C lib. It is pretty straightforward to set a parameter in the MFC program and send it to the report. First, you need to create a so called Formula Field in the report file. Give it a name say FStartDate. Then, from your program, setup the connection to the report (To do this, just follow the steps described in the document), and then call this function: PESetFormula(Job, "FStartDate", (char*)(LPCSTR)strStartDate)) where Job is an integer for the report job and strStartDate is a CString. There are some bugs in the version I used. I think the latest stand alone version is 5.0. Once one of our clients installed Version 4.5 after he installed my application and had some compatibility problems so I had to fix it. Overall, I think it is a good product in terms of creating database related reports. -- Dong d_chen@ix.netcom.com -----From: Gerry SweeneyEnvironment: VC++ 4.2-flat, Win 95, WinNT 4.0 A number of you have been asking about Crystal Reports in MFC. I done some work with this some time ago and wanted to achieve a seamless integration with the MFC framework. We wanted the ability to have a report preview per MDI child window. We achieved this no problem. Unfortunately I do not have the code to hand but this is roughly what you need to do:- 1. Create an MDI app 2. Create a menu with an Item for each PExxx function that duplicates the toolbar found on the bottom of the Report Window. 3. Create a Toolbar bitmap that has buttons and map these buttons to the menu functions above. 4. Map a message handler to each of the menu/tool buttons and call the relevant PExx function from within it. 5. Override the OnSize, OnSetFocus, OnCreate member functions of the view class 6. In the OnCreate call the PEOutputToWindow and pass the flags and window handle from the 'this->GetSafeHwnd()' call of the view to create the report window as a child window of the view. Save the handle. 7. When the above window has been created successfully, Your view class will have one child window in it. Use the 'EnumerateChildWindows' (I think its called that! You know the one I mean) and get the Window handle of the reports window. Save it! 8. In the 'OnSize' member, using the window handle from the previous step resize/reposition the report view so that the boarder and toolbar is outside of the view area and just the report data is visible. 9. On the OnSetFocus' member, Set the focus to the report hwnd. I may have forgotten a few bits but doing the above should get you going in about an hour or so. In the early version of CR not all of the navigation functions in the toolbar were exported so we used a bit of message hacking to post the appropriate WM_COMMAND messages at the report view but in later versions (4+) they have exported them all so there is no need to do this. Incidentally we done this with version 4 + 5 pro and we did not use the standard stuff that comes with VC++. I hope this helps all you Crystal Reporters out there. Incidentally we have to do some work in the near future with setting report criteria from custom Dialogs/DLL's If anyone has any ideas I would appreciate them Kind Regards Gerry Sweeney Hornbill Systems Ltd gerry@hornbill.com
Riso Nemec -- nemec@softec.sk Friday, November 22, 1996 > Environment: VC++ 4.2-flat, Win 95, WinNT 4.0 > > A number of you have been asking about Crystal Reports in MFC. Do you know about a simple way how to put my own data collection to a Crystal Report? Preferably concerning my data as a computed stream and without saving them into any kind of data store (file, database, etc.). Thank you Richard ___ ___ ____ _ ___________________________________________________ / __)/ \| ) | Richard NEMEC, SOFTEC, Bratislava, Slovakia, Europe (___ \ | \ (| | phone: +42-7-273805 (_____)____/_|\_\_| e-mail: nemec@softec.sk ____ _ ___ ___ www: http://www.fmph.uniba.sk/~nemec | ) |/ __)/ \ http://softec.softec.sk/~nemec | (| |___ \ | \ hobby: iveta@home.dnv.sk |_|\_\_|_____)____/ ___________________________________________________
Gerry Sweeney -- gerry@hornbill.com Monday, November 25, 1996 [Mini-digest: 2 responses] Environment: VC++ 4.2-flat, Win 95, WinNT 4.0 Richard, I too wanted to do this but was unable to with any great success. It depends on the kind of data and the size of data. One way which we tried but did not like was writing the data into a temporary .DBF file on you local HDD and opening the report on this file. Its a bit naff but it does work. Whet we wanted to do was display tables and graphs with various statistics in real time. We resorted to the Visual Tools Grid Control DLL and made reports with this. This was much faster that CR in this example and real time updates where near instantaneous. Gerry ---------- From: owner-mfc-l To: 'mfc-l@netcom.com' Subject: RE: Crystal Reports and MFC Date: 22 November 1996 08:01 > Environment: VC++ 4.2-flat, Win 95, WinNT 4.0 > > A number of you have been asking about Crystal Reports in MFC. Do you know about a simple way how to put my own data collection to a Crystal Report? Preferably concerning my data as a computed stream and without saving them into any kind of data store (file, database, etc.). Thank you Richard ___ ___ ____ _ ___________________________________________________ / __)/ \| ) | Richard NEMEC, SOFTEC, Bratislava, Slovakia, Europe (___ \ | \ (| | phone: +42-7-273805 (_____)____/_|\_\_| e-mail: nemec@softec.sk ____ _ ___ ___ www: http://www.fmph.uniba.sk/~nemec | ) |/ __)/ \ http://softec.softec.sk/~nemec | (| |___ \ | \ hobby: iveta@home.dnv.sk |_|\_\_|_____)____/ ___________________________________________________ -----From: kevin@earth.pln.com.tw (Kevin Tarn) I think that the only way is to reserve some formulas in your report template, and then replace them with your data streams. Kevin Tarn kevin@pln.com.tw
| Вернуться в корень Архива |