public Form1() { InitializeComponent(); Visio.Application application = new Visio.Application(); application.Visible = true; var doc = application.Documents.Add(""); Visio.IVPage page = application.ActivePage; var shape = page.DrawRectangle(0, 0, 2, 3); shape.Text = "With Microsoft.Office.Interop.Visio"; doc.Saved = true; var SID_SRCStream = new short[4]; SID_SRCStream[0] = (short)shape.ID16; SID_SRCStream[1] = (short)VisSectionIndices.visSectionObject; SID_SRCStream[2] = (short)VisRowIndices.visRowFill; SID_SRCStream[3] = (short)VisCellIndices.visFillForegnd; try { object[] a = null;// new Array[4]; page.GetFormulasTest(SID_SRCStream, out a); // page.GetFormulas(SID_SRCStream, out a); } catch (Exception exception) { Console.WriteLine(exception.ToString()); } try { application.Quit(); application.Dispose(); } catch { // may closed by user } }
public Form1() { InitializeComponent(); Visio.Application application = new Visio.Application(); application.Visible = true; var doc = application.Documents.Add(""); Visio.IVPage page = application.ActivePage; var shape = page.DrawRectangle(0, 0, 2, 3); shape.Text = "With Microsoft.Office.Interop.Visio"; doc.Saved = true; var SID_SRCStream = new short[4]; SID_SRCStream[0] = (short)shape.ID16; SID_SRCStream[1] = (short)VisSectionIndices.visSectionObject; SID_SRCStream[2] = (short)VisRowIndices.visRowFill; SID_SRCStream[3] = (short)VisCellIndices.visFillForegnd; try { object[] a = null;// new Array[4]; page.GetFormulasTest(SID_SRCStream, out a); // page.GetFormulas(SID_SRCStream, out a); } catch (Exception exception) { Console.WriteLine(exception.ToString()); } try { application.Quit(); application.Dispose(); } catch { // may closed by user } }
public void Quit() { switch (_officeApp) { case "Excel": _excelApplication.Quit(); break; case "Word": _wordApplication.Quit(); break; case "Outlook": _outlookApplication.Quit(); break; case "Power Point": _powerpointApplication.Quit(); break; case "Access": _accessApplication.Quit(); break; case "Project": _projectApplication.Quit(); break; case "Visio": _visioApplication.Quit(); break; default: throw new ArgumentOutOfRangeException("officeApp"); } }