Visio - Perl extension mainpulating XML based Visio files


Visio documentation  | view source Contained in the Visio distribution.

Index


NAME

Top

Visio - Perl extension mainpulating XML based Visio files

SYNOPSIS

Top

To create a viso vdx file, create multiple pages, reorient one of the pages:

  my $v = new Visio();
  $v->set_title('wabla wabla');
  $v->set_timeCreated();
  $v->set_timeSaved()

  my $page = $v->addpage();
  $page->set_name('my page');
  $page->set_heightWidth(8,11);

  my $page2 = $v->addpage();
  $page2->set_name('my page2');

  $v->toFile('myvisofile.vdx');

ABSTRACT

Top

  Visio is an alpha stage library to create and manipulate Microsoft Visio
  drawings.

DESCRIPTION

Top

  Visio is an alpha stage library to create and manipulate Microsoft Visio
  drawings.

  Currently it can only create drawings from scratch, and can not
  create a usable object model from a pre-existing file.

  The Visio module is however able to extract stencils from pre-existing
  files and insert them into your new drawings. This is helpfull as 
  it is fairly difficult to make a nice drawing on your own via the 
  current Visio perl module API.

  This is my first public Perl module, and I'm sure there are tons of 
  mistakes. Please feel free to communicate any design flaws or reworking
  you may feel would make Visio more usable and approachable.

Document Methods

Top

new()

A new Visio document is created using the new method:

 my $vDoc = new Visio();

By default the document is completely empty and the document creator is set to 'perl-visio'. This can be overwritten by use of the set_creator method.

toString()

Visio document is returned as an XML string.

 my $vString = $vDoc->toString;

toFile($filename)

Visio doc is written out to an XML file.

 $vDoc->toFile('myfile.vdx');

toXmlDoc()

libxml2 doc element is returned

 $vDoc->toXmlDoc();

set_title($title)

Sets Document title

 $vDoc->set_title('my title');

set_subject($subject)

Sets Document subject

 $vDoc->set_subject('my subject');

set_manager($manager)

Sets Document manager field

 $vDoc->set_manager('my manager');

set_company($company)

Sets company filed in document.

 $vDoc->set_company('my company');

set_desc($desc)

Sets Document description.

 $vDoc->set_desc('my really good description');

set_creator($creator)

Sets Document creator field.

 $vDoc->set_creator('just me');

set_timeCreated($visoTimeString)

Set's document time created information. If time is not passed, the current time (UTC) is set.

 $vDoc->set_timeCreated();

set_timeSaved($visioTimeString)

Set's document time saved information. If time is not passed, the current time (UTC) is set.

 $vDoc->set_timeSaved();

visio_timeformat($time)

Takes in argument of $time, which is in the format of the perl time() function. Returns a $visioTimeString formatted string.

 $vDoc->set_timeCreated(Visio::visio_timeformat(time()));

 is equivilent to:

 $vDoc->set_timeCreated();

find_master_dom()

searches the visio masters (stencils). filters can be specifed:

 $vDoc->find_master_dom({name=>'myrectangle'})

returns a libxml nodelist object of all stencils that had name 'myractangle'. Not specifying filters returns all stencils.

filters avaliable:

name

Page Methods

Top

addpage()

A new Visio page is created in a Visio document.

 my $vPage1 = $vDoc->addpage();

By default the document is completely empty and the document creator is set to 'perl-visio'. This can be overwritten by use of the set_creator method.

set_name($name)

Sets the name of the page

 $vPage->set_name('mypage');

set_heightWidth($height,$width)

Sets a page's height and width. In inches by default:

 $vPage->setheightWidth(8,11);

create_pageSheet();

creates a pageSheet method if needed under this page

    my $pageSheet = $vPage->create_pageSheet();

PageSheet methods

Top

For the most part one shouldn't need to directly use these methods

new($parentNode)

new creates (if one does not already exist) a new child PageSheet element node under $parentNode, which is a libxml2 object.

get_node

returns the PageSheet libxml2 node

 my $pageSheetNode = $pageSheet->getnode();

create_pageProps

creates a PageProps object and element under the current PageSheet

PageProps methods

Top

For the most part one shouldn't need to directly use these methods

new($parentNode)

new creates (if one does not already exist) a new child PageProps element node under $parentNode, which is a libxml2 object.

get_node

returns the PageProps libxml2 node

 my $pagePropsNode = $pageProps->getnode();

set_PageWidth($width)

sets the page width of this PageProps node. Default unit is in inches.

 $pageProps->set_PageWidth($width);

set_PageHeight($height)

sets the page height of this PageProps node. Default unit is in inches.

 $pageProps->set_PageHeight($height);







EXPORT

None by default.

SEE ALSO

Top

If you have a mailing list set up for your module, mention it here.

AUTHOR

Top

Aamer Akhter, <aakhter@cisco.com> <aakhter@gmail.com>

COPYRIGHT AND LICENSE

Top


Visio documentation  | view source Contained in the Visio distribution.