Excel-Writer-XLSX
view release on metacpan or search on metacpan
lib/Excel/Writer/XLSX/Package/VML.pm view on Meta::CPAN
my $self = shift;
my $id = '_x0000_t201';
my $coordsize = '21600,21600';
my $spt = 201;
my $path = 'm,l,21600r21600,l21600,xe';
my @attributes = (
'id' => $id,
'coordsize' => $coordsize,
'o:spt' => $spt,
'path' => $path,
);
$self->xml_start_tag( 'v:shapetype', @attributes );
# Write the v:stroke element.
$self->_write_stroke();
# Write the v:path element.
$self->_write_button_path( 't', 'rect' );
# Write the o:lock element.
$self->_write_shapetype_lock();
$self->xml_end_tag( 'v:shapetype' );
}
##############################################################################
#
# _write_image_shapetype()
#
# Write the <v:shapetype> element.
#
sub _write_image_shapetype {
my $self = shift;
my $id = '_x0000_t75';
my $coordsize = '21600,21600';
my $spt = 75;
my $o_preferrelative = 't';
my $path = 'm@4@5l@4@11@9@11@9@5xe';
my $filled = 'f';
my $stroked = 'f';
my @attributes = (
'id' => $id,
'coordsize' => $coordsize,
'o:spt' => $spt,
'o:preferrelative' => $o_preferrelative,
'path' => $path,
'filled' => $filled,
'stroked' => $stroked,
);
$self->xml_start_tag( 'v:shapetype', @attributes );
# Write the v:stroke element.
$self->_write_stroke();
# Write the v:formulas element.
$self->_write_formulas();
# Write the v:path element.
$self->_write_image_path();
# Write the o:lock element.
$self->_write_aspect_ratio_lock();
$self->xml_end_tag( 'v:shapetype' );
}
##############################################################################
#
# _write_stroke()
#
# Write the <v:stroke> element.
#
sub _write_stroke {
my $self = shift;
my $joinstyle = 'miter';
my @attributes = ( 'joinstyle' => $joinstyle );
$self->xml_empty_tag( 'v:stroke', @attributes );
}
##############################################################################
#
# _write_comment_path()
#
# Write the <v:path> element.
#
sub _write_comment_path {
my $self = shift;
my $gradientshapeok = shift;
my $connecttype = shift;
my @attributes = ();
push @attributes, ( 'gradientshapeok' => 't' ) if $gradientshapeok;
push @attributes, ( 'o:connecttype' => $connecttype );
$self->xml_empty_tag( 'v:path', @attributes );
}
##############################################################################
#
# _write_button_path()
#
# Write the <v:path> element.
#
sub _write_button_path {
my $self = shift;
my $shadowok = 'f';
my $extrusionok = 'f';
my $strokeok = 'f';
lib/Excel/Writer/XLSX/Package/VML.pm view on Meta::CPAN
my $self = shift;
my $data = 'Center';
$self->xml_data_element( 'x:TextHAlign', $data );
}
##############################################################################
#
# _write_text_valign()
#
# Write the <x:TextVAlign> element.
#
sub _write_text_valign {
my $self = shift;
my $data = 'Center';
$self->xml_data_element( 'x:TextVAlign', $data );
}
##############################################################################
#
# _write_fmla_macro()
#
# Write the <x:FmlaMacro> element.
#
sub _write_fmla_macro {
my $self = shift;
my $data = shift;
$self->xml_data_element( 'x:FmlaMacro', $data );
}
##############################################################################
#
# _write_imagedata()
#
# Write the <v:imagedata> element.
#
sub _write_imagedata {
my $self = shift;
my $index = shift;
my $o_title = shift;
my @attributes = (
'o:relid' => 'rId' . $index,
'o:title' => $o_title,
);
$self->xml_empty_tag( 'v:imagedata', @attributes );
}
##############################################################################
#
# _write_formulas()
#
# Write the <v:formulas> element.
#
sub _write_formulas {
my $self = shift;
$self->xml_start_tag( 'v:formulas' );
# Write the v:f elements.
$self->_write_f('if lineDrawn pixelLineWidth 0');
$self->_write_f('sum @0 1 0');
$self->_write_f('sum 0 0 @1');
$self->_write_f('prod @2 1 2');
$self->_write_f('prod @3 21600 pixelWidth');
$self->_write_f('prod @3 21600 pixelHeight');
$self->_write_f('sum @0 0 1');
$self->_write_f('prod @6 1 2');
$self->_write_f('prod @7 21600 pixelWidth');
$self->_write_f('sum @8 21600 0');
$self->_write_f('prod @7 21600 pixelHeight');
$self->_write_f('sum @10 21600 0');
$self->xml_end_tag( 'v:formulas' );
}
##############################################################################
#
# _write_f()
#
# Write the <v:f> element.
#
sub _write_f {
my $self = shift;
my $eqn = shift;
my @attributes = ( 'eqn' => $eqn );
$self->xml_empty_tag( 'v:f', @attributes );
}
1;
__END__
=pod
=head1 NAME
VML - A class for writing the Excel XLSX VML files.
=head1 SYNOPSIS
See the documentation for L<Excel::Writer::XLSX>.
=head1 DESCRIPTION
This module is used in conjunction with L<Excel::Writer::XLSX>.
=head1 AUTHOR
John McNamara jmcnamara@cpan.org
=head1 COPYRIGHT
(c) MM-MMXXV, John McNamara.
All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.
=head1 LICENSE
Either the Perl Artistic Licence L<https://dev.perl.org/licenses/artistic.html> or the GNU General Public License v1.0 or later L<https://dev.perl.org/licenses/gpl1.html>.
=head1 DISCLAIMER OF WARRANTY
See the documentation for L<Excel::Writer::XLSX>.
=cut
( run in 1.256 second using v1.01-cache-2.11-cpan-39bf76dae61 )