I've added a function to the Win32::PowerPoint module successfully to draw a line and astonishingly enough it works:
sub add_line { my ($self, $options) = @_; return unless $self->slide; $options = {} unless ref $options eq 'HASH'; my $new_line = $self->slide->Shapes->AddLine($options->{x1}, $option +s->{y1}, $options->{x2}, $options->{y2}); return $new_line; }
I've tried to add a function to draw a shape with very similar extension like this:
sub add_shape { my ($self, $shape, $options) = @_; return unless $self->slide; $options = {} unless ref $options eq 'HASH'; my $new_shape = $self->slide->Shapes->AddShape($shape, $options->{le +ft}, $options->{top}, $options->{width}, $options->{height}); return $new_shape; }
But it doesn't work.

In the horrible MSDN documents on VBA there's discussion about encoded shape names like 'msoShapeRectangle' which is shape enumeration 1, and when I call this function it draws nothing. I've tried calling this new function both the following ways with no success:

# Add the Rectangle $pp->add_shape('msoShapeRectangle', { left=>100, top=>100, width=>100, + height=>100}); # Add the Rectangle $pp->add_shape(1, { left=>100, top=>100, width=>100, height=>100});
Neither works.

Any help or guidance would be apprecaited. There's almost no help in the Win32::PowerPoint in CPAN.

Also, I've searched for hours for examples on even how to change the color of the line that I can successfully draw - to no avail.

Kind regards, nzsvz9

I'm not a coder, I just play one in my job


In reply to Win32::PowerPoint Extension for Lines and Shapes by nzsvz9

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.