Solved

Export Dataset/Datagrid into .PDF format

Posted on 2004-04-16
6
2,596 Views
Last Modified: 2012-06-27
Hello,

I found a way to export a dataset/datagird into Excel using the below code, BUT is there a way to do the same thing but export the data into an organized .PDF file, as long as it's not "Action Reports" or any other component I have to buy?

                'Open the file as a stream to read or write
                Dim objExcel As Object
                Dim objBook As Object
                Dim objSheet As Object
                objExcel = CreateObject("Excel.Application")
                objBook = objExcel.Workbooks.Add
                objSheet = objBook.Worksheets(1)

                'Set up the Query Table and tell it where to find the data.
                Dim objQryTable As Object
                objQryTable = objSheet.QueryTables.Add("OLEDB;Provider=sqloledb;Data Source=MyDataSource" & _
                    ";Initial Catalog=MyDatabase" & _
                    ";Trusted Connection=Yes;Integrated Security=SSPI;", objSheet.Range("A1"), strSQL)
                objQryTable.RefreshStyle = 2 ' x1InsertEntire Rows = 2
                objQryTable.Refresh(False)

                'sPath is a string containing the location to save the file to
                objBook.SaveAs(objSaveDialog.FileName)
                'Clear everything so you can display it to the user
                objQryTable = Nothing
                objSheet = Nothing
                objBook = Nothing
                objExcel.Quit()
                objExcel = Nothing

Thanks!

Chris
0
Comment
Question by:Trancedified
  • 3
  • 2
6 Comments
 
LVL 7

Expert Comment

by:ramesh12
ID: 10847020
I think you can use CrystalReports with in .Net to create a report and have that exported/saved to PDF format
0
 
LVL 7

Expert Comment

by:ramesh12
ID: 10847043
0
 
LVL 7

Assisted Solution

by:ramesh12
ramesh12 earned 250 total points
ID: 10847047
0
Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

 
LVL 1

Author Comment

by:Trancedified
ID: 10861945
Yeah crystal reports works, all you do is hit a button, but is there a way to do this w/out Crystal reports?


Chris
0
 
LVL 8

Accepted Solution

by:
nishikanth earned 250 total points
ID: 10875147
0
 
LVL 1

Author Comment

by:Trancedified
ID: 10954445
nishikanth,

I am able to export to Excel, that is how I had it, but how would you export to .PDF format WITHOUT using crystal reports?

Thanks!

Chris
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

790 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