public void saveDoc(Word.Document doc, bool SaveInTable) { //our own function to be handled here if (!doc.ReadOnly) { doc.Save(); } ApplicationClass ap = new ApplicationClass(); while (ap.BackgroundSavingStatus > 0) { System.Threading.Thread.Sleep(250); } if (FileID != string.Empty && SaveInTable) { string content = doc.Content.Text; object dummy = null; wAppC.Documents.Close(ref dummy, ref dummy, ref dummy); wDoc = null; if (TableName == "tempdocs" && FileID != string.Empty) { TempDocManager.EditFile(FileID, filename, content); FileID = string.Empty; } else if (TableName == "filedocs" && FileID != string.Empty) { FileDocManager.EditFile(FileID, filename, content); FileID = string.Empty; } } //////else //////{ ////// if (!doc.ReadOnly ) ////// doc.Save(); //////} //////ApplicationClass ap = new ApplicationClass(); ////// while (ap.BackgroundSavingStatus > 0) //////{ ////// System.Threading.Thread.Sleep(250); //////} }
private static void saveFileToParegooDB() { try { PareGooWord.Globals.ThisAddIn.Application.ActiveDocument.Save(); Microsoft.Office.Interop.Word.Shapes tx = PareGooWord.Globals.ThisAddIn.Application.ActiveDocument.Shapes; for (int i = 0; i < tx.Count; i++) { try { if (tx[i].Type == Microsoft.Office.Core.MsoShapeType.msoTextBox) { if (tx[i].TextFrame.TextRange.Text != "\r" && tx[i].TextFrame.TextRange.Text != " \r") { content += tx[i].TextFrame.TextRange.Text.Trim() + " "; } } } catch (Exception ex) { } } if (tableName == "tempdocs" && fileID != string.Empty) { TempDocManager.EditFile(fileID, filePath, content, conString); } else if (tableName == "filedocs" && fileID != string.Empty) { FileDocManager.EditFile(fileID, filePath, content, conString); } else if (tableName == "deskdocs" && fileID != string.Empty) { Lawyer.Common.VB.Timing.TimingManager.EditTimeDocs(filePath, fileName, conString); } if (tableName != string.Empty && fileID != string.Empty) { System.Windows.Forms.MessageBox.Show("فایل ذخیره شد"); } } catch (Exception ex) { System.Windows.Forms.MessageBox.Show("خطا در آفیس:" + "\r\n" + ex.Message); } }