Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

how to save a report generated using CNiReportData to a disk

I generated a report (graph and text) with CNiReportData. I would like to save to report before printting. How can do I it?
0 Kudos
Message 1 of 2
(2,780 Views)
We actually have a KB document explaining the process, however it was written for LabView. I have created a new generalized version for the shared NI-Reports component, and here is the text contained within:

Title:
How to save a report generated with NI-Reports in LabWindows/CVI, Measurement Studio for Visual C++ (ComponentWorks++), and LabView.


Problem:
I want to be able to save reports to disk and then recall them later, in order to print them. As it stands, the NI-Report functions allow me to print the report, but only during the existence of my report object at run-time of the program. I want to be able to save my reports for later use.



Solution :
NI-Reports is a shared component for the LabWindows/CVI, Measurement Studio for Visual C++ (ComponentWorks++), and LabView development tools, so the information contained in this document is relevant to all of them.

Here is the workaround:

You can add a new printer to your system's list of printers and configure it to print to a file, instead of a port. This will create a file that you can open and parse in your program at a later time, or open up in another application for printing (you won't be able to re-initialize a new report object with the data from this file though, the file is only intended to store your report on disk).

[ NOTE: You may be prompted for your Windows CD when you use this workaround, for step 6. ]

1. Go to Start >> Settings >> Printers and click on Add Printer to launch the Add Printer Wizard.

2. Select Local printer and click Next.

3. Under "Manufacturers" select Generic. This will give you the option Generic/Text only under "Printers". Click Next.

[ NOTE: You can also generate post-script (PS) or PDF (Adobe Acrobat Reader) documents using different kinds of printers (e.g., AST TurboLaser-PS). The printer type will also affect different properties of the printed output, i.e. whether or not certain fonts are honored, whether page breaks are honored, etc... The output file structure is wholly governed by the type of printer you select and is not a function of the NI-Reports library.]

4. Under "Available ports:" select FILE: Creates a file on disk. Click Next.

5. You will be asked to give the printer a name. You probably want to use a simple, one word name (like reports) that you can remember. You will also be asked, if you want this to be your default printer. Click Next.

6. Do not print a test page (select NO). Click Finish.

7. Now, when you print your NI-Reports report a dialog box will pop-up asking for a filename to use when it prints to the file. Make sure to include the entire path of where you want the file to be stored, i.e. c:\myreports\report.txt

Jason F.
Applications Engineer
National Instruments
www.ni.com/ask
Message 2 of 2
(2,780 Views)