Solved

Export Dataset/Datagrid into .PDF format

Posted on 2004-04-16
6
2,615 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Is Your Team Achieving Their Full Potential?

74% of employees feel they are not achieving their full potential. With Linux Academy, not only will you strengthen your team's core competencies but also their knowledge of of the newest IT topics.

With new material every week, we'll make sure that you stay ahead of the game.

 
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

Quiz: What Do These Organizations Have In Common?

Hint: Their teams ended up taking quizzes, too.

Question has a verified solution.

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

The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

688 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