Note that there are some explanatory texts on larger screens.

plurals
  1. POWord is trying to recover
    text
    copied!<p>We are currently processing big word documents in c# program. During processing i am getting message "Microsoft Windows has stopped working".</p> <p>The program reads the word document based on the comments added to the document and processes the images and other text in the document and also creates lot of independent word documents with content from the original document.</p> <p>What is the reason for the problem? Is this because word documents are created, opened and closed so frequently?</p> <p>Program Steps: 1) Copy the content referred by the comment in the doc to clipboard</p> <pre><code> comment.Scope.CopyAsPicture(); </code></pre> <p>2) Then process convert the content to "html" or "plain" image by</p> <pre><code> public String _GetContentFromClipboard() { String text = ""; if (Clipboard.GetData(DataFormats.Html) != null) { text = Clipboard.GetData(DataFormats.Html).ToString(); } else { IDataObject iData = Clipboard.GetDataObject(); if (iData.GetDataPresent(DataFormats.Bitmap)) { Image image = iData.GetData(DataFormats.Bitmap, true) as Image; String imageFile = Guid.NewGuid().ToString() + ".jpg"; image.Save(imageFile, System.Drawing.Imaging.ImageFormat.Jpeg); text = "&lt;img src=\"" + imageFile + "\" width=\"" + image.Width + "\" height=\"" + image.Height + "\" /&gt;"; } } return text; } </code></pre> <p>3) Also sometimes save the content from the clipboard to new word document</p> <pre><code> public String SaveClipboardContentToDoc(bool removeComments) { Object docName = GeneralUtil.GetTempFileWithoutExtension() + ".docx"; Microsoft.Office.Interop.Word.Application oWord = new Microsoft.Office.Interop.Word.Application(); Microsoft.Office.Interop.Word.Document oDoc = new Microsoft.Office.Interop.Word.Document(); oDoc = oWord.Documents.Add(ref missingObj, ref missingObj, ref missingObj, ref missingObj); oWord.DisplayAlerts = Microsoft.Office.Interop.Word.WdAlertLevel.wdAlertsNone; oWord.Visible = false; oDoc.ActiveWindow.Selection.Paste(); if (removeComments == true) { foreach (Comment selectionComment in oDoc.Comments) { selectionComment.Delete(); } } oDoc.SaveAs(ref docName, ref missingObj, ref missingObj, ref missingObj, ref missingObj, ref missingObj, ref missingObj, ref missingObj, ref missingObj, ref missingObj, ref missingObj, ref missingObj, ref missingObj, ref missingObj, ref missingObj, ref missingObj); ((Microsoft.Office.Interop.Word._Document)oDoc).Close(ref missingObj, ref missingObj, ref missingObj); ((Microsoft.Office.Interop.Word._Application)oWord).Quit(ref missingObj, ref missingObj, ref missingObj); return docName.ToString(); } </code></pre> <p>The initial warning message is </p> <pre><code>"Microsoft Windows has stopped working" Windows can check online for a solution to the problem and try to recover your information. Check online for a solution and close the program close the program Debug the program Then clicking on debug leads to " "An unhandled win32 execption occurred in WINWORD.EXE [7372]" </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload