Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I print to file using CNiReports object?

Hello,
I am trying to print to file using CNiReports. I understand there is a Print() function that would let you print it to a printer. Is there a way to print this report to a file instead?

Thanks,
Hy
0 Kudos
Message 1 of 7
(3,681 Views)
I don't think that CNiReport has anything to support this. I haven't tried this, but you might be able to do this by configuring a local printer to print to a file and then specify the name of that configured printer to the Print method. To set this up, go to the Add Printer Wizard in Control Panel, select "Local printer" in the first step, select "Use the following port" in the next step and select FILE: port option in the listview below the option, then follow the rest of the steps in the wizard. Hope this helps.

- Elton
0 Kudos
Message 2 of 7
(3,681 Views)
Hi Elton,

Thanks for the heads up! I have tried it. It is in a .prn format. I am guessing it's a PostScript printer format. Is there a way to get just a text file out of it?

Thanks for your assistance,
Hy
0 Kudos
Message 3 of 7
(3,681 Views)
I'm not sure what a .prn file is. If it is a postscript file, there should be tools that you can find on the web that will convert it from postscript to text. Off the top of my head, I think that Ghostscript has a tool called ps2ascii that will convert postscript to text. Try searching for ps2ascii on Google.

- Elton
0 Kudos
Message 4 of 7
(3,681 Views)
Hi Elton,

Yep, it is PostScript. When you print to file, Windows save it with that printer formating, so you can print with any other printer which is PostScript. So you won't be able to view it cleanly with Word or any other text editing tool.

Thanks,
Hy
0 Kudos
Message 5 of 7
(3,681 Views)
Hy,

Actually Adobe Acrobat and GhostScript should both be able to view and search the postscript file. You may need to change the extension from .prn to .ps.

Tony
NI - Measurement Studio
0 Kudos
Message 6 of 7
(3,681 Views)
Tony,

Yes, I know. The key is your printer driver has to support PostScript. So when you want to print to file, it does it in PostScript format. Otherwise, I don't know what format it is in.

I just wanted to convert the PostScript format to text so that I can imported into Excel for additional graph and stuff like that.

Thanks,
Hy
0 Kudos
Message 7 of 7
(3,681 Views)