You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is the equivalent of Excel's menu option to insert an image using the option to "Place over Cells". See C<embed_image()> below for the equivalent method to "Place in Cell".
1716
+
1714
1717
The optional C<options> hash/hashref parameter can be used to set various options for the image. The defaults are:
1715
1718
1716
1719
%options = (
@@ -1780,6 +1783,66 @@ BMP images must be 24 bit, true colour, bitmaps. In general it is best to avoid
This method can be used to embed a image into a worksheet cell and have the
1795
+
image automatically scale to the width and height of the cell. The X/Y scaling
1796
+
of the image is preserved but the size of the image is adjusted to fit the
1797
+
largest possible width or height depending on the cell dimensions.
1798
+
1799
+
This is the equivalent of Excel's menu option to insert an image using the
1800
+
option to "Place in Cell". See C<insert_image()> for the equivalent method to
1801
+
"Place over Cells".
1802
+
1803
+
The optional C<options> hash/hashref parameter can be used to set various options for the image. The defaults are:
1804
+
1805
+
%options = (
1806
+
cell_format => format,
1807
+
url => undef,
1808
+
tip => undef,
1809
+
description => $filename,
1810
+
decorative => 0,
1811
+
);
1812
+
1813
+
The C<cell_format> parameters can be an standard Format to set the formatting of the cell behind the image.
1814
+
1815
+
The C<url> option can be use to used to add a hyperlink to an image:
1816
+
1817
+
$worksheet->insert_image( 'A1', 'logo.png',
1818
+
{ url => 'https://github.com/jmcnamara' } );
1819
+
1820
+
The supported url formats are the same as those supported by the C<write_url()> method and the same rules/limits apply.
1821
+
1822
+
The C<tip> option can be use to used to add a mouseover tip to the hyperlink:
1823
+
1824
+
$worksheet->insert_image( 'A1', 'logo.png',
1825
+
{
1826
+
url => 'https://github.com/jmcnamara',
1827
+
tip => 'GitHub'
1828
+
}
1829
+
);
1830
+
1831
+
The C<description> parameter can be used to specify a description or "alt text" string for the image. In general this would be used to provide a text description of the image to help accessibility. It is an optional parameter and defaults to the filename of the image. It can be used as follows:
1832
+
1833
+
$worksheet->insert_image( 'E9', 'logo.png',
1834
+
{description => "This is some alternative text"} );
1835
+
1836
+
The optional C<decorative> parameter is also used to help accessibility. It is used to mark the image as decorative, and thus uninformative, for automated screen readers. As in Excel, if this parameter is in use the C<description> field isn't written. It is used as follows:
Note: you must call C<set_row()> or C<set_column()> before C<insert_image()> if you wish to change the default dimensions of any of the rows or columns that the image occupies. The height of a row can also change if you use a font that is larger than the default. This in turn will affect the scaling of your image. To avoid this you should explicitly set the height of the row using C<set_row()> if it contains a font size that will change the row height.
1841
+
1842
+
BMP images must be 24 bit, true colour, bitmaps. In general it is best to avoid BMP images since they aren't compressed.
0 commit comments