Solved

Exporting a Data Report To .pdf file........

Posted on 2001-07-25
17
2,900 Views
Last Modified: 2013-12-02
I have a number of data reports that when exported loose their formating (boxes and lines). I know that if these reports are exported into .pdf format this will work.

I am using the following code, which works but does not create .pdf files in the correct format:

strTemplate = "MyCompany Daily Report" & vbCrLf & rptTagBody

' Add an ExportFormat object. The FileFormatString determines
' what will be displayed in the Export dialog box.
rptProjStdWeekRep5KP.ExportFormats.Add _
   Key:="StandardReport", _
   FormatType:=rptFmtText, _
   FileFormatString:="Standard Report (*.pdf)", _
   FileFilter:="*.pdf", _
   Template:=strTemplate


The problem I have is what is the correct FormatType so as the reports open in Adobe reader?
0
Comment
Question by:kenmck
  • 6
  • 4
  • 4
  • +3
17 Comments
 
LVL 3

Expert Comment

by:nigelrowe
Comment Utility
You mean that you have an appli which converts non-Adobe files to PDF format?
0
 

Author Comment

by:kenmck
Comment Utility
No I have an application that creates reports and I want to export them to .pdf format so as I do not lose the formating on the reports.

How do I do this?
0
 
LVL 3

Expert Comment

by:nigelrowe
Comment Utility
You will need either ADOBE Acrobat(not the reader), which is pretty expensive, or some type of plugin, either of which take Word docs, Excel etc, and convert them to PDF format. Which ever way you choose, I reckon you will have to pay. I don't know of any plug-ins, applications which do this and are free. Somebody else might know.
0
 

Author Comment

by:kenmck
Comment Utility
Crystal Reports does this. You click export and Adobe Acrobat (PDF) and it produces the report with the formatting as a .pdf file.

It's works and is easy to use.

Unfortunately I used the Microsoft Data Report writer (which comes with VB6) for all my reports, only to find that when you export a report you loose all the formatting. Which makes it useless. Who wants a report with no formatting?

The moral of the story is, use a proper reporting tool (such as Crystal Reports) rather than Microsoft's cobbled together effort!
0
 
LVL 3

Expert Comment

by:nigelrowe
Comment Utility
Exactly. The thing is, Crystal Reports is no longer free. It was supplied with VB up until VB4. As Adobe continues to make gasometer volumes of money with PDF format (look at the explosion of PDF files on the Internet) it does not seem likely that it will ever be available for free. If you have Crystal Reports (a version that converts to PDF that is, as I don't think the version supplied with VB could do that), use that instead.

I looked at the Microsoft Data Report writer. It seems that you have two choices in the ExportFormat bit, HTML or Text. I suppose HTML format is better than nothing, but it leaves a lot to be desired in termes of formatting. It's worth a try anyway.
0
 

Author Comment

by:kenmck
Comment Utility
You are correct, Html format does not export the lines and boxes which make the report look presentable thus, rendering the 'Export' from Data Reports nearly useless and certainly pointless.

The version of Crystal Reports I am running is 8.5 and is well worth the extra #150 - #200 that it costs as it is a proper tool that allows reports to be created and e-mailed easily.

It looks like I will need to recreate all the reports into Crystal Reports from Microsoft's Data Reports. It seems such an obvious thing to do (export the report and the formating) that I am surprised that Microsoft did not look at it!!
0
 
LVL 3

Expert Comment

by:nigelrowe
Comment Utility
Yes, but as I said, formatting to PDF costs money, that's one of the reasons(I suppose)why they don't give Crystal Reports for free anymore.

Maybe you should leave your question for a few more days, to see if anyone else has any suggestions or more positive comments. Then, if nobody comes up with a solution, delete it. I don't think you should give points for a non-solution.

Best of luck, Nigel
0
 
LVL 1

Expert Comment

by:garrenb
Comment Utility
Yep,

I've got to agree. Mocrosoft's Data report writer stinks. Crystal Reports Ver. 8.5 does all this & a lot more.

GarrenB
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Expert Comment

by:gdeluca
Comment Utility
Check out GhostScript. It has the ability to create PDF output. I've got it installed and followed the instructions to add a printer to which everything sent is converted to PDF format. (Real handy, it means that ANYTHING which I can print in windows from ANY application can be put to a PDF file!)

It does it through some convoluted means, the printer is first created as a PS style printer, and then the raw PS output from the PS Driver is piped into Ghostscript. This is all 'hooked' in to the printer setup in some automagic method I didn't really understand too well. I just followed the install instructions and it worked. Maybe there's a way to piggyback on this support.
0
 

Author Comment

by:kenmck
Comment Utility
gdeluca,

I have downloaded the software from the Internet but I cannot make head nor tale of how to setup a printer. Can you tell me how you did it?

This looks really useful and any help would be gratefully accepted.

Thanks,

Ken
0
 

Accepted Solution

by:
gdeluca earned 200 total points
Comment Utility
OK, it took me a while to figure out how I did all this. I looked through the Ghostscript doc files - nothing (like I'm sure you've done too)

Well, its because you need yet another package called RedMon (Redirection Port Monitor) to complete the puzzle. In the Help file of RedMon, under 'What is Ghostscript' you'll find the PDF printer setup instructions. The whole process is NOT for novices, but following step by step I did get it to work. If you install Ghostscript and/or Redmon to non-suggested directories (which I did) you must be very carefull to adjust things properly. The command line operands and script files etc. all point at each other and its easy to screw up (as I did). None of the screwing around caused any kind of system problems, so don't sweat that aspect. I did do a small write-up for a co-worker to do setup, but so far our combined filing system has defeated us. If it shows up I'll post it. If you can't find Redmon, I still have the install stuff.
0
 

Author Comment

by:kenmck
Comment Utility
gdeluca,

Thanks that works a treat!!

As you said, it was not the most straightforward bit of software to setup, but once done it is brilliant. Copies report images to .pdf format and keeps all formats. I have been looking for this for months.

Cheers,

Ken
0
 

Expert Comment

by:gdeluca
Comment Utility
I'm glad it will help. I'm always surprised that this combination of two tools is so little known. Being able to create PDF files from ANY application is worth its weight in gold.
0
 

Expert Comment

by:kennethcky
Comment Utility
Hi.....


I found the above informations very usefull to my current development which i wish if hope you guys can show or tell me how how do converting an application's report to PDF format.
As GhostScript was mentioned above and can anyone tell me
how can i get it and how to install it.


Any help will be appreciated


thanks



0
 

Author Comment

by:kenmck
Comment Utility
0
 

Expert Comment

by:AkonInfosys
Comment Utility
Can anybody explain the whole procedure to export DataReport to PDF using ghostscript or RenMon or whateve.
I am searching this topic since many days please help me.

I have written code in VB as follows

Dim RF As ExportFormat
Dim strTemplate As String
strTemplate = "MyCompany Daily Report" & vbCrLf & rptTagBody

Set RF = DataReport1.ExportFormats.Add _
   (Key:="StandardReport", _
   FormatType:=rptFmtText, _
   FileFormatString:="Standard Report (*.pdf)", _
   FileFilter:="*.pdf", _
   Template:=strTemplate)

DataReport1.ExportReport RF.Key, "C:\Test12.pdf", True, True, rptRangeFromTo, 1, 1

Right now it is exporting report to PDF but file is not opening with Acrobat 5.0.  What should i do?
Any help will be heartly appriciated.

Thanx
0
 

Expert Comment

by:gdeluca
Comment Utility
If you have installed Redmon and Ghostscript properly as per their included install instructions you should now have a new Printer installed on your system called "PDF Printer" (or some such name)

1. If you do NOT have such a printer, go back through the install instructions, you have overlooked or missed something.

2. If you DO have such a printer, then you need DO NOTHING SPECIAL in your VB application, just create a report as you would for your normal default printer.   When your  App runs, all you need to do is select the "PDF Printer" as the desired printer.  When printing starts, you will be prompted for the Path and Filename for the desired PDF file.

George
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

I. Introduction In a previous article (http://www.experts-exchange.com/Web_Development/Document_Imaging/A_6537-PaperPort-Upgrade-How-to-download-and-install-updated-versions-of-PaperPort-11-and-12.html) (now deprecated), I discussed how to upgrad…
In this article you will learn how to create a free basic website on Bitbucket, a git service provider. Polymer creates dynamic HTML components, which allow more flexibility than static HTML. This tutorial uses Ubuntu Linux but can also be done on W…
Microsoft Office Picture Manager has a Picture Shortcuts pane that shows a list with the Recently Browsed folders. While creating my video Micro Tutorial here at Experts Exchange showing How to Install Microsoft Office Picture Manager in Office 2013…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now