Welcome to MSDN Blogs Sign in | Join | Help

Simple F# interop with Visio example

A example that launches visio, creates a document, and then draws a rectangle. Nothing surprising, but useful as a starting point for automation.

 

Source Code

#r @"C:\Windows\assembly\gac\microsoft.office.interop.visio\12.0.0.0__71e9bce111e9429c\Microsoft.Office.Interop.Visio.dll";;

let visio_app = new Microsoft.Office.Interop.Visio.ApplicationClass() ;;

let doc = visio_app.Documents.Add( "" );;

let page = doc.Pages.Item(1);;

let shape = page.DrawRectangle( 1.0, 1.0, 5.0, 4.0);;
do shape.Text <- "Hello World";;

 

Output

image

 

Notes

  • Nice to get Intellisense with F# when running in Visual Studio 2005
  • Next step is to use my "AutoVisio" assembly to make some nice drawings
Published Saturday, July 14, 2007 7:46 PM by saveenr

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# Visio Guy &raquo; Blog Archive &raquo; Interesting Blog With Cool Visio Topics

# Visio and F# interop: a more complex example

in July, I posted a very simple example showing how F# could be used to automate Visio . As my VisioAutoExt

Tuesday, January 15, 2008 11:10 AM by Saveen Reddy's blog

# Visio and F# interop: a more complex example

in July, I posted a very simple example showing how F# could be used to automate Visio . As my VisioAutoExt

Tuesday, January 15, 2008 12:08 PM by Noticias externas

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker