1Spreadsheet::WriteExcelU(s3e)r Contributed Perl DocumentaStpiroenadsheet::WriteExcel(3)
2
3
4

NAME

6       Spreadsheet::WriteExcel - Write to a cross-platform Excel binary file.
7

VERSION

9       This document refers to version 2.40 of Spreadsheet::WriteExcel,
10       released November 6, 2013.
11

SYNOPSIS

13       To write a string, a formatted string, a number and a formula to the
14       first worksheet in an Excel workbook called perl.xls:
15
16           use Spreadsheet::WriteExcel;
17
18           # Create a new Excel workbook
19           my $workbook = Spreadsheet::WriteExcel->new('perl.xls');
20
21           # Add a worksheet
22           $worksheet = $workbook->add_worksheet();
23
24           #  Add and define a format
25           $format = $workbook->add_format(); # Add a format
26           $format->set_bold();
27           $format->set_color('red');
28           $format->set_align('center');
29
30           # Write a formatted and unformatted string, row and column notation.
31           $col = $row = 0;
32           $worksheet->write($row, $col, 'Hi Excel!', $format);
33           $worksheet->write(1,    $col, 'Hi Excel!');
34
35           # Write a number and a formula using A1 notation
36           $worksheet->write('A3', 1.2345);
37           $worksheet->write('A4', '=SIN(PI()/4)');
38

DESCRIPTION

40       The Spreadsheet::WriteExcel Perl module can be used to create a cross-
41       platform Excel binary file. Multiple worksheets can be added to a
42       workbook and formatting can be applied to cells. Text, numbers,
43       formulas, hyperlinks, images and charts can be written to the cells.
44
45       The file produced by this module is compatible with Excel 97, 2000,
46       2002, 2003 and 2007.
47
48       The module will work on the majority of Windows, UNIX and Mac
49       platforms. Generated files are also compatible with the Linux/UNIX
50       spreadsheet applications Gnumeric and OpenOffice.org.
51
52       This module cannot be used to write to an existing Excel file (See
53       "MODIFYING AND REWRITING EXCEL FILES").
54
55       Note: This module is in maintenance only mode and in future will only
56       be updated with bug fixes. The newer, more feature rich and API
57       compatible Excel::Writer::XLSX module is recommended instead. See,
58       "Migrating to Excel::Writer::XLSX".
59

QUICK START

61       Spreadsheet::WriteExcel tries to provide an interface to as many of
62       Excel's features as possible. As a result there is a lot of
63       documentation to accompany the interface and it can be difficult at
64       first glance to see what it important and what is not. So for those of
65       you who prefer to assemble Ikea furniture first and then read the
66       instructions, here are three easy steps:
67
68       1. Create a new Excel workbook (i.e. file) using new().
69
70       2. Add a worksheet to the new workbook using add_worksheet().
71
72       3. Write to the worksheet using write().
73
74       Like this:
75
76           use Spreadsheet::WriteExcel;                             # Step 0
77
78           my $workbook = Spreadsheet::WriteExcel->new('perl.xls'); # Step 1
79           $worksheet   = $workbook->add_worksheet();               # Step 2
80           $worksheet->write('A1', 'Hi Excel!');                    # Step 3
81
82       This will create an Excel file called "perl.xls" with a single
83       worksheet and the text 'Hi Excel!' in the relevant cell. And that's it.
84       Okay, so there is actually a zeroth step as well, but "use module" goes
85       without saying. There are also more than 80 examples that come with the
86       distribution and which you can use to get you started. See "EXAMPLES".
87
88       Those of you who read the instructions first and assemble the furniture
89       afterwards will know how to proceed. ;-)
90

WORKBOOK METHODS

92       The Spreadsheet::WriteExcel module provides an object oriented
93       interface to a new Excel workbook. The following methods are available
94       through a new workbook.
95
96           new()
97           add_worksheet()
98           add_format()
99           add_chart()
100           add_chart_ext()
101           close()
102           compatibility_mode()
103           set_properties()
104           define_name()
105           set_tempdir()
106           set_custom_color()
107           sheets()
108           set_1904()
109           set_codepage()
110
111       If you are unfamiliar with object oriented interfaces or the way that
112       they are implemented in Perl have a look at "perlobj" and "perltoot" in
113       the main Perl documentation.
114
115   new()
116       A new Excel workbook is created using the new() constructor which
117       accepts either a filename or a filehandle as a parameter. The following
118       example creates a new Excel file based on a filename:
119
120           my $workbook  = Spreadsheet::WriteExcel->new('filename.xls');
121           my $worksheet = $workbook->add_worksheet();
122           $worksheet->write(0, 0, 'Hi Excel!');
123
124       Here are some other examples of using new() with filenames:
125
126           my $workbook1 = Spreadsheet::WriteExcel->new($filename);
127           my $workbook2 = Spreadsheet::WriteExcel->new('/tmp/filename.xls');
128           my $workbook3 = Spreadsheet::WriteExcel->new("c:\\tmp\\filename.xls");
129           my $workbook4 = Spreadsheet::WriteExcel->new('c:\tmp\filename.xls');
130
131       The last two examples demonstrates how to create a file on DOS or
132       Windows where it is necessary to either escape the directory separator
133       "\" or to use single quotes to ensure that it isn't interpolated. For
134       more information  see "perlfaq5: Why can't I use "C:\temp\foo" in DOS
135       paths?".
136
137       The new() constructor returns a Spreadsheet::WriteExcel object that you
138       can use to add worksheets and store data. It should be noted that
139       although "my" is not specifically required it defines the scope of the
140       new workbook variable and, in the majority of cases, ensures that the
141       workbook is closed properly without explicitly calling the close()
142       method.
143
144       If the file cannot be created, due to file permissions or some other
145       reason,  "new" will return "undef". Therefore, it is good practice to
146       check the return value of "new" before proceeding. As usual the Perl
147       variable $! will be set if there is a file creation error. You will
148       also see one of the warning messages detailed in "DIAGNOSTICS":
149
150           my $workbook  = Spreadsheet::WriteExcel->new('protected.xls');
151           die "Problems creating new Excel file: $!" unless defined $workbook;
152
153       You can also pass a valid filehandle to the new() constructor. For
154       example in a CGI program you could do something like this:
155
156           binmode(STDOUT);
157           my $workbook  = Spreadsheet::WriteExcel->new(\*STDOUT);
158
159       The requirement for binmode() is explained below.
160
161       See also, the "cgi.pl" program in the "examples" directory of the
162       distro.
163
164       However, this special case will not work in "mod_perl" programs where
165       you will have to do something like the following:
166
167           # mod_perl 1
168           ...
169           tie *XLS, 'Apache';
170           binmode(XLS);
171           my $workbook  = Spreadsheet::WriteExcel->new(\*XLS);
172           ...
173
174           # mod_perl 2
175           ...
176           tie *XLS => $r;  # Tie to the Apache::RequestRec object
177           binmode(*XLS);
178           my $workbook  = Spreadsheet::WriteExcel->new(\*XLS);
179           ...
180
181       See also, the "mod_perl1.pl" and "mod_perl2.pl" programs in the
182       "examples" directory of the distro.
183
184       Filehandles can also be useful if you want to stream an Excel file over
185       a socket or if you want to store an Excel file in a scalar.
186
187       For example here is a way to write an Excel file to a scalar with "perl
188       5.8":
189
190           #!/usr/bin/perl -w
191
192           use strict;
193           use Spreadsheet::WriteExcel;
194
195           # Requires perl 5.8 or later
196           open my $fh, '>', \my $str or die "Failed to open filehandle: $!";
197
198           my $workbook  = Spreadsheet::WriteExcel->new($fh);
199           my $worksheet = $workbook->add_worksheet();
200
201           $worksheet->write(0, 0,  'Hi Excel!');
202
203           $workbook->close();
204
205           # The Excel file in now in $str. Remember to binmode() the output
206           # filehandle before printing it.
207           binmode STDOUT;
208           print $str;
209
210       See also the "write_to_scalar.pl" and "filehandle.pl" programs in the
211       "examples" directory of the distro.
212
213       Note about the requirement for binmode(). An Excel file is comprised of
214       binary data. Therefore, if you are using a filehandle you should ensure
215       that you binmode() it prior to passing it to new().You should do this
216       regardless of whether you are on a Windows platform or not. This
217       applies especially to users of perl 5.8 on systems where "UTF-8" is
218       likely to be in operation such as RedHat Linux 9. If your program,
219       either intentionally or not, writes "UTF-8" data to a filehandle that
220       is passed to new() it will corrupt the Excel file that is created.
221
222       You don't have to worry about binmode() if you are using filenames
223       instead of filehandles. Spreadsheet::WriteExcel performs the binmode()
224       internally when it converts the filename to a filehandle. For more
225       information about binmode() see "perlfunc" and "perlopentut" in the
226       main Perl documentation.
227
228   add_worksheet($sheetname, $utf_16_be)
229       At least one worksheet should be added to a new workbook. A worksheet
230       is used to write data into cells:
231
232           $worksheet1 = $workbook->add_worksheet();           # Sheet1
233           $worksheet2 = $workbook->add_worksheet('Foglio2');  # Foglio2
234           $worksheet3 = $workbook->add_worksheet('Data');     # Data
235           $worksheet4 = $workbook->add_worksheet();           # Sheet4
236
237       If $sheetname is not specified the default Excel convention will be
238       followed, i.e. Sheet1, Sheet2, etc. The $utf_16_be parameter is
239       optional, see below.
240
241       The worksheet name must be a valid Excel worksheet name, i.e. it cannot
242       contain any of the following characters, "[ ] : * ? / \" and it must be
243       less than 32 characters. In addition, you cannot use the same, case
244       insensitive, $sheetname for more than one worksheet.
245
246       On systems with "perl 5.8" and later the add_worksheet() method will
247       also handle strings in "UTF-8" format.
248
249           $worksheet = $workbook->add_worksheet("\x{263a}"); # Smiley
250
251       On earlier Perl systems your can specify "UTF-16BE" worksheet names
252       using an additional optional parameter:
253
254           my $name = pack 'n', 0x263a;
255           $worksheet = $workbook->add_worksheet($name, 1);   # Smiley
256
257   add_format(%properties)
258       The add_format() method can be used to create new Format objects which
259       are used to apply formatting to a cell. You can either define the
260       properties at creation time via a hash of property values or later via
261       method calls.
262
263           $format1 = $workbook->add_format(%props); # Set properties at creation
264           $format2 = $workbook->add_format();       # Set properties later
265
266       See the "CELL FORMATTING" section for more details about Format
267       properties and how to set them.
268
269   add_chart(%properties)
270       This method is use to create a new chart either as a standalone
271       worksheet (the default) or as an embeddable object that can be inserted
272       into a worksheet via the insert_chart() Worksheet method.
273
274           my $chart = $workbook->add_chart( type => 'column' );
275
276       The properties that can be set are:
277
278           type     (required)
279           name     (optional)
280           embedded (optional)
281
282       •   "type"
283
284           This is a required parameter. It defines the type of chart that
285           will be created.
286
287               my $chart = $workbook->add_chart( type => 'line' );
288
289           The available types are:
290
291               area
292               bar
293               column
294               line
295               pie
296               scatter
297               stock
298
299       •   "name"
300
301           Set the name for the chart sheet. The name property is optional and
302           if it isn't supplied will default to "Chart1 .. n". The name must
303           be a valid Excel worksheet name. See add_worksheet() for more
304           details on valid sheet names. The "name" property can be omitted
305           for embedded charts.
306
307               my $chart = $workbook->add_chart( type => 'line', name => 'Results Chart' );
308
309       •   "embedded"
310
311           Specifies that the Chart object will be inserted in a worksheet via
312           the insert_chart() Worksheet method. It is an error to try insert a
313           Chart that doesn't have this flag set.
314
315               my $chart = $workbook->add_chart( type => 'line', embedded => 1 );
316
317               # Configure the chart.
318               ...
319
320               # Insert the chart into the a worksheet.
321               $worksheet->insert_chart( 'E2', $chart );
322
323       See Spreadsheet::WriteExcel::Chart for details on how to configure the
324       chart object once it is created. See also the "chart_*.pl" programs in
325       the examples directory of the distro.
326
327   add_chart_ext($chart_data, $chartname)
328       This method is use to include externally generated charts in a
329       Spreadsheet::WriteExcel file.
330
331           my $chart = $workbook->add_chart_ext('chart01.bin', 'Chart1');
332
333       This feature is semi-deprecated in favour of the "native" charts
334       created using add_chart(). Read "external_charts.txt" (or ".pod") in
335       the external_charts directory of the distro for a full explanation.
336
337   close()
338       In general your Excel file will be closed automatically when your
339       program ends or when the Workbook object goes out of scope, however the
340       close() method can be used to explicitly close an Excel file.
341
342           $workbook->close();
343
344       An explicit close() is required if the file must be closed prior to
345       performing some external action on it such as copying it, reading its
346       size or attaching it to an email.
347
348       In addition, close() may be required to prevent perl's garbage
349       collector from disposing of the Workbook, Worksheet and Format objects
350       in the wrong order. Situations where this can occur are:
351
352       •   If my() was not used to declare the scope of a workbook variable
353           created using new().
354
355       •   If the new(), add_worksheet() or add_format() methods are called in
356           subroutines.
357
358       The reason for this is that Spreadsheet::WriteExcel relies on Perl's
359       "DESTROY" mechanism to trigger destructor methods in a specific
360       sequence. This may not happen in cases where the Workbook, Worksheet
361       and Format variables are not lexically scoped or where they have
362       different lexical scopes.
363
364       In general, if you create a file with a size of 0 bytes or you fail to
365       create a file you need to call close().
366
367       The return value of close() is the same as that returned by perl when
368       it closes the file created by new(). This allows you to handle error
369       conditions in the usual way:
370
371           $workbook->close() or die "Error closing file: $!";
372
373   compatibility_mode()
374       This method is used to improve compatibility with third party
375       applications that read Excel files.
376
377           $workbook->compatibility_mode();
378
379       An Excel file is comprised of binary records that describe properties
380       of a spreadsheet. Excel is reasonably liberal about this and, outside
381       of a core subset, it doesn't require every possible record to be
382       present when it reads a file. This is also true of Gnumeric and
383       OpenOffice.Org Calc.
384
385       Spreadsheet::WriteExcel takes advantage of this fact to omit some
386       records in order to minimise the amount of data stored in memory and to
387       simplify and speed up the writing of files. However, some third party
388       applications that read Excel files often expect certain records to be
389       present. In "compatibility mode" Spreadsheet::WriteExcel writes these
390       records and tries to be as close to an Excel generated file as
391       possible.
392
393       Applications that require compatibility_mode() are Apache POI, Apple
394       Numbers, and Quickoffice on Nokia, Palm and other devices. You should
395       also use compatibility_mode() if your Excel file will be used as an
396       external data source by another Excel file.
397
398       If you encounter other situations that require compatibility_mode(),
399       please let me know.
400
401       It should be noted that compatibility_mode() requires additional data
402       to be stored in memory and additional processing. This incurs a memory
403       and speed penalty and may not be suitable for very large files (>20MB).
404
405       You must call compatibility_mode() before calling add_worksheet().
406
407   set_properties()
408       The "set_properties" method can be used to set the document properties
409       of the Excel file created by "Spreadsheet::WriteExcel". These
410       properties are visible when you use the "File->Properties" menu option
411       in Excel and are also available to external applications that read or
412       index windows files.
413
414       The properties should be passed as a hash of values as follows:
415
416           $workbook->set_properties(
417               title    => 'This is an example spreadsheet',
418               author   => 'John McNamara',
419               comments => 'Created with Perl and Spreadsheet::WriteExcel',
420           );
421
422       The properties that can be set are:
423
424           title
425           subject
426           author
427           manager
428           company
429           category
430           keywords
431           comments
432
433       User defined properties are not supported due to effort required.
434
435       In perl 5.8+ you can also pass UTF-8 strings as properties. See
436       "UNICODE IN EXCEL".
437
438           my $smiley = chr 0x263A;
439
440           $workbook->set_properties(
441               subject => "Happy now? $smiley",
442           );
443
444       With older versions of perl you can use a module to convert a non-ASCII
445       string to a binary representation of UTF-8 and then pass an additional
446       "utf8" flag to set_properties():
447
448           my $smiley = pack 'H*', 'E298BA';
449
450           $workbook->set_properties(
451               subject => "Happy now? $smiley",
452               utf8    => 1,
453           );
454
455       Usually Spreadsheet::WriteExcel allows you to use UTF-16 with pre 5.8
456       versions of perl. However, document properties don't support UTF-16 for
457       these type of strings.
458
459       In order to promote the usefulness of Perl and the
460       Spreadsheet::WriteExcel module consider adding a comment such as the
461       following when using document properties:
462
463           $workbook->set_properties(
464               ...,
465               comments => 'Created with Perl and Spreadsheet::WriteExcel',
466               ...,
467           );
468
469       This feature requires that the "OLE::Storage_Lite" module is installed
470       (which is usually the case for a standard Spreadsheet::WriteExcel
471       installation). However, this also means that the resulting OLE document
472       may possibly be buggy for files less than 7MB since it hasn't been as
473       rigorously tested in that domain. As a result of this "set_properties"
474       is currently incompatible with Gnumeric for files less than 7MB. This
475       is being investigated. If you encounter any problems with this features
476       let me know.
477
478       For convenience it is possible to pass either a hash or hash ref of
479       arguments to this method.
480
481       See also the "properties.pl" program in the examples directory of the
482       distro.
483
484   define_name()
485       This method is used to defined a name that can be used to represent a
486       value, a single cell or a range of cells in a workbook.
487
488           $workbook->define_name('Exchange_rate', '=0.96');
489           $workbook->define_name('Sales',         '=Sheet1!$G$1:$H$10');
490           $workbook->define_name('Sheet2!Sales',  '=Sheet2!$G$1:$G$10');
491
492       See the defined_name.pl program in the examples dir of the distro.
493
494       Note: This currently a beta feature. More documentation and examples
495       will be added.
496
497   set_tempdir()
498       For speed and efficiency "Spreadsheet::WriteExcel" stores worksheet
499       data in temporary files prior to assembling the final workbook.
500
501       If Spreadsheet::WriteExcel is unable to create these temporary files it
502       will store the required data in memory. This can be slow for large
503       files.
504
505       The problem occurs mainly with IIS on Windows although it could
506       feasibly occur on Unix systems as well. The problem generally occurs
507       because the default temp file directory is defined as "C:/" or some
508       other directory that IIS doesn't provide write access to.
509
510       To check if this might be a problem on a particular system you can run
511       a simple test program with "-w" or "use warnings". This will generate a
512       warning if the module cannot create the required temporary files:
513
514           #!/usr/bin/perl -w
515
516           use Spreadsheet::WriteExcel;
517
518           my $workbook  = Spreadsheet::WriteExcel->new('test.xls');
519           my $worksheet = $workbook->add_worksheet();
520
521       To avoid this problem the set_tempdir() method can be used to specify a
522       directory that is accessible for the creation of temporary files.
523
524       The "File::Temp" module is used to create the temporary files.
525       File::Temp uses "File::Spec" to determine an appropriate location for
526       these files such as "/tmp" or "c:\windows\temp". You can find out which
527       directory is used on your system as follows:
528
529           perl -MFile::Spec -le "print File::Spec->tmpdir"
530
531       Even if the default temporary file directory is accessible you may wish
532       to specify an alternative location for security or maintenance reasons:
533
534           $workbook->set_tempdir('/tmp/writeexcel');
535           $workbook->set_tempdir('c:\windows\temp\writeexcel');
536
537       The directory for the temporary file must exist, set_tempdir() will not
538       create a new directory.
539
540       One disadvantage of using the set_tempdir() method is that on some
541       Windows systems it will limit you to approximately 800 concurrent
542       tempfiles. This means that a single program running on one of these
543       systems will be limited to creating a total of 800 workbook and
544       worksheet objects. You can run multiple, non-concurrent programs to
545       work around this if necessary.
546
547   set_custom_color($index, $red, $green, $blue)
548       The set_custom_color() method can be used to override one of the built-
549       in palette values with a more suitable colour.
550
551       The value for $index should be in the range 8..63, see "COLOURS IN
552       EXCEL".
553
554       The default named colours use the following indices:
555
556            8   =>   black
557            9   =>   white
558           10   =>   red
559           11   =>   lime
560           12   =>   blue
561           13   =>   yellow
562           14   =>   magenta
563           15   =>   cyan
564           16   =>   brown
565           17   =>   green
566           18   =>   navy
567           20   =>   purple
568           22   =>   silver
569           23   =>   gray
570           33   =>   pink
571           53   =>   orange
572
573       A new colour is set using its RGB (red green blue) components. The
574       $red, $green and $blue values must be in the range 0..255. You can
575       determine the required values in Excel using the
576       "Tools->Options->Colors->Modify" dialog.
577
578       The set_custom_color() workbook method can also be used with a HTML
579       style "#rrggbb" hex value:
580
581           $workbook->set_custom_color(40, 255,  102,  0   ); # Orange
582           $workbook->set_custom_color(40, 0xFF, 0x66, 0x00); # Same thing
583           $workbook->set_custom_color(40, '#FF6600'       ); # Same thing
584
585           my $font = $workbook->add_format(color => 40); # Use the modified colour
586
587       The return value from set_custom_color() is the index of the colour
588       that was changed:
589
590           my $ferrari = $workbook->set_custom_color(40, 216, 12, 12);
591
592           my $format  = $workbook->add_format(
593                                               bg_color => $ferrari,
594                                               pattern  => 1,
595                                               border   => 1
596                                             );
597
598   sheets(0, 1, ...)
599       The sheets() method returns a list, or a sliced list, of the worksheets
600       in a workbook.
601
602       If no arguments are passed the method returns a list of all the
603       worksheets in the workbook. This is useful if you want to repeat an
604       operation on each worksheet:
605
606           foreach $worksheet ($workbook->sheets()) {
607              print $worksheet->get_name();
608           }
609
610       You can also specify a slice list to return one or more worksheet
611       objects:
612
613           $worksheet = $workbook->sheets(0);
614           $worksheet->write('A1', 'Hello');
615
616       Or since return value from sheets() is a reference to a worksheet
617       object you can write the above example as:
618
619           $workbook->sheets(0)->write('A1', 'Hello');
620
621       The following example returns the first and last worksheet in a
622       workbook:
623
624           foreach $worksheet ($workbook->sheets(0, -1)) {
625              # Do something
626           }
627
628       Array slices are explained in the perldata manpage.
629
630   set_1904()
631       Excel stores dates as real numbers where the integer part stores the
632       number of days since the epoch and the fractional part stores the
633       percentage of the day. The epoch can be either 1900 or 1904. Excel for
634       Windows uses 1900 and Excel for Macintosh uses 1904. However, Excel on
635       either platform will convert automatically between one system and the
636       other.
637
638       Spreadsheet::WriteExcel stores dates in the 1900 format by default. If
639       you wish to change this you can call the set_1904() workbook method.
640       You can query the current value by calling the get_1904() workbook
641       method. This returns 0 for 1900 and 1 for 1904.
642
643       See also "DATES AND TIME IN EXCEL" for more information about working
644       with Excel's date system.
645
646       In general you probably won't need to use set_1904().
647
648   set_codepage($codepage)
649       The default code page or character set used by Spreadsheet::WriteExcel
650       is ANSI. This is also the default used by Excel for Windows.
651       Occasionally however it may be necessary to change the code page via
652       the set_codepage() method.
653
654       Changing the code page may be required if your are using
655       Spreadsheet::WriteExcel on the Macintosh and you are using characters
656       outside the ASCII 128 character set:
657
658           $workbook->set_codepage(1); # ANSI, MS Windows
659           $workbook->set_codepage(2); # Apple Macintosh
660
661       The set_codepage() method is rarely required.
662

WORKSHEET METHODS

664       A new worksheet is created by calling the add_worksheet() method from a
665       workbook object:
666
667           $worksheet1 = $workbook->add_worksheet();
668           $worksheet2 = $workbook->add_worksheet();
669
670       The following methods are available through a new worksheet:
671
672           write()
673           write_number()
674           write_string()
675           write_utf16be_string()
676           write_utf16le_string()
677           keep_leading_zeros()
678           write_blank()
679           write_row()
680           write_col()
681           write_date_time()
682           write_url()
683           write_url_range()
684           write_formula()
685           store_formula()
686           repeat_formula()
687           write_comment()
688           show_comments()
689           add_write_handler()
690           insert_image()
691           insert_chart()
692           data_validation()
693           get_name()
694           activate()
695           select()
696           hide()
697           set_first_sheet()
698           protect()
699           set_selection()
700           set_row()
701           set_column()
702           outline_settings()
703           freeze_panes()
704           split_panes()
705           merge_range()
706           set_zoom()
707           right_to_left()
708           hide_zero()
709           set_tab_color()
710           autofilter()
711
712   Cell notation
713       Spreadsheet::WriteExcel supports two forms of notation to designate the
714       position of cells: Row-column notation and A1 notation.
715
716       Row-column notation uses a zero based index for both row and column
717       while A1 notation uses the standard Excel alphanumeric sequence of
718       column letter and 1-based row. For example:
719
720           (0, 0)      # The top left cell in row-column notation.
721           ('A1')      # The top left cell in A1 notation.
722
723           (1999, 29)  # Row-column notation.
724           ('AD2000')  # The same cell in A1 notation.
725
726       Row-column notation is useful if you are referring to cells
727       programmatically:
728
729           for my $i (0 .. 9) {
730               $worksheet->write($i, 0, 'Hello'); # Cells A1 to A10
731           }
732
733       A1 notation is useful for setting up a worksheet manually and for
734       working with formulas:
735
736           $worksheet->write('H1', 200);
737           $worksheet->write('H2', '=H1+1');
738
739       In formulas and applicable methods you can also use the "A:A" column
740       notation:
741
742           $worksheet->write('A1', '=SUM(B:B)');
743
744       The "Spreadsheet::WriteExcel::Utility" module that is included in the
745       distro contains helper functions for dealing with A1 notation, for
746       example:
747
748           use Spreadsheet::WriteExcel::Utility;
749
750           ($row, $col)    = xl_cell_to_rowcol('C2');  # (1, 2)
751           $str            = xl_rowcol_to_cell(1, 2);  # C2
752
753       For simplicity, the parameter lists for the worksheet method calls in
754       the following sections are given in terms of row-column notation. In
755       all cases it is also possible to use A1 notation.
756
757       Note: in Excel it is also possible to use a R1C1 notation. This is not
758       supported by Spreadsheet::WriteExcel.
759
760   write($row, $column, $token, $format)
761       Excel makes a distinction between data types such as strings, numbers,
762       blanks, formulas and hyperlinks. To simplify the process of writing
763       data the write() method acts as a general alias for several more
764       specific methods:
765
766           write_string()
767           write_number()
768           write_blank()
769           write_formula()
770           write_url()
771           write_row()
772           write_col()
773
774       The general rule is that if the data looks like a something then a
775       something is written. Here are some examples in both row-column and A1
776       notation:
777
778                                                             # Same as:
779           $worksheet->write(0, 0, 'Hello'                ); # write_string()
780           $worksheet->write(1, 0, 'One'                  ); # write_string()
781           $worksheet->write(2, 0,  2                     ); # write_number()
782           $worksheet->write(3, 0,  3.00001               ); # write_number()
783           $worksheet->write(4, 0,  ""                    ); # write_blank()
784           $worksheet->write(5, 0,  ''                    ); # write_blank()
785           $worksheet->write(6, 0,  undef                 ); # write_blank()
786           $worksheet->write(7, 0                         ); # write_blank()
787           $worksheet->write(8, 0,  'http://www.perl.com/'); # write_url()
788           $worksheet->write('A9',  'ftp://ftp.cpan.org/' ); # write_url()
789           $worksheet->write('A10', 'internal:Sheet1!A1'  ); # write_url()
790           $worksheet->write('A11', 'external:c:\foo.xls' ); # write_url()
791           $worksheet->write('A12', '=A3 + 3*A4'          ); # write_formula()
792           $worksheet->write('A13', '=SIN(PI()/4)'        ); # write_formula()
793           $worksheet->write('A14', \@array               ); # write_row()
794           $worksheet->write('A15', [\@array]             ); # write_col()
795
796           # And if the keep_leading_zeros property is set:
797           $worksheet->write('A16', '2'                   ); # write_number()
798           $worksheet->write('A17', '02'                  ); # write_string()
799           $worksheet->write('A18', '00002'               ); # write_string()
800
801       The "looks like" rule is defined by regular expressions:
802
803       write_number() if $token is a number based on the following regex:
804       "$token =~ /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/".
805
806       write_string() if keep_leading_zeros() is set and $token is an integer
807       with leading zeros based on the following regex: "$token =~ /^0\d+$/".
808
809       write_blank() if $token is undef or a blank string: "undef", "" or ''.
810
811       write_url() if $token is a http, https, ftp or mailto URL based on the
812       following regexes: "$token =~ m|^[fh]tt?ps?://|" or  "$token =~
813       m|^mailto:|".
814
815       write_url() if $token is an internal or external sheet reference based
816       on the following regex: "$token =~ m[^(in|ex)ternal:]".
817
818       write_formula() if the first character of $token is "=".
819
820       write_row() if $token is an array ref.
821
822       write_col() if $token is an array ref of array refs.
823
824       write_string() if none of the previous conditions apply.
825
826       The $format parameter is optional. It should be a valid Format object,
827       see "CELL FORMATTING":
828
829           my $format = $workbook->add_format();
830           $format->set_bold();
831           $format->set_color('red');
832           $format->set_align('center');
833
834           $worksheet->write(4, 0, 'Hello', $format); # Formatted string
835
836       The write() method will ignore empty strings or "undef" tokens unless a
837       format is also supplied. As such you needn't worry about special
838       handling for empty or "undef" values in your data. See also the
839       write_blank() method.
840
841       One problem with the write() method is that occasionally data looks
842       like a number but you don't want it treated as a number. For example,
843       zip codes or ID numbers often start with a leading zero. If you write
844       this data as a number then the leading zero(s) will be stripped. You
845       can change this default behaviour by using the keep_leading_zeros()
846       method. While this property is in place any integers with leading zeros
847       will be treated as strings and the zeros will be preserved. See the
848       keep_leading_zeros() section for a full discussion of this issue.
849
850       You can also add your own data handlers to the write() method using
851       add_write_handler().
852
853       On systems with "perl 5.8" and later the write() method will also
854       handle Unicode strings in "UTF-8" format.
855
856       The "write" methods return:
857
858           0 for success.
859          -1 for insufficient number of arguments.
860          -2 for row or column out of bounds.
861          -3 for string too long.
862
863   write_number($row, $column, $number, $format)
864       Write an integer or a float to the cell specified by $row and $column:
865
866           $worksheet->write_number(0, 0,  123456);
867           $worksheet->write_number('A2',  2.3451);
868
869       See the note about "Cell notation". The $format parameter is optional.
870
871       In general it is sufficient to use the write() method.
872
873   write_string($row, $column, $string, $format)
874       Write a string to the cell specified by $row and $column:
875
876           $worksheet->write_string(0, 0, 'Your text here' );
877           $worksheet->write_string('A2', 'or here' );
878
879       The maximum string size is 32767 characters. However the maximum string
880       segment that Excel can display in a cell is 1000. All 32767 characters
881       can be displayed in the formula bar.
882
883       The $format parameter is optional.
884
885       On systems with "perl 5.8" and later the write() method will also
886       handle strings in "UTF-8" format. With older perls you can also write
887       Unicode in "UTF16" format via the write_utf16be_string() method. See
888       also the "unicode_*.pl" programs in the examples directory of the
889       distro.
890
891       In general it is sufficient to use the write() method. However, you may
892       sometimes wish to use the write_string() method to write data that
893       looks like a number but that you don't want treated as a number. For
894       example, zip codes or phone numbers:
895
896           # Write as a plain string
897           $worksheet->write_string('A1', '01209');
898
899       However, if the user edits this string Excel may convert it back to a
900       number. To get around this you can use the Excel text format "@":
901
902           # Format as a string. Doesn't change to a number when edited
903           my $format1 = $workbook->add_format(num_format => '@');
904           $worksheet->write_string('A2', '01209', $format1);
905
906       See also the note about "Cell notation".
907
908   write_utf16be_string($row, $column, $string, $format)
909       This method is used to write "UTF-16BE" strings to a cell in Excel. It
910       is functionally the same as the write_string() method except that the
911       string should be in "UTF-16BE" Unicode format. It is generally easier,
912       when using Spreadsheet::WriteExcel, to write unicode strings in "UTF-8"
913       format, see "UNICODE IN EXCEL". The write_utf16be_string() method is
914       mainly of use in versions of perl prior to 5.8.
915
916       The following is a simple example showing how to write some Unicode
917       strings in "UTF-16BE" format:
918
919           #!/usr/bin/perl -w
920
921
922           use strict;
923           use Spreadsheet::WriteExcel;
924           use Unicode::Map();
925
926           my $workbook  = Spreadsheet::WriteExcel->new('utf_16_be.xls');
927           my $worksheet = $workbook->add_worksheet();
928
929           # Increase the column width for clarity
930           $worksheet->set_column('A:A', 25);
931
932
933           # Write a Unicode character
934           #
935           my $smiley = pack 'n', 0x263a;
936
937           # Increase the font size for legibility.
938           my $big_font = $workbook->add_format(size => 72);
939
940           $worksheet->write_utf16be_string('A3', $smiley, $big_font);
941
942
943
944           # Write a phrase in Cyrillic using a hex-encoded string
945           #
946           my $str = pack 'H*', '042d0442043e0020044404400430043704300020043d' .
947                                '043000200440044304410441043a043e043c0021';
948
949           $worksheet->write_utf16be_string('A5', $str);
950
951
952
953           # Map a string to UTF-16BE using an external module.
954           #
955           my $map   = Unicode::Map->new('ISO-8859-1');
956           my $utf16 = $map->to_unicode('Hello world!');
957
958           $worksheet->write_utf16be_string('A7', $utf16);
959
960       You can convert ASCII encodings to the required "UTF-16BE" format using
961       one of the many Unicode modules on CPAN. For example "Unicode::Map" and
962       "Unicode::String":
963       <http://search.cpan.org/author/MSCHWARTZ/Unicode-Map/Map.pm> and
964       <http://search.cpan.org/author/GAAS/Unicode-String/String.pm>.
965
966       For a full list of the Perl Unicode modules see:
967       <http://search.cpan.org/search?query=unicode&mode=all>.
968
969       "UTF-16BE" is the format most often returned by "Perl" modules that
970       generate "UTF-16". To write "UTF-16" strings in little-endian format
971       use the write_utf16be_string_le() method below.
972
973       The write_utf16be_string() method was previously called
974       write_unicode(). That, overly general, name is still supported but
975       deprecated.
976
977       See also the "unicode_*.pl" programs in the examples directory of the
978       distro.
979
980   write_utf16le_string($row, $column, $string, $format)
981       This method is the same as write_utf16be() except that the string
982       should be 16-bit characters in little-endian format. This is generally
983       referred to as "UTF-16LE". See "UNICODE IN EXCEL".
984
985       "UTF-16" data can be changed from little-endian to big-endian format
986       (and vice-versa) as follows:
987
988           $utf16be = pack 'n*', unpack 'v*', $utf16le;
989
990   keep_leading_zeros()
991       This method changes the default handling of integers with leading zeros
992       when using the write() method.
993
994       The write() method uses regular expressions to determine what type of
995       data to write to an Excel worksheet. If the data looks like a number it
996       writes a number using write_number(). One problem with this approach is
997       that occasionally data looks like a number but you don't want it
998       treated as a number.
999
1000       Zip codes and ID numbers, for example, often start with a leading zero.
1001       If you write this data as a number then the leading zero(s) will be
1002       stripped. This is the also the default behaviour when you enter data
1003       manually in Excel.
1004
1005       To get around this you can use one of three options. Write a formatted
1006       number, write the number as a string or use the keep_leading_zeros()
1007       method to change the default behaviour of write():
1008
1009           # Implicitly write a number, the leading zero is removed: 1209
1010           $worksheet->write('A1', '01209');
1011
1012           # Write a zero padded number using a format: 01209
1013           my $format1 = $workbook->add_format(num_format => '00000');
1014           $worksheet->write('A2', '01209', $format1);
1015
1016           # Write explicitly as a string: 01209
1017           $worksheet->write_string('A3', '01209');
1018
1019           # Write implicitly as a string: 01209
1020           $worksheet->keep_leading_zeros();
1021           $worksheet->write('A4', '01209');
1022
1023       The above code would generate a worksheet that looked like the
1024       following:
1025
1026            -----------------------------------------------------------
1027           |   |     A     |     B     |     C     |     D     | ...
1028            -----------------------------------------------------------
1029           | 1 |      1209 |           |           |           | ...
1030           | 2 |     01209 |           |           |           | ...
1031           | 3 | 01209     |           |           |           | ...
1032           | 4 | 01209     |           |           |           | ...
1033
1034       The examples are on different sides of the cells due to the fact that
1035       Excel displays strings with a left justification and numbers with a
1036       right justification by default. You can change this by using a format
1037       to justify the data, see "CELL FORMATTING".
1038
1039       It should be noted that if the user edits the data in examples "A3" and
1040       "A4" the strings will revert back to numbers. Again this is Excel's
1041       default behaviour. To avoid this you can use the text format "@":
1042
1043           # Format as a string (01209)
1044           my $format2 = $workbook->add_format(num_format => '@');
1045           $worksheet->write_string('A5', '01209', $format2);
1046
1047       The keep_leading_zeros() property is off by default. The
1048       keep_leading_zeros() method takes 0 or 1 as an argument. It defaults to
1049       1 if an argument isn't specified:
1050
1051           $worksheet->keep_leading_zeros();  # Set on
1052           $worksheet->keep_leading_zeros(1); # Set on
1053           $worksheet->keep_leading_zeros(0); # Set off
1054
1055       See also the add_write_handler() method.
1056
1057   write_blank($row, $column, $format)
1058       Write a blank cell specified by $row and $column:
1059
1060           $worksheet->write_blank(0, 0, $format);
1061
1062       This method is used to add formatting to a cell which doesn't contain a
1063       string or number value.
1064
1065       Excel differentiates between an "Empty" cell and a "Blank" cell. An
1066       "Empty" cell is a cell which doesn't contain data whilst a "Blank" cell
1067       is a cell which doesn't contain data but does contain formatting. Excel
1068       stores "Blank" cells but ignores "Empty" cells.
1069
1070       As such, if you write an empty cell without formatting it is ignored:
1071
1072           $worksheet->write('A1',  undef, $format); # write_blank()
1073           $worksheet->write('A2',  undef         ); # Ignored
1074
1075       This seemingly uninteresting fact means that you can write arrays of
1076       data without special treatment for undef or empty string values.
1077
1078       See the note about "Cell notation".
1079
1080   write_row($row, $column, $array_ref, $format)
1081       The write_row() method can be used to write a 1D or 2D array of data in
1082       one go. This is useful for converting the results of a database query
1083       into an Excel worksheet. You must pass a reference to the array of data
1084       rather than the array itself. The write() method is then called for
1085       each element of the data. For example:
1086
1087           @array      = ('awk', 'gawk', 'mawk');
1088           $array_ref  = \@array;
1089
1090           $worksheet->write_row(0, 0, $array_ref);
1091
1092           # The above example is equivalent to:
1093           $worksheet->write(0, 0, $array[0]);
1094           $worksheet->write(0, 1, $array[1]);
1095           $worksheet->write(0, 2, $array[2]);
1096
1097       Note: For convenience the write() method behaves in the same way as
1098       write_row() if it is passed an array reference. Therefore the following
1099       two method calls are equivalent:
1100
1101           $worksheet->write_row('A1', $array_ref); # Write a row of data
1102           $worksheet->write(    'A1', $array_ref); # Same thing
1103
1104       As with all of the write methods the $format parameter is optional. If
1105       a format is specified it is applied to all the elements of the data
1106       array.
1107
1108       Array references within the data will be treated as columns. This
1109       allows you to write 2D arrays of data in one go. For example:
1110
1111           @eec =  (
1112                       ['maggie', 'milly', 'molly', 'may'  ],
1113                       [13,       14,      15,      16     ],
1114                       ['shell',  'star',  'crab',  'stone']
1115                   );
1116
1117           $worksheet->write_row('A1', \@eec);
1118
1119       Would produce a worksheet as follows:
1120
1121            -----------------------------------------------------------
1122           |   |    A    |    B    |    C    |    D    |    E    | ...
1123            -----------------------------------------------------------
1124           | 1 | maggie  | 13      | shell   | ...     |  ...    | ...
1125           | 2 | milly   | 14      | star    | ...     |  ...    | ...
1126           | 3 | molly   | 15      | crab    | ...     |  ...    | ...
1127           | 4 | may     | 16      | stone   | ...     |  ...    | ...
1128           | 5 | ...     | ...     | ...     | ...     |  ...    | ...
1129           | 6 | ...     | ...     | ...     | ...     |  ...    | ...
1130
1131       To write the data in a row-column order refer to the write_col() method
1132       below.
1133
1134       Any "undef" values in the data will be ignored unless a format is
1135       applied to the data, in which case a formatted blank cell will be
1136       written. In either case the appropriate row or column value will still
1137       be incremented.
1138
1139       To find out more about array references refer to "perlref" and
1140       "perlreftut" in the main Perl documentation. To find out more about 2D
1141       arrays or "lists of lists" refer to "perllol".
1142
1143       The write_row() method returns the first error encountered when writing
1144       the elements of the data or zero if no errors were encountered. See the
1145       return values described for the write() method above.
1146
1147       See also the "write_arrays.pl" program in the "examples" directory of
1148       the distro.
1149
1150       The write_row() method allows the following idiomatic conversion of a
1151       text file to an Excel file:
1152
1153           #!/usr/bin/perl -w
1154
1155           use strict;
1156           use Spreadsheet::WriteExcel;
1157
1158           my $workbook  = Spreadsheet::WriteExcel->new('file.xls');
1159           my $worksheet = $workbook->add_worksheet();
1160
1161           open INPUT, 'file.txt' or die "Couldn't open file: $!";
1162
1163           $worksheet->write($.-1, 0, [split]) while <INPUT>;
1164
1165   write_col($row, $column, $array_ref, $format)
1166       The write_col() method can be used to write a 1D or 2D array of data in
1167       one go. This is useful for converting the results of a database query
1168       into an Excel worksheet. You must pass a reference to the array of data
1169       rather than the array itself. The write() method is then called for
1170       each element of the data. For example:
1171
1172           @array      = ('awk', 'gawk', 'mawk');
1173           $array_ref  = \@array;
1174
1175           $worksheet->write_col(0, 0, $array_ref);
1176
1177           # The above example is equivalent to:
1178           $worksheet->write(0, 0, $array[0]);
1179           $worksheet->write(1, 0, $array[1]);
1180           $worksheet->write(2, 0, $array[2]);
1181
1182       As with all of the write methods the $format parameter is optional. If
1183       a format is specified it is applied to all the elements of the data
1184       array.
1185
1186       Array references within the data will be treated as rows. This allows
1187       you to write 2D arrays of data in one go. For example:
1188
1189           @eec =  (
1190                       ['maggie', 'milly', 'molly', 'may'  ],
1191                       [13,       14,      15,      16     ],
1192                       ['shell',  'star',  'crab',  'stone']
1193                   );
1194
1195           $worksheet->write_col('A1', \@eec);
1196
1197       Would produce a worksheet as follows:
1198
1199            -----------------------------------------------------------
1200           |   |    A    |    B    |    C    |    D    |    E    | ...
1201            -----------------------------------------------------------
1202           | 1 | maggie  | milly   | molly   | may     |  ...    | ...
1203           | 2 | 13      | 14      | 15      | 16      |  ...    | ...
1204           | 3 | shell   | star    | crab    | stone   |  ...    | ...
1205           | 4 | ...     | ...     | ...     | ...     |  ...    | ...
1206           | 5 | ...     | ...     | ...     | ...     |  ...    | ...
1207           | 6 | ...     | ...     | ...     | ...     |  ...    | ...
1208
1209       To write the data in a column-row order refer to the write_row() method
1210       above.
1211
1212       Any "undef" values in the data will be ignored unless a format is
1213       applied to the data, in which case a formatted blank cell will be
1214       written. In either case the appropriate row or column value will still
1215       be incremented.
1216
1217       As noted above the write() method can be used as a synonym for
1218       write_row() and write_row() handles nested array refs as columns.
1219       Therefore, the following two method calls are equivalent although the
1220       more explicit call to write_col() would be preferable for
1221       maintainability:
1222
1223           $worksheet->write_col('A1', $array_ref    ); # Write a column of data
1224           $worksheet->write(    'A1', [ $array_ref ]); # Same thing
1225
1226       To find out more about array references refer to "perlref" and
1227       "perlreftut" in the main Perl documentation. To find out more about 2D
1228       arrays or "lists of lists" refer to "perllol".
1229
1230       The write_col() method returns the first error encountered when writing
1231       the elements of the data or zero if no errors were encountered. See the
1232       return values described for the write() method above.
1233
1234       See also the "write_arrays.pl" program in the "examples" directory of
1235       the distro.
1236
1237   write_date_time($row, $col, $date_string, $format)
1238       The write_date_time() method can be used to write a date or time to the
1239       cell specified by $row and $column:
1240
1241           $worksheet->write_date_time('A1', '2004-05-13T23:20', $date_format);
1242
1243       The $date_string should be in the following format:
1244
1245           yyyy-mm-ddThh:mm:ss.sss
1246
1247       This conforms to an ISO8601 date but it should be noted that the full
1248       range of ISO8601 formats are not supported.
1249
1250       The following variations on the $date_string parameter are permitted:
1251
1252           yyyy-mm-ddThh:mm:ss.sss         # Standard format
1253           yyyy-mm-ddT                     # No time
1254                     Thh:mm:ss.sss         # No date
1255           yyyy-mm-ddThh:mm:ss.sssZ        # Additional Z (but not time zones)
1256           yyyy-mm-ddThh:mm:ss             # No fractional seconds
1257           yyyy-mm-ddThh:mm                # No seconds
1258
1259       Note that the "T" is required in all cases.
1260
1261       A date should always have a $format, otherwise it will appear as a
1262       number, see "DATES AND TIME IN EXCEL" and "CELL FORMATTING". Here is a
1263       typical example:
1264
1265           my $date_format = $workbook->add_format(num_format => 'mm/dd/yy');
1266           $worksheet->write_date_time('A1', '2004-05-13T23:20', $date_format);
1267
1268       Valid dates should be in the range 1900-01-01 to 9999-12-31, for the
1269       1900 epoch and 1904-01-01 to 9999-12-31, for the 1904 epoch. As with
1270       Excel, dates outside these ranges will be written as a string.
1271
1272       See also the date_time.pl program in the "examples" directory of the
1273       distro.
1274
1275   write_url($row, $col, $url, $label, $format)
1276       Write a hyperlink to a URL in the cell specified by $row and $column.
1277       The hyperlink is comprised of two elements: the visible label and the
1278       invisible link. The visible label is the same as the link unless an
1279       alternative label is specified. The parameters $label and the $format
1280       are optional and their position is interchangeable.
1281
1282       The label is written using the write() method. Therefore it is possible
1283       to write strings, numbers or formulas as labels.
1284
1285       There are four web style URI's supported: "http://", "https://",
1286       "ftp://" and  "mailto:":
1287
1288           $worksheet->write_url(0, 0,  'ftp://www.perl.org/'                  );
1289           $worksheet->write_url(1, 0,  'http://www.perl.com/', 'Perl home'    );
1290           $worksheet->write_url('A3',  'http://www.perl.com/', $format        );
1291           $worksheet->write_url('A4',  'http://www.perl.com/', 'Perl', $format);
1292           $worksheet->write_url('A5',  'mailto:jmcnamara@cpan.org'            );
1293
1294       There are two local URIs supported: "internal:" and "external:". These
1295       are used for hyperlinks to internal worksheet references or external
1296       workbook and worksheet references:
1297
1298           $worksheet->write_url('A6',  'internal:Sheet2!A1'                   );
1299           $worksheet->write_url('A7',  'internal:Sheet2!A1',   $format        );
1300           $worksheet->write_url('A8',  'internal:Sheet2!A1:B2'                );
1301           $worksheet->write_url('A9',  q{internal:'Sales Data'!A1}            );
1302           $worksheet->write_url('A10', 'external:c:\temp\foo.xls'             );
1303           $worksheet->write_url('A11', 'external:c:\temp\foo.xls#Sheet2!A1'   );
1304           $worksheet->write_url('A12', 'external:..\..\..\foo.xls'            );
1305           $worksheet->write_url('A13', 'external:..\..\..\foo.xls#Sheet2!A1'  );
1306           $worksheet->write_url('A13', 'external:\\\\NETWORK\share\foo.xls'   );
1307
1308       All of the these URI types are recognised by the write() method, see
1309       above.
1310
1311       Worksheet references are typically of the form "Sheet1!A1". You can
1312       also refer to a worksheet range using the standard Excel notation:
1313       "Sheet1!A1:B2".
1314
1315       In external links the workbook and worksheet name must be separated by
1316       the "#" character: "external:Workbook.xls#Sheet1!A1'".
1317
1318       You can also link to a named range in the target worksheet. For example
1319       say you have a named range called "my_name" in the workbook
1320       "c:\temp\foo.xls" you could link to it as follows:
1321
1322           $worksheet->write_url('A14', 'external:c:\temp\foo.xls#my_name');
1323
1324       Note, you cannot currently create named ranges with
1325       "Spreadsheet::WriteExcel".
1326
1327       Excel requires that worksheet names containing spaces or non
1328       alphanumeric characters are single quoted as follows "'Sales Data'!A1".
1329       If you need to do this in a single quoted string then you can either
1330       escape the single quotes "\'" or use the quote operator "q{}" as
1331       described in "perlop" in the main Perl documentation.
1332
1333       Links to network files are also supported. MS/Novell Network files
1334       normally begin with two back slashes as follows "\\NETWORK\etc". In
1335       order to generate this in a single or double quoted string you will
1336       have to escape the backslashes,  '\\\\NETWORK\etc'.
1337
1338       If you are using double quote strings then you should be careful to
1339       escape anything that looks like a metacharacter. For more information
1340       see "perlfaq5: Why can't I use "C:\temp\foo" in DOS paths?".
1341
1342       Finally, you can avoid most of these quoting problems by using forward
1343       slashes. These are translated internally to backslashes:
1344
1345           $worksheet->write_url('A14', "external:c:/temp/foo.xls"             );
1346           $worksheet->write_url('A15', 'external://NETWORK/share/foo.xls'     );
1347
1348       See also, the note about "Cell notation".
1349
1350   write_url_range($row1, $col1, $row2, $col2, $url, $string, $format)
1351       This method is essentially the same as the write_url() method described
1352       above. The main difference is that you can specify a link for a range
1353       of cells:
1354
1355           $worksheet->write_url(0, 0, 0, 3, 'ftp://www.perl.org/'              );
1356           $worksheet->write_url(1, 0, 0, 3, 'http://www.perl.com/', 'Perl home');
1357           $worksheet->write_url('A3:D3',    'internal:Sheet2!A1'               );
1358           $worksheet->write_url('A4:D4',    'external:c:\temp\foo.xls'         );
1359
1360       This method is generally only required when used in conjunction with
1361       merged cells. See the merge_range() method and the "merge" property of
1362       a Format object, "CELL FORMATTING".
1363
1364       There is no way to force this behaviour through the write() method.
1365
1366       The parameters $string and the $format are optional and their position
1367       is interchangeable. However, they are applied only to the first cell in
1368       the range.
1369
1370       See also, the note about "Cell notation".
1371
1372   write_formula($row, $column, $formula, $format, $value)
1373       Write a formula or function to the cell specified by $row and $column:
1374
1375           $worksheet->write_formula(0, 0, '=$B$3 + B4'  );
1376           $worksheet->write_formula(1, 0, '=SIN(PI()/4)');
1377           $worksheet->write_formula(2, 0, '=SUM(B1:B5)' );
1378           $worksheet->write_formula('A4', '=IF(A3>1,"Yes", "No")'   );
1379           $worksheet->write_formula('A5', '=AVERAGE(1, 2, 3, 4)'    );
1380           $worksheet->write_formula('A6', '=DATEVALUE("1-Jan-2001")');
1381
1382       See the note about "Cell notation". For more information about writing
1383       Excel formulas see "FORMULAS AND FUNCTIONS IN EXCEL"
1384
1385       See also the section "Improving performance when working with formulas"
1386       and the store_formula() and repeat_formula() methods.
1387
1388       If required, it is also possible to specify the calculated value of the
1389       formula. This is occasionally necessary when working with non-Excel
1390       applications that don't calculate the value of the formula. The
1391       calculated $value is added at the end of the argument list:
1392
1393           $worksheet->write('A1', '=2+2', $format, 4);
1394
1395       However, this probably isn't something that will ever need to do. If
1396       you do use this feature then do so with care.
1397
1398   store_formula($formula)
1399       The store_formula() method is used in conjunction with repeat_formula()
1400       to speed up the generation of repeated formulas. See "Improving
1401       performance when working with formulas" in "FORMULAS AND FUNCTIONS IN
1402       EXCEL".
1403
1404       The store_formula() method pre-parses a textual representation of a
1405       formula and stores it for use at a later stage by the repeat_formula()
1406       method.
1407
1408       store_formula() carries the same speed penalty as write_formula().
1409       However, in practice it will be used less frequently.
1410
1411       The return value of this method is a scalar that can be thought of as a
1412       reference to a formula.
1413
1414           my $sin = $worksheet->store_formula('=SIN(A1)');
1415           my $cos = $worksheet->store_formula('=COS(A1)');
1416
1417           $worksheet->repeat_formula('B1', $sin, $format, 'A1', 'A2');
1418           $worksheet->repeat_formula('C1', $cos, $format, 'A1', 'A2');
1419
1420       Although store_formula() is a worksheet method the return value can be
1421       used in any worksheet:
1422
1423           my $now = $worksheet->store_formula('=NOW()');
1424
1425           $worksheet1->repeat_formula('B1', $now);
1426           $worksheet2->repeat_formula('B1', $now);
1427           $worksheet3->repeat_formula('B1', $now);
1428
1429   repeat_formula($row, $col, $formula, $format, ($pattern => $replace, ...))
1430       The repeat_formula() method is used in conjunction with store_formula()
1431       to speed up the generation of repeated formulas.  See "Improving
1432       performance when working with formulas" in "FORMULAS AND FUNCTIONS IN
1433       EXCEL".
1434
1435       In many respects repeat_formula() behaves like write_formula() except
1436       that it is significantly faster.
1437
1438       The repeat_formula() method creates a new formula based on the pre-
1439       parsed tokens returned by store_formula(). The new formula is generated
1440       by substituting $pattern, $replace pairs in the stored formula:
1441
1442           my $formula = $worksheet->store_formula('=A1 * 3 + 50');
1443
1444           for my $row (0..99) {
1445               $worksheet->repeat_formula($row, 1, $formula, $format, 'A1', 'A'.($row +1));
1446           }
1447
1448       It should be noted that repeat_formula() doesn't modify the tokens. In
1449       the above example the substitution is always made against the original
1450       token, "A1", which doesn't change.
1451
1452       As usual, you can use "undef" if you don't wish to specify a $format:
1453
1454           $worksheet->repeat_formula('B2', $formula, $format, 'A1', 'A2');
1455           $worksheet->repeat_formula('B3', $formula, undef,   'A1', 'A3');
1456
1457       The substitutions are made from left to right and you can use as many
1458       $pattern, $replace pairs as you need. However, each substitution is
1459       made only once:
1460
1461           my $formula = $worksheet->store_formula('=A1 + A1');
1462
1463           # Gives '=B1 + A1'
1464           $worksheet->repeat_formula('B1', $formula, undef, 'A1', 'B1');
1465
1466           # Gives '=B1 + B1'
1467           $worksheet->repeat_formula('B2', $formula, undef, ('A1', 'B1') x 2);
1468
1469       Since the $pattern is interpolated each time that it is used it is
1470       worth using the "qr" operator to quote the pattern. The "qr" operator
1471       is explained in the "perlop" man page.
1472
1473           $worksheet->repeat_formula('B1', $formula, $format, qr/A1/, 'A2');
1474
1475       Care should be taken with the values that are substituted. The formula
1476       returned by repeat_formula() contains several other tokens in addition
1477       to those in the formula and these might also match the  pattern that
1478       you are trying to replace. In particular you should avoid substituting
1479       a single 0, 1, 2 or 3.
1480
1481       You should also be careful to avoid false matches. For example the
1482       following snippet is meant to change the stored formula in steps from
1483       "=A1 + SIN(A1)" to "=A10 + SIN(A10)".
1484
1485           my $formula = $worksheet->store_formula('=A1 + SIN(A1)');
1486
1487           for my $row (1 .. 10) {
1488               $worksheet->repeat_formula($row -1, 1, $formula, undef,
1489                                           qw/A1/, 'A' . $row,   #! Bad.
1490                                           qw/A1/, 'A' . $row    #! Bad.
1491                                         );
1492           }
1493
1494       However it contains a bug. In the last iteration of the loop when $row
1495       is 10 the following substitutions will occur:
1496
1497           s/A1/A10/;    changes    =A1 + SIN(A1)     to    =A10 + SIN(A1)
1498           s/A1/A10/;    changes    =A10 + SIN(A1)    to    =A100 + SIN(A1) # !!
1499
1500       The solution in this case is to use a more explicit match such as
1501       "qw/^A1$/":
1502
1503               $worksheet->repeat_formula($row -1, 1, $formula, undef,
1504                                           qw/^A1$/, 'A' . $row,
1505                                           qw/^A1$/, 'A' . $row
1506                                         );
1507
1508       Another similar problem occurs due to the fact that substitutions are
1509       made in order. For example the following snippet is meant to change the
1510       stored formula from "=A10 + A11"  to "=A11 + A12":
1511
1512           my $formula = $worksheet->store_formula('=A10 + A11');
1513
1514           $worksheet->repeat_formula('A1', $formula, undef,
1515                                       qw/A10/, 'A11',   #! Bad.
1516                                       qw/A11/, 'A12'    #! Bad.
1517                                     );
1518
1519       However, the actual substitution yields "=A12 + A11":
1520
1521           s/A10/A11/;    changes    =A10 + A11    to    =A11 + A11
1522           s/A11/A12/;    changes    =A11 + A11    to    =A12 + A11 # !!
1523
1524       The solution here would be to reverse the order of the substitutions or
1525       to start with a stored formula that won't yield a false match such as
1526       "=X10 + Y11":
1527
1528           my $formula = $worksheet->store_formula('=X10 + Y11');
1529
1530           $worksheet->repeat_formula('A1', $formula, undef,
1531                                       qw/X10/, 'A11',
1532                                       qw/Y11/, 'A12'
1533                                     );
1534
1535       If you think that you have a problem related to a false match you can
1536       check the tokens that you are substituting against as follows.
1537
1538           my $formula = $worksheet->store_formula('=A1*5+4');
1539           print "@$formula\n";
1540
1541       See also the "repeat.pl" program in the "examples" directory of the
1542       distro.
1543
1544   write_comment($row, $column, $string, ...)
1545       The write_comment() method is used to add a comment to a cell. A cell
1546       comment is indicated in Excel by a small red triangle in the upper
1547       right-hand corner of the cell. Moving the cursor over the red triangle
1548       will reveal the comment.
1549
1550       The following example shows how to add a comment to a cell:
1551
1552           $worksheet->write        (2, 2, 'Hello');
1553           $worksheet->write_comment(2, 2, 'This is a comment.');
1554
1555       As usual you can replace the $row and $column parameters with an "A1"
1556       cell reference. See the note about "Cell notation".
1557
1558           $worksheet->write        ('C3', 'Hello');
1559           $worksheet->write_comment('C3', 'This is a comment.');
1560
1561       On systems with "perl 5.8" and later the write_comment() method will
1562       also handle strings in "UTF-8" format.
1563
1564           $worksheet->write_comment('C3', "\x{263a}");       # Smiley
1565           $worksheet->write_comment('C4', 'Comment ca va?');
1566
1567       In addition to the basic 3 argument form of write_comment() you can
1568       pass in several optional key/value pairs to control the format of the
1569       comment. For example:
1570
1571           $worksheet->write_comment('C3', 'Hello', visible => 1, author => 'Perl');
1572
1573       Most of these options are quite specific and in general the default
1574       comment behaviour will be all that you need. However, should you need
1575       greater control over the format of the cell comment the following
1576       options are available:
1577
1578           encoding
1579           author
1580           author_encoding
1581           visible
1582           x_scale
1583           width
1584           y_scale
1585           height
1586           color
1587           start_cell
1588           start_row
1589           start_col
1590           x_offset
1591           y_offset
1592
1593       Option: encoding
1594           This option is used to indicate that the comment string is encoded
1595           as "UTF-16BE".
1596
1597               my $comment = pack 'n', 0x263a; # UTF-16BE Smiley symbol
1598
1599               $worksheet->write_comment('C3', $comment, encoding => 1);
1600
1601           If you wish to use Unicode characters in the comment string then
1602           the preferred method is to use perl 5.8 and "UTF-8" strings, see
1603           "UNICODE IN EXCEL".
1604
1605       Option: author
1606           This option is used to indicate who the author of the comment is.
1607           Excel displays the author of the comment in the status bar at the
1608           bottom of the worksheet. This is usually of interest in corporate
1609           environments where several people might review and provide comments
1610           to a workbook.
1611
1612               $worksheet->write_comment('C3', 'Atonement', author => 'Ian McEwan');
1613
1614       Option: author_encoding
1615           This option is used to indicate that the author string is encoded
1616           as "UTF-16BE".
1617
1618       Option: visible
1619           This option is used to make a cell comment visible when the
1620           worksheet is opened. The default behaviour in Excel is that
1621           comments are initially hidden. However, it is also possible in
1622           Excel to make individual or all comments visible. In
1623           Spreadsheet::WriteExcel individual comments can be made visible as
1624           follows:
1625
1626               $worksheet->write_comment('C3', 'Hello', visible => 1);
1627
1628           It is possible to make all comments in a worksheet visible using
1629           the show_comments() worksheet method (see below). Alternatively, if
1630           all of the cell comments have been made visible you can hide
1631           individual comments:
1632
1633               $worksheet->write_comment('C3', 'Hello', visible => 0);
1634
1635       Option: x_scale
1636           This option is used to set the width of the cell comment box as a
1637           factor of the default width.
1638
1639               $worksheet->write_comment('C3', 'Hello', x_scale => 2);
1640               $worksheet->write_comment('C4', 'Hello', x_scale => 4.2);
1641
1642       Option: width
1643           This option is used to set the width of the cell comment box
1644           explicitly in pixels.
1645
1646               $worksheet->write_comment('C3', 'Hello', width => 200);
1647
1648       Option: y_scale
1649           This option is used to set the height of the cell comment box as a
1650           factor of the default height.
1651
1652               $worksheet->write_comment('C3', 'Hello', y_scale => 2);
1653               $worksheet->write_comment('C4', 'Hello', y_scale => 4.2);
1654
1655       Option: height
1656           This option is used to set the height of the cell comment box
1657           explicitly in pixels.
1658
1659               $worksheet->write_comment('C3', 'Hello', height => 200);
1660
1661       Option: color
1662           This option is used to set the background colour of cell comment
1663           box. You can use one of the named colours recognised by
1664           Spreadsheet::WriteExcel or a colour index. See "COLOURS IN EXCEL".
1665
1666               $worksheet->write_comment('C3', 'Hello', color => 'green');
1667               $worksheet->write_comment('C4', 'Hello', color => 0x35);    # Orange
1668
1669       Option: start_cell
1670           This option is used to set the cell in which the comment will
1671           appear. By default Excel displays comments one cell to the right
1672           and one cell above the cell to which the comment relates. However,
1673           you can change this behaviour if you wish. In the following example
1674           the comment which would appear by default in cell "D2" is moved to
1675           "E2".
1676
1677               $worksheet->write_comment('C3', 'Hello', start_cell => 'E2');
1678
1679       Option: start_row
1680           This option is used to set the row in which the comment will
1681           appear. See the "start_cell" option above. The row is zero indexed.
1682
1683               $worksheet->write_comment('C3', 'Hello', start_row => 0);
1684
1685       Option: start_col
1686           This option is used to set the column in which the comment will
1687           appear. See the "start_cell" option above. The column is zero
1688           indexed.
1689
1690               $worksheet->write_comment('C3', 'Hello', start_col => 4);
1691
1692       Option: x_offset
1693           This option is used to change the x offset, in pixels, of a comment
1694           within a cell:
1695
1696               $worksheet->write_comment('C3', $comment, x_offset => 30);
1697
1698       Option: y_offset
1699           This option is used to change the y offset, in pixels, of a comment
1700           within a cell:
1701
1702               $worksheet->write_comment('C3', $comment, x_offset => 30);
1703
1704       You can apply as many of these options as you require.
1705
1706       See also "ROW HEIGHTS AND WORKSHEET OBJECTS".
1707
1708   show_comments()
1709       This method is used to make all cell comments visible when a worksheet
1710       is opened.
1711
1712       Individual comments can be made visible using the "visible" parameter
1713       of the "write_comment" method (see above):
1714
1715           $worksheet->write_comment('C3', 'Hello', visible => 1);
1716
1717       If all of the cell comments have been made visible you can hide
1718       individual comments as follows:
1719
1720           $worksheet->write_comment('C3', 'Hello', visible => 0);
1721
1722   add_write_handler($re, $code_ref)
1723       This method is used to extend the Spreadsheet::WriteExcel write()
1724       method to handle user defined data.
1725
1726       If you refer to the section on write() above you will see that it acts
1727       as an alias for several more specific "write_*" methods. However, it
1728       doesn't always act in exactly the way that you would like it to.
1729
1730       One solution is to filter the input data yourself and call the
1731       appropriate "write_*" method. Another approach is to use the
1732       add_write_handler() method to add your own automated behaviour to
1733       write().
1734
1735       The add_write_handler() method take two arguments, $re, a regular
1736       expression to match incoming data and $code_ref a callback function to
1737       handle the matched data:
1738
1739           $worksheet->add_write_handler(qr/^\d\d\d\d$/, \&my_write);
1740
1741       (In the these examples the "qr" operator is used to quote the regular
1742       expression strings, see perlop for more details).
1743
1744       The method is used as follows. say you wished to write 7 digit ID
1745       numbers as a string so that any leading zeros were preserved*, you
1746       could do something like the following:
1747
1748           $worksheet->add_write_handler(qr/^\d{7}$/, \&write_my_id);
1749
1750
1751           sub write_my_id {
1752               my $worksheet = shift;
1753               return $worksheet->write_string(@_);
1754           }
1755
1756       * You could also use the keep_leading_zeros() method for this.
1757
1758       Then if you call write() with an appropriate string it will be handled
1759       automatically:
1760
1761           # Writes 0000000. It would normally be written as a number; 0.
1762           $worksheet->write('A1', '0000000');
1763
1764       The callback function will receive a reference to the calling worksheet
1765       and all of the other arguments that were passed to write(). The
1766       callback will see an @_ argument list that looks like the following:
1767
1768           $_[0]   A ref to the calling worksheet. *
1769           $_[1]   Zero based row number.
1770           $_[2]   Zero based column number.
1771           $_[3]   A number or string or token.
1772           $_[4]   A format ref if any.
1773           $_[5]   Any other arguments.
1774           ...
1775
1776           *  It is good style to shift this off the list so the @_ is the same
1777              as the argument list seen by write().
1778
1779       Your callback should return() the return value of the "write_*" method
1780       that was called or "undef" to indicate that you rejected the match and
1781       want write() to continue as normal.
1782
1783       So for example if you wished to apply the previous filter only to ID
1784       values that occur in the first column you could modify your callback
1785       function as follows:
1786
1787           sub write_my_id {
1788               my $worksheet = shift;
1789               my $col       = $_[1];
1790
1791               if ($col == 0) {
1792                   return $worksheet->write_string(@_);
1793               }
1794               else {
1795                   # Reject the match and return control to write()
1796                   return undef;
1797               }
1798           }
1799
1800       Now, you will get different behaviour for the first column and other
1801       columns:
1802
1803           $worksheet->write('A1', '0000000'); # Writes 0000000
1804           $worksheet->write('B1', '0000000'); # Writes 0
1805
1806       You may add more than one handler in which case they will be called in
1807       the order that they were added.
1808
1809       Note, the add_write_handler() method is particularly suited for
1810       handling dates.
1811
1812       See the "write_handler 1-4" programs in the "examples" directory for
1813       further examples.
1814
1815   insert_image($row, $col, $filename, $x, $y, $scale_x, $scale_y)
1816       This method can be used to insert a image into a worksheet. The image
1817       can be in PNG, JPEG or BMP format. The $x, $y, $scale_x and $scale_y
1818       parameters are optional.
1819
1820           $worksheet1->insert_image('A1', 'perl.bmp');
1821           $worksheet2->insert_image('A1', '../images/perl.bmp');
1822           $worksheet3->insert_image('A1', '.c:\images\perl.bmp');
1823
1824       The parameters $x and $y can be used to specify an offset from the top
1825       left hand corner of the cell specified by $row and $col. The offset
1826       values are in pixels.
1827
1828           $worksheet1->insert_image('A1', 'perl.bmp', 32, 10);
1829
1830       The default width of a cell is 63 pixels. The default height of a cell
1831       is 17 pixels. The pixels offsets can be calculated using the following
1832       relationships:
1833
1834           Wp = int(12We)   if We <  1
1835           Wp = int(7We +5) if We >= 1
1836           Hp = int(4/3He)
1837
1838           where:
1839           We is the cell width in Excels units
1840           Wp is width in pixels
1841           He is the cell height in Excels units
1842           Hp is height in pixels
1843
1844       The offsets can be greater than the width or height of the underlying
1845       cell. This can be occasionally useful if you wish to align two or more
1846       images relative to the same cell.
1847
1848       The parameters $scale_x and $scale_y can be used to scale the inserted
1849       image horizontally and vertically:
1850
1851           # Scale the inserted image: width x 2.0, height x 0.8
1852           $worksheet->insert_image('A1', 'perl.bmp', 0, 0, 2, 0.8);
1853
1854       See also the "images.pl" program in the "examples" directory of the
1855       distro.
1856
1857       BMP images must be 24 bit, true colour, bitmaps. In general it is best
1858       to avoid BMP images since they aren't compressed. The older
1859       insert_bitmap() method is still supported but deprecated.
1860
1861       See also "ROW HEIGHTS AND WORKSHEET OBJECTS".
1862
1863   insert_chart($row, $col, $chart, $x, $y, $scale_x, $scale_y)
1864       This method can be used to insert a Chart object into a worksheet. The
1865       Chart must be created by the add_chart() Workbook method  and it must
1866       have the "embedded" option set.
1867
1868           my $chart = $workbook->add_chart( type => 'line', embedded => 1 );
1869
1870           # Configure the chart.
1871           ...
1872
1873           # Insert the chart into the a worksheet.
1874           $worksheet->insert_chart('E2', $chart);
1875
1876       See add_chart() for details on how to create the Chart object and
1877       Spreadsheet::WriteExcel::Chart for details on how to configure it. See
1878       also the "chart_*.pl" programs in the examples directory of the distro.
1879
1880       The $x, $y, $scale_x and $scale_y parameters are optional.
1881
1882       The parameters $x and $y can be used to specify an offset from the top
1883       left hand corner of the cell specified by $row and $col. The offset
1884       values are in pixels. See the "insert_image" method above for more
1885       information on sizes.
1886
1887           $worksheet1->insert_chart('E2', $chart, 3, 3);
1888
1889       The parameters $scale_x and $scale_y can be used to scale the inserted
1890       image horizontally and vertically:
1891
1892           # Scale the width by 120% and the height by 150%
1893           $worksheet->insert_chart('E2', $chart, 0, 0, 1.2, 1.5);
1894
1895       The easiest way to calculate the required scaling is to create a test
1896       chart worksheet with Spreadsheet::WriteExcel. Then open the file,
1897       select the chart and drag the corner to get the required size. While
1898       holding down the mouse the scale of the resized chart is shown to the
1899       left of the formula bar.
1900
1901       See also "ROW HEIGHTS AND WORKSHEET OBJECTS".
1902
1903   embed_chart($row, $col, $filename, $x, $y, $scale_x, $scale_y)
1904       This method can be used to insert a externally generated chart into a
1905       worksheet. The chart must first be extracted from an existing Excel
1906       file. This feature is semi-deprecated in favour of the "native" charts
1907       created using add_chart(). Read "external_charts.txt" (or ".pod") in
1908       the external_charts directory of the distro for a full explanation.
1909
1910       Here is an example:
1911
1912           $worksheet->embed_chart('B2', 'sales_chart.bin');
1913
1914       The $x, $y, $scale_x and $scale_y parameters are optional. See
1915       insert_chart() above for details.
1916
1917   data_validation()
1918       The data_validation() method is used to construct an Excel data
1919       validation or to limit the user input to a dropdown list of values.
1920
1921           $worksheet->data_validation('B3',
1922               {
1923                   validate => 'integer',
1924                   criteria => '>',
1925                   value    => 100,
1926               });
1927
1928           $worksheet->data_validation('B5:B9',
1929               {
1930                   validate => 'list',
1931                   value    => ['open', 'high', 'close'],
1932               });
1933
1934       This method contains a lot of parameters and is described in detail in
1935       a separate section "DATA VALIDATION IN EXCEL".
1936
1937       See also the "data_validate.pl" program in the examples directory of
1938       the distro
1939
1940   get_name()
1941       The get_name() method is used to retrieve the name of a worksheet. For
1942       example:
1943
1944           foreach my $sheet ($workbook->sheets()) {
1945               print $sheet->get_name();
1946           }
1947
1948       For reasons related to the design of Spreadsheet::WriteExcel and to the
1949       internals of Excel there is no set_name() method. The only way to set
1950       the worksheet name is via the add_worksheet() method.
1951
1952   activate()
1953       The activate() method is used to specify which worksheet is initially
1954       visible in a multi-sheet workbook:
1955
1956           $worksheet1 = $workbook->add_worksheet('To');
1957           $worksheet2 = $workbook->add_worksheet('the');
1958           $worksheet3 = $workbook->add_worksheet('wind');
1959
1960           $worksheet3->activate();
1961
1962       This is similar to the Excel VBA activate method. More than one
1963       worksheet can be selected via the select() method, see below, however
1964       only one worksheet can be active.
1965
1966       The default active worksheet is the first worksheet.
1967
1968   select()
1969       The select() method is used to indicate that a worksheet is selected in
1970       a multi-sheet workbook:
1971
1972           $worksheet1->activate();
1973           $worksheet2->select();
1974           $worksheet3->select();
1975
1976       A selected worksheet has its tab highlighted. Selecting worksheets is a
1977       way of grouping them together so that, for example, several worksheets
1978       could be printed in one go. A worksheet that has been activated via the
1979       activate() method will also appear as selected.
1980
1981   hide()
1982       The hide() method is used to hide a worksheet:
1983
1984           $worksheet2->hide();
1985
1986       You may wish to hide a worksheet in order to avoid confusing a user
1987       with intermediate data or calculations.
1988
1989       A hidden worksheet can not be activated or selected so this method is
1990       mutually exclusive with the activate() and select() methods. In
1991       addition, since the first worksheet will default to being the active
1992       worksheet, you cannot hide the first worksheet without activating
1993       another sheet:
1994
1995           $worksheet2->activate();
1996           $worksheet1->hide();
1997
1998   set_first_sheet()
1999       The activate() method determines which worksheet is initially selected.
2000       However, if there are a large number of worksheets the selected
2001       worksheet may not appear on the screen. To avoid this you can select
2002       which is the leftmost visible worksheet using set_first_sheet():
2003
2004           for (1..20) {
2005               $workbook->add_worksheet;
2006           }
2007
2008           $worksheet21 = $workbook->add_worksheet();
2009           $worksheet22 = $workbook->add_worksheet();
2010
2011           $worksheet21->set_first_sheet();
2012           $worksheet22->activate();
2013
2014       This method is not required very often. The default value is the first
2015       worksheet.
2016
2017   protect($password)
2018       The protect() method is used to protect a worksheet from modification:
2019
2020           $worksheet->protect();
2021
2022       It can be turned off in Excel via the "Tools->Protection->Unprotect
2023       Sheet" menu command.
2024
2025       The protect() method also has the effect of enabling a cell's "locked"
2026       and "hidden" properties if they have been set. A "locked" cell cannot
2027       be edited. A "hidden" cell will display the results of a formula but
2028       not the formula itself. In Excel a cell's locked property is on by
2029       default.
2030
2031           # Set some format properties
2032           my $unlocked  = $workbook->add_format(locked => 0);
2033           my $hidden    = $workbook->add_format(hidden => 1);
2034
2035           # Enable worksheet protection
2036           $worksheet->protect();
2037
2038           # This cell cannot be edited, it is locked by default
2039           $worksheet->write('A1', '=1+2');
2040
2041           # This cell can be edited
2042           $worksheet->write('A2', '=1+2', $unlocked);
2043
2044           # The formula in this cell isn't visible
2045           $worksheet->write('A3', '=1+2', $hidden);
2046
2047       See also the "set_locked" and "set_hidden" format methods in "CELL
2048       FORMATTING".
2049
2050       You can optionally add a password to the worksheet protection:
2051
2052           $worksheet->protect('drowssap');
2053
2054       Note, the worksheet level password in Excel provides very weak
2055       protection. It does not encrypt your data in any way and it is very
2056       easy to deactivate. Therefore, do not use the above method if you wish
2057       to protect sensitive data or calculations. However, before you get
2058       worried, Excel's own workbook level password protection does provide
2059       strong encryption in Excel 97+. For technical reasons this will never
2060       be supported by "Spreadsheet::WriteExcel".
2061
2062   set_selection($first_row, $first_col, $last_row, $last_col)
2063       This method can be used to specify which cell or cells are selected in
2064       a worksheet. The most common requirement is to select a single cell, in
2065       which case $last_row and $last_col can be omitted. The active cell
2066       within a selected range is determined by the order in which $first and
2067       $last are specified. It is also possible to specify a cell or a range
2068       using A1 notation. See the note about "Cell notation".
2069
2070       Examples:
2071
2072           $worksheet1->set_selection(3, 3);       # 1. Cell D4.
2073           $worksheet2->set_selection(3, 3, 6, 6); # 2. Cells D4 to G7.
2074           $worksheet3->set_selection(6, 6, 3, 3); # 3. Cells G7 to D4.
2075           $worksheet4->set_selection('D4');       # Same as 1.
2076           $worksheet5->set_selection('D4:G7');    # Same as 2.
2077           $worksheet6->set_selection('G7:D4');    # Same as 3.
2078
2079       The default cell selections is (0, 0), 'A1'.
2080
2081   set_row($row, $height, $format, $hidden, $level, $collapsed)
2082       This method can be used to change the default properties of a row. All
2083       parameters apart from $row are optional.
2084
2085       The most common use for this method is to change the height of a row:
2086
2087           $worksheet->set_row(0, 20); # Row 1 height set to 20
2088
2089       If you wish to set the format without changing the height you can pass
2090       "undef" as the height parameter:
2091
2092           $worksheet->set_row(0, undef, $format);
2093
2094       The $format parameter will be applied to any cells in the row that
2095       don't  have a format. For example
2096
2097           $worksheet->set_row(0, undef, $format1);    # Set the format for row 1
2098           $worksheet->write('A1', 'Hello');           # Defaults to $format1
2099           $worksheet->write('B1', 'Hello', $format2); # Keeps $format2
2100
2101       If you wish to define a row format in this way you should call the
2102       method before any calls to write(). Calling it afterwards will
2103       overwrite any format that was previously specified.
2104
2105       The $hidden parameter should be set to 1 if you wish to hide a row.
2106       This can be used, for example, to hide intermediary steps in a
2107       complicated calculation:
2108
2109           $worksheet->set_row(0, 20,    $format, 1);
2110           $worksheet->set_row(1, undef, undef,   1);
2111
2112       The $level parameter is used to set the outline level of the row.
2113       Outlines are described in "OUTLINES AND GROUPING IN EXCEL". Adjacent
2114       rows with the same outline level are grouped together into a single
2115       outline.
2116
2117       The following example sets an outline level of 1 for rows 1 and 2
2118       (zero-indexed):
2119
2120           $worksheet->set_row(1, undef, undef, 0, 1);
2121           $worksheet->set_row(2, undef, undef, 0, 1);
2122
2123       The $hidden parameter can also be used to hide collapsed outlined rows
2124       when used in conjunction with the $level parameter.
2125
2126           $worksheet->set_row(1, undef, undef, 1, 1);
2127           $worksheet->set_row(2, undef, undef, 1, 1);
2128
2129       For collapsed outlines you should also indicate which row has the
2130       collapsed "+" symbol using the optional $collapsed parameter.
2131
2132           $worksheet->set_row(3, undef, undef, 0, 0, 1);
2133
2134       For a more complete example see the "outline.pl" and
2135       "outline_collapsed.pl" programs in the examples directory of the
2136       distro.
2137
2138       Excel allows up to 7 outline levels. Therefore the $level parameter
2139       should be in the range "0 <= $level <= 7".
2140
2141   set_column($first_col, $last_col, $width, $format, $hidden, $level,
2142       $collapsed)
2143       This method can be used to change the default properties of a single
2144       column or a range of columns. All parameters apart from $first_col and
2145       $last_col are optional.
2146
2147       If set_column() is applied to a single column the value of $first_col
2148       and $last_col should be the same. In the case where $last_col is zero
2149       it is set to the same value as $first_col.
2150
2151       It is also possible, and generally clearer, to specify a column range
2152       using the form of A1 notation used for columns. See the note about
2153       "Cell notation".
2154
2155       Examples:
2156
2157           $worksheet->set_column(0, 0,  20); # Column  A   width set to 20
2158           $worksheet->set_column(1, 3,  30); # Columns B-D width set to 30
2159           $worksheet->set_column('E:E', 20); # Column  E   width set to 20
2160           $worksheet->set_column('F:H', 30); # Columns F-H width set to 30
2161
2162       The width corresponds to the column width value that is specified in
2163       Excel. It is approximately equal to the length of a string in the
2164       default font of Arial 10. Unfortunately, there is no way to specify
2165       "AutoFit" for a column in the Excel file format. This feature is only
2166       available at runtime from within Excel.
2167
2168       As usual the $format parameter is optional, for additional information,
2169       see "CELL FORMATTING". If you wish to set the format without changing
2170       the width you can pass "undef" as the width parameter:
2171
2172           $worksheet->set_column(0, 0, undef, $format);
2173
2174       The $format parameter will be applied to any cells in the column that
2175       don't  have a format. For example
2176
2177           $worksheet->set_column('A:A', undef, $format1); # Set format for col 1
2178           $worksheet->write('A1', 'Hello');               # Defaults to $format1
2179           $worksheet->write('A2', 'Hello', $format2);     # Keeps $format2
2180
2181       If you wish to define a column format in this way you should call the
2182       method before any calls to write(). If you call it afterwards it won't
2183       have any effect.
2184
2185       A default row format takes precedence over a default column format
2186
2187           $worksheet->set_row(0, undef,        $format1); # Set format for row 1
2188           $worksheet->set_column('A:A', undef, $format2); # Set format for col 1
2189           $worksheet->write('A1', 'Hello');               # Defaults to $format1
2190           $worksheet->write('A2', 'Hello');               # Defaults to $format2
2191
2192       The $hidden parameter should be set to 1 if you wish to hide a column.
2193       This can be used, for example, to hide intermediary steps in a
2194       complicated calculation:
2195
2196           $worksheet->set_column('D:D', 20,    $format, 1);
2197           $worksheet->set_column('E:E', undef, undef,   1);
2198
2199       The $level parameter is used to set the outline level of the column.
2200       Outlines are described in "OUTLINES AND GROUPING IN EXCEL". Adjacent
2201       columns with the same outline level are grouped together into a single
2202       outline.
2203
2204       The following example sets an outline level of 1 for columns B to G:
2205
2206           $worksheet->set_column('B:G', undef, undef, 0, 1);
2207
2208       The $hidden parameter can also be used to hide collapsed outlined
2209       columns when used in conjunction with the $level parameter.
2210
2211           $worksheet->set_column('B:G', undef, undef, 1, 1);
2212
2213       For collapsed outlines you should also indicate which row has the
2214       collapsed "+" symbol using the optional $collapsed parameter.
2215
2216           $worksheet->set_column('H:H', undef, undef, 0, 0, 1);
2217
2218       For a more complete example see the "outline.pl" and
2219       "outline_collapsed.pl" programs in the examples directory of the
2220       distro.
2221
2222       Excel allows up to 7 outline levels. Therefore the $level parameter
2223       should be in the range "0 <= $level <= 7".
2224
2225   outline_settings($visible, $symbols_below, $symbols_right, $auto_style)
2226       The outline_settings() method is used to control the appearance of
2227       outlines in Excel. Outlines are described in "OUTLINES AND GROUPING IN
2228       EXCEL".
2229
2230       The $visible parameter is used to control whether or not outlines are
2231       visible. Setting this parameter to 0 will cause all outlines on the
2232       worksheet to be hidden. They can be unhidden in Excel by means of the
2233       "Show Outline Symbols" command button. The default setting is 1 for
2234       visible outlines.
2235
2236           $worksheet->outline_settings(0);
2237
2238       The $symbols_below parameter is used to control whether the row outline
2239       symbol will appear above or below the outline level bar. The default
2240       setting is 1 for symbols to appear below the outline level bar.
2241
2242       The "symbols_right" parameter is used to control whether the column
2243       outline symbol will appear to the left or the right of the outline
2244       level bar. The default setting is 1 for symbols to appear to the right
2245       of the outline level bar.
2246
2247       The $auto_style parameter is used to control whether the automatic
2248       outline generator in Excel uses automatic styles when creating an
2249       outline. This has no effect on a file generated by
2250       "Spreadsheet::WriteExcel" but it does have an effect on how the
2251       worksheet behaves after it is created. The default setting is 0 for
2252       "Automatic Styles" to be turned off.
2253
2254       The default settings for all of these parameters correspond to Excel's
2255       default parameters.
2256
2257       The worksheet parameters controlled by outline_settings() are rarely
2258       used.
2259
2260   freeze_panes($row, $col, $top_row, $left_col)
2261       This method can be used to divide a worksheet into horizontal or
2262       vertical regions known as panes and to also "freeze" these panes so
2263       that the splitter bars are not visible. This is the same as the
2264       "Window->Freeze Panes" menu command in Excel
2265
2266       The parameters $row and $col are used to specify the location of the
2267       split. It should be noted that the split is specified at the top or
2268       left of a cell and that the method uses zero based indexing. Therefore
2269       to freeze the first row of a worksheet it is necessary to specify the
2270       split at row 2 (which is 1 as the zero-based index). This might lead
2271       you to think that you are using a 1 based index but this is not the
2272       case.
2273
2274       You can set one of the $row and $col parameters as zero if you do not
2275       want either a vertical or horizontal split.
2276
2277       Examples:
2278
2279           $worksheet->freeze_panes(1, 0); # Freeze the first row
2280           $worksheet->freeze_panes('A2'); # Same using A1 notation
2281           $worksheet->freeze_panes(0, 1); # Freeze the first column
2282           $worksheet->freeze_panes('B1'); # Same using A1 notation
2283           $worksheet->freeze_panes(1, 2); # Freeze first row and first 2 columns
2284           $worksheet->freeze_panes('C2'); # Same using A1 notation
2285
2286       The parameters $top_row and $left_col are optional. They are used to
2287       specify the top-most or left-most visible row or column in the
2288       scrolling region of the panes. For example to freeze the first row and
2289       to have the scrolling region begin at row twenty:
2290
2291           $worksheet->freeze_panes(1, 0, 20, 0);
2292
2293       You cannot use A1 notation for the $top_row and $left_col parameters.
2294
2295       See also the "panes.pl" program in the "examples" directory of the
2296       distribution.
2297
2298   split_panes($y, $x, $top_row, $left_col)
2299       This method can be used to divide a worksheet into horizontal or
2300       vertical regions known as panes. This method is different from the
2301       freeze_panes() method in that the splits between the panes will be
2302       visible to the user and each pane will have its own scroll bars.
2303
2304       The parameters $y and $x are used to specify the vertical and
2305       horizontal position of the split. The units for $y and $x are the same
2306       as those used by Excel to specify row height and column width. However,
2307       the vertical and horizontal units are different from each other.
2308       Therefore you must specify the $y and $x parameters in terms of the row
2309       heights and column widths that you have set or the default values which
2310       are 12.75 for a row and  8.43 for a column.
2311
2312       You can set one of the $y and $x parameters as zero if you do not want
2313       either a vertical or horizontal split. The parameters $top_row and
2314       $left_col are optional. They are used to specify the top-most or left-
2315       most visible row or column in the bottom-right pane.
2316
2317       Example:
2318
2319           $worksheet->split_panes(12.75, 0,    1, 0); # First row
2320           $worksheet->split_panes(0,     8.43, 0, 1); # First column
2321           $worksheet->split_panes(12.75, 8.43, 1, 1); # First row and column
2322
2323       You cannot use A1 notation with this method.
2324
2325       See also the freeze_panes() method and the "panes.pl" program in the
2326       "examples" directory of the distribution.
2327
2328       Note: This split_panes() method was called thaw_panes() in older
2329       versions. The older name is still available for backwards
2330       compatibility.
2331
2332   merge_range($first_row, $first_col, $last_row, $last_col, $token, $format,
2333       $utf_16_be)
2334       Merging cells can be achieved by setting the "merge" property of a
2335       Format object, see "CELL FORMATTING". However, this only allows simple
2336       Excel5 style horizontal merging which Excel refers to as "center across
2337       selection".
2338
2339       The merge_range() method allows you to do Excel97+ style formatting
2340       where the cells can contain other types of alignment in addition to the
2341       merging:
2342
2343           my $format = $workbook->add_format(
2344                                               border  => 6,
2345                                               valign  => 'vcenter',
2346                                               align   => 'center',
2347                                             );
2348
2349           $worksheet->merge_range('B3:D4', 'Vertical and horizontal', $format);
2350
2351       WARNING. The format object that is used with a merge_range() method
2352       call is marked internally as being associated with a merged range. It
2353       is a fatal error to use a merged format in a non-merged cell. Instead
2354       you should use separate formats for merged and non-merged cells. This
2355       restriction will be removed in a future release.
2356
2357       The $utf_16_be parameter is optional, see below.
2358
2359       merge_range() writes its $token argument using the worksheet write()
2360       method. Therefore it will handle numbers, strings, formulas or urls as
2361       required.
2362
2363       Setting the "merge" property of the format isn't required when you are
2364       using merge_range(). In fact using it will exclude the use of any other
2365       horizontal alignment option.
2366
2367       On systems with "perl 5.8" and later the merge_range() method will also
2368       handle strings in "UTF-8" format.
2369
2370           $worksheet->merge_range('B3:D4', "\x{263a}", $format); # Smiley
2371
2372       On earlier Perl systems your can specify "UTF-16BE" worksheet names
2373       using an additional optional parameter:
2374
2375           my $str = pack 'n', 0x263a;
2376           $worksheet->merge_range('B3:D4', $str, $format, 1); # Smiley
2377
2378       The full possibilities of this method are shown in the "merge3.pl" to
2379       "merge6.pl" programs in the "examples" directory of the distribution.
2380
2381   set_zoom($scale)
2382       Set the worksheet zoom factor in the range "10 <= $scale <= 400":
2383
2384           $worksheet1->set_zoom(50);
2385           $worksheet2->set_zoom(75);
2386           $worksheet3->set_zoom(300);
2387           $worksheet4->set_zoom(400);
2388
2389       The default zoom factor is 100. You cannot zoom to "Selection" because
2390       it is calculated by Excel at run-time.
2391
2392       Note, set_zoom() does not affect the scale of the printed page. For
2393       that you should use set_print_scale().
2394
2395   right_to_left()
2396       The right_to_left() method is used to change the default direction of
2397       the worksheet from left-to-right, with the A1 cell in the top left, to
2398       right-to-left, with the he A1 cell in the top right.
2399
2400           $worksheet->right_to_left();
2401
2402       This is useful when creating Arabic, Hebrew or other near or far
2403       eastern worksheets that use right-to-left as the default direction.
2404
2405   hide_zero()
2406       The hide_zero() method is used to hide any zero values that appear in
2407       cells.
2408
2409           $worksheet->hide_zero();
2410
2411       In Excel this option is found under Tools->Options->View.
2412
2413   set_tab_color()
2414       The set_tab_color() method is used to change the colour of the
2415       worksheet tab. This feature is only available in Excel 2002 and later.
2416       You can use one of the standard colour names provided by the Format
2417       object or a colour index. See "COLOURS IN EXCEL" and the
2418       set_custom_color() method.
2419
2420           $worksheet1->set_tab_color('red');
2421           $worksheet2->set_tab_color(0x0C);
2422
2423       See the "tab_colors.pl" program in the examples directory of the
2424       distro.
2425
2426   autofilter($first_row, $first_col, $last_row, $last_col)
2427       This method allows an autofilter to be added to a worksheet. An
2428       autofilter is a way of adding drop down lists to the headers of a 2D
2429       range of worksheet data. This in turn allow users to filter the data
2430       based on simple criteria so that some data is shown and some is hidden.
2431
2432       To add an autofilter to a worksheet:
2433
2434           $worksheet->autofilter(0, 0, 10, 3);
2435           $worksheet->autofilter('A1:D11');    # Same as above in A1 notation.
2436
2437       Filter conditions can be applied using the filter_column() method.
2438
2439       See the "autofilter.pl" program in the examples directory of the distro
2440       for a more detailed example.
2441
2442   filter_column($column, $expression)
2443       The "filter_column" method can be used to filter columns in a
2444       autofilter range based on simple conditions.
2445
2446       NOTE: It isn't sufficient to just specify the filter condition. You
2447       must also hide any rows that don't match the filter condition. Rows are
2448       hidden using the set_row() "visible" parameter.
2449       "Spreadsheet::WriteExcel" cannot do this automatically since it isn't
2450       part of the file format. See the "autofilter.pl" program in the
2451       examples directory of the distro for an example.
2452
2453       The conditions for the filter are specified using simple expressions:
2454
2455           $worksheet->filter_column('A', 'x > 2000');
2456           $worksheet->filter_column('B', 'x > 2000 and x < 5000');
2457
2458       The $column parameter can either be a zero indexed column number or a
2459       string column name.
2460
2461       The following operators are available:
2462
2463           Operator        Synonyms
2464              ==           =   eq  =~
2465              !=           <>  ne  !=
2466              >
2467              <
2468              >=
2469              <=
2470
2471              and          &&
2472              or           ||
2473
2474       The operator synonyms are just syntactic sugar to make you more
2475       comfortable using the expressions. It is important to remember that the
2476       expressions will be interpreted by Excel and not by perl.
2477
2478       An expression can comprise a single statement or two statements
2479       separated by the "and" and "or" operators. For example:
2480
2481           'x <  2000'
2482           'x >  2000'
2483           'x == 2000'
2484           'x >  2000 and x <  5000'
2485           'x == 2000 or  x == 5000'
2486
2487       Filtering of blank or non-blank data can be achieved by using a value
2488       of "Blanks" or "NonBlanks" in the expression:
2489
2490           'x == Blanks'
2491           'x == NonBlanks'
2492
2493       Top 10 style filters can be specified using a expression like the
2494       following:
2495
2496           Top|Bottom 1-500 Items|%
2497
2498       For example:
2499
2500           'Top    10 Items'
2501           'Bottom  5 Items'
2502           'Top    25 %'
2503           'Bottom 50 %'
2504
2505       Excel also allows some simple string matching operations:
2506
2507           'x =~ b*'   # begins with b
2508           'x !~ b*'   # doesn't begin with b
2509           'x =~ *b'   # ends with b
2510           'x !~ *b'   # doesn't end with b
2511           'x =~ *b*'  # contains b
2512           'x !~ *b*'  # doesn't contains b
2513
2514       You can also use "*" to match any character or number and "?" to match
2515       any single character or number. No other regular expression quantifier
2516       is supported by Excel's filters. Excel's regular expression characters
2517       can be escaped using "~".
2518
2519       The placeholder variable "x" in the above examples can be replaced by
2520       any simple string. The actual placeholder name is ignored internally so
2521       the following are all equivalent:
2522
2523           'x     < 2000'
2524           'col   < 2000'
2525           'Price < 2000'
2526
2527       Also, note that a filter condition can only be applied to a column in a
2528       range specified by the autofilter() Worksheet method.
2529
2530       See the "autofilter.pl" program in the examples directory of the distro
2531       for a more detailed example.
2532

PAGE SET-UP METHODS

2534       Page set-up methods affect the way that a worksheet looks when it is
2535       printed. They control features such as page headers and footers and
2536       margins. These methods are really just standard worksheet methods. They
2537       are documented here in a separate section for the sake of clarity.
2538
2539       The following methods are available for page set-up:
2540
2541           set_landscape()
2542           set_portrait()
2543           set_page_view()
2544           set_paper()
2545           center_horizontally()
2546           center_vertically()
2547           set_margins()
2548           set_header()
2549           set_footer()
2550           repeat_rows()
2551           repeat_columns()
2552           hide_gridlines()
2553           print_row_col_headers()
2554           print_area()
2555           print_across()
2556           fit_to_pages()
2557           set_start_page()
2558           set_print_scale()
2559           set_h_pagebreaks()
2560           set_v_pagebreaks()
2561
2562       A common requirement when working with Spreadsheet::WriteExcel is to
2563       apply the same page set-up features to all of the worksheets in a
2564       workbook. To do this you can use the sheets() method of the "workbook"
2565       class to access the array of worksheets in a workbook:
2566
2567           foreach $worksheet ($workbook->sheets()) {
2568              $worksheet->set_landscape();
2569           }
2570
2571   set_landscape()
2572       This method is used to set the orientation of a worksheet's printed
2573       page to landscape:
2574
2575           $worksheet->set_landscape(); # Landscape mode
2576
2577   set_portrait()
2578       This method is used to set the orientation of a worksheet's printed
2579       page to portrait. The default worksheet orientation is portrait, so you
2580       won't generally need to call this method.
2581
2582           $worksheet->set_portrait(); # Portrait mode
2583
2584   set_page_view()
2585       This method is used to display the worksheet in "Page View" mode. This
2586       is currently only supported by Mac Excel, where it is the default.
2587
2588           $worksheet->set_page_view();
2589
2590   set_paper($index)
2591       This method is used to set the paper format for the printed output of a
2592       worksheet. The following paper styles are available:
2593
2594           Index   Paper format            Paper size
2595           =====   ============            ==========
2596             0     Printer default         -
2597             1     Letter                  8 1/2 x 11 in
2598             2     Letter Small            8 1/2 x 11 in
2599             3     Tabloid                 11 x 17 in
2600             4     Ledger                  17 x 11 in
2601             5     Legal                   8 1/2 x 14 in
2602             6     Statement               5 1/2 x 8 1/2 in
2603             7     Executive               7 1/4 x 10 1/2 in
2604             8     A3                      297 x 420 mm
2605             9     A4                      210 x 297 mm
2606            10     A4 Small                210 x 297 mm
2607            11     A5                      148 x 210 mm
2608            12     B4                      250 x 354 mm
2609            13     B5                      182 x 257 mm
2610            14     Folio                   8 1/2 x 13 in
2611            15     Quarto                  215 x 275 mm
2612            16     -                       10x14 in
2613            17     -                       11x17 in
2614            18     Note                    8 1/2 x 11 in
2615            19     Envelope  9             3 7/8 x 8 7/8
2616            20     Envelope 10             4 1/8 x 9 1/2
2617            21     Envelope 11             4 1/2 x 10 3/8
2618            22     Envelope 12             4 3/4 x 11
2619            23     Envelope 14             5 x 11 1/2
2620            24     C size sheet            -
2621            25     D size sheet            -
2622            26     E size sheet            -
2623            27     Envelope DL             110 x 220 mm
2624            28     Envelope C3             324 x 458 mm
2625            29     Envelope C4             229 x 324 mm
2626            30     Envelope C5             162 x 229 mm
2627            31     Envelope C6             114 x 162 mm
2628            32     Envelope C65            114 x 229 mm
2629            33     Envelope B4             250 x 353 mm
2630            34     Envelope B5             176 x 250 mm
2631            35     Envelope B6             176 x 125 mm
2632            36     Envelope                110 x 230 mm
2633            37     Monarch                 3.875 x 7.5 in
2634            38     Envelope                3 5/8 x 6 1/2 in
2635            39     Fanfold                 14 7/8 x 11 in
2636            40     German Std Fanfold      8 1/2 x 12 in
2637            41     German Legal Fanfold    8 1/2 x 13 in
2638
2639       Note, it is likely that not all of these paper types will be available
2640       to the end user since it will depend on the paper formats that the
2641       user's printer supports. Therefore, it is best to stick to standard
2642       paper types.
2643
2644           $worksheet->set_paper(1); # US Letter
2645           $worksheet->set_paper(9); # A4
2646
2647       If you do not specify a paper type the worksheet will print using the
2648       printer's default paper.
2649
2650   center_horizontally()
2651       Center the worksheet data horizontally between the margins on the
2652       printed page:
2653
2654           $worksheet->center_horizontally();
2655
2656   center_vertically()
2657       Center the worksheet data vertically between the margins on the printed
2658       page:
2659
2660           $worksheet->center_vertically();
2661
2662   set_margins($inches)
2663       There are several methods available for setting the worksheet margins
2664       on the printed page:
2665
2666           set_margins()        # Set all margins to the same value
2667           set_margins_LR()     # Set left and right margins to the same value
2668           set_margins_TB()     # Set top and bottom margins to the same value
2669           set_margin_left();   # Set left margin
2670           set_margin_right();  # Set right margin
2671           set_margin_top();    # Set top margin
2672           set_margin_bottom(); # Set bottom margin
2673
2674       All of these methods take a distance in inches as a parameter. Note: 1
2675       inch = 25.4mm. ;-) The default left and right margin is 0.75 inch. The
2676       default top and bottom margin is 1.00 inch.
2677
2678   set_header($string, $margin)
2679       Headers and footers are generated using a $string which is a
2680       combination of plain text and control characters. The $margin parameter
2681       is optional.
2682
2683       The available control character are:
2684
2685           Control             Category            Description
2686           =======             ========            ===========
2687           &L                  Justification       Left
2688           &C                                      Center
2689           &R                                      Right
2690
2691           &P                  Information         Page number
2692           &N                                      Total number of pages
2693           &D                                      Date
2694           &T                                      Time
2695           &F                                      File name
2696           &A                                      Worksheet name
2697           &Z                                      Workbook path
2698
2699           &fontsize           Font                Font size
2700           &"font,style"                           Font name and style
2701           &U                                      Single underline
2702           &E                                      Double underline
2703           &S                                      Strikethrough
2704           &X                                      Superscript
2705           &Y                                      Subscript
2706
2707           &&                  Miscellaneous       Literal ampersand &
2708
2709       Text in headers and footers can be justified (aligned) to the left,
2710       center and right by prefixing the text with the control characters &L,
2711       &C and &R.
2712
2713       For example (with ASCII art representation of the results):
2714
2715           $worksheet->set_header('&LHello');
2716
2717            ---------------------------------------------------------------
2718           |                                                               |
2719           | Hello                                                         |
2720           |                                                               |
2721
2722
2723           $worksheet->set_header('&CHello');
2724
2725            ---------------------------------------------------------------
2726           |                                                               |
2727           |                          Hello                                |
2728           |                                                               |
2729
2730
2731           $worksheet->set_header('&RHello');
2732
2733            ---------------------------------------------------------------
2734           |                                                               |
2735           |                                                         Hello |
2736           |                                                               |
2737
2738       For simple text, if you do not specify any justification the text will
2739       be centred. However, you must prefix the text with &C if you specify a
2740       font name or any other formatting:
2741
2742           $worksheet->set_header('Hello');
2743
2744            ---------------------------------------------------------------
2745           |                                                               |
2746           |                          Hello                                |
2747           |                                                               |
2748
2749       You can have text in each of the justification regions:
2750
2751           $worksheet->set_header('&LCiao&CBello&RCielo');
2752
2753            ---------------------------------------------------------------
2754           |                                                               |
2755           | Ciao                     Bello                          Cielo |
2756           |                                                               |
2757
2758       The information control characters act as variables that Excel will
2759       update as the workbook or worksheet changes. Times and dates are in the
2760       users default format:
2761
2762           $worksheet->set_header('&CPage &P of &N');
2763
2764            ---------------------------------------------------------------
2765           |                                                               |
2766           |                        Page 1 of 6                            |
2767           |                                                               |
2768
2769
2770           $worksheet->set_header('&CUpdated at &T');
2771
2772            ---------------------------------------------------------------
2773           |                                                               |
2774           |                    Updated at 12:30 PM                        |
2775           |                                                               |
2776
2777       You can specify the font size of a section of the text by prefixing it
2778       with the control character &n where "n" is the font size:
2779
2780           $worksheet1->set_header('&C&30Hello Big'  );
2781           $worksheet2->set_header('&C&10Hello Small');
2782
2783       You can specify the font of a section of the text by prefixing it with
2784       the control sequence "&"font,style"" where "fontname" is a font name
2785       such as "Courier New" or "Times New Roman" and "style" is one of the
2786       standard Windows font descriptions: "Regular", "Italic", "Bold" or
2787       "Bold Italic":
2788
2789           $worksheet1->set_header('&C&"Courier New,Italic"Hello');
2790           $worksheet2->set_header('&C&"Courier New,Bold Italic"Hello');
2791           $worksheet3->set_header('&C&"Times New Roman,Regular"Hello');
2792
2793       It is possible to combine all of these features together to create
2794       sophisticated headers and footers. As an aid to setting up complicated
2795       headers and footers you can record a page set-up as a macro in Excel
2796       and look at the format strings that VBA produces. Remember however that
2797       VBA uses two double quotes "" to indicate a single double quote. For
2798       the last example above the equivalent VBA code looks like this:
2799
2800           .LeftHeader   = ""
2801           .CenterHeader = "&""Times New Roman,Regular""Hello"
2802           .RightHeader  = ""
2803
2804       To include a single literal ampersand "&" in a header or footer you
2805       should use a double ampersand "&&":
2806
2807           $worksheet1->set_header('&CCuriouser && Curiouser - Attorneys at Law');
2808
2809       As stated above the margin parameter is optional. As with the other
2810       margins the value should be in inches. The default header and footer
2811       margin is 0.50 inch. The header and footer margin size can be set as
2812       follows:
2813
2814           $worksheet->set_header('&CHello', 0.75);
2815
2816       The header and footer margins are independent of the top and bottom
2817       margins.
2818
2819       Note, the header or footer string must be less than 255 characters.
2820       Strings longer than this will not be written and a warning will be
2821       generated.
2822
2823       On systems with "perl 5.8" and later the set_header() method can also
2824       handle Unicode strings in "UTF-8" format.
2825
2826           $worksheet->set_header("&C\x{263a}")
2827
2828       See, also the "headers.pl" program in the "examples" directory of the
2829       distribution.
2830
2831   set_footer()
2832       The syntax of the set_footer() method is the same as set_header(),  see
2833       above.
2834
2835   repeat_rows($first_row, $last_row)
2836       Set the number of rows to repeat at the top of each printed page.
2837
2838       For large Excel documents it is often desirable to have the first row
2839       or rows of the worksheet print out at the top of each page. This can be
2840       achieved by using the repeat_rows() method. The parameters $first_row
2841       and $last_row are zero based. The $last_row parameter is optional if
2842       you only wish to specify one row:
2843
2844           $worksheet1->repeat_rows(0);    # Repeat the first row
2845           $worksheet2->repeat_rows(0, 1); # Repeat the first two rows
2846
2847   repeat_columns($first_col, $last_col)
2848       Set the columns to repeat at the left hand side of each printed page.
2849
2850       For large Excel documents it is often desirable to have the first
2851       column or columns of the worksheet print out at the left hand side of
2852       each page. This can be achieved by using the repeat_columns() method.
2853       The parameters $first_column and $last_column are zero based. The
2854       $last_column parameter is optional if you only wish to specify one
2855       column. You can also specify the columns using A1 column notation, see
2856       the note about "Cell notation".
2857
2858           $worksheet1->repeat_columns(0);     # Repeat the first column
2859           $worksheet2->repeat_columns(0, 1);  # Repeat the first two columns
2860           $worksheet3->repeat_columns('A:A'); # Repeat the first column
2861           $worksheet4->repeat_columns('A:B'); # Repeat the first two columns
2862
2863   hide_gridlines($option)
2864       This method is used to hide the gridlines on the screen and printed
2865       page. Gridlines are the lines that divide the cells on a worksheet.
2866       Screen and printed gridlines are turned on by default in an Excel
2867       worksheet. If you have defined your own cell borders you may wish to
2868       hide the default gridlines.
2869
2870           $worksheet->hide_gridlines();
2871
2872       The following values of $option are valid:
2873
2874           0 : Don't hide gridlines
2875           1 : Hide printed gridlines only
2876           2 : Hide screen and printed gridlines
2877
2878       If you don't supply an argument or use "undef" the default option is 1,
2879       i.e. only the printed gridlines are hidden.
2880
2881   print_row_col_headers()
2882       Set the option to print the row and column headers on the printed page.
2883
2884       An Excel worksheet looks something like the following;
2885
2886            ------------------------------------------
2887           |   |   A   |   B   |   C   |   D   |  ...
2888            ------------------------------------------
2889           | 1 |       |       |       |       |  ...
2890           | 2 |       |       |       |       |  ...
2891           | 3 |       |       |       |       |  ...
2892           | 4 |       |       |       |       |  ...
2893           |...|  ...  |  ...  |  ...  |  ...  |  ...
2894
2895       The headers are the letters and numbers at the top and the left of the
2896       worksheet. Since these headers serve mainly as a indication of position
2897       on the worksheet they generally do not appear on the printed page. If
2898       you wish to have them printed you can use the print_row_col_headers()
2899       method :
2900
2901           $worksheet->print_row_col_headers();
2902
2903       Do not confuse these headers with page headers as described in the
2904       set_header() section above.
2905
2906   print_area($first_row, $first_col, $last_row, $last_col)
2907       This method is used to specify the area of the worksheet that will be
2908       printed. All four parameters must be specified. You can also use A1
2909       notation, see the note about "Cell notation".
2910
2911           $worksheet1->print_area('A1:H20');    # Cells A1 to H20
2912           $worksheet2->print_area(0, 0, 19, 7); # The same
2913           $worksheet2->print_area('A:H');       # Columns A to H if rows have data
2914
2915   print_across()
2916       The "print_across" method is used to change the default print
2917       direction. This is referred to by Excel as the sheet "page order".
2918
2919           $worksheet->print_across();
2920
2921       The default page order is shown below for a worksheet that extends over
2922       4 pages. The order is called "down then across":
2923
2924           [1] [3]
2925           [2] [4]
2926
2927       However, by using the "print_across" method the print order will be
2928       changed to "across then down":
2929
2930           [1] [2]
2931           [3] [4]
2932
2933   fit_to_pages($width, $height)
2934       The fit_to_pages() method is used to fit the printed area to a specific
2935       number of pages both vertically and horizontally. If the printed area
2936       exceeds the specified number of pages it will be scaled down to fit.
2937       This guarantees that the printed area will always appear on the
2938       specified number of pages even if the page size or margins change.
2939
2940           $worksheet1->fit_to_pages(1, 1); # Fit to 1x1 pages
2941           $worksheet2->fit_to_pages(2, 1); # Fit to 2x1 pages
2942           $worksheet3->fit_to_pages(1, 2); # Fit to 1x2 pages
2943
2944       The print area can be defined using the print_area() method as
2945       described above.
2946
2947       A common requirement is to fit the printed output to n pages wide but
2948       have the height be as long as necessary. To achieve this set the
2949       $height to zero or leave it blank:
2950
2951           $worksheet1->fit_to_pages(1, 0); # 1 page wide and as long as necessary
2952           $worksheet2->fit_to_pages(1);    # The same
2953
2954       Note that although it is valid to use both fit_to_pages() and
2955       set_print_scale() on the same worksheet only one of these options can
2956       be active at a time. The last method call made will set the active
2957       option.
2958
2959       Note that fit_to_pages() will override any manual page breaks that are
2960       defined in the worksheet.
2961
2962   set_start_page($start_page)
2963       The set_start_page() method is used to set the number of the starting
2964       page when the worksheet is printed out. The default value is 1.
2965
2966           $worksheet->set_start_page(2);
2967
2968   set_print_scale($scale)
2969       Set the scale factor of the printed page. Scale factors in the range
2970       "10 <= $scale <= 400" are valid:
2971
2972           $worksheet1->set_print_scale(50);
2973           $worksheet2->set_print_scale(75);
2974           $worksheet3->set_print_scale(300);
2975           $worksheet4->set_print_scale(400);
2976
2977       The default scale factor is 100. Note, set_print_scale() does not
2978       affect the scale of the visible page in Excel. For that you should use
2979       set_zoom().
2980
2981       Note also that although it is valid to use both fit_to_pages() and
2982       set_print_scale() on the same worksheet only one of these options can
2983       be active at a time. The last method call made will set the active
2984       option.
2985
2986   set_h_pagebreaks(@breaks)
2987       Add horizontal page breaks to a worksheet. A page break causes all the
2988       data that follows it to be printed on the next page. Horizontal page
2989       breaks act between rows. To create a page break between rows 20 and 21
2990       you must specify the break at row 21. However in zero index notation
2991       this is actually row 20. So you can pretend for a small while that you
2992       are using 1 index notation:
2993
2994           $worksheet1->set_h_pagebreaks(20); # Break between row 20 and 21
2995
2996       The set_h_pagebreaks() method will accept a list of page breaks and you
2997       can call it more than once:
2998
2999           $worksheet2->set_h_pagebreaks( 20,  40,  60,  80, 100); # Add breaks
3000           $worksheet2->set_h_pagebreaks(120, 140, 160, 180, 200); # Add some more
3001
3002       Note: If you specify the "fit to page" option via the fit_to_pages()
3003       method it will override all manual page breaks.
3004
3005       There is a silent limitation of about 1000 horizontal page breaks per
3006       worksheet in line with an Excel internal limitation.
3007
3008   set_v_pagebreaks(@breaks)
3009       Add vertical page breaks to a worksheet. A page break causes all the
3010       data that follows it to be printed on the next page. Vertical page
3011       breaks act between columns. To create a page break between columns 20
3012       and 21 you must specify the break at column 21. However in zero index
3013       notation this is actually column 20. So you can pretend for a small
3014       while that you are using 1 index notation:
3015
3016           $worksheet1->set_v_pagebreaks(20); # Break between column 20 and 21
3017
3018       The set_v_pagebreaks() method will accept a list of page breaks and you
3019       can call it more than once:
3020
3021           $worksheet2->set_v_pagebreaks( 20,  40,  60,  80, 100); # Add breaks
3022           $worksheet2->set_v_pagebreaks(120, 140, 160, 180, 200); # Add some more
3023
3024       Note: If you specify the "fit to page" option via the fit_to_pages()
3025       method it will override all manual page breaks.
3026

CELL FORMATTING

3028       This section describes the methods and properties that are available
3029       for formatting cells in Excel. The properties of a cell that can be
3030       formatted include: fonts, colours, patterns, borders, alignment and
3031       number formatting.
3032
3033   Creating and using a Format object
3034       Cell formatting is defined through a Format object. Format objects are
3035       created by calling the workbook add_format() method as follows:
3036
3037           my $format1 = $workbook->add_format();       # Set properties later
3038           my $format2 = $workbook->add_format(%props); # Set at creation
3039
3040       The format object holds all the formatting properties that can be
3041       applied to a cell, a row or a column. The process of setting these
3042       properties is discussed in the next section.
3043
3044       Once a Format object has been constructed and its properties have been
3045       set it can be passed as an argument to the worksheet "write" methods as
3046       follows:
3047
3048           $worksheet->write(0, 0, 'One', $format);
3049           $worksheet->write_string(1, 0, 'Two', $format);
3050           $worksheet->write_number(2, 0, 3, $format);
3051           $worksheet->write_blank(3, 0, $format);
3052
3053       Formats can also be passed to the worksheet set_row() and set_column()
3054       methods to define the default property for a row or column.
3055
3056           $worksheet->set_row(0, 15, $format);
3057           $worksheet->set_column(0, 0, 15, $format);
3058
3059   Format methods and Format properties
3060       The following table shows the Excel format categories, the formatting
3061       properties that can be applied and the equivalent object method:
3062
3063           Category   Description       Property        Method Name
3064           --------   -----------       --------        -----------
3065           Font       Font type         font            set_font()
3066                      Font size         size            set_size()
3067                      Font color        color           set_color()
3068                      Bold              bold            set_bold()
3069                      Italic            italic          set_italic()
3070                      Underline         underline       set_underline()
3071                      Strikeout         font_strikeout  set_font_strikeout()
3072                      Super/Subscript   font_script     set_font_script()
3073                      Outline           font_outline    set_font_outline()
3074                      Shadow            font_shadow     set_font_shadow()
3075
3076           Number     Numeric format    num_format      set_num_format()
3077
3078           Protection Lock cells        locked          set_locked()
3079                      Hide formulas     hidden          set_hidden()
3080
3081           Alignment  Horizontal align  align           set_align()
3082                      Vertical align    valign          set_align()
3083                      Rotation          rotation        set_rotation()
3084                      Text wrap         text_wrap       set_text_wrap()
3085                      Justify last      text_justlast   set_text_justlast()
3086                      Center across     center_across   set_center_across()
3087                      Indentation       indent          set_indent()
3088                      Shrink to fit     shrink          set_shrink()
3089
3090           Pattern    Cell pattern      pattern         set_pattern()
3091                      Background color  bg_color        set_bg_color()
3092                      Foreground color  fg_color        set_fg_color()
3093
3094           Border     Cell border       border          set_border()
3095                      Bottom border     bottom          set_bottom()
3096                      Top border        top             set_top()
3097                      Left border       left            set_left()
3098                      Right border      right           set_right()
3099                      Border color      border_color    set_border_color()
3100                      Bottom color      bottom_color    set_bottom_color()
3101                      Top color         top_color       set_top_color()
3102                      Left color        left_color      set_left_color()
3103                      Right color       right_color     set_right_color()
3104
3105       There are two ways of setting Format properties: by using the object
3106       method interface or by setting the property directly. For example, a
3107       typical use of the method interface would be as follows:
3108
3109           my $format = $workbook->add_format();
3110           $format->set_bold();
3111           $format->set_color('red');
3112
3113       By comparison the properties can be set directly by passing a hash of
3114       properties to the Format constructor:
3115
3116           my $format = $workbook->add_format(bold => 1, color => 'red');
3117
3118       or after the Format has been constructed by means of the
3119       set_format_properties() method as follows:
3120
3121           my $format = $workbook->add_format();
3122           $format->set_format_properties(bold => 1, color => 'red');
3123
3124       You can also store the properties in one or more named hashes and pass
3125       them to the required method:
3126
3127           my %font    = (
3128                           font  => 'Arial',
3129                           size  => 12,
3130                           color => 'blue',
3131                           bold  => 1,
3132                         );
3133
3134           my %shading = (
3135                           bg_color => 'green',
3136                           pattern  => 1,
3137                         );
3138
3139
3140           my $format1 = $workbook->add_format(%font);           # Font only
3141           my $format2 = $workbook->add_format(%font, %shading); # Font and shading
3142
3143       The provision of two ways of setting properties might lead you to
3144       wonder which is the best way. The method mechanism may be better is you
3145       prefer setting properties via method calls (which the author did when
3146       the code was first written) otherwise passing properties to the
3147       constructor has proved to be a little more flexible and self
3148       documenting in practice. An additional advantage of working with
3149       property hashes is that it allows you to share formatting between
3150       workbook objects as shown in the example above.
3151
3152       The Perl/Tk style of adding properties is also supported:
3153
3154           my %font    = (
3155                           -font      => 'Arial',
3156                           -size      => 12,
3157                           -color     => 'blue',
3158                           -bold      => 1,
3159                         );
3160
3161   Working with formats
3162       The default format is Arial 10 with all other properties off.
3163
3164       Each unique format in Spreadsheet::WriteExcel must have a corresponding
3165       Format object. It isn't possible to use a Format with a write() method
3166       and then redefine the Format for use at a later stage. This is because
3167       a Format is applied to a cell not in its current state but in its final
3168       state. Consider the following example:
3169
3170           my $format = $workbook->add_format();
3171           $format->set_bold();
3172           $format->set_color('red');
3173           $worksheet->write('A1', 'Cell A1', $format);
3174           $format->set_color('green');
3175           $worksheet->write('B1', 'Cell B1', $format);
3176
3177       Cell A1 is assigned the Format $format which is initially set to the
3178       colour red. However, the colour is subsequently set to green. When
3179       Excel displays Cell A1 it will display the final state of the Format
3180       which in this case will be the colour green.
3181
3182       In general a method call without an argument will turn a property on,
3183       for example:
3184
3185           my $format1 = $workbook->add_format();
3186           $format1->set_bold();  # Turns bold on
3187           $format1->set_bold(1); # Also turns bold on
3188           $format1->set_bold(0); # Turns bold off
3189

FORMAT METHODS

3191       The Format object methods are described in more detail in the following
3192       sections. In addition, there is a Perl program called "formats.pl" in
3193       the "examples" directory of the WriteExcel distribution. This program
3194       creates an Excel workbook called "formats.xls" which contains examples
3195       of almost all the format types.
3196
3197       The following Format methods are available:
3198
3199           set_font()
3200           set_size()
3201           set_color()
3202           set_bold()
3203           set_italic()
3204           set_underline()
3205           set_font_strikeout()
3206           set_font_script()
3207           set_font_outline()
3208           set_font_shadow()
3209           set_num_format()
3210           set_locked()
3211           set_hidden()
3212           set_align()
3213           set_rotation()
3214           set_text_wrap()
3215           set_text_justlast()
3216           set_center_across()
3217           set_indent()
3218           set_shrink()
3219           set_pattern()
3220           set_bg_color()
3221           set_fg_color()
3222           set_border()
3223           set_bottom()
3224           set_top()
3225           set_left()
3226           set_right()
3227           set_border_color()
3228           set_bottom_color()
3229           set_top_color()
3230           set_left_color()
3231           set_right_color()
3232
3233       The above methods can also be applied directly as properties. For
3234       example "$format->set_bold()" is equivalent to
3235       "$workbook->add_format(bold => 1)".
3236
3237   set_format_properties(%properties)
3238       The properties of an existing Format object can be also be set by means
3239       of set_format_properties():
3240
3241           my $format = $workbook->add_format();
3242           $format->set_format_properties(bold => 1, color => 'red');
3243
3244       However, this method is here mainly for legacy reasons. It is
3245       preferable to set the properties in the format constructor:
3246
3247           my $format = $workbook->add_format(bold => 1, color => 'red');
3248
3249   set_font($fontname)
3250           Default state:      Font is Arial
3251           Default action:     None
3252           Valid args:         Any valid font name
3253
3254       Specify the font used:
3255
3256           $format->set_font('Times New Roman');
3257
3258       Excel can only display fonts that are installed on the system that it
3259       is running on. Therefore it is best to use the fonts that come as
3260       standard such as 'Arial', 'Times New Roman' and 'Courier New'. See also
3261       the Fonts worksheet created by formats.pl
3262
3263   set_size()
3264           Default state:      Font size is 10
3265           Default action:     Set font size to 1
3266           Valid args:         Integer values from 1 to as big as your screen.
3267
3268       Set the font size. Excel adjusts the height of a row to accommodate the
3269       largest font size in the row. You can also explicitly specify the
3270       height of a row using the set_row() worksheet method.
3271
3272           my $format = $workbook->add_format();
3273           $format->set_size(30);
3274
3275   set_color()
3276           Default state:      Excels default color, usually black
3277           Default action:     Set the default color
3278           Valid args:         Integers from 8..63 or the following strings:
3279                               'black'
3280                               'blue'
3281                               'brown'
3282                               'cyan'
3283                               'gray'
3284                               'green'
3285                               'lime'
3286                               'magenta'
3287                               'navy'
3288                               'orange'
3289                               'pink'
3290                               'purple'
3291                               'red'
3292                               'silver'
3293                               'white'
3294                               'yellow'
3295
3296       Set the font colour. The set_color() method is used as follows:
3297
3298           my $format = $workbook->add_format();
3299           $format->set_color('red');
3300           $worksheet->write(0, 0, 'wheelbarrow', $format);
3301
3302       Note: The set_color() method is used to set the colour of the font in a
3303       cell. To set the colour of a cell use the set_bg_color() and
3304       set_pattern() methods.
3305
3306       For additional examples see the 'Named colors' and 'Standard colors'
3307       worksheets created by formats.pl in the examples directory.
3308
3309       See also "COLOURS IN EXCEL".
3310
3311   set_bold()
3312           Default state:      bold is off
3313           Default action:     Turn bold on
3314           Valid args:         0, 1 [1]
3315
3316       Set the bold property of the font:
3317
3318           $format->set_bold();  # Turn bold on
3319
3320       [1] Actually, values in the range 100..1000 are also valid. 400 is
3321       normal, 700 is bold and 1000 is very bold indeed. It is probably best
3322       to set the value to 1 and use normal bold.
3323
3324   set_italic()
3325           Default state:      Italic is off
3326           Default action:     Turn italic on
3327           Valid args:         0, 1
3328
3329       Set the italic property of the font:
3330
3331           $format->set_italic();  # Turn italic on
3332
3333   set_underline()
3334           Default state:      Underline is off
3335           Default action:     Turn on single underline
3336           Valid args:         0  = No underline
3337                               1  = Single underline
3338                               2  = Double underline
3339                               33 = Single accounting underline
3340                               34 = Double accounting underline
3341
3342       Set the underline property of the font.
3343
3344           $format->set_underline();   # Single underline
3345
3346   set_font_strikeout()
3347           Default state:      Strikeout is off
3348           Default action:     Turn strikeout on
3349           Valid args:         0, 1
3350
3351       Set the strikeout property of the font.
3352
3353   set_font_script()
3354           Default state:      Super/Subscript is off
3355           Default action:     Turn Superscript on
3356           Valid args:         0  = Normal
3357                               1  = Superscript
3358                               2  = Subscript
3359
3360       Set the superscript/subscript property of the font. This format is
3361       currently not very useful.
3362
3363   set_font_outline()
3364           Default state:      Outline is off
3365           Default action:     Turn outline on
3366           Valid args:         0, 1
3367
3368       Macintosh only.
3369
3370   set_font_shadow()
3371           Default state:      Shadow is off
3372           Default action:     Turn shadow on
3373           Valid args:         0, 1
3374
3375       Macintosh only.
3376
3377   set_num_format()
3378           Default state:      General format
3379           Default action:     Format index 1
3380           Valid args:         See the following table
3381
3382       This method is used to define the numerical format of a number in
3383       Excel. It controls whether a number is displayed as an integer, a
3384       floating point number, a date, a currency value or some other user
3385       defined format.
3386
3387       The numerical format of a cell can be specified by using a format
3388       string or an index to one of Excel's built-in formats:
3389
3390           my $format1 = $workbook->add_format();
3391           my $format2 = $workbook->add_format();
3392           $format1->set_num_format('d mmm yyyy'); # Format string
3393           $format2->set_num_format(0x0f);         # Format index
3394
3395           $worksheet->write(0, 0, 36892.521, $format1);      # 1 Jan 2001
3396           $worksheet->write(0, 0, 36892.521, $format2);      # 1-Jan-01
3397
3398       Using format strings you can define very sophisticated formatting of
3399       numbers.
3400
3401           $format01->set_num_format('0.000');
3402           $worksheet->write(0,  0, 3.1415926, $format01);    # 3.142
3403
3404           $format02->set_num_format('#,##0');
3405           $worksheet->write(1,  0, 1234.56,   $format02);    # 1,235
3406
3407           $format03->set_num_format('#,##0.00');
3408           $worksheet->write(2,  0, 1234.56,   $format03);    # 1,234.56
3409
3410           $format04->set_num_format('$0.00');
3411           $worksheet->write(3,  0, 49.99,     $format04);    # $49.99
3412
3413           # Note you can use other currency symbols such as the pound or yen as well.
3414           # Other currencies may require the use of Unicode.
3415
3416           $format07->set_num_format('mm/dd/yy');
3417           $worksheet->write(6,  0, 36892.521, $format07);    # 01/01/01
3418
3419           $format08->set_num_format('mmm d yyyy');
3420           $worksheet->write(7,  0, 36892.521, $format08);    # Jan 1 2001
3421
3422           $format09->set_num_format('d mmmm yyyy');
3423           $worksheet->write(8,  0, 36892.521, $format09);    # 1 January 2001
3424
3425           $format10->set_num_format('dd/mm/yyyy hh:mm AM/PM');
3426           $worksheet->write(9,  0, 36892.521, $format10);    # 01/01/2001 12:30 AM
3427
3428           $format11->set_num_format('0 "dollar and" .00 "cents"');
3429           $worksheet->write(10, 0, 1.87,      $format11);    # 1 dollar and .87 cents
3430
3431           # Conditional formatting
3432           $format12->set_num_format('[Green]General;[Red]-General;General');
3433           $worksheet->write(11, 0, 123,       $format12);    # > 0 Green
3434           $worksheet->write(12, 0, -45,       $format12);    # < 0 Red
3435           $worksheet->write(13, 0, 0,         $format12);    # = 0 Default colour
3436
3437           # Zip code
3438           $format13->set_num_format('00000');
3439           $worksheet->write(14, 0, '01209',   $format13);
3440
3441       The number system used for dates is described in "DATES AND TIME IN
3442       EXCEL".
3443
3444       The colour format should have one of the following values:
3445
3446           [Black] [Blue] [Cyan] [Green] [Magenta] [Red] [White] [Yellow]
3447
3448       Alternatively you can specify the colour based on a colour index as
3449       follows: "[Color n]", where n is a standard Excel colour index - 7. See
3450       the 'Standard colors' worksheet created by formats.pl.
3451
3452       For more information refer to the documentation on formatting in the
3453       "docs" directory of the Spreadsheet::WriteExcel distro, the Excel on-
3454       line help or
3455       <http://office.microsoft.com/en-gb/assistance/HP051995001033.aspx>.
3456
3457       You should ensure that the format string is valid in Excel prior to
3458       using it in WriteExcel.
3459
3460       Excel's built-in formats are shown in the following table:
3461
3462           Index   Index   Format String
3463           0       0x00    General
3464           1       0x01    0
3465           2       0x02    0.00
3466           3       0x03    #,##0
3467           4       0x04    #,##0.00
3468           5       0x05    ($#,##0_);($#,##0)
3469           6       0x06    ($#,##0_);[Red]($#,##0)
3470           7       0x07    ($#,##0.00_);($#,##0.00)
3471           8       0x08    ($#,##0.00_);[Red]($#,##0.00)
3472           9       0x09    0%
3473           10      0x0a    0.00%
3474           11      0x0b    0.00E+00
3475           12      0x0c    # ?/?
3476           13      0x0d    # ??/??
3477           14      0x0e    m/d/yy
3478           15      0x0f    d-mmm-yy
3479           16      0x10    d-mmm
3480           17      0x11    mmm-yy
3481           18      0x12    h:mm AM/PM
3482           19      0x13    h:mm:ss AM/PM
3483           20      0x14    h:mm
3484           21      0x15    h:mm:ss
3485           22      0x16    m/d/yy h:mm
3486           ..      ....    ...........
3487           37      0x25    (#,##0_);(#,##0)
3488           38      0x26    (#,##0_);[Red](#,##0)
3489           39      0x27    (#,##0.00_);(#,##0.00)
3490           40      0x28    (#,##0.00_);[Red](#,##0.00)
3491           41      0x29    _(* #,##0_);_(* (#,##0);_(* "-"_);_(@_)
3492           42      0x2a    _($* #,##0_);_($* (#,##0);_($* "-"_);_(@_)
3493           43      0x2b    _(* #,##0.00_);_(* (#,##0.00);_(* "-"??_);_(@_)
3494           44      0x2c    _($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)
3495           45      0x2d    mm:ss
3496           46      0x2e    [h]:mm:ss
3497           47      0x2f    mm:ss.0
3498           48      0x30    ##0.0E+0
3499           49      0x31    @
3500
3501       For examples of these formatting codes see the 'Numerical formats'
3502       worksheet created by formats.pl. See also the number_formats1.html and
3503       the number_formats2.html documents in the "docs" directory of the
3504       distro.
3505
3506       Note 1. Numeric formats 23 to 36 are not documented by Microsoft and
3507       may differ in international versions.
3508
3509       Note 2. In Excel 5 the dollar sign appears as a dollar sign. In Excel
3510       97-2000 it appears as the defined local currency symbol.
3511
3512       Note 3. The red negative numeric formats display slightly differently
3513       in Excel 5 and Excel 97-2000.
3514
3515   set_locked()
3516           Default state:      Cell locking is on
3517           Default action:     Turn locking on
3518           Valid args:         0, 1
3519
3520       This property can be used to prevent modification of a cells contents.
3521       Following Excel's convention, cell locking is turned on by default.
3522       However, it only has an effect if the worksheet has been protected, see
3523       the worksheet protect() method.
3524
3525           my $locked  = $workbook->add_format();
3526           $locked->set_locked(1); # A non-op
3527
3528           my $unlocked = $workbook->add_format();
3529           $locked->set_locked(0);
3530
3531           # Enable worksheet protection
3532           $worksheet->protect();
3533
3534           # This cell cannot be edited.
3535           $worksheet->write('A1', '=1+2', $locked);
3536
3537           # This cell can be edited.
3538           $worksheet->write('A2', '=1+2', $unlocked);
3539
3540       Note: This offers weak protection even with a password, see the note in
3541       relation to the protect() method.
3542
3543   set_hidden()
3544           Default state:      Formula hiding is off
3545           Default action:     Turn hiding on
3546           Valid args:         0, 1
3547
3548       This property is used to hide a formula while still displaying its
3549       result. This is generally used to hide complex calculations from end
3550       users who are only interested in the result. It only has an effect if
3551       the worksheet has been protected, see the worksheet protect() method.
3552
3553           my $hidden = $workbook->add_format();
3554           $hidden->set_hidden();
3555
3556           # Enable worksheet protection
3557           $worksheet->protect();
3558
3559           # The formula in this cell isn't visible
3560           $worksheet->write('A1', '=1+2', $hidden);
3561
3562       Note: This offers weak protection even with a password, see the note in
3563       relation to the protect() method.
3564
3565   set_align()
3566           Default state:      Alignment is off
3567           Default action:     Left alignment
3568           Valid args:         'left'              Horizontal
3569                               'center'
3570                               'right'
3571                               'fill'
3572                               'justify'
3573                               'center_across'
3574
3575                               'top'               Vertical
3576                               'vcenter'
3577                               'bottom'
3578                               'vjustify'
3579
3580       This method is used to set the horizontal and vertical text alignment
3581       within a cell. Vertical and horizontal alignments can be combined. The
3582       method is used as follows:
3583
3584           my $format = $workbook->add_format();
3585           $format->set_align('center');
3586           $format->set_align('vcenter');
3587           $worksheet->set_row(0, 30);
3588           $worksheet->write(0, 0, 'X', $format);
3589
3590       Text can be aligned across two or more adjacent cells using the
3591       "center_across" property. However, for genuine merged cells it is
3592       better to use the merge_range() worksheet method.
3593
3594       The "vjustify" (vertical justify) option can be used to provide
3595       automatic text wrapping in a cell. The height of the cell will be
3596       adjusted to accommodate the wrapped text. To specify where the text
3597       wraps use the set_text_wrap() method.
3598
3599       For further examples see the 'Alignment' worksheet created by
3600       formats.pl.
3601
3602   set_center_across()
3603           Default state:      Center across selection is off
3604           Default action:     Turn center across on
3605           Valid args:         1
3606
3607       Text can be aligned across two or more adjacent cells using the
3608       set_center_across() method. This is an alias for the
3609       set_align('center_across') method call.
3610
3611       Only one cell should contain the text, the other cells should be blank:
3612
3613           my $format = $workbook->add_format();
3614           $format->set_center_across();
3615
3616           $worksheet->write(1, 1, 'Center across selection', $format);
3617           $worksheet->write_blank(1, 2, $format);
3618
3619       See also the "merge1.pl" to "merge6.pl" programs in the "examples"
3620       directory and the merge_range() method.
3621
3622   set_text_wrap()
3623           Default state:      Text wrap is off
3624           Default action:     Turn text wrap on
3625           Valid args:         0, 1
3626
3627       Here is an example using the text wrap property, the escape character
3628       "\n" is used to indicate the end of line:
3629
3630           my $format = $workbook->add_format();
3631           $format->set_text_wrap();
3632           $worksheet->write(0, 0, "It's\na bum\nwrap", $format);
3633
3634       Excel will adjust the height of the row to accommodate the wrapped
3635       text. A similar effect can be obtained without newlines using the
3636       set_align('vjustify') method. See the "textwrap.pl" program in the
3637       "examples" directory.
3638
3639   set_rotation()
3640           Default state:      Text rotation is off
3641           Default action:     None
3642           Valid args:         Integers in the range -90 to 90 and 270
3643
3644       Set the rotation of the text in a cell. The rotation can be any angle
3645       in the range -90 to 90 degrees.
3646
3647           my $format = $workbook->add_format();
3648           $format->set_rotation(30);
3649           $worksheet->write(0, 0, 'This text is rotated', $format);
3650
3651       The angle 270 is also supported. This indicates text where the letters
3652       run from top to bottom.
3653
3654   set_indent()
3655           Default state:      Text indentation is off
3656           Default action:     Indent text 1 level
3657           Valid args:         Positive integers
3658
3659       This method can be used to indent text. The argument, which should be
3660       an integer, is taken as the level of indentation:
3661
3662           my $format = $workbook->add_format();
3663           $format->set_indent(2);
3664           $worksheet->write(0, 0, 'This text is indented', $format);
3665
3666       Indentation is a horizontal alignment property. It will override any
3667       other horizontal properties but it can be used in conjunction with
3668       vertical properties.
3669
3670   set_shrink()
3671           Default state:      Text shrinking is off
3672           Default action:     Turn "shrink to fit" on
3673           Valid args:         1
3674
3675       This method can be used to shrink text so that it fits in a cell.
3676
3677           my $format = $workbook->add_format();
3678           $format->set_shrink();
3679           $worksheet->write(0, 0, 'Honey, I shrunk the text!', $format);
3680
3681   set_text_justlast()
3682           Default state:      Justify last is off
3683           Default action:     Turn justify last on
3684           Valid args:         0, 1
3685
3686       Only applies to Far Eastern versions of Excel.
3687
3688   set_pattern()
3689           Default state:      Pattern is off
3690           Default action:     Solid fill is on
3691           Valid args:         0 .. 18
3692
3693       Set the background pattern of a cell.
3694
3695       Examples of the available patterns are shown in the 'Patterns'
3696       worksheet created by formats.pl. However, it is unlikely that you will
3697       ever need anything other than Pattern 1 which is a solid fill of the
3698       background color.
3699
3700   set_bg_color()
3701           Default state:      Color is off
3702           Default action:     Solid fill.
3703           Valid args:         See set_color()
3704
3705       The set_bg_color() method can be used to set the background colour of a
3706       pattern. Patterns are defined via the set_pattern() method. If a
3707       pattern hasn't been defined then a solid fill pattern is used as the
3708       default.
3709
3710       Here is an example of how to set up a solid fill in a cell:
3711
3712           my $format = $workbook->add_format();
3713
3714           $format->set_pattern(); # This is optional when using a solid fill
3715
3716           $format->set_bg_color('green');
3717           $worksheet->write('A1', 'Ray', $format);
3718
3719       For further examples see the 'Patterns' worksheet created by
3720       formats.pl.
3721
3722   set_fg_color()
3723           Default state:      Color is off
3724           Default action:     Solid fill.
3725           Valid args:         See set_color()
3726
3727       The set_fg_color() method can be used to set the foreground colour of a
3728       pattern.
3729
3730       For further examples see the 'Patterns' worksheet created by
3731       formats.pl.
3732
3733   set_border()
3734           Also applies to:    set_bottom()
3735                               set_top()
3736                               set_left()
3737                               set_right()
3738
3739           Default state:      Border is off
3740           Default action:     Set border type 1
3741           Valid args:         0-13, See below.
3742
3743       A cell border is comprised of a border on the bottom, top, left and
3744       right. These can be set to the same value using set_border() or
3745       individually using the relevant method calls shown above.
3746
3747       The following shows the border styles sorted by Spreadsheet::WriteExcel
3748       index number:
3749
3750           Index   Name            Weight   Style
3751           =====   =============   ======   ===========
3752           0       None            0
3753           1       Continuous      1        -----------
3754           2       Continuous      2        -----------
3755           3       Dash            1        - - - - - -
3756           4       Dot             1        . . . . . .
3757           5       Continuous      3        -----------
3758           6       Double          3        ===========
3759           7       Continuous      0        -----------
3760           8       Dash            2        - - - - - -
3761           9       Dash Dot        1        - . - . - .
3762           10      Dash Dot        2        - . - . - .
3763           11      Dash Dot Dot    1        - . . - . .
3764           12      Dash Dot Dot    2        - . . - . .
3765           13      SlantDash Dot   2        / - . / - .
3766
3767       The following shows the borders sorted by style:
3768
3769           Name            Weight   Style         Index
3770           =============   ======   ===========   =====
3771           Continuous      0        -----------   7
3772           Continuous      1        -----------   1
3773           Continuous      2        -----------   2
3774           Continuous      3        -----------   5
3775           Dash            1        - - - - - -   3
3776           Dash            2        - - - - - -   8
3777           Dash Dot        1        - . - . - .   9
3778           Dash Dot        2        - . - . - .   10
3779           Dash Dot Dot    1        - . . - . .   11
3780           Dash Dot Dot    2        - . . - . .   12
3781           Dot             1        . . . . . .   4
3782           Double          3        ===========   6
3783           None            0                      0
3784           SlantDash Dot   2        / - . / - .   13
3785
3786       The following shows the borders in the order shown in the Excel Dialog.
3787
3788           Index   Style             Index   Style
3789           =====   =====             =====   =====
3790           0       None              12      - . . - . .
3791           7       -----------       13      / - . / - .
3792           4       . . . . . .       10      - . - . - .
3793           11      - . . - . .       8       - - - - - -
3794           9       - . - . - .       2       -----------
3795           3       - - - - - -       5       -----------
3796           1       -----------       6       ===========
3797
3798       Examples of the available border styles are shown in the 'Borders'
3799       worksheet created by formats.pl.
3800
3801   set_border_color()
3802           Also applies to:    set_bottom_color()
3803                               set_top_color()
3804                               set_left_color()
3805                               set_right_color()
3806
3807           Default state:      Color is off
3808           Default action:     Undefined
3809           Valid args:         See set_color()
3810
3811       Set the colour of the cell borders. A cell border is comprised of a
3812       border on the bottom, top, left and right. These can be set to the same
3813       colour using set_border_color() or individually using the relevant
3814       method calls shown above. Examples of the border styles and colours are
3815       shown in the 'Borders' worksheet created by formats.pl.
3816
3817   copy($format)
3818       This method is used to copy all of the properties from one Format
3819       object to another:
3820
3821           my $lorry1 = $workbook->add_format();
3822           $lorry1->set_bold();
3823           $lorry1->set_italic();
3824           $lorry1->set_color('red');    # lorry1 is bold, italic and red
3825
3826           my $lorry2 = $workbook->add_format();
3827           $lorry2->copy($lorry1);
3828           $lorry2->set_color('yellow'); # lorry2 is bold, italic and yellow
3829
3830       The copy() method is only useful if you are using the method interface
3831       to Format properties. It generally isn't required if you are setting
3832       Format properties directly using hashes.
3833
3834       Note: this is not a copy constructor, both objects must exist prior to
3835       copying.
3836

UNICODE IN EXCEL

3838       The following is a brief introduction to handling Unicode in
3839       "Spreadsheet::WriteExcel".
3840
3841       For a more general introduction to Unicode handling in Perl see
3842       perlunitut and perluniintro.
3843
3844       When using Spreadsheet::WriteExcel the best and easiest way to write
3845       unicode strings to an Excel file is to use "UTF-8" encoded strings and
3846       perl 5.8 (or later). Spreadsheet::WriteExcel also allows you to write
3847       unicode strings using older perls but it generally requires more work,
3848       as explained below.
3849
3850       Internally, Excel encodes unicode data as "UTF-16LE" (where LE means
3851       little-endian). If you are using perl 5.8+ then Spreadsheet::WriteExcel
3852       will convert "UTF-8" strings to "UTF-16LE" when required. No further
3853       intervention is required from the programmer, for example:
3854
3855           # perl 5.8+ example:
3856           my $smiley = "\x{263A}";
3857
3858           $worksheet->write('A1', 'Hello world'); # ASCII
3859           $worksheet->write('A2', $smiley);       # UTF-8
3860
3861       Spreadsheet::WriteExcel also lets you write unicode data as "UTF-16".
3862       Since the majority of CPAN modules default to "UTF-16BE" (big-endian)
3863       Spreadsheet::WriteExcel also uses "UTF-16BE" and converts it internally
3864       to "UTF-16LE":
3865
3866           # perl 5.005 example:
3867           my $smiley = pack 'n', 0x263A;
3868
3869           $worksheet->write               ('A3', 'Hello world'); # ASCII
3870           $worksheet->write_utf16be_string('A4', $smiley);       # UTF-16
3871
3872       Although the above examples look similar there is an important
3873       difference. With "uft8" and perl 5.8+ Spreadsheet::WriteExcel treats
3874       "UTF-8" strings in exactly the same way as any other string. However,
3875       with "UTF16" data we need to distinguish it from other strings either
3876       by calling a separate function or by passing an additional flag to
3877       indicate the data type.
3878
3879       If you are dealing with non-ASCII characters that aren't in "UTF-8"
3880       then perl 5.8+ provides useful tools in the guise of the "Encode"
3881       module to help you to convert to the required format. For example:
3882
3883           use Encode 'decode';
3884
3885           my $string = 'some string with koi8-r characters';
3886              $string = decode('koi8-r', $string); # koi8-r to utf8
3887
3888       Alternatively you can read data from an encoded file and convert it to
3889       "UTF-8" as you read it in:
3890
3891           my $file = 'unicode_koi8r.txt';
3892           open FH, '<:encoding(koi8-r)', $file  or die "Couldn't open $file: $!\n";
3893
3894           my $row = 0;
3895           while (<FH>) {
3896               # Data read in is now in utf8 format.
3897               chomp;
3898               $worksheet->write($row++, 0,  $_);
3899           }
3900
3901       These methodologies are explained in more detail in perlunitut,
3902       perluniintro and perlunicode.
3903
3904       See also the "unicode_*.pl" programs in the examples directory of the
3905       distro.
3906

COLOURS IN EXCEL

3908       Excel provides a colour palette of 56 colours. In
3909       Spreadsheet::WriteExcel these colours are accessed via their palette
3910       index in the range 8..63. This index is used to set the colour of
3911       fonts, cell patterns and cell borders. For example:
3912
3913           my $format = $workbook->add_format(
3914                                               color => 12, # index for blue
3915                                               font  => 'Arial',
3916                                               size  => 12,
3917                                               bold  => 1,
3918                                            );
3919
3920       The most commonly used colours can also be accessed by name. The name
3921       acts as a simple alias for the colour index:
3922
3923           black     =>    8
3924           blue      =>   12
3925           brown     =>   16
3926           cyan      =>   15
3927           gray      =>   23
3928           green     =>   17
3929           lime      =>   11
3930           magenta   =>   14
3931           navy      =>   18
3932           orange    =>   53
3933           pink      =>   33
3934           purple    =>   20
3935           red       =>   10
3936           silver    =>   22
3937           white     =>    9
3938           yellow    =>   13
3939
3940       For example:
3941
3942           my $font = $workbook->add_format(color => 'red');
3943
3944       Users of VBA in Excel should note that the equivalent colour indices
3945       are in the range 1..56 instead of 8..63.
3946
3947       If the default palette does not provide a required colour you can
3948       override one of the built-in values. This is achieved by using the
3949       set_custom_color() workbook method to adjust the RGB (red green blue)
3950       components of the colour:
3951
3952           my $ferrari = $workbook->set_custom_color(40, 216, 12, 12);
3953
3954           my $format  = $workbook->add_format(
3955                                               bg_color => $ferrari,
3956                                               pattern  => 1,
3957                                               border   => 1
3958                                             );
3959
3960           $worksheet->write_blank('A1', $format);
3961
3962       The default Excel colour palette is shown in "palette.html" in the
3963       "docs" directory  of the distro. You can generate an Excel version of
3964       the palette using "colors.pl" in the "examples" directory.
3965

DATES AND TIME IN EXCEL

3967       There are two important things to understand about dates and times in
3968       Excel:
3969
3970       1 A date/time in Excel is a real number plus an Excel number format.
3971       2 Spreadsheet::WriteExcel doesn't automatically convert date/time
3972       strings in write() to an Excel date/time.
3973
3974       These two points are explained in more detail below along with some
3975       suggestions on how to convert times and dates to the required format.
3976
3977   An Excel date/time is a number plus a format
3978       If you write a date string with write() then all you will get is a
3979       string:
3980
3981           $worksheet->write('A1', '02/03/04'); # !! Writes a string not a date. !!
3982
3983       Dates and times in Excel are represented by real numbers, for example
3984       "Jan 1 2001 12:30 AM" is represented by the number 36892.521.
3985
3986       The integer part of the number stores the number of days since the
3987       epoch and the fractional part stores the percentage of the day.
3988
3989       A date or time in Excel is just like any other number. To have the
3990       number display as a date you must apply an Excel number format to it.
3991       Here are some examples.
3992
3993           #!/usr/bin/perl -w
3994
3995           use strict;
3996           use Spreadsheet::WriteExcel;
3997
3998           my $workbook  = Spreadsheet::WriteExcel->new('date_examples.xls');
3999           my $worksheet = $workbook->add_worksheet();
4000
4001           $worksheet->set_column('A:A', 30); # For extra visibility.
4002
4003           my $number    = 39506.5;
4004
4005           $worksheet->write('A1', $number);            #     39506.5
4006
4007           my $format2 = $workbook->add_format(num_format => 'dd/mm/yy');
4008           $worksheet->write('A2', $number , $format2); #     28/02/08
4009
4010           my $format3 = $workbook->add_format(num_format => 'mm/dd/yy');
4011           $worksheet->write('A3', $number , $format3); #     02/28/08
4012
4013           my $format4 = $workbook->add_format(num_format => 'd-m-yyyy');
4014           $worksheet->write('A4', $number , $format4); #     28-2-2008
4015
4016           my $format5 = $workbook->add_format(num_format => 'dd/mm/yy hh:mm');
4017           $worksheet->write('A5', $number , $format5); #     28/02/08 12:00
4018
4019           my $format6 = $workbook->add_format(num_format => 'd mmm yyyy');
4020           $worksheet->write('A6', $number , $format6); #     28 Feb 2008
4021
4022           my $format7 = $workbook->add_format(num_format => 'mmm d yyyy hh:mm AM/PM');
4023           $worksheet->write('A7', $number , $format7); #     Feb 28 2008 12:00 PM
4024
4025   Spreadsheet::WriteExcel doesn't automatically convert date/time strings
4026       Spreadsheet::WriteExcel doesn't automatically convert input date
4027       strings into Excel's formatted date numbers due to the large number of
4028       possible date formats and also due to the possibility of
4029       misinterpretation.
4030
4031       For example, does "02/03/04" mean March 2 2004, February 3 2004 or even
4032       March 4 2002.
4033
4034       Therefore, in order to handle dates you will have to convert them to
4035       numbers and apply an Excel format. Some methods for converting dates
4036       are listed in the next section.
4037
4038       The most direct way is to convert your dates to the ISO8601
4039       "yyyy-mm-ddThh:mm:ss.sss" date format and use the write_date_time()
4040       worksheet method:
4041
4042           $worksheet->write_date_time('A2', '2001-01-01T12:20', $format);
4043
4044       See the write_date_time() section of the documentation for more
4045       details.
4046
4047       A general methodology for handling date strings with write_date_time()
4048       is:
4049
4050           1. Identify incoming date/time strings with a regex.
4051           2. Extract the component parts of the date/time using the same regex.
4052           3. Convert the date/time to the ISO8601 format.
4053           4. Write the date/time using write_date_time() and a number format.
4054
4055       Here is an example:
4056
4057           #!/usr/bin/perl -w
4058
4059           use strict;
4060           use Spreadsheet::WriteExcel;
4061
4062           my $workbook    = Spreadsheet::WriteExcel->new('example.xls');
4063           my $worksheet   = $workbook->add_worksheet();
4064
4065           # Set the default format for dates.
4066           my $date_format = $workbook->add_format(num_format => 'mmm d yyyy');
4067
4068           # Increase column width to improve visibility of data.
4069           $worksheet->set_column('A:C', 20);
4070
4071           # Simulate reading from a data source.
4072           my $row = 0;
4073
4074           while (<DATA>) {
4075               chomp;
4076
4077               my $col  = 0;
4078               my @data = split ' ';
4079
4080               for my $item (@data) {
4081
4082                   # Match dates in the following formats: d/m/yy, d/m/yyyy
4083                   if ($item =~ qr[^(\d{1,2})/(\d{1,2})/(\d{4})$]) {
4084
4085                       # Change to the date format required by write_date_time().
4086                       my $date = sprintf "%4d-%02d-%02dT", $3, $2, $1;
4087
4088                       $worksheet->write_date_time($row, $col++, $date, $date_format);
4089                   }
4090                   else {
4091                       # Just plain data
4092                       $worksheet->write($row, $col++, $item);
4093                   }
4094               }
4095               $row++;
4096           }
4097
4098           __DATA__
4099           Item    Cost    Date
4100           Book    10      1/9/2007
4101           Beer    4       12/9/2007
4102           Bed     500     5/10/2007
4103
4104       For a slightly more advanced solution you can modify the write() method
4105       to handle date formats of your choice via the add_write_handler()
4106       method. See the add_write_handler() section of the docs and the
4107       write_handler3.pl and write_handler4.pl programs in the examples
4108       directory of the distro.
4109
4110   Converting dates and times to an Excel date or time
4111       The write_date_time() method above is just one way of handling dates
4112       and times.
4113
4114       The Spreadsheet::WriteExcel::Utility module which is included in the
4115       distro has date/time handling functions:
4116
4117           use Spreadsheet::WriteExcel::Utility;
4118
4119           $date           = xl_date_list(2002, 1, 1);         # 37257
4120           $date           = xl_parse_date("11 July 1997");    # 35622
4121           $time           = xl_parse_time('3:21:36 PM');      # 0.64
4122           $date           = xl_decode_date_EU("13 May 2002"); # 37389
4123
4124       Note: some of these functions require additional CPAN modules.
4125
4126       For date conversions using the CPAN "DateTime" framework see
4127       DateTime::Format::Excel
4128       <http://search.cpan.org/search?dist=DateTime-Format-Excel>.
4129

OUTLINES AND GROUPING IN EXCEL

4131       Excel allows you to group rows or columns so that they can be hidden or
4132       displayed with a single mouse click. This feature is referred to as
4133       outlines.
4134
4135       Outlines can reduce complex data down to a few salient sub-totals or
4136       summaries.
4137
4138       This feature is best viewed in Excel but the following is an ASCII
4139       representation of what a worksheet with three outlines might look like.
4140       Rows 3-4 and rows 7-8 are grouped at level 2. Rows 2-9 are grouped at
4141       level 1. The lines at the left hand side are called outline level bars.
4142
4143                   ------------------------------------------
4144            1 2 3 |   |   A   |   B   |   C   |   D   |  ...
4145                   ------------------------------------------
4146             _    | 1 |   A   |       |       |       |  ...
4147            |  _  | 2 |   B   |       |       |       |  ...
4148            | |   | 3 |  (C)  |       |       |       |  ...
4149            | |   | 4 |  (D)  |       |       |       |  ...
4150            | -   | 5 |   E   |       |       |       |  ...
4151            |  _  | 6 |   F   |       |       |       |  ...
4152            | |   | 7 |  (G)  |       |       |       |  ...
4153            | |   | 8 |  (H)  |       |       |       |  ...
4154            | -   | 9 |   I   |       |       |       |  ...
4155            -     | . |  ...  |  ...  |  ...  |  ...  |  ...
4156
4157       Clicking the minus sign on each of the level 2 outlines will collapse
4158       and hide the data as shown in the next figure. The minus sign changes
4159       to a plus sign to indicate that the data in the outline is hidden.
4160
4161                   ------------------------------------------
4162            1 2 3 |   |   A   |   B   |   C   |   D   |  ...
4163                   ------------------------------------------
4164             _    | 1 |   A   |       |       |       |  ...
4165            |     | 2 |   B   |       |       |       |  ...
4166            | +   | 5 |   E   |       |       |       |  ...
4167            |     | 6 |   F   |       |       |       |  ...
4168            | +   | 9 |   I   |       |       |       |  ...
4169            -     | . |  ...  |  ...  |  ...  |  ...  |  ...
4170
4171       Clicking on the minus sign on the level 1 outline will collapse the
4172       remaining rows as follows:
4173
4174                   ------------------------------------------
4175            1 2 3 |   |   A   |   B   |   C   |   D   |  ...
4176                   ------------------------------------------
4177                  | 1 |   A   |       |       |       |  ...
4178            +     | . |  ...  |  ...  |  ...  |  ...  |  ...
4179
4180       Grouping in "Spreadsheet::WriteExcel" is achieved by setting the
4181       outline level via the set_row() and set_column() worksheet methods:
4182
4183           set_row($row, $height, $format, $hidden, $level, $collapsed)
4184           set_column($first_col, $last_col, $width, $format, $hidden, $level, $collapsed)
4185
4186       The following example sets an outline level of 1 for rows 1 and 2
4187       (zero-indexed) and columns B to G. The parameters $height and $XF are
4188       assigned default values since they are undefined:
4189
4190           $worksheet->set_row(1, undef, undef, 0, 1);
4191           $worksheet->set_row(2, undef, undef, 0, 1);
4192           $worksheet->set_column('B:G', undef, undef, 0, 1);
4193
4194       Excel allows up to 7 outline levels. Therefore the $level parameter
4195       should be in the range "0 <= $level <= 7".
4196
4197       Rows and columns can be collapsed by setting the $hidden flag for the
4198       hidden rows/columns and setting the $collapsed flag for the row/column
4199       that has the collapsed "+" symbol:
4200
4201           $worksheet->set_row(1, undef, undef, 1, 1);
4202           $worksheet->set_row(2, undef, undef, 1, 1);
4203           $worksheet->set_row(3, undef, undef, 0, 0, 1);        # Collapsed flag.
4204
4205           $worksheet->set_column('B:G', undef, undef, 1, 1);
4206           $worksheet->set_column('H:H', undef, undef, 0, 0, 1); # Collapsed flag.
4207
4208       Note: Setting the $collapsed flag is particularly important for
4209       compatibility with OpenOffice.org and Gnumeric.
4210
4211       For a more complete example see the "outline.pl" and
4212       "outline_collapsed.pl" programs in the examples directory of the
4213       distro.
4214
4215       Some additional outline properties can be set via the
4216       outline_settings() worksheet method, see above.
4217

DATA VALIDATION IN EXCEL

4219       Data validation is a feature of Excel which allows you to restrict the
4220       data that a users enters in a cell and to display help and warning
4221       messages. It also allows you to restrict input to values in a drop down
4222       list.
4223
4224       A typical use case might be to restrict data in a cell to integer
4225       values in a certain range, to provide a help message to indicate the
4226       required value and to issue a warning if the input data doesn't meet
4227       the stated criteria. In Spreadsheet::WriteExcel we could do that as
4228       follows:
4229
4230           $worksheet->data_validation('B3',
4231               {
4232                   validate        => 'integer',
4233                   criteria        => 'between',
4234                   minimum         => 1,
4235                   maximum         => 100,
4236                   input_title     => 'Input an integer:',
4237                   input_message   => 'Between 1 and 100',
4238                   error_message   => 'Sorry, try again.',
4239               });
4240
4241       The above example would look like this in Excel:
4242       <http://homepage.eircom.net/~jmcnamara/perl/data_validation.jpg>.
4243
4244       For more information on data validation see the following Microsoft
4245       support article "Description and examples of data validation in Excel":
4246       <http://support.microsoft.com/kb/211485>.
4247
4248       The following sections describe how to use the data_validation() method
4249       and its various options.
4250
4251   data_validation($row, $col, { parameter => 'value', ... })
4252       The data_validation() method is used to construct an Excel data
4253       validation.
4254
4255       It can be applied to a single cell or a range of cells. You can pass 3
4256       parameters such as  "($row, $col, {...})" or 5 parameters such as
4257       "($first_row, $first_col, $last_row, $last_col, {...})". You can also
4258       use "A1" style notation. For example:
4259
4260           $worksheet->data_validation(0, 0,       {...});
4261           $worksheet->data_validation(0, 0, 4, 1, {...});
4262
4263           # Which are the same as:
4264
4265           $worksheet->data_validation('A1',       {...});
4266           $worksheet->data_validation('A1:B5',    {...});
4267
4268       See also the note about "Cell notation" for more information.
4269
4270       The last parameter in data_validation() must be a hash ref containing
4271       the parameters that describe the type and style of the data validation.
4272       The allowable parameters are:
4273
4274           validate
4275           criteria
4276           value | minimum | source
4277           maximum
4278           ignore_blank
4279           dropdown
4280
4281           input_title
4282           input_message
4283           show_input
4284
4285           error_title
4286           error_message
4287           error_type
4288           show_error
4289
4290       These parameters are explained in the following sections. Most of the
4291       parameters are optional, however, you will generally require the three
4292       main options "validate", "criteria" and "value".
4293
4294           $worksheet->data_validation('B3',
4295               {
4296                   validate => 'integer',
4297                   criteria => '>',
4298                   value    => 100,
4299               });
4300
4301       The "data_validation" method returns:
4302
4303            0 for success.
4304           -1 for insufficient number of arguments.
4305           -2 for row or column out of bounds.
4306           -3 for incorrect parameter or value.
4307
4308   validate
4309       This parameter is passed in a hash ref to data_validation().
4310
4311       The "validate" parameter is used to set the type of data that you wish
4312       to validate. It is always required and it has no default value.
4313       Allowable values are:
4314
4315           any
4316           integer
4317           decimal
4318           list
4319           date
4320           time
4321           length
4322           custom
4323
4324any is used to specify that the type of data is unrestricted. This
4325           is the same as not applying a data validation. It is only provided
4326           for completeness and isn't used very often in the context of
4327           Spreadsheet::WriteExcel.
4328
4329integer restricts the cell to integer values. Excel refers to this
4330           as 'whole number'.
4331
4332               validate => 'integer',
4333               criteria => '>',
4334               value    => 100,
4335
4336decimal restricts the cell to decimal values.
4337
4338               validate => 'decimal',
4339               criteria => '>',
4340               value    => 38.6,
4341
4342list restricts the cell to a set of user specified values. These
4343           can be passed in an array ref or as a cell range (named ranges
4344           aren't currently supported):
4345
4346               validate => 'list',
4347               value    => ['open', 'high', 'close'],
4348               # Or like this:
4349               value    => 'B1:B3',
4350
4351           Excel requires that range references are only to cells on the same
4352           worksheet.
4353
4354date restricts the cell to date values. Dates in Excel are
4355           expressed as integer values but you can also pass an ISO860 style
4356           string as used in write_date_time(). See also "DATES AND TIME IN
4357           EXCEL" for more information about working with Excel's dates.
4358
4359               validate => 'date',
4360               criteria => '>',
4361               value    => 39653, # 24 July 2008
4362               # Or like this:
4363               value    => '2008-07-24T',
4364
4365time restricts the cell to time values. Times in Excel are
4366           expressed as decimal values but you can also pass an ISO860 style
4367           string as used in write_date_time(). See also "DATES AND TIME IN
4368           EXCEL" for more information about working with Excel's times.
4369
4370               validate => 'time',
4371               criteria => '>',
4372               value    => 0.5, # Noon
4373               # Or like this:
4374               value    => 'T12:00:00',
4375
4376length restricts the cell data based on an integer string length.
4377           Excel refers to this as 'Text length'.
4378
4379               validate => 'length',
4380               criteria => '>',
4381               value    => 10,
4382
4383custom restricts the cell based on an external Excel formula that
4384           returns a "TRUE/FALSE" value.
4385
4386               validate => 'custom',
4387               value    => '=IF(A10>B10,TRUE,FALSE)',
4388
4389   criteria
4390       This parameter is passed in a hash ref to data_validation().
4391
4392       The "criteria" parameter is used to set the criteria by which the data
4393       in the cell is validated. It is almost always required except for the
4394       "list" and "custom" validate options. It has no default value.
4395       Allowable values are:
4396
4397           'between'
4398           'not between'
4399           'equal to'                  |  '=='  |  '='
4400           'not equal to'              |  '!='  |  '<>'
4401           'greater than'              |  '>'
4402           'less than'                 |  '<'
4403           'greater than or equal to'  |  '>='
4404           'less than or equal to'     |  '<='
4405
4406       You can either use Excel's textual description strings, in the first
4407       column above, or the more common operator alternatives. The following
4408       are equivalent:
4409
4410           validate => 'integer',
4411           criteria => 'greater than',
4412           value    => 100,
4413
4414           validate => 'integer',
4415           criteria => '>',
4416           value    => 100,
4417
4418       The "list" and "custom" validate options don't require a "criteria". If
4419       you specify one it will be ignored.
4420
4421           validate => 'list',
4422           value    => ['open', 'high', 'close'],
4423
4424           validate => 'custom',
4425           value    => '=IF(A10>B10,TRUE,FALSE)',
4426
4427   value | minimum | source
4428       This parameter is passed in a hash ref to data_validation().
4429
4430       The "value" parameter is used to set the limiting value to which the
4431       "criteria" is applied. It is always required and it has no default
4432       value. You can also use the synonyms "minimum" or "source" to make the
4433       validation a little clearer and closer to Excel's description of the
4434       parameter:
4435
4436           # Use 'value'
4437           validate => 'integer',
4438           criteria => '>',
4439           value    => 100,
4440
4441           # Use 'minimum'
4442           validate => 'integer',
4443           criteria => 'between',
4444           minimum  => 1,
4445           maximum  => 100,
4446
4447           # Use 'source'
4448           validate => 'list',
4449           source   => '$B$1:$B$3',
4450
4451   maximum
4452       This parameter is passed in a hash ref to data_validation().
4453
4454       The "maximum" parameter is used to set the upper limiting value when
4455       the "criteria" is either 'between' or 'not between':
4456
4457           validate => 'integer',
4458           criteria => 'between',
4459           minimum  => 1,
4460           maximum  => 100,
4461
4462   ignore_blank
4463       This parameter is passed in a hash ref to data_validation().
4464
4465       The "ignore_blank" parameter is used to toggle on and off the 'Ignore
4466       blank' option in the Excel data validation dialog. When the option is
4467       on the data validation is not applied to blank data in the cell. It is
4468       on by default.
4469
4470           ignore_blank => 0,  # Turn the option off
4471
4472   dropdown
4473       This parameter is passed in a hash ref to data_validation().
4474
4475       The "dropdown" parameter is used to toggle on and off the 'In-cell
4476       dropdown' option in the Excel data validation dialog. When the option
4477       is on a dropdown list will be shown for "list" validations. It is on by
4478       default.
4479
4480           dropdown => 0,      # Turn the option off
4481
4482   input_title
4483       This parameter is passed in a hash ref to data_validation().
4484
4485       The "input_title" parameter is used to set the title of the input
4486       message that is displayed when a cell is entered. It has no default
4487       value and is only displayed if the input message is displayed. See the
4488       "input_message" parameter below.
4489
4490           input_title   => 'This is the input title',
4491
4492       The maximum title length is 32 characters. UTF8 strings are handled
4493       automatically in perl 5.8 and later.
4494
4495   input_message
4496       This parameter is passed in a hash ref to data_validation().
4497
4498       The "input_message" parameter is used to set the input message that is
4499       displayed when a cell is entered. It has no default value.
4500
4501           validate      => 'integer',
4502           criteria      => 'between',
4503           minimum       => 1,
4504           maximum       => 100,
4505           input_title   => 'Enter the applied discount:',
4506           input_message => 'between 1 and 100',
4507
4508       The message can be split over several lines using newlines, "\n" in
4509       double quoted strings.
4510
4511           input_message => "This is\na test.",
4512
4513       The maximum message length is 255 characters. UTF8 strings are handled
4514       automatically in perl 5.8 and later.
4515
4516   show_input
4517       This parameter is passed in a hash ref to data_validation().
4518
4519       The "show_input" parameter is used to toggle on and off the 'Show input
4520       message when cell is selected' option in the Excel data validation
4521       dialog. When the option is off an input message is not displayed even
4522       if it has been set using "input_message". It is on by default.
4523
4524           show_input => 0,      # Turn the option off
4525
4526   error_title
4527       This parameter is passed in a hash ref to data_validation().
4528
4529       The "error_title" parameter is used to set the title of the error
4530       message that is displayed when the data validation criteria is not met.
4531       The default error title is 'Microsoft Excel'.
4532
4533           error_title   => 'Input value is not valid',
4534
4535       The maximum title length is 32 characters. UTF8 strings are handled
4536       automatically in perl 5.8 and later.
4537
4538   error_message
4539       This parameter is passed in a hash ref to data_validation().
4540
4541       The "error_message" parameter is used to set the error message that is
4542       displayed when a cell is entered. The default error message is "The
4543       value you entered is not valid.\nA user has restricted values that can
4544       be entered into the cell.".
4545
4546           validate      => 'integer',
4547           criteria      => 'between',
4548           minimum       => 1,
4549           maximum       => 100,
4550           error_title   => 'Input value is not valid',
4551           error_message => 'It should be an integer between 1 and 100',
4552
4553       The message can be split over several lines using newlines, "\n" in
4554       double quoted strings.
4555
4556           input_message => "This is\na test.",
4557
4558       The maximum message length is 255 characters. UTF8 strings are handled
4559       automatically in perl 5.8 and later.
4560
4561   error_type
4562       This parameter is passed in a hash ref to data_validation().
4563
4564       The "error_type" parameter is used to specify the type of error dialog
4565       that is displayed. There are 3 options:
4566
4567           'stop'
4568           'warning'
4569           'information'
4570
4571       The default is 'stop'.
4572
4573   show_error
4574       This parameter is passed in a hash ref to data_validation().
4575
4576       The "show_error" parameter is used to toggle on and off the 'Show error
4577       alert after invalid data is entered' option in the Excel data
4578       validation dialog. When the option is off an error message is not
4579       displayed even if it has been set using "error_message". It is on by
4580       default.
4581
4582           show_error => 0,      # Turn the option off
4583
4584   Data Validation Examples
4585       Example 1. Limiting input to an integer greater than a fixed value.
4586
4587           $worksheet->data_validation('A1',
4588               {
4589                   validate        => 'integer',
4590                   criteria        => '>',
4591                   value           => 0,
4592               });
4593
4594       Example 2. Limiting input to an integer greater than a fixed value
4595       where the value is referenced from a cell.
4596
4597           $worksheet->data_validation('A2',
4598               {
4599                   validate        => 'integer',
4600                   criteria        => '>',
4601                   value           => '=E3',
4602               });
4603
4604       Example 3. Limiting input to a decimal in a fixed range.
4605
4606           $worksheet->data_validation('A3',
4607               {
4608                   validate        => 'decimal',
4609                   criteria        => 'between',
4610                   minimum         => 0.1,
4611                   maximum         => 0.5,
4612               });
4613
4614       Example 4. Limiting input to a value in a dropdown list.
4615
4616           $worksheet->data_validation('A4',
4617               {
4618                   validate        => 'list',
4619                   source          => ['open', 'high', 'close'],
4620               });
4621
4622       Example 5. Limiting input to a value in a dropdown list where the list
4623       is specified as a cell range.
4624
4625           $worksheet->data_validation('A5',
4626               {
4627                   validate        => 'list',
4628                   source          => '=E4:G4',
4629               });
4630
4631       Example 6. Limiting input to a date in a fixed range.
4632
4633           $worksheet->data_validation('A6',
4634               {
4635                   validate        => 'date',
4636                   criteria        => 'between',
4637                   minimum         => '2008-01-01T',
4638                   maximum         => '2008-12-12T',
4639               });
4640
4641       Example 7. Displaying a message when the cell is selected.
4642
4643           $worksheet->data_validation('A7',
4644               {
4645                   validate      => 'integer',
4646                   criteria      => 'between',
4647                   minimum       => 1,
4648                   maximum       => 100,
4649                   input_title   => 'Enter an integer:',
4650                   input_message => 'between 1 and 100',
4651               });
4652
4653       See also the "data_validate.pl" program in the examples directory of
4654       the distro.
4655

ROW HEIGHTS AND WORKSHEET OBJECTS

4657       The following relates to worksheet objects such as images, comments and
4658       charts.
4659
4660       If you specify the height of a row that contains a worksheet object
4661       then Spreadsheet::WriteExcel will adjust the height of the object to
4662       maintain its default or user specified dimensions. In this way the
4663       object won't appear stretched or compressed in Excel.
4664
4665       However, Excel can also adjust the height of a row automatically if it
4666       contains cells that have the text wrap property set or contain large
4667       fonts. In these cases the height of the row is unknown to
4668       Spreadsheet::WriteExcel at execution time and the scaling calculations
4669       it performs are incorrect. The effect of this is that the  object is
4670       stretched with the row when it is displayed in Excel.
4671
4672       In order to avoid this issue you should use the set_row() method to
4673       explicitly specify the height of any row that may otherwise be changed
4674       automatically by Excel.
4675

FORMULAS AND FUNCTIONS IN EXCEL

4677   Caveats
4678       The first thing to note is that there are still some outstanding issues
4679       with the implementation of formulas and functions:
4680
4681           1. Writing a formula is much slower than writing the equivalent string.
4682           2. You cannot use array constants, i.e. {1;2;3}, in functions.
4683           3. Unary minus isn't supported.
4684           4. Whitespace is not preserved around operators.
4685           5. Named ranges are not supported.
4686           6. Array formulas are not supported.
4687
4688       However, these constraints will be removed in future versions. They are
4689       here because of a trade-off between features and time. Also, it is
4690       possible to work around issue 1 using the store_formula() and
4691       repeat_formula() methods as described later in this section.
4692
4693   Introduction
4694       The following is a brief introduction to formulas and functions in
4695       Excel and Spreadsheet::WriteExcel.
4696
4697       A formula is a string that begins with an equals sign:
4698
4699           '=A1+B1'
4700           '=AVERAGE(1, 2, 3)'
4701
4702       The formula can contain numbers, strings, boolean values, cell
4703       references, cell ranges and functions. Named ranges are not supported.
4704       Formulas should be written as they appear in Excel, that is cells and
4705       functions must be in uppercase.
4706
4707       Cells in Excel are referenced using the A1 notation system where the
4708       column is designated by a letter and the row by a number. Columns range
4709       from A to IV i.e. 0 to 255, rows range from 1 to 65536. The
4710       "Spreadsheet::WriteExcel::Utility" module that is included in the
4711       distro contains helper functions for dealing with A1 notation, for
4712       example:
4713
4714           use Spreadsheet::WriteExcel::Utility;
4715
4716           ($row, $col) = xl_cell_to_rowcol('C2');  # (1, 2)
4717           $str         = xl_rowcol_to_cell(1, 2);  # C2
4718
4719       The Excel "$" notation in cell references is also supported. This
4720       allows you to specify whether a row or column is relative or absolute.
4721       This only has an effect if the cell is copied. The following examples
4722       show relative and absolute values.
4723
4724           '=A1'   # Column and row are relative
4725           '=$A1'  # Column is absolute and row is relative
4726           '=A$1'  # Column is relative and row is absolute
4727           '=$A$1' # Column and row are absolute
4728
4729       Formulas can also refer to cells in other worksheets of the current
4730       workbook. For example:
4731
4732           '=Sheet2!A1'
4733           '=Sheet2!A1:A5'
4734           '=Sheet2:Sheet3!A1'
4735           '=Sheet2:Sheet3!A1:A5'
4736           q{='Test Data'!A1}
4737           q{='Test Data1:Test Data2'!A1}
4738
4739       The sheet reference and the cell reference are separated by  "!" the
4740       exclamation mark symbol. If worksheet names contain spaces, commas or
4741       parentheses then Excel requires that the name is enclosed in single
4742       quotes as shown in the last two examples above. In order to avoid using
4743       a lot of escape characters you can use the quote operator "q{}" to
4744       protect the quotes. See "perlop" in the main Perl documentation. Only
4745       valid sheet names that have been added using the add_worksheet() method
4746       can be used in formulas. You cannot reference external workbooks.
4747
4748       The following table lists the operators that are available in Excel's
4749       formulas. The majority of the operators are the same as Perl's,
4750       differences are indicated:
4751
4752           Arithmetic operators:
4753           =====================
4754           Operator  Meaning                   Example
4755              +      Addition                  1+2
4756              -      Subtraction               2-1
4757              *      Multiplication            2*3
4758              /      Division                  1/4
4759              ^      Exponentiation            2^3      # Equivalent to **
4760              -      Unary minus               -(1+2)   # Not yet supported
4761              %      Percent (Not modulus)     13%      # Not supported, [1]
4762
4763
4764           Comparison operators:
4765           =====================
4766           Operator  Meaning                   Example
4767               =     Equal to                  A1 =  B1 # Equivalent to ==
4768               <>    Not equal to              A1 <> B1 # Equivalent to !=
4769               >     Greater than              A1 >  B1
4770               <     Less than                 A1 <  B1
4771               >=    Greater than or equal to  A1 >= B1
4772               <=    Less than or equal to     A1 <= B1
4773
4774
4775           String operator:
4776           ================
4777           Operator  Meaning                   Example
4778               &     Concatenation             "Hello " & "World!" # [2]
4779
4780
4781           Reference operators:
4782           ====================
4783           Operator  Meaning                   Example
4784               :     Range operator            A1:A4               # [3]
4785               ,     Union operator            SUM(1, 2+2, B3)     # [4]
4786
4787
4788           Notes:
4789           [1]: You can get a percentage with formatting and modulus with MOD().
4790           [2]: Equivalent to ("Hello " . "World!") in Perl.
4791           [3]: This range is equivalent to cells A1, A2, A3 and A4.
4792           [4]: The comma behaves like the list separator in Perl.
4793
4794       The range and comma operators can have different symbols in non-English
4795       versions of Excel. These will be supported in a later version of
4796       Spreadsheet::WriteExcel. European users of Excel take note:
4797
4798           $worksheet->write('A1', '=SUM(1; 2; 3)'); # Wrong!!
4799           $worksheet->write('A1', '=SUM(1, 2, 3)'); # Okay
4800
4801       The following table lists all of the core functions supported by Excel
4802       5 and Spreadsheet::WriteExcel. Any additional functions that are
4803       available through the "Analysis ToolPak" or other add-ins are not
4804       supported. These functions have all been tested to verify that they
4805       work.
4806
4807           ABS           DB            INDIRECT      NORMINV       SLN
4808           ACOS          DCOUNT        INFO          NORMSDIST     SLOPE
4809           ACOSH         DCOUNTA       INT           NORMSINV      SMALL
4810           ADDRESS       DDB           INTERCEPT     NOT           SQRT
4811           AND           DEGREES       IPMT          NOW           STANDARDIZE
4812           AREAS         DEVSQ         IRR           NPER          STDEV
4813           ASIN          DGET          ISBLANK       NPV           STDEVP
4814           ASINH         DMAX          ISERR         ODD           STEYX
4815           ATAN          DMIN          ISERROR       OFFSET        SUBSTITUTE
4816           ATAN2         DOLLAR        ISLOGICAL     OR            SUBTOTAL
4817           ATANH         DPRODUCT      ISNA          PEARSON       SUM
4818           AVEDEV        DSTDEV        ISNONTEXT     PERCENTILE    SUMIF
4819           AVERAGE       DSTDEVP       ISNUMBER      PERCENTRANK   SUMPRODUCT
4820           BETADIST      DSUM          ISREF         PERMUT        SUMSQ
4821           BETAINV       DVAR          ISTEXT        PI            SUMX2MY2
4822           BINOMDIST     DVARP         KURT          PMT           SUMX2PY2
4823           CALL          ERROR.TYPE    LARGE         POISSON       SUMXMY2
4824           CEILING       EVEN          LEFT          POWER         SYD
4825           CELL          EXACT         LEN           PPMT          T
4826           CHAR          EXP           LINEST        PROB          TAN
4827           CHIDIST       EXPONDIST     LN            PRODUCT       TANH
4828           CHIINV        FACT          LOG           PROPER        TDIST
4829           CHITEST       FALSE         LOG10         PV            TEXT
4830           CHOOSE        FDIST         LOGEST        QUARTILE      TIME
4831           CLEAN         FIND          LOGINV        RADIANS       TIMEVALUE
4832           CODE          FINV          LOGNORMDIST   RAND          TINV
4833           COLUMN        FISHER        LOOKUP        RANK          TODAY
4834           COLUMNS       FISHERINV     LOWER         RATE          TRANSPOSE
4835           COMBIN        FIXED         MATCH         REGISTER.ID   TREND
4836           CONCATENATE   FLOOR         MAX           REPLACE       TRIM
4837           CONFIDENCE    FORECAST      MDETERM       REPT          TRIMMEAN
4838           CORREL        FREQUENCY     MEDIAN        RIGHT         TRUE
4839           COS           FTEST         MID           ROMAN         TRUNC
4840           COSH          FV            MIN           ROUND         TTEST
4841           COUNT         GAMMADIST     MINUTE        ROUNDDOWN     TYPE
4842           COUNTA        GAMMAINV      MINVERSE      ROUNDUP       UPPER
4843           COUNTBLANK    GAMMALN       MIRR          ROW           VALUE
4844           COUNTIF       GEOMEAN       MMULT         ROWS          VAR
4845           COVAR         GROWTH        MOD           RSQ           VARP
4846           CRITBINOM     HARMEAN       MODE          SEARCH        VDB
4847           DATE          HLOOKUP       MONTH         SECOND        VLOOKUP
4848           DATEVALUE     HOUR          N             SIGN          WEEKDAY
4849           DAVERAGE      HYPGEOMDIST   NA            SIN           WEIBULL
4850           DAY           IF            NEGBINOMDIST  SINH          YEAR
4851           DAYS360       INDEX         NORMDIST      SKEW          ZTEST
4852
4853       You can also modify the module to support function names in the
4854       following languages: German, French, Spanish, Portuguese, Dutch,
4855       Finnish, Italian and Swedish. See the "function_locale.pl" program in
4856       the "examples" directory of the distro.
4857
4858       For a general introduction to Excel's formulas and an explanation of
4859       the syntax of the function refer to the Excel help files or the
4860       following:
4861       <http://office.microsoft.com/en-us/assistance/CH062528031033.aspx>.
4862
4863       If your formula doesn't work in Spreadsheet::WriteExcel try the
4864       following:
4865
4866           1. Verify that the formula works in Excel (or Gnumeric or OpenOffice.org).
4867           2. Ensure that it isn't on the Caveats list shown above.
4868           3. Ensure that cell references and formula names are in uppercase.
4869           4. Ensure that you are using ':' as the range operator, A1:A4.
4870           5. Ensure that you are using ',' as the union operator, SUM(1,2,3).
4871           6. Ensure that the function is in the above table.
4872
4873       If you go through steps 1-6 and you still have a problem, mail me.
4874
4875   Improving performance when working with formulas
4876       Writing a large number of formulas with Spreadsheet::WriteExcel can be
4877       slow. This is due to the fact that each formula has to be parsed and
4878       with the current implementation this is computationally expensive.
4879
4880       However, in a lot of cases the formulas that you write will be quite
4881       similar, for example:
4882
4883           $worksheet->write_formula('B1',    '=A1 * 3 + 50',    $format);
4884           $worksheet->write_formula('B2',    '=A2 * 3 + 50',    $format);
4885           ...
4886           ...
4887           $worksheet->write_formula('B99',   '=A999 * 3 + 50',  $format);
4888           $worksheet->write_formula('B1000', '=A1000 * 3 + 50', $format);
4889
4890       In this example the cell reference changes in iterations from "A1" to
4891       "A1000". The parser treats this variable as a token and arranges it
4892       according to predefined rules. However, since the parser is oblivious
4893       to the value of the token, it is essentially performing the same
4894       calculation 1000 times. This is inefficient.
4895
4896       The way to avoid this inefficiency and thereby speed up the writing of
4897       formulas is to parse the formula once and then repeatedly substitute
4898       similar tokens.
4899
4900       A formula can be parsed and stored via the store_formula() worksheet
4901       method. You can then use the repeat_formula() method to substitute
4902       $pattern, $replace pairs in the stored formula:
4903
4904           my $formula = $worksheet->store_formula('=A1 * 3 + 50');
4905
4906           for my $row (0..999) {
4907               $worksheet->repeat_formula($row, 1, $formula, $format, 'A1', 'A'.($row +1));
4908           }
4909
4910       On an arbitrary test machine this method was 10 times faster than the
4911       brute force method shown above.
4912
4913       For more information about how Spreadsheet::WriteExcel parses and
4914       stores formulas see the "Spreadsheet::WriteExcel::Formula" man page.
4915
4916       It should be noted however that the overall speed of direct formula
4917       parsing will be improved in a future version.
4918

EXAMPLES

4920       See Spreadsheet::WriteExcel::Examples for a full list of examples.
4921
4922   Example 1
4923       The following example shows some of the basic features of
4924       Spreadsheet::WriteExcel.
4925
4926           #!/usr/bin/perl -w
4927
4928           use strict;
4929           use Spreadsheet::WriteExcel;
4930
4931           # Create a new workbook called simple.xls and add a worksheet
4932           my $workbook  = Spreadsheet::WriteExcel->new('simple.xls');
4933           my $worksheet = $workbook->add_worksheet();
4934
4935           # The general syntax is write($row, $column, $token). Note that row and
4936           # column are zero indexed
4937
4938           # Write some text
4939           $worksheet->write(0, 0,  'Hi Excel!');
4940
4941
4942           # Write some numbers
4943           $worksheet->write(2, 0,  3);          # Writes 3
4944           $worksheet->write(3, 0,  3.00000);    # Writes 3
4945           $worksheet->write(4, 0,  3.00001);    # Writes 3.00001
4946           $worksheet->write(5, 0,  3.14159);    # TeX revision no.?
4947
4948
4949           # Write some formulas
4950           $worksheet->write(7, 0,  '=A3 + A6');
4951           $worksheet->write(8, 0,  '=IF(A5>3,"Yes", "No")');
4952
4953
4954           # Write a hyperlink
4955           $worksheet->write(10, 0, 'http://www.perl.com/');
4956
4957   Example 2
4958       The following is a general example which demonstrates some features of
4959       working with multiple worksheets.
4960
4961           #!/usr/bin/perl -w
4962
4963           use strict;
4964           use Spreadsheet::WriteExcel;
4965
4966           # Create a new Excel workbook
4967           my $workbook = Spreadsheet::WriteExcel->new('regions.xls');
4968
4969           # Add some worksheets
4970           my $north = $workbook->add_worksheet('North');
4971           my $south = $workbook->add_worksheet('South');
4972           my $east  = $workbook->add_worksheet('East');
4973           my $west  = $workbook->add_worksheet('West');
4974
4975           # Add a Format
4976           my $format = $workbook->add_format();
4977           $format->set_bold();
4978           $format->set_color('blue');
4979
4980           # Add a caption to each worksheet
4981           foreach my $worksheet ($workbook->sheets()) {
4982               $worksheet->write(0, 0, 'Sales', $format);
4983           }
4984
4985           # Write some data
4986           $north->write(0, 1, 200000);
4987           $south->write(0, 1, 100000);
4988           $east->write (0, 1, 150000);
4989           $west->write (0, 1, 100000);
4990
4991           # Set the active worksheet
4992           $south->activate();
4993
4994           # Set the width of the first column
4995           $south->set_column(0, 0, 20);
4996
4997           # Set the active cell
4998           $south->set_selection(0, 1);
4999
5000   Example 3
5001       This example shows how to use a conditional numerical format with
5002       colours to indicate if a share price has gone up or down.
5003
5004           use strict;
5005           use Spreadsheet::WriteExcel;
5006
5007           # Create a new workbook and add a worksheet
5008           my $workbook  = Spreadsheet::WriteExcel->new('stocks.xls');
5009           my $worksheet = $workbook->add_worksheet();
5010
5011           # Set the column width for columns 1, 2, 3 and 4
5012           $worksheet->set_column(0, 3, 15);
5013
5014
5015           # Create a format for the column headings
5016           my $header = $workbook->add_format();
5017           $header->set_bold();
5018           $header->set_size(12);
5019           $header->set_color('blue');
5020
5021
5022           # Create a format for the stock price
5023           my $f_price = $workbook->add_format();
5024           $f_price->set_align('left');
5025           $f_price->set_num_format('$0.00');
5026
5027
5028           # Create a format for the stock volume
5029           my $f_volume = $workbook->add_format();
5030           $f_volume->set_align('left');
5031           $f_volume->set_num_format('#,##0');
5032
5033
5034           # Create a format for the price change. This is an example of a
5035           # conditional format. The number is formatted as a percentage. If it is
5036           # positive it is formatted in green, if it is negative it is formatted
5037           # in red and if it is zero it is formatted as the default font colour
5038           # (in this case black). Note: the [Green] format produces an unappealing
5039           # lime green. Try [Color 10] instead for a dark green.
5040           #
5041           my $f_change = $workbook->add_format();
5042           $f_change->set_align('left');
5043           $f_change->set_num_format('[Green]0.0%;[Red]-0.0%;0.0%');
5044
5045
5046           # Write out the data
5047           $worksheet->write(0, 0, 'Company',$header);
5048           $worksheet->write(0, 1, 'Price',  $header);
5049           $worksheet->write(0, 2, 'Volume', $header);
5050           $worksheet->write(0, 3, 'Change', $header);
5051
5052           $worksheet->write(1, 0, 'Damage Inc.'       );
5053           $worksheet->write(1, 1, 30.25,    $f_price ); # $30.25
5054           $worksheet->write(1, 2, 1234567,  $f_volume); # 1,234,567
5055           $worksheet->write(1, 3, 0.085,    $f_change); # 8.5% in green
5056
5057           $worksheet->write(2, 0, 'Dump Corp.'        );
5058           $worksheet->write(2, 1, 1.56,     $f_price ); # $1.56
5059           $worksheet->write(2, 2, 7564,     $f_volume); # 7,564
5060           $worksheet->write(2, 3, -0.015,   $f_change); # -1.5% in red
5061
5062           $worksheet->write(3, 0, 'Rev Ltd.'          );
5063           $worksheet->write(3, 1, 0.13,     $f_price ); # $0.13
5064           $worksheet->write(3, 2, 321,      $f_volume); # 321
5065           $worksheet->write(3, 3, 0,        $f_change); # 0 in the font color (black)
5066
5067   Example 4
5068       The following is a simple example of using functions.
5069
5070           #!/usr/bin/perl -w
5071
5072           use strict;
5073           use Spreadsheet::WriteExcel;
5074
5075           # Create a new workbook and add a worksheet
5076           my $workbook  = Spreadsheet::WriteExcel->new('stats.xls');
5077           my $worksheet = $workbook->add_worksheet('Test data');
5078
5079           # Set the column width for columns 1
5080           $worksheet->set_column(0, 0, 20);
5081
5082
5083           # Create a format for the headings
5084           my $format = $workbook->add_format();
5085           $format->set_bold();
5086
5087
5088           # Write the sample data
5089           $worksheet->write(0, 0, 'Sample', $format);
5090           $worksheet->write(0, 1, 1);
5091           $worksheet->write(0, 2, 2);
5092           $worksheet->write(0, 3, 3);
5093           $worksheet->write(0, 4, 4);
5094           $worksheet->write(0, 5, 5);
5095           $worksheet->write(0, 6, 6);
5096           $worksheet->write(0, 7, 7);
5097           $worksheet->write(0, 8, 8);
5098
5099           $worksheet->write(1, 0, 'Length', $format);
5100           $worksheet->write(1, 1, 25.4);
5101           $worksheet->write(1, 2, 25.4);
5102           $worksheet->write(1, 3, 24.8);
5103           $worksheet->write(1, 4, 25.0);
5104           $worksheet->write(1, 5, 25.3);
5105           $worksheet->write(1, 6, 24.9);
5106           $worksheet->write(1, 7, 25.2);
5107           $worksheet->write(1, 8, 24.8);
5108
5109           # Write some statistical functions
5110           $worksheet->write(4,  0, 'Count', $format);
5111           $worksheet->write(4,  1, '=COUNT(B1:I1)');
5112
5113           $worksheet->write(5,  0, 'Sum', $format);
5114           $worksheet->write(5,  1, '=SUM(B2:I2)');
5115
5116           $worksheet->write(6,  0, 'Average', $format);
5117           $worksheet->write(6,  1, '=AVERAGE(B2:I2)');
5118
5119           $worksheet->write(7,  0, 'Min', $format);
5120           $worksheet->write(7,  1, '=MIN(B2:I2)');
5121
5122           $worksheet->write(8,  0, 'Max', $format);
5123           $worksheet->write(8,  1, '=MAX(B2:I2)');
5124
5125           $worksheet->write(9,  0, 'Standard Deviation', $format);
5126           $worksheet->write(9,  1, '=STDEV(B2:I2)');
5127
5128           $worksheet->write(10, 0, 'Kurtosis', $format);
5129           $worksheet->write(10, 1, '=KURT(B2:I2)');
5130
5131   Example 5
5132       The following example converts a tab separated file called "tab.txt"
5133       into an Excel file called "tab.xls".
5134
5135           #!/usr/bin/perl -w
5136
5137           use strict;
5138           use Spreadsheet::WriteExcel;
5139
5140           open (TABFILE, 'tab.txt') or die "tab.txt: $!";
5141
5142           my $workbook  = Spreadsheet::WriteExcel->new('tab.xls');
5143           my $worksheet = $workbook->add_worksheet();
5144
5145           # Row and column are zero indexed
5146           my $row = 0;
5147
5148           while (<TABFILE>) {
5149               chomp;
5150               # Split on single tab
5151               my @Fld = split('\t', $_);
5152
5153               my $col = 0;
5154               foreach my $token (@Fld) {
5155                   $worksheet->write($row, $col, $token);
5156                   $col++;
5157               }
5158               $row++;
5159           }
5160
5161       NOTE: This is a simple conversion program for illustrative purposes
5162       only. For converting a CSV or Tab separated or any other type of
5163       delimited text file to Excel I recommend the more rigorous csv2xls
5164       program that is part of H.Merijn Brand's Text::CSV_XS module distro.
5165
5166       See the examples/csv2xls link here:
5167       <http://search.cpan.org/~hmbrand/Text-CSV_XS/MANIFEST>.
5168
5169   Additional Examples
5170       The following is a description of the example files that are provided
5171       in the standard Spreadsheet::WriteExcel distribution. They demonstrate
5172       the different features and options of the module.  See
5173       Spreadsheet::WriteExcel::Examples for more details.
5174
5175           Getting started
5176           ===============
5177           a_simple.pl             A get started example with some basic features.
5178           demo.pl                 A demo of some of the available features.
5179           regions.pl              A simple example of multiple worksheets.
5180           stats.pl                Basic formulas and functions.
5181           formats.pl              All the available formatting on several worksheets.
5182           bug_report.pl           A template for submitting bug reports.
5183
5184
5185           Advanced
5186           ========
5187           autofilter.pl           Examples of worksheet autofilters.
5188           autofit.pl              Simulate Excel's autofit for column widths.
5189           bigfile.pl              Write past the 7MB limit with OLE::Storage_Lite.
5190           cgi.pl                  A simple CGI program.
5191           chart_area.pl           A demo of area style charts.
5192           chart_bar.pl            A demo of bar (vertical histogram) style charts.
5193           chart_column.pl         A demo of column (histogram) style charts.
5194           chart_line.pl           A demo of line style charts.
5195           chart_pie.pl            A demo of pie style charts.
5196           chart_scatter.pl        A demo of scatter style charts.
5197           chart_stock.pl          A demo of stock style charts.
5198           chess.pl                An example of reusing formatting via properties.
5199           colors.pl               A demo of the colour palette and named colours.
5200           comments1.pl            Add comments to worksheet cells.
5201           comments2.pl            Add comments with advanced options.
5202           copyformat.pl           Example of copying a cell format.
5203           data_validate.pl        An example of data validation and dropdown lists.
5204           date_time.pl            Write dates and times with write_date_time().
5205           defined_name.pl         Example of how to create defined names.
5206           diag_border.pl          A simple example of diagonal cell borders.
5207           easter_egg.pl           Expose the Excel97 flight simulator.
5208           filehandle.pl           Examples of working with filehandles.
5209           formula_result.pl       Formulas with user specified results.
5210           headers.pl              Examples of worksheet headers and footers.
5211           hide_sheet.pl           Simple example of hiding a worksheet.
5212           hyperlink1.pl           Shows how to create web hyperlinks.
5213           hyperlink2.pl           Examples of internal and external hyperlinks.
5214           images.pl               Adding images to worksheets.
5215           indent.pl               An example of cell indentation.
5216           merge1.pl               A simple example of cell merging.
5217           merge2.pl               A simple example of cell merging with formatting.
5218           merge3.pl               Add hyperlinks to merged cells.
5219           merge4.pl               An advanced example of merging with formatting.
5220           merge5.pl               An advanced example of merging with formatting.
5221           merge6.pl               An example of merging with Unicode strings.
5222           mod_perl1.pl            A simple mod_perl 1 program.
5223           mod_perl2.pl            A simple mod_perl 2 program.
5224           outline.pl              An example of outlines and grouping.
5225           outline_collapsed.pl    An example of collapsed outlines.
5226           panes.pl                An examples of how to create panes.
5227           properties.pl           Add document properties to a workbook.
5228           protection.pl           Example of cell locking and formula hiding.
5229           repeat.pl               Example of writing repeated formulas.
5230           right_to_left.pl        Change default sheet direction to right to left.
5231           row_wrap.pl             How to wrap data from one worksheet onto another.
5232           sales.pl                An example of a simple sales spreadsheet.
5233           sendmail.pl             Send an Excel email attachment using Mail::Sender.
5234           stats_ext.pl            Same as stats.pl with external references.
5235           stocks.pl               Demonstrates conditional formatting.
5236           tab_colors.pl           Example of how to set worksheet tab colours.
5237           textwrap.pl             Demonstrates text wrapping options.
5238           win32ole.pl             A sample Win32::OLE example for comparison.
5239           write_arrays.pl         Example of writing 1D or 2D arrays of data.
5240           write_handler1.pl       Example of extending the write() method. Step 1.
5241           write_handler2.pl       Example of extending the write() method. Step 2.
5242           write_handler3.pl       Example of extending the write() method. Step 3.
5243           write_handler4.pl       Example of extending the write() method. Step 4.
5244           write_to_scalar.pl      Example of writing an Excel file to a Perl scalar.
5245
5246
5247           Unicode
5248           =======
5249           unicode_utf16.pl        Simple example of using Unicode UTF16 strings.
5250           unicode_utf16_japan.pl  Write Japanese Unicode strings using UTF-16.
5251           unicode_cyrillic.pl     Write Russian Cyrillic strings using UTF-8.
5252           unicode_list.pl         List the chars in a Unicode font.
5253           unicode_2022_jp.pl      Japanese: ISO-2022-JP to utf8 in perl 5.8.
5254           unicode_8859_11.pl      Thai:     ISO-8859_11 to utf8 in perl 5.8.
5255           unicode_8859_7.pl       Greek:    ISO-8859_7  to utf8 in perl 5.8.
5256           unicode_big5.pl         Chinese:  BIG5        to utf8 in perl 5.8.
5257           unicode_cp1251.pl       Russian:  CP1251      to utf8 in perl 5.8.
5258           unicode_cp1256.pl       Arabic:   CP1256      to utf8 in perl 5.8.
5259           unicode_koi8r.pl        Russian:  KOI8-R      to utf8 in perl 5.8.
5260           unicode_polish_utf8.pl  Polish :  UTF8        to utf8 in perl 5.8.
5261           unicode_shift_jis.pl    Japanese: Shift JIS   to utf8 in perl 5.8.
5262
5263
5264           Utility
5265           =======
5266           csv2xls.pl              Program to convert a CSV file to an Excel file.
5267           tab2xls.pl              Program to convert a tab separated file to xls.
5268           datecalc1.pl            Convert Unix/Perl time to Excel time.
5269           datecalc2.pl            Calculate an Excel date using Date::Calc.
5270           lecxe.pl                Convert Excel to WriteExcel using Win32::OLE.
5271
5272
5273           Developer
5274           =========
5275           convertA1.pl            Helper functions for dealing with A1 notation.
5276           function_locale.pl      Add non-English function names to Formula.pm.
5277           writeA1.pl              Example of how to extend the module.
5278

LIMITATIONS

5280       The following limits are imposed by Excel:
5281
5282           Description                          Limit
5283           -----------------------------------  ------
5284           Maximum number of chars in a string  32767
5285           Maximum number of columns            256
5286           Maximum number of rows               65536
5287           Maximum chars in a sheet name        31
5288           Maximum chars in a header/footer     254
5289
5290       For Excel 2007+ file limits see the Excel::Writer::XLSX module.
5291
5292       The minimum file size is 6K due to the OLE overhead. The maximum file
5293       size is approximately 7MB (7087104 bytes) of BIFF data. This can be
5294       extended by installing Takanori Kawai's OLE::Storage_Lite module
5295       <http://search.cpan.org/search?dist=OLE-Storage_Lite> see the
5296       "bigfile.pl" example in the "examples" directory of the distro.
5297

DOWNLOADING

5299       The latest version of this module is always available at:
5300       <http://search.cpan.org/search?dist=Spreadsheet-WriteExcel/>.
5301

REQUIREMENTS

5303       This module requires Perl >= 5.005, Parse::RecDescent, File::Temp and
5304       OLE::Storage_Lite:
5305
5306           http://search.cpan.org/search?dist=Parse-RecDescent/ # For formulas.
5307           http://search.cpan.org/search?dist=File-Temp/        # For set_tempdir().
5308           http://search.cpan.org/search?dist=OLE-Storage_Lite/ # For files > 7MB.
5309
5310       Note, these aren't strict requirements. Spreadsheet::WriteExcel will
5311       work without these modules if you don't use write_formula(),
5312       set_tempdir() or create files greater than 7MB. However, it is best to
5313       install them if possible and they will be installed automatically if
5314       you use a tool such as CPAN.pm or ppm.
5315

INSTALLATION

5317       See the INSTALL or install.html docs that come with the distribution
5318       or:
5319       <http://search.cpan.org/src/JMCNAMARA/Spreadsheet-WriteExcel-2.31/INSTALL>.
5320

PORTABILITY

5322       Spreadsheet::WriteExcel will work on the majority of Windows, UNIX and
5323       Macintosh platforms. Specifically, the module will work on any system
5324       where perl packs floats in the 64 bit IEEE format. The float must also
5325       be in little-endian format but it will be reversed if necessary. Thus:
5326
5327           print join(' ', map { sprintf '%#02x', $_ } unpack('C*', pack 'd', 1.2345)), "\n";
5328
5329       should give (or in reverse order):
5330
5331           0x8d 0x97 0x6e 0x12 0x83 0xc0 0xf3 0x3f
5332
5333       In general, if you don't know whether your system supports a 64 bit
5334       IEEE float or not, it probably does. If your system doesn't, WriteExcel
5335       will croak() with the message given in the "DIAGNOSTICS" section. You
5336       can check which platforms the module has been tested on at the CPAN
5337       testers site:
5338       <http://testers.cpan.org/search?request=dist&dist=Spreadsheet-WriteExcel>.
5339

DIAGNOSTICS

5341       Filename required by Spreadsheet::WriteExcel->new()
5342           A filename must be given in the constructor.
5343
5344       Can't open filename. It may be in use or protected.
5345           The file cannot be opened for writing. The directory that you are
5346           writing to  may be protected or the file may be in use by another
5347           program.
5348
5349       Unable to create tmp files via File::Temp::tempfile()...
5350           This is a "-w" warning. You will see it if you are using
5351           Spreadsheet::WriteExcel in an environment where temporary files
5352           cannot be created, in which case all data will be stored in memory.
5353           The warning is for information only: it does not affect creation
5354           but it will affect the speed of execution for large files. See the
5355           "set_tempdir" workbook method.
5356
5357       Maximum file size, 7087104, exceeded.
5358           The current OLE implementation only supports a maximum BIFF file of
5359           this size. This limit can be extended, see the "LIMITATIONS"
5360           section.
5361
5362       Can't locate Parse/RecDescent.pm in @INC ...
5363           Spreadsheet::WriteExcel requires the Parse::RecDescent module.
5364           Download it from CPAN:
5365           <http://search.cpan.org/search?dist=Parse-RecDescent>
5366
5367       Couldn't parse formula ...
5368           There are a large number of warnings which relate to badly formed
5369           formulas and functions. See the "FORMULAS AND FUNCTIONS IN EXCEL"
5370           section for suggestions on how to avoid these errors. You should
5371           also check the formula in Excel to ensure that it is valid.
5372
5373       Required floating point format not supported on this platform.
5374           Operating system doesn't support 64 bit IEEE float or it is byte-
5375           ordered in a way unknown to WriteExcel.
5376
5377       'file.xls' cannot be accessed. The file may be read-only ...
5378           You may sometimes encounter the following error when trying to open
5379           a file in Excel: "file.xls cannot be accessed. The file may be
5380           read-only, or you may be trying to access a read-only location. Or,
5381           the server the document is stored on may not be responding."
5382
5383           This error generally means that the Excel file has been corrupted.
5384           There are two likely causes of this: the file was FTPed in ASCII
5385           mode instead of binary mode or else the file was created with
5386           "UTF-8" data returned by an XML parser. See "Warning about
5387           XML::Parser and perl 5.6" for further details.
5388

THE EXCEL BINARY FORMAT

5390       The following is some general information about the Excel binary format
5391       for anyone who may be interested.
5392
5393       Excel data is stored in the "Binary Interchange File Format" (BIFF)
5394       file format. Details of this format are given in "Excel 97-2007 Binary
5395       File Format Specification"
5396       <http://www.microsoft.com/interop/docs/OfficeBinaryFormats.mspx>.
5397
5398       Daniel Rentz of OpenOffice.org has also written a detailed description
5399       of the Excel workbook records, see
5400       <http://sc.openoffice.org/excelfileformat.pdf>.
5401
5402       Charles Wybble has collected together additional information about the
5403       Excel file format. See "The Chicago Project" at
5404       <http://chicago.sourceforge.net/devel/>.
5405
5406       The BIFF data is stored along with other data in an OLE Compound File.
5407       This is a structured storage which acts like a file system within a
5408       file. A Compound File is comprised of storages and streams which, to
5409       follow the file system analogy, are like directories and files.
5410
5411       The OLE format is explained in the "Windows Compound Binary File Format
5412       Specification"
5413       <http://www.microsoft.com/interop/docs/supportingtechnologies.mspx>
5414
5415       The Digital Imaging Group have also detailed the OLE format in the
5416       JPEG2000 specification: see Appendix A of
5417       <http://www.i3a.org/pdf/wg1n1017.pdf>.
5418
5419       Please note that the provision of this information does not constitute
5420       an invitation to start hacking at the BIFF or OLE file formats. There
5421       are more interesting ways to waste your time. ;-)
5422

WRITING EXCEL FILES

5424       Depending on your requirements, background and general sensibilities
5425       you may prefer one of the following methods of getting data into Excel:
5426
5427       •   Win32::OLE module and office automation
5428
5429           This requires a Windows platform and an installed copy of Excel.
5430           This is the most powerful and complete method for interfacing with
5431           Excel. See
5432           <http://www.activestate.com/ASPN/Reference/Products/ActivePerl-5.6/faq/Windows/ActivePerl-Winfaq12.html>
5433           and
5434           <http://www.activestate.com/ASPN/Reference/Products/ActivePerl-5.6/site/lib/Win32/OLE.html>.
5435           If your main platform is UNIX but you have the resources to set up
5436           a separate Win32/MSOffice server, you can convert office documents
5437           to text, postscript or PDF using Win32::OLE. For a demonstration of
5438           how to do this using Perl see Docserver:
5439           <http://search.cpan.org/search?mode=module&query=docserver>.
5440
5441       •   CSV, comma separated variables or text
5442
5443           If the file extension is "csv", Excel will open and convert this
5444           format automatically. Generating a valid CSV file isn't as easy as
5445           it seems. Have a look at the DBD::RAM, DBD::CSV, Text::xSV and
5446           Text::CSV_XS modules.
5447
5448       •   DBI with DBD::ADO or DBD::ODBC
5449
5450           Excel files contain an internal index table that allows them to act
5451           like a database file. Using one of the standard Perl database
5452           modules you can connect to an Excel file as a database.
5453
5454       •   DBD::Excel
5455
5456           You can also access Spreadsheet::WriteExcel using the standard DBI
5457           interface via Takanori Kawai's DBD::Excel module
5458           <http://search.cpan.org/dist/DBD-Excel>
5459
5460       •   Spreadsheet::WriteExcelXML
5461
5462           This module allows you to create an Excel XML file using the same
5463           interface as Spreadsheet::WriteExcel. See:
5464           <http://search.cpan.org/dist/Spreadsheet-WriteExcelXML>
5465
5466       •   Excel::Template
5467
5468           This module allows you to create an Excel file from an XML template
5469           in a manner similar to HTML::Template. See
5470           <http://search.cpan.org/dist/Excel-Template/>.
5471
5472       •   Spreadsheet::WriteExcel::FromXML
5473
5474           This module allows you to turn a simple XML file into an Excel file
5475           using Spreadsheet::WriteExcel as a back-end. The format of the XML
5476           file is defined by a supplied DTD:
5477           <http://search.cpan.org/dist/Spreadsheet-WriteExcel-FromXML>.
5478
5479       •   Spreadsheet::WriteExcel::Simple
5480
5481           This provides an easier interface to Spreadsheet::WriteExcel:
5482           <http://search.cpan.org/dist/Spreadsheet-WriteExcel-Simple>.
5483
5484       •   Spreadsheet::WriteExcel::FromDB
5485
5486           This is a useful module for creating Excel files directly from a DB
5487           table: <http://search.cpan.org/dist/Spreadsheet-WriteExcel-FromDB>.
5488
5489       •   HTML tables
5490
5491           This is an easy way of adding formatting via a text based format.
5492
5493       •   XML or HTML
5494
5495           The Excel XML and HTML file specification are available from
5496           <http://msdn.microsoft.com/library/officedev/ofxml2k/ofxml2k.htm>.
5497
5498       For other Perl-Excel modules try the following search:
5499       <http://search.cpan.org/search?mode=module&query=excel>.
5500

READING EXCEL FILES

5502       To read data from Excel files try:
5503
5504       •   Spreadsheet::ParseExcel
5505
5506           This uses the OLE::Storage-Lite module to extract data from an
5507           Excel file. <http://search.cpan.org/dist/Spreadsheet-ParseExcel>.
5508
5509       •   Spreadsheet::ParseExcel_XLHTML
5510
5511           This module uses Spreadsheet::ParseExcel's interface but uses
5512           xlHtml (see below) to do the conversion:
5513           <http://search.cpan.org/dist/Spreadsheet-ParseExcel_XLHTML>
5514           Spreadsheet::ParseExcel_XLHTML
5515
5516       •   xlHtml
5517
5518           This is an open source "Excel to HTML Converter" C/C++ project at
5519           <http://chicago.sourceforge.net/xlhtml/>.
5520
5521       •   DBD::Excel (reading)
5522
5523           You can also access Spreadsheet::ParseExcel using the standard DBI
5524           interface via  Takanori Kawai's DBD::Excel module
5525           <http://search.cpan.org/dist/DBD-Excel>.
5526
5527       •   Win32::OLE module and office automation (reading)
5528
5529           See, the section "WRITING EXCEL FILES".
5530
5531       •   HTML tables (reading)
5532
5533           If the files are saved from Excel in a HTML format the data can be
5534           accessed using HTML::TableExtract
5535           <http://search.cpan.org/dist/HTML-TableExtract>.
5536
5537       •   DBI with DBD::ADO or DBD::ODBC.
5538
5539           See, the section "WRITING EXCEL FILES".
5540
5541       •   XML::Excel
5542
5543           Converts Excel files to XML using Spreadsheet::ParseExcel
5544           <http://search.cpan.org/dist/XML-Excel>.
5545
5546       •   OLE::Storage, aka LAOLA
5547
5548           This is a Perl interface to OLE file formats. In particular, the
5549           distro contains an Excel to HTML converter called Herbert,
5550           <http://user.cs.tu-berlin.de/~schwartz/pmh/>. This has been
5551           superseded by the Spreadsheet::ParseExcel module.
5552
5553       For other Perl-Excel modules try the following search:
5554       <http://search.cpan.org/search?mode=module&query=excel>.
5555
5556       If you wish to view Excel files on a UNIX/Linux platform check out the
5557       excellent Gnumeric spreadsheet application at
5558       <http://www.gnome.org/projects/gnumeric/> or OpenOffice.org at
5559       <http://www.openoffice.org/>.
5560
5561       If you wish to view Excel files on a Windows platform which doesn't
5562       have Excel installed you can use the free Microsoft Excel Viewer
5563       <http://office.microsoft.com/downloads/2000/xlviewer.aspx>.
5564

MODIFYING AND REWRITING EXCEL FILES

5566       An Excel file is a binary file within a binary file. It contains
5567       several interlinked checksums and changing even one byte can cause it
5568       to become corrupted.
5569
5570       As such you cannot simply append or update an Excel file. The only way
5571       to achieve this is to read the entire file into memory, make the
5572       required changes or additions and then write the file out again.
5573
5574       You can read and rewrite an Excel file using the
5575       Spreadsheet::ParseExcel::SaveParser module which is a wrapper around
5576       Spreadsheet::ParseExcel and Spreadsheet::WriteExcel. It is part of the
5577       Spreadsheet::ParseExcel package:
5578       <http://search.cpan.org/search?dist=Spreadsheet-ParseExcel>.
5579
5580       However, you can only rewrite the features that Spreadsheet::WriteExcel
5581       supports so macros, graphs and some other features in the original
5582       Excel file will be lost. Also, formulas aren't rewritten, only the
5583       result of a formula is written.
5584
5585       Here is an example:
5586
5587           #!/usr/bin/perl -w
5588
5589           use strict;
5590           use Spreadsheet::ParseExcel;
5591           use Spreadsheet::ParseExcel::SaveParser;
5592
5593           # Open the template with SaveParser
5594           my $parser   = new Spreadsheet::ParseExcel::SaveParser;
5595           my $template = $parser->Parse('template.xls');
5596
5597           my $sheet    = 0;
5598           my $row      = 0;
5599           my $col      = 0;
5600
5601           # Get the format from the cell
5602           my $format   = $template->{Worksheet}[$sheet]
5603                                   ->{Cells}[$row][$col]
5604                                   ->{FormatNo};
5605
5606           # Write data to some cells
5607           $template->AddCell(0, $row,   $col,   1,     $format);
5608           $template->AddCell(0, $row+1, $col, "Hello", $format);
5609
5610           # Add a new worksheet
5611           $template->AddWorksheet('New Data');
5612
5613           # The SaveParser SaveAs() method returns a reference to a
5614           # Spreadsheet::WriteExcel object. If you wish you can then
5615           # use this to access any of the methods that aren't
5616           # available from the SaveParser object. If you don't need
5617           # to do this just use SaveAs().
5618           #
5619           my $workbook;
5620
5621           {
5622               # SaveAs generates a lot of harmless warnings about unset
5623               # Worksheet properties. You can ignore them if you wish.
5624               local $^W = 0;
5625
5626               # Rewrite the file or save as a new file
5627               $workbook = $template->SaveAs('new.xls');
5628           }
5629
5630           # Use Spreadsheet::WriteExcel methods
5631           my $worksheet  = $workbook->sheets(0);
5632
5633           $worksheet->write($row+2, $col, "World2");
5634
5635           $workbook->close();
5636

Warning about XML::Parser and perl 5.6

5638       You must be careful when using Spreadsheet::WriteExcel in conjunction
5639       with perl 5.6 and XML::Parser (and other XML parsers) due to the fact
5640       that the data returned by the parser is generally in "UTF-8" format.
5641
5642       When "UTF-8" strings are added to Spreadsheet::WriteExcel's internal
5643       data it causes the generated Excel file to become corrupt.
5644
5645       Note, this doesn't affect perl 5.005 (which doesn't try to handle
5646       "UTF-8") or 5.8 (which handles it correctly).
5647
5648       To avoid this problem you should upgrade to perl 5.8, if possible, or
5649       else you should convert the output data from XML::Parser to ASCII or
5650       ISO-8859-1 using one of the following methods:
5651
5652           $new_str = pack 'C*', unpack 'U*', $utf8_str;
5653
5654
5655           use Unicode::MapUTF8 'from_utf8';
5656           $new_str = from_utf8({-str => $utf8_str, -charset => 'ISO-8859-1'});
5657

Warning about Office Service Pack 3

5659       If you have Office Service Pack 3 (SP3) installed you may see the
5660       following warning when you open a file created by
5661       Spreadsheet::WriteExcel:
5662
5663           "File Error: data may have been lost".
5664
5665       This is usually caused by multiple instances of data in a cell.
5666
5667       SP3 changed Excel's default behaviour when it encounters multiple data
5668       in a cell so that it issues a warning when the file is opened and it
5669       displays the first data that was written. Prior to SP3 it didn't issue
5670       a warning and displayed the last data written.
5671
5672       For a longer discussion and some workarounds see the following:
5673       <http://groups.google.com/group/spreadsheet-writeexcel/browse_thread/thread/3dcea40e6620af3a>.
5674

BUGS

5676       Formulas are formulae.
5677
5678       XML and "UTF-8" data on perl 5.6 can cause Excel files created by
5679       Spreadsheet::WriteExcel to become corrupt. See "Warning about
5680       XML::Parser and perl 5.6" for further details.
5681
5682       The format object that is used with a merge_range() method call is
5683       marked internally as being associated with a merged range. It is a
5684       fatal error to use a merged format in a non-merged cell. The current
5685       workaround is to use separate formats for merged and non-merged cell.
5686       This restriction will be removed in a future release.
5687
5688       Nested formulas sometimes aren't parsed correctly and give a result of
5689       "#VALUE". If you come across a formula that parses like this, let me
5690       know.
5691
5692       Spreadsheet::ParseExcel: All formulas created by
5693       Spreadsheet::WriteExcel are read as having a value of zero. This is
5694       because Spreadsheet::WriteExcel only stores the formula and not the
5695       calculated result.
5696
5697       OpenOffice.org: No known issues in this release.
5698
5699       Gnumeric: No known issues in this release.
5700
5701       If you wish to submit a bug report run the "bug_report.pl" program in
5702       the "examples" directory of the distro.
5703

Migrating to Excel::Writer::XLSX

5705       Spreadsheet::WriteExcel is in maintenance only mode and has effectively
5706       been superseded by Excel::Writer::XLSX.
5707
5708       Excel::Writer::XLSX is an API compatible, drop-in replacement for
5709       Spreadsheet::WriteExcel. It also has many more features such as
5710       conditional formats, better charts, better formula handling, Excel
5711       tables and even sparklines.
5712
5713       To convert your Spreadsheet::WriteExcel program to Excel::Writer::XLSX
5714       you only need do the following:
5715
5716       •   Substitute Excel::Writer::XLSX for Spreadsheet::WriteExcel in your
5717           program.
5718
5719       •   Change the file extension of the output file from ".xls" to
5720           ".xlsx".
5721
5722       •   Optionally replace store_formula() and repeat_formula() with
5723           write_formula() which is no longer an expensive operation in
5724           Excel::Writer::XLSX. However, you can leave them unchanged if
5725           required.
5726
5727       There are some differences between the formats and the modules that are
5728       worth noting:
5729
5730       •   The default font in the XLSX format is Calibri 11 not Arial 10.
5731
5732       •   Default column widths and row heights are different between XLS and
5733           XLSX.
5734
5735       •   The Excel::Writer::XLSX module uses more memory by default but has
5736           a optimisation mode to reduce usage for large files.
5737
5738       •   The XLSX format doesn't have reading support that is as complete as
5739           Spreadsheet::ParseExcel.
5740

REPOSITORY

5742       The Spreadsheet::WriteExcel source code in host on github:
5743       <http://github.com/jmcnamara/spreadsheet-writeexcel>.
5744

MAILING LIST

5746       There is a Google group for discussing and asking questions about
5747       Spreadsheet::WriteExcel. This is a good place to search to see if your
5748       question has been asked before:
5749       <http://groups.google.com/group/spreadsheet-writeexcel>.
5750
5751       Alternatively you can keep up to date with future releases by
5752       subscribing at: <http://freshmeat.net/projects/writeexcel/>.
5753

DONATIONS

5755       If you'd care to donate to the Spreadsheet::WriteExcel project, you can
5756       do so via PayPal: <http://tinyurl.com/7ayes>.
5757

SEE ALSO

5759       Spreadsheet::ParseExcel:
5760       <http://search.cpan.org/dist/Spreadsheet-ParseExcel>.
5761
5762       Spreadsheet-WriteExcel-FromXML:
5763       <http://search.cpan.org/dist/Spreadsheet-WriteExcel-FromXML>.
5764
5765       Spreadsheet::WriteExcel::FromDB:
5766       <http://search.cpan.org/dist/Spreadsheet-WriteExcel-FromDB>.
5767
5768       Excel::Template: <http://search.cpan.org/~rkinyon/Excel-Template/>.
5769
5770       DateTime::Format::Excel:
5771       <http://search.cpan.org/dist/DateTime-Format-Excel>.
5772
5773       "Reading and writing Excel files with Perl" by Teodor Zlatanov, at IBM
5774       developerWorks:
5775       <http://www-106.ibm.com/developerworks/library/l-pexcel/>.
5776
5777       "Excel-Dateien mit Perl erstellen - Controller im Gluck" by Peter
5778       Dintelmann and Christian Kirsch in the German Unix/web journal iX:
5779       <http://www.heise.de/ix/artikel/2001/06/175/>.
5780
5781       Spreadsheet::WriteExcel documentation in Japanese by Takanori Kawai.
5782       <http://member.nifty.ne.jp/hippo2000/perltips/Spreadsheet/WriteExcel.htm>.
5783
5784       Oesterly user brushes with fame:
5785       <http://oesterly.com/releases/12102000.html>.
5786
5787       The csv2xls program that is part of Text::CSV_XS:
5788       <http://search.cpan.org/~hmbrand/Text-CSV_XS/MANIFEST>.
5789

ACKNOWLEDGMENTS

5791       The following people contributed to the debugging and testing of
5792       Spreadsheet::WriteExcel:
5793
5794       Alexander Farber, Andre de Bruin, Arthur@ais, Artur Silveira da Cunha,
5795       Bob Rose, Borgar Olsen, Brian Foley, Brian White, Bob Mackay, Cedric
5796       Bouvier, Chad Johnson, CPAN testers, Damyan Ivanov, Daniel Berger,
5797       Daniel Gardner, Dmitry Kochurov, Eric Frazier, Ernesto Baschny, Felipe
5798       Perez Galiana, Gordon Simpson, Hanc Pavel, Harold Bamford, James
5799       Holmes, James Wilkinson, Johan Ekenberg, Johann Hanne, Jonathan Scott
5800       Duff, J.C. Wren, Kenneth Stacey, Keith Miller, Kyle Krom, Marc
5801       Rosenthal, Markus Schmitz, Michael Braig, Michael Buschauer, Mike
5802       Blazer, Michael Erickson, Michael W J West, Ning Xie, Paul J. Falbe,
5803       Paul Medynski, Peter Dintelmann, Pierre Laplante, Praveen Kotha, Reto
5804       Badertscher, Rich Sorden, Shane Ashby, Sharron McKenzie, Shenyu Zheng,
5805       Stephan Loescher, Steve Sapovits, Sven Passig, Svetoslav Marinov, Tamas
5806       Gulacsi, Troy Daniels, Vahe Sarkissian.
5807
5808       The following people contributed patches, examples or Excel
5809       information:
5810
5811       Andrew Benham, Bill Young, Cedric Bouvier, Charles Wybble, Daniel
5812       Rentz, David Robins, Franco Venturi, Guy Albertelli, Ian Penman, John
5813       Heitmann, Jon Guy, Kyle R. Burton, Pierre-Jean Vouette, Rubio, Marco
5814       Geri, Mark Fowler, Matisse Enzer, Sam Kington, Takanori Kawai, Tom
5815       O'Sullivan.
5816
5817       Many thanks to Ron McKelvey, Ronzo Consulting for Siemens, who
5818       sponsored the development of the formula caching routines.
5819
5820       Many thanks to Cassens Transport who sponsored the development of the
5821       embedded charts and autofilters.
5822
5823       Additional thanks to Takanori Kawai for translating the documentation
5824       into Japanese.
5825
5826       Gunnar Wolf maintains the Debian distro.
5827
5828       Thanks to Damian Conway for the excellent Parse::RecDescent.
5829
5830       Thanks to Tim Jenness for File::Temp.
5831
5832       Thanks to Michael Meeks and Jody Goldberg for their work on Gnumeric.
5833

DISCLAIMER OF WARRANTY

5835       Because this software is licensed free of charge, there is no warranty
5836       for the software, to the extent permitted by applicable law. Except
5837       when otherwise stated in writing the copyright holders and/or other
5838       parties provide the software "as is" without warranty of any kind,
5839       either expressed or implied, including, but not limited to, the implied
5840       warranties of merchantability and fitness for a particular purpose. The
5841       entire risk as to the quality and performance of the software is with
5842       you. Should the software prove defective, you assume the cost of all
5843       necessary servicing, repair, or correction.
5844
5845       In no event unless required by applicable law or agreed to in writing
5846       will any copyright holder, or any other party who may modify and/or
5847       redistribute the software as permitted by the above licence, be liable
5848       to you for damages, including any general, special, incidental, or
5849       consequential damages arising out of the use or inability to use the
5850       software (including but not limited to loss of data or data being
5851       rendered inaccurate or losses sustained by you or third parties or a
5852       failure of the software to operate with any other software), even if
5853       such holder or other party has been advised of the possibility of such
5854       damages.
5855

LICENSE

5857       Either the Perl Artistic Licence
5858       <http://dev.perl.org/licenses/artistic.html> or the GPL
5859       <http://www.opensource.org/licenses/gpl-license.php>.
5860

AUTHOR

5862       John McNamara jmcnamara@cpan.org
5863
5864           The ashtray says
5865           You were up all night.
5866           When you went to bed
5867           With your darkest mind.
5868           Your pillow wept
5869           And covered your eyes.
5870           And you finally slept
5871           While the sun caught fire.
5872
5873           You've changed.
5874             -- Jeff Tweedy
5875
5877       Copyright MM-MMXII, John McNamara.
5878
5879       All Rights Reserved. This module is free software. It may be used,
5880       redistributed and/or modified under the same terms as Perl itself.
5881
5882
5883
5884perl v5.36.0                      2023-01-20        Spreadsheet::WriteExcel(3)
Impressum