2009-10-26 4 views
1

J'essaie d'imprimer des documents PowerPoint via mon application Windows en C#. J'utilise Microsoft.Office.Interop.PowerPoint pour cette fonctionnalité. Voici le code que j'ai utilisé. Il envoie la demande à l'imprimante mais rien ne s'imprime.PowerPoint Impression C# - Rien ne s'imprime

string filename = "C:\\test.ppt"; 
int copies = 1; 

Microsoft.Office.Interop.PowerPoint.Presentation work = null; 
Microsoft.Office.Interop.PowerPoint.Application app = new Microsoft.Office.Interop.PowerPoint.ApplicationClass(); 
Microsoft.Office.Interop.PowerPoint.Presentations presprint = app.Presentations; 

work = presprint.Open(filename, Microsoft.Office.Core.MsoTriState.msoCTrue, Microsoft.Office.Core.MsoTriState.msoCTrue, Microsoft.Office.Core.MsoTriState.msoFalse); 
//app.Visible = Microsoft.Office.Core.MsoTriState.msoTrue; 
work.PrintOptions.PrintInBackground = Microsoft.Office.Core.MsoTriState.msoFalse; 
//work.PrintOptions.PrintInBackground = Microsoft.Office.Core.MsoTriState.msoTrue; 
//work.PrintOptions.ActivePrinter = "HP LaserJet 5000 Series PCL6"; 
work.PrintOptions.ActivePrinter = app.ActivePrinter;  
work.PrintOut(1, work.Slides.Count, app.ActivePrinter, copies, Microsoft.Office.Core.MsoTriState.msoFalse); 

work.Close(); 
app.Quit();` 

Répondre

0

Lors du débogage, essayez l'arrêt après work.PrintOut et vérifiez votre imprimante pour voir si les travaux arrivent. Je suppose que vous fermez PowerPoint trop vite.