Suppose you have a shape in test.vsd:
use strict;
use warnings;
use Win32::OLE;
$Win32::OLE::Warn = 3;
my $path = "D:\\FilePath\\";
my $file = "test.vsd";
my $Visio = Win32::OLE->new('Visio.Application', 'Quit');
my $VDocs = $Visio->Documents;
my $VDoc = $VDocs->Open("$path$file");
my $VPage = $VDoc->Pages->Item(1);
my $VShapes = $VPage->Shapes;
my $VShape = $VShapes->Item(1);
$VShape->{Text} = "Biggie Ole";
print $VShape->{Text};
$VDoc->SaveAs($path."test2.vsd");
Open Up the Shrinkwrap with OLE is a good (albeit old) article on Visio OLE (a 2MB PDF). |