Reputation: 119
Let's say I want to convert a PowerPoint file to a PDF file using Office Interop:
using Microsoft.Office.Core;
using Microsoft.Office.Interop.PowerPoint;
Application app = null;
try
{
app = new Application();
Presentation doc = app.Presentations.Open("Document.pptx", MsoTriState.msoFalse, MsoTriState.msoFalse, MsoTriState.msoFalse);
doc.SaveAs("Document.pdf", PpSaveAsFileType.ppSaveAsPDF, MsoTriState.msoFalse);
doc.Close();
}
finally
{
if (app != null)
app.Quit();
app = null;
}
How can I cancel that?
SaveAs may require an unreasonable amount of time to finish in case the document is sufficiently complex. So, the user may want to cancel.
Upvotes: 0
Views: 40