This can be done using the Process class and specifying the verb as ‘Print’. This is the equivalent of right clicking and selecting print in the windows shell. Here is the code snippet that prints documents like MS Excel, MS Word, pdf etc..
// In C#.NET //Print an Excel document Process pr = new Process(); pr.StartInfo.Verb = 'Print'; pr.StartInfo.FileName = 'Sample.xls'; pr.Start();
’ In VB.NET ’Print an Excel document Dim pr As Process = New Process() pr.StartInfo.Verb = 'Print' pr.StartInfo.FileName = 'Sample.xls' pr.Start()