示例#1
0
        public static void SyncPageNames()
        {
            VisioHelper.DisplayInWatchWindow(string.Format("{0}()",
                                                           System.Reflection.MethodBase.GetCurrentMethod().Name));

            Visio.Application app = Globals.ThisAddIn.Application;

            Visio.Document doc = app.ActiveDocument;

            List <Visio.Page> pagesToUpdate = new List <Microsoft.Office.Interop.Visio.Page>();

            VisioHelper.DisplayInWatchWindow(string.Format("Document({0})", doc.Name));

            foreach (Visio.Page page in doc.Pages)
            {
                if (!page.Name.Equals(page.NameU))
                {
                    pagesToUpdate.Add(page);
                }
            }

            foreach (Visio.Page page in pagesToUpdate)
            {
                Visio_Page.SyncPageNames(page);
            }
        }
示例#2
0
        public static void DisplayLayer(string layerName, bool show)
        {
            VisioHelper.DisplayInWatchWindow(string.Format("{0}(layer:{1} show:{2})",
                                                           System.Reflection.MethodBase.GetCurrentMethod().Name, layerName, show.ToString()));

            foreach (Visio.Page page in Globals.ThisAddIn.Application.ActiveDocument.Pages)
            {
                Visio_Page.DisplayLayer(page, layerName, show);
            }
        }
示例#3
0
        public static void RemoveLayers()
        {
            VisioHelper.DisplayInWatchWindow(string.Format("{0}()",
                                                           System.Reflection.MethodBase.GetCurrentMethod().Name));

            Visio.Application app = Globals.ThisAddIn.Application;
            Visio.Document    doc = app.ActiveDocument;

            foreach (Visio.Page page in doc.Pages)
            {
                Visio_Page.DeleteLayers(page);
            }
        }
示例#4
0
        public static void AutoSizePagesOn()
        {
            VisioHelper.DisplayInWatchWindow(string.Format("{0}()",
                                                           System.Reflection.MethodBase.GetCurrentMethod().Name));

            int undoScope = Globals.ThisAddIn.Application.BeginUndoScope("AutoSizePagesOn");

            Visio.Application app = Globals.ThisAddIn.Application;

            Visio.Document doc = app.ActiveDocument;

            foreach (Visio.Page page in doc.Pages)
            {
                Visio_Page.AutoSizePageOn(page);
            }

            Globals.ThisAddIn.Application.EndUndoScope(undoScope, true);
        }
示例#5
0
        public static void SavePages()
        {
            VisioHelper.DisplayInWatchWindow(string.Format("{0}()",
                                                           System.Reflection.MethodInfo.GetCurrentMethod().Name));

            Visio.Application app  = Globals.ThisAddIn.Application;
            Visio.Document    doc  = app.ActiveDocument;
            Visio.Page        page = app.ActivePage;

            foreach (Visio.Shape shape in page.Shapes)
            {
                VisioHelper.DisplayInWatchWindow(string.Format("Name: {0}  Text: {1}", shape.Name, shape.Text));
                try
                {
                    Visio_Page.SavePage(doc.Pages[shape.Text]);
                }
                catch (Exception ex)
                {
                    Log.Error(ex, Common.LOG_CATEGORY);
                }
            }
        }
示例#6
0
        public static void AddDefaultLayers()
        {
            VisioHelper.DisplayInWatchWindow(string.Format("{0}()",
                                                           System.Reflection.MethodBase.GetCurrentMethod().Name));

            Visio.Application app = Globals.ThisAddIn.Application;

            Visio.Document doc = app.ActiveDocument;

            if (doc == null)
            {
                System.Windows.Forms.MessageBox.Show("No ActiveDocument");
                return;
            }

            int undoScope = Globals.ThisAddIn.Application.BeginUndoScope("AddDefaultLayers");

            foreach (Visio.Page page in doc.Pages)
            {
                Visio_Page.AddDefaultLayers(page);
            }

            Globals.ThisAddIn.Application.EndUndoScope(undoScope, true);
        }