Reputation: 1916
I work regularly in Visio to make diagrams/charts/etc. and need to export them to PNG for the rest of my team to consume. Doing this manually starts to become a problem as charts are continuously updated.
What I want is that everytime the visio file is changed, the exported PNGs are updated to a new version automatically. How do I do that?
Upvotes: 0
Views: 487
Reputation: 179
Micky is correct, there is an export Com Method (http://msdn.microsoft.com/en-us/library/ms427146%28v=office.12%29.aspx) that you can use. However, what you really want is like a filewatcher to notice whenever a file is modified?
That's kind of a separate question, so I'll focus this answer on just how to export out a visio document as a PNG file.
$visioApp = New-Object -ComObject Visio.Application
$visioApp.visible = $false
[void]$visioApp.Documents.Add("C:\temp\drawing1.vsdx")
foreach($page in $visioApp.ActiveDocument.Pages) {
$page.Export("C:\temp\$($page.name).png")
}
To export out whenever the file change you'd need to use filewatcher, one of the Com events on document changing available in the namespace, or just have a scheduled task that iterated through a directory and exported them out on a given schedule.
Upvotes: 1