Excel-Writer-XLSX
view release on metacpan or search on metacpan
* Multiple worksheets
* Strings and numbers
* Unicode text
* Cell formatting
* Formulas
* Images
* Charts
* Autofilters
* Data validation
* Conditional formatting
* Macros
* Tables
* Shapes
* Sparklines
* Hyperlinks
* Rich string formats
* Defined names
* Grouping/Outlines
* Cell comments
* Panes
* Page set-up and printing options
lib/Excel/Writer/XLSX.pm view on Meta::CPAN
my $workbook = Excel::Writer::XLSX->new( 'file.xlsm' );
$workbook->add_vba_project( './vbaProject.bin' );
The supplied C<extract_vba> utility can be used to extract the required C<vbaProject.bin> file from an existing Excel file:
$ extract_vba file.xlsm
Extracted 'vbaProject.bin' successfully
Macros can be tied to buttons using the worksheet C<insert_button()> method (see the L</WORKSHEET METHODS> section for details):
$worksheet->insert_button( 'C2', { macro => 'my_macro' } );
Note, Excel uses the file extension C<xlsm> instead of C<xlsx> for files that contain macros. It is advisable to follow the same convention.
See also the C<macros.pl> example file and the L<WORKING WITH VBA MACROS>.
=head2 set_vba_name()
lib/Excel/Writer/XLSX/Package/VML.pm view on Meta::CPAN
# Write the x:Anchor element.
$self->_write_anchor( $vertices );
# Write the x:PrintObject element.
$self->_write_print_object();
# Write the x:AutoFill element.
$self->_write_auto_fill();
# Write the x:FmlaMacro element.
$self->_write_fmla_macro( $macro );
# Write the x:TextHAlign element.
$self->_write_text_halign();
# Write the x:TextVAlign element.
$self->_write_text_valign();
$self->xml_end_tag( 'x:ClientData' );
}
lib/Excel/Writer/XLSX/Package/VML.pm view on Meta::CPAN
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 {
lib/Excel/Writer/XLSX/Shape.pm view on Meta::CPAN
my $type = $ellipse->get_type(); # Find out what it really is.
Multiple shape properties may also be modified in one go by using the C<set_properties()> method:
$shape->set_properties( type => 'ellipse', text => 'Hello' );
The properties of a shape object that can be defined via C<add_shape()> are shown below.
=head2 name
Defines the name of the shape. This is an optional property and the shape will be given a default name if not supplied. The name is generally only used by Excel Macros to refer to the object.
=head2 type
Defines the type of the object such as C<rect>, C<ellipse> or C<triangle>:
my $ellipse = $workbook->add_shape( type => 'ellipse' );
The default type is C<rect>.
The full list of available shapes is shown below.
t/package/vml/vml_02.t view on Meta::CPAN
<o:lock v:ext="edit" rotation="t"/>
<v:textbox style="mso-direction-alt:auto" o:singleclick="f">
<div style="text-align:center">
<font face="Calibri" size="220" color="#000000">Button 1</font>
</div>
</v:textbox>
<x:ClientData ObjectType="Button">
<x:Anchor>2, 0, 1, 0, 3, 0, 2, 0</x:Anchor>
<x:PrintObject>False</x:PrintObject>
<x:AutoFill>False</x:AutoFill>
<x:FmlaMacro>[0]!Button1_Click</x:FmlaMacro>
<x:TextHAlign>Center</x:TextHAlign>
<x:TextVAlign>Center</x:TextVAlign>
</x:ClientData>
</v:shape>
</xml>
( run in 0.337 second using v1.01-cache-2.11-cpan-05444aca049 )