public static void CreateMultiLOEP(Word.Document Doc, List <loepDocument> loepDocumentArray) { DocSettings DS = new DocSettings(Doc); DS.CreateMultiLOEP(loepDocumentArray); trackChange(Doc, true); }
public static void ChangesExport(Word.Document Doc) { DocSettings DS = new DocSettings(Doc); DS.ChangesExport(); trackChange(Doc, true); }
public static void ProcessMonitoring(Word.Document Doc) { DocSettings DS = new DocSettings(Doc); for (int i = 1; i <= DS.GetPageNumber(Doc); i++) { DS.changePageData(i); } DS.UpDateFields(); }
public static void initTOC(Word.Document Doc) { DocSettings DS = new DocSettings(Doc); DS.IsAlert = true; if (Doc.TablesOfContents.Count < 0) { MessageBox.Show("Cant Find TOC in DOC"); return; } DS.initTOC(); DS.initTOF(); trackChange(Doc, true); }
public void PageRevisionForm(Office.IRibbonControl control) { if (!isActiveAddin()) { return; } if (settings.monitorDoc) { MessageBox.Show("Auto Rivision on, Please Turn off"); return; } if (settings.page_rev_frm != null) { settings.page_rev_frm.Close(); settings.page_rev_frm.Dispose(); settings.page_rev_frm = null; } Doc = Globals.ThisAddIn.Application.ActiveDocument; DocSettings DS = new DocSettings(Doc); if (settings.check_if_edoc(Doc)) { Doc.Application.ScreenUpdating = false; settings.trackChange(Doc, false); settings.page_rev_frm = new PageRevisionFrm(Doc); if (settings.last_rev != "") { settings.page_rev_frm.page_rev.Text = settings.last_rev; } if (settings.last_date == "") { settings.last_date = DateTime.Now.Date.ToString("d", DateTimeFormatInfo.InvariantInfo); } settings.page_rev_frm.date_rev.Text = settings.last_date; System.Drawing.Point cursor_pos = new System.Drawing.Point(Cursor.Position.X - 50, Cursor.Position.Y - 10); settings.page_rev_frm.Location = cursor_pos; Doc.Application.ScreenUpdating = true; settings.trackChange(Doc, true); settings.page_rev_frm.Show(); } else { MessageBox.Show("eDoc Only"); } }
public void insertText(string filedName, Word.Range rng) { if (!isActiveAddin()) { return; } Doc = Globals.ThisAddIn.Application.ActiveDocument; if (!settings.check_if_edoc(Doc)) { MessageBox.Show("eDoc Only"); return; } settings.trackChange(Doc, false); DocSettings DS = new DocSettings(Doc, "WTF"); DS.InesrtRevDatatoAllHeadingCells(filedName, rng); DS.UpDateFields(); }
public void insertSectionPageTemplateText(Office.IRibbonControl control) { if (!isActiveAddin()) { return; } Doc = Globals.ThisAddIn.Application.ActiveDocument; /** * string pageCode = "X-P1"; * try{ * pageCode = Doc.Variables["pageTemplate"].Value; * } * catch{} * insertText(pageCode, Doc.Application.Selection.Range); * BuildFields( "\"edocs_Page_" + data + "\"", data); **/ Word.Range range = Doc.Application.Selection.Range; int rangeStart = range.Start; range.Text = " "; range.End = range.Start; range.Fields.Add(range, Word.WdFieldType.wdFieldDocVariable, "\"edocs_Page_\"", false); range.SetRange(rangeStart + 26, rangeStart + 26); range.Fields.Add(range, Word.WdFieldType.wdFieldDocVariable, "\"pageTemplate\"", false); range.SetRange(rangeStart + 25, rangeStart + 25); range.Fields.Add(range, Word.WdFieldType.wdFieldDocVariable, "\"edocs_Page_page\"", false); range.Start = range.Start + 25; range.Fields.Add(range, Word.WdFieldType.wdFieldEmpty, @"PAGE \* ARABIC", false); DocSettings DS = new DocSettings(Doc, "WTF"); DS.UpDateFields(); }
public static void process_doc(Word.Document Doc, string type) { DocSettings DS = new DocSettings(Doc); DS.IsAlert = true; int DocPageNumber = DS.GetPageNumber(Doc); System.Diagnostics.Debug.WriteLine("DocPageNumber process doc - " + DocPageNumber); if (DS.PageNumberFromHeaders(DocPageNumber, type)) { if (settings.monitorDoc) { DS.processMonitoring(); settings.monitorDoc = false; } } DS.UpDateFields();; trackChange(Doc, false); Doc.Application.ActiveWindow.VerticalPercentScrolled = 0; Globals.ThisAddIn.m_Ribbon.ribbon.InvalidateControl("toggleButton_ribbon"); Globals.ThisAddIn.m_Ribbon.ribbon.InvalidateControl("rev_cbo"); Globals.ThisAddIn.m_Ribbon.ribbon.InvalidateControl("date_cbo"); }
public static int BuildTable_ListOfEffctivePage(DocSettings DS, Word.Table tbl, int PageNum, int FirstHeaderPage) { int pagesSum = 1; PageNum = PageNum - FirstHeaderPage; int startPageNumber = PageNum; int RowToadd = 0; while (pagesSum * 2 < PageNum) { if (settings.alert.worker.CancellationPending) { return(-1); } RowToadd = (PageNum / 2) - pagesSum; if (PageNum % 2 != 0) { RowToadd = RowToadd + 1; } tbl.Rows[tbl.Rows.Count].Select(); DS.Doc.Application.Selection.InsertRowsBelow(RowToadd); pagesSum = tbl.Rows.Count - 2; PageNum = DS.GetPageNumber() - FirstHeaderPage; } if (PageNum % 2 != 0) { tbl.Cell(tbl.Rows.Count, 5).Range.Text = "x"; tbl.Cell(tbl.Rows.Count, 6).Range.Text = "x"; tbl.Cell(tbl.Rows.Count, 7).Range.Text = "x"; tbl.Cell(tbl.Rows.Count, 8).Range.Text = "x"; } return(PageNum - startPageNumber); }
private void PageRevisionFrm_Load(object sender, EventArgs e) { DS = new DocSettings(Doc); settings.trackChange(Doc, false); int DocPageNumber = DS.GetPageNumber(Doc); string pageRev = ""; string eDocPage = ""; string pageDate = ""; string pageIssue = ""; string pageEffectiveDate = ""; string text1 = ""; string text2 = ""; string text3 = ""; string text4 = ""; firstClickItemIndex = 0; try { this.date_rev.Text = Doc.Variables["last_date_rivision"].Value; } catch { } try { this.page_rev.Text = Doc.Variables["last_page_rivision"].Value; } catch { } try { this.issueText.Text = Doc.Variables["last_issue"].Value; } catch { } try { this.effectiveText.Text = Doc.Variables["last_effective_date"].Value; } catch { } try { this.text1_text.Text = Doc.Variables["last_text1_value"].Value; } catch { } try { this.text2_text.Text = Doc.Variables["last_text2_value"].Value; } catch { } try { this.text3_text.Text = Doc.Variables["last_text3_value"].Value; } catch { } try { this.text4_text.Text = Doc.Variables["last_text4_value"].Value; } catch { } for (int i = 1; i <= DocPageNumber; i++) { Cursor.Current = Cursors.WaitCursor; pageRev = getVarString("rev", i); try { string pageTemplate = Doc.Variables["pageTemplate"].Value; switch (pageTemplate) { case "X-P1": eDocPage = getVarString("X-P1", i); break; case "X-P-1": eDocPage = getVarString("X-P-1", i); break; case "X1": eDocPage = getVarString("X1", i); break; } } catch { eDocPage = getVarString("page", i); } pageDate = getVarString("date", i); pageIssue = getVarString("issue", i); pageEffectiveDate = getVarString("effective", i); text1 = getVarString("text1", i); text2 = getVarString("text2", i); text3 = getVarString("text3", i); text4 = getVarString("text4", i); string[] row = { i.ToString(), eDocPage, pageRev, pageDate, pageIssue, pageEffectiveDate, text1, text2, text3, text4 }; var listViewItem = new ListViewItem(row); pageView.Items.Add(listViewItem); } pageView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize); Cursor.Current = Cursors.Default; settings.trackChange(Doc, true); }
public static void moveToNewVersion(Word.Document Doc) { DocSettings DS = new DocSettings(Doc); DS.moveToNewVersion(); }
public static void init_ListOfE_New(Word.Document RealDoc) { // JUST FOR ADD PAGES TO //BuildTable_ListOfEffctive_BigData(RealDoc, RealDoc.Tables[2]); // return; //END OF BIG DATA Object SelectionNext; DocSettings DS = new DocSettings(RealDoc); SelectionNext = RealDoc.Application.Selection.End; Word.Range rangeForToCopy = RealDoc.Range(ref SelectionNext, ref SelectionNext); int pageSize = 4; if (rangeForToCopy.PageSetup.PaperSize == Word.WdPaperSize.wdPaperA5) { pageSize = 5; } int currentPageNum = Convert.ToInt32(RealDoc.Application.Selection.get_Information(Microsoft.Office.Interop.Word.WdInformation.wdActiveEndPageNumber)); object currentPageNumToRef = currentPageNum; Word.Document DocOfE = null; try { DocOfE = Globals.ThisAddIn.Application.Documents.Add(LOEPPath(pageSize)); } catch (Exception ex) { MessageBox.Show("Something Went Wrong - " + ex.Message); OpenFileDialog openFile = new OpenFileDialog(); openFile.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); openFile.Title = "Select Word Template"; openFile.FileName = ""; openFile.Filter = "Word Documents (*.doc;*.docx)|*.doc;*.docx"; if (openFile.ShowDialog() == System.Windows.Forms.DialogResult.OK) { DocOfE = Globals.ThisAddIn.Application.Documents.Add(openFile.FileName); } else { settings.alert.Close(); } } Cursor.Current = Cursors.WaitCursor; DocOfE.Tables[1].Range.Copy(); rangeForToCopy.PasteAndFormat(Word.WdRecoveryType.wdFormatOriginalFormatting); try { int DocPageNumber = DS.GetPageNumber(RealDoc); RealDoc.Activate(); int FirstHeaderPage = 0; int pageToDo = BuildTable_ListOfEffctivePage(DS, rangeForToCopy.Tables[1], DocPageNumber, FirstHeaderPage); copyCellsToTable(rangeForToCopy.Tables[1], DocOfE.Tables[2], (DocPageNumber + pageToDo - FirstHeaderPage), FirstHeaderPage); DocOfE.Close(ref saveOption, ref originalFormat, ref routeDocument); if (pageToDo > 0) { try { string PageString = RealDoc.Variables["edocs_Page" + currentPageNum + "_page"].Value; string PageRev = RealDoc.Variables["edocs_Page" + PageString + "_rev"].Value; string PageDate = RealDoc.Variables["edocs_Page" + PageString + "_date"].Value; for (int i = currentPageNum + 1; i <= currentPageNum + pageToDo; i++) { string PageString2 = RealDoc.Variables["edocs_Page" + i + "_page"].Value; RealDoc.Variables["edocs_Page" + PageString2 + "_rev"].Value = PageRev; RealDoc.Variables["edocs_Page" + PageString2 + "_date"].Value = PageDate; } } catch { } } try { string test1 = RealDoc.Variables["processType"].Value; } catch { RealDoc.Variables.Add("processType", "styles"); } if (pageToDo == -1 || !DS.PageNumberFromHeaders(DocPageNumber + pageToDo, RealDoc.Variables["processType"].Value)) { RealDoc.Application.ScreenUpdating = true; } RealDoc.Application.Selection.GoTo(ref what, ref which, ref currentPageNumToRef, ref missing); trackChange(RealDoc, true); } catch (Exception ex) { trackChange(RealDoc, true); RealDoc.Application.ScreenUpdating = true; MessageBox.Show("Something Went Wrong - " + ex.Message); settings.alert.Close(); } Cursor.Current = Cursors.Default; rangeForToCopy.Tables[1].Range.Fields.Locked = 0; rangeForToCopy.Tables[1].Range.Fields.Update(); DS.UpDateFields(); }