Printing of dataset in excel (Windows application)  
Author Message
pc_bond





PostPosted: Visual Basic General, Printing of dataset in excel (Windows application) Top

YOz guyz!

How can i print from excel the dataset 's data by the specific query only for eg...



Visual Basic22  
 
 
spotty





PostPosted: Visual Basic General, Printing of dataset in excel (Windows application) Top

You have a couple of alternative - one may be to write the dataset contents to a CSV file which Excel can read and then load this CSV file into excel and using the Excel Object Model to print out the file.

The other would be to create a specific excel spreadsheet by writing to the excel cells prior to printing it out.

As for getting the data into either the csv or excel spreadsheet - you will need to iterate over the rows and columns to write the contents. THis is easily achieved using a simple nested for each construct for the rows and columns.


Either way you are going to need to use the Excel Object model to initate a print from Excel programatically - the following are some articles which have helped people in the past get going with Excel automation.

Another article which shows communicating with an Excel spreadsheet is

http://support.microsoft.com/kb/q301982/

http://msdn.microsoft.com/vbasic/downloads/code/101samples/#vsto

http://www.vbdotnetheaven.com/Code/Jul2003/2124.asp