Reputation: 332
the following 2 code lines cause my program to somehow not continue the rest of the methods code:
Microsoft.Office.Interop.Word.Application WordApp = new Microsoft.Office.Interop.Word.Application();
WordApp.DisplayAlerts = Microsoft.Office.Interop.Word.WdAlertLevel.wdAlertsNone;
document = WordApp.Documents.Add();
document.PageSetup.TopMargin = 5;
document.PageSetup.Orientation = WdOrientation.wdOrientLandscape;
The application does not freeze. Every single breakpoint after these lines will never be reached.
If I take these lines out, the rest of the code runs through and works fine.
Upvotes: 1
Views: 559
Reputation: 332
Resolved: The problems cause was the network printer. Because word needs a connection to a printer to set Page setup and it couldn't establish the connection to the printer, it waited. Setting the default printer to another one solved the issue.
Upvotes: 1