Solved

Export Dataset/Datagrid into .PDF format

Posted on 2004-04-16
6
2,583 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

911 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

21 Experts available now in Live!

Get 1:1 Help Now