Solved

Export Dataset/Datagrid into .PDF format

Posted on 2004-04-16
6
2,577 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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

706 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

16 Experts available now in Live!

Get 1:1 Help Now