Does anybody have any idea how to print an excel file programatically using C# and the Excel Interop? If so, can you please provide code?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In order to print, you can make use of the Worksheet.PrintOut() method. You can omit any or all of the optional arguments by passing in Type.Missing. If you omit all of them, it will default to printing out one copy from your active printer. But you can make use of the arguments to set the number of copies to print, collation, etc. See help on the Worksheet.PrintOut() method for more.
The example they show in the help file is:
But unless you need to change the default settings, you can simply pass in Type.Missing for all the arguments. Here’s an example using automation to open an Excel Workbook, print the first page, and then shut down:
Hope this helps!
Mike