Click here to Skip to main content
15,905,504 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
the excel File contain only one page.
Thank you for any help .

What I have tried:

  private void Print_Click(object sender, RoutedEventArgs e)
        {

print code ...


        }
Posted
Updated 23-Nov-17 7:31am

1 solution

C#
private void Print_Click(object sender, RoutedEventArgs e)
{
    System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo
    {
        FileName = @"Path\To\Your\excel_file.xls",
        Verb = "Print"
    });
}
 
Share this answer
 
Comments
EM_Y 24-Nov-17 3:20am    
thank you very much it works ,
but can you help me please to specify exactly the sheet that I want to print in this file !
EM_Y 27-Nov-17 4:39am    
this code is printing " the Evaluation warning sheet" witch is always activate when the excel file opened because I'm using spire.xls , I need to define in code the sheet number wich is zero here to print it .
Thank you for help !
Richard Deeming 28-Nov-17 8:13am    
If you need to control what gets printed, then you'll need to use Interop:
Printing Excel using Interop[^]
EM_Y 28-Nov-17 8:16am    
Thank you for your precious help ,it works !

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900