r1960 - in packages/libspreadsheet-writeexcel-perl/trunk: . charts debian doc examples lib/Spreadsheet lib/Spreadsheet/WriteExcel t

Gunnar Wolf gwolf at costa.debian.org
Tue Jan 17 00:31:27 UTC 2006


Author: gwolf
Date: 2006-01-17 00:30:29 +0000 (Tue, 17 Jan 2006)
New Revision: 1960

Added:
   packages/libspreadsheet-writeexcel-perl/trunk/examples/comments1.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/comments2.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/merge6.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/right_to_left.pl
   packages/libspreadsheet-writeexcel-perl/trunk/t/02_merge_formats.t
   packages/libspreadsheet-writeexcel-perl/trunk/t/21_escher.t
   packages/libspreadsheet-writeexcel-perl/trunk/t/22_mso_drawing_group.t
   packages/libspreadsheet-writeexcel-perl/trunk/t/23_note.t
   packages/libspreadsheet-writeexcel-perl/trunk/t/24_txo.t
Removed:
   packages/libspreadsheet-writeexcel-perl/trunk/t/01_merge_formats.t
Modified:
   packages/libspreadsheet-writeexcel-perl/trunk/Changes
   packages/libspreadsheet-writeexcel-perl/trunk/INSTALL
   packages/libspreadsheet-writeexcel-perl/trunk/MANIFEST
   packages/libspreadsheet-writeexcel-perl/trunk/META.yml
   packages/libspreadsheet-writeexcel-perl/trunk/Makefile.PL
   packages/libspreadsheet-writeexcel-perl/trunk/README
   packages/libspreadsheet-writeexcel-perl/trunk/charts/chartex.pl
   packages/libspreadsheet-writeexcel-perl/trunk/charts/charts.pod
   packages/libspreadsheet-writeexcel-perl/trunk/charts/demo1.pl
   packages/libspreadsheet-writeexcel-perl/trunk/charts/demo2.pl
   packages/libspreadsheet-writeexcel-perl/trunk/charts/demo3.pl
   packages/libspreadsheet-writeexcel-perl/trunk/debian/changelog
   packages/libspreadsheet-writeexcel-perl/trunk/doc/WriteExcel.html
   packages/libspreadsheet-writeexcel-perl/trunk/examples/README
   packages/libspreadsheet-writeexcel-perl/trunk/examples/bigfile.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/bug_report.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/cgi.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/chess.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/colors.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/convertA1.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/copyformat.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/csv2xls.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/date_time.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/datecalc1.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/datecalc2.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/demo.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/diag_border.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/easter_egg.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/filehandle.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/formats.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/formula_result.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/function_locale.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/headers.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/hide_sheet.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/hyperlink1.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/hyperlink2.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/images.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/indent.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/lecxe.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/merge1.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/merge2.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/merge3.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/merge4.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/merge5.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/mod_perl1.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/mod_perl2.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/outline.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/panes.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/protection.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/regions.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/repeat.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/sales.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/sendmail.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/simple.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/stats.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/stats_ext.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/stocks.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/tab2xls.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/textwrap.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode_2022_jp.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode_8859_11.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode_8859_7.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode_big5.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode_cp1251.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode_cp1256.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode_cyrillic.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode_japan.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode_koi8r.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode_list.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode_polish_utf8.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode_shift_jis.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/win32ole.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/writeA1.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/write_arrays.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/write_handler1.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/write_handler2.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/write_handler3.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/write_handler4.pl
   packages/libspreadsheet-writeexcel-perl/trunk/examples/write_to_scalar.pl
   packages/libspreadsheet-writeexcel-perl/trunk/lib/Spreadsheet/WriteExcel.pm
   packages/libspreadsheet-writeexcel-perl/trunk/lib/Spreadsheet/WriteExcel/BIFFwriter.pm
   packages/libspreadsheet-writeexcel-perl/trunk/lib/Spreadsheet/WriteExcel/Big.pm
   packages/libspreadsheet-writeexcel-perl/trunk/lib/Spreadsheet/WriteExcel/Chart.pm
   packages/libspreadsheet-writeexcel-perl/trunk/lib/Spreadsheet/WriteExcel/Format.pm
   packages/libspreadsheet-writeexcel-perl/trunk/lib/Spreadsheet/WriteExcel/Formula.pm
   packages/libspreadsheet-writeexcel-perl/trunk/lib/Spreadsheet/WriteExcel/OLEwriter.pm
   packages/libspreadsheet-writeexcel-perl/trunk/lib/Spreadsheet/WriteExcel/Utility.pm
   packages/libspreadsheet-writeexcel-perl/trunk/lib/Spreadsheet/WriteExcel/Workbook.pm
   packages/libspreadsheet-writeexcel-perl/trunk/lib/Spreadsheet/WriteExcel/WorkbookBig.pm
   packages/libspreadsheet-writeexcel-perl/trunk/lib/Spreadsheet/WriteExcel/Worksheet.pm
   packages/libspreadsheet-writeexcel-perl/trunk/t/00_IEEE_double.t
   packages/libspreadsheet-writeexcel-perl/trunk/t/01_add_worksheet.t
   packages/libspreadsheet-writeexcel-perl/trunk/t/11_date_time.t
   packages/libspreadsheet-writeexcel-perl/trunk/t/12_date_only.t
   packages/libspreadsheet-writeexcel-perl/trunk/t/13_date_seconds.t
Log:
New upstream release


Modified: packages/libspreadsheet-writeexcel-perl/trunk/Changes
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/Changes	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/Changes	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,506 +1,541 @@
-Revision history for Perl module Spreadsheet::WriteExcel.
-
-2.15 September 18 2005 - Minor
-
-	! Changed OLE container stream name from "Book" to "Workbook"
-	  for compatibility with some third party apps.
-      Thanks Wieland Pusch and Kevin McMahon.
-
-	! Fixed bug that caused all worksheets to be selected in
-	  OpenOfficeOrg causing strange linking of data between
-	  Worksheets. Thanks  M. Brodbelt. See
-	  http://rt.cpan.org/NoAuth/Bug.html?id=14094
-	  http://www.openoffice.org/issues/show_bug.cgi?id=52955
-
-	! Changed file creation from end of program to the start of
-	  program in order to avoid race conditions and extra file
-	  creation on VMS.
-
-    + Added optional user supplied results for formulas as a
-      workaround for uncalcuated values in some non-Excel apps.
-      Added formula_result.pl example of above.
-
-
-
-2.14 May 9 2005 - Minor
-
-    ! Fixed handling of Unicode font names.
-
-
-2.13 April 20 2005 - Minor
-
-    ! Made it a fatal error to use a merged format in a non-
-      merged cell (and vice-versa). This is a temporary measure
-      to prevent people from shooting themselves in the foot
-      until the Format.pm code can be refactored.
-
-    + Add 01_merge_formats.t test for above.
-
-    + Added date_time tests.
-
-
-2.12 March 22 2005 - Minor
-
-    + Added further Unicode support. The following methods now
-      handle uft8 in perl 5.8:
-      add_worksheet()
-      set_header()
-      set_footer()
-      set_font()
-      set_num_format()
-
-    + Added unicode_cyrillic.pl example.
-
-    + Added 01_add_worksheet.t test.
-
-
-2.11 September 30 2004 - Minor
-
-    - Removed undocumented date_time handling from write() to
-      avoid potential false matches.
-
-    + Added add_write_handler() method to allow users to add
-      their own data handlers to write().
-
-    + Added 4 write_handler examples.
-
-
-2.10 September 23 2004 - Major
-
-    + Added chart support via external templates.
-      Added Chart.pm and add_chart_ext() method to Workbook object.
-      Added /charts directory with examples and documentation
-
-    + Added write_date_time() worksheet method for writing dates
-      and times in Excel date format.
-      Added date_time.pl example.
-
-    + Added automatic Unicode handling via utf8 in perl 5.8 and
-      later. Thanks Mark Fowler.
-      Added several unicode_*.pl examples in different encodings.
-      Thanks to Sean Burke for the sample encodings.
-
-    + Added write_to_scalar.pl example in order to answer frequently
-      asked question about writing an Excel file to a scalar.
-
-
-2.04 August 18 2004 - Minor
-
-    ! Fixed handling of Euro symbol in num_format() strings.
-
-    ! Renamed the Excel 5 style merge() format to the more correct
-      center_across(). Updated examples accordingly.
-
-    ! Added bug warning about using merge formats outside of
-      merged ranges.
-
-    + Fixed handling of doubled double quotes in formula strings.
-      Thanks to a tip from merlyn.
-
-    + The 2.xx versions are now compatible with MS Access. Removed
-      statements to the contrary.
-
-
-2.03 July 4 2004 - Minor
-
-    ! Fixed bug that prevented column outlines from displaying.
-      Thanks to Marc Rosenthal.
-
-    ! Enhanced add_worksheet() name checking to exclude case-
-      insensitive duplicate names.
-      Thanks to James Wilkinson.
-
-    ! Internal fix to number of rows in several (unseen) places.
-
-    + Added mod_perl 2 example program from Matisse Enzer. Thanks.
-
-
-2.02 May 28 2004 - Minor
-
-    + Fixed internal version numbers to keep CPAN.pm happy.
-      Thanks to David Dyck.
-
-    + Minor changes to demo.pl merge5.pl and the html docs.
-
-
-2.01 May 27 2004 - Major
-
-    This version is a MAJOR revision to Spreadsheet::WriteExcel. The
-    format of the Excel file that it produces has been updated from
-    Excel 5 to Excel 97. This allows support for long, 32k character
-    strings and Unicode.
-
-    DUE TO THE MAJOR INTERNAL CHANGES IT IS RECOMMENDED THAT YOU TEST
-    THIS UPGRADE FULLY BEFORE DEPLOYING IT.
-
-    Also note that this version can be 1.5 to 2 times slower than
-    previous versions and the write_comment() method has been
-    temporarily removed. These issues will be fixed in later releases.
-
-
-    + Changed the default Excel format to Excel 97.
-
-    + Added support for strings up to 32767 character.
-
-    + Added support for Unicode strings.
-
-    + Improved speed in relation to pre-release versions.
-      However, it is still slower than the 1.xx versions.
-
-    + Improved OpenOffice.org support.
-
-    + Added more examples: diag_border.pl, indent.pl,
-      unicode.pl, unicode_japan.pl, unicode_list.pl
-
-    + Changed the distro dir structure.
-
-    - Temporarily removed write_comment() support since the Excel 5
-      version isn't compatible with Excel 97+.
-
-
-1.01 May 24 2004 - Minor
-
-    ! Small non-bug fix to write_comment().
-
-
-0.43 April 28 2004 - Minor
-
-    ! Fixed longstanding bug where page setup features didn't
-      show up in OpenOffice.org.
-
-    ! Fixed localised @_ bug when using threaded perls.
-      Thanks Tamas Gulacsi and Stephan Loescher.
-
-
-0.42 August 26 2003 - Minor
-
-    ! Fixed bug when using IO::Sclalar object as a filehandle.
-      Thanks to Kyle R. Burton and David Robins.
-
-    ! Fixed minor formula parser bug.
-      Thanks Michael Braig
-
-    ! Fixed handling of column sizing for widths less than 1
-      unit (again). Thanks to Rubio (again).
-
-    ! Failed new() returns undef instead of croak()ing as per docs.
-
-
-0.41 April 24 2003 - Minor
-
-    + Added facility for adding outlines to worksheets. Added
-      outline.pl example. Thanks to Franco Venturi.
-
-    + Moved write_comment() code into the core modules. It is now
-      possible to write cell comments.
-
-    + Added option to return a slice from the sheets() method.
-
-    + Added link to latest Excel97 pre-release.
-      http://freshmeat.net/projects/writeexcel/#comment-24916
-
-    ! Changed, once more, the handling of temp files to avoid several
-      file closing bugs. Thanks to many.
-
-    ! Fixed handling of column sizing for widths less than 1 unit.
-      Thanks Rubio.
-
-    ! Renamed addworksheet() and addformat() to add_worksheet()
-      and add_format() for consistency with other method names.
-      Older names are supported but deprecated.
-
-
-0.40 December 21 2002 - Minor
-
-    ! Fixed internal sheet indexing in formulas on some platforms.
-      This caused multi-sheet workbooks with formulas to crash.
-      Thanks Troy Daniels.
-
-    ! Fixed non-lexical filehandles to prevent problems in
-      multi-threaded environments.
-      Thanks Ning Xie.
-
-
-0.39 September 23 2002 - Minor
-
-    + Added the set_codepage() workbook method. This is mainly to
-      prevent a bug that caused Gnumeric to crash but it is also
-      useful for people working with non ascii chars on the Macintosh.
-      Thanks Jody Goldberg.
-
-    ! Fixed the non-deletion of temporary files. Users of version
-      0.38 should probably clean up their tmp dirs manually.
-      Thanks Pierre Laplante.
-
-    ! Changed default handling of set_fg_color and set_bg_color from
-      what Excel expected to what everyone else expected. Setting the
-      fill colour of a cell should now be more intuitive.
-
-    + Replaced the merge_cells() method with the merge_range() method.
-      This is mainly to prevent the Excel 97 crashing bug that occurs
-      when merge_cells() is used correctly. It also provide a simpler
-      interface to the merge feature. Updated merge example programs.
-
-    ! Refactored the error raising mechanism for formulas. The source
-      of errors should now be clearer.
-
-    ! Minor internal fixes to Format.pm.
-
-
-0.38 August 29 2002 - Minor
-
-    + Added formula caching to speed up the writing of formulas.
-      Thanks to Ron McKelvey.
-
-    + Added handling of A:A column notation in formulas and
-      applicable worksheet methods.
-
-    + Changed handling of numbers with leading zeroes so that they
-      can be treated as strings and the zeroes maintained.
-
-    + Modified $workbook->close() to return the value of the system
-      file close.
-
-    + Made file size exceeded a die() error instead of a warning.
-
-    + Added option to hide row with the set_row() method
-
-    + Added more examples: merge4.pl, merge5.pl, sendmail.pl and
-      repeat.pl
-
-    ! Fixed write_url() when handling relative links in the current
-      directory. Thanks Bob Mackay Andre de Bruin
-
-    ! Fixed handling of multiple AND()'s and OR()'s in formulas.
-
-    ! Fixed bug when creating a very large number of files within a
-      single program on Windows.
-
-    ! Added warning about Excel97 crashing bug with merge_cells().
-
-    ! Fixed handling of parentheses in Worksheet names.
-      Thanks Jann Linder.
-
-    ! Fixed minor bugs in Format.pm. Thanks Johann Hanne.
-
-    ! Fixed File::Temp dependency in Makefile. Thanks to many.
-
-
-0.37 April 29 2002 - Minor
-
-    + Added set_tempdir() method to allow a user defined temp
-      directory. This is mainly of use to IIS users.
-
-    + Fixed default format behaviour for formats set via the set_row()
-      and set_column() methods.
-
-    + Extended the hide_gridlines() method to allow hiding of screen
-      gridlines as well as print gridlines.
-
-    + Added long_string.pl a workaround example for the 255 char
-      limit.
-
-    + Added https match to url regex. Thanks The Tilghman.
-
-
-0.36 April 9 2002 - Minor
-
-    + Added user definable colour palette. Thanks Bill Young.
-
-    + Added headers.pl and colors.pl examples.
-
-
-0.35 March 18 2002 - Minor
-
-    + Added internal and external hyperlinks. Thanks Ian Penman.
-
-    + Added worksheet set_zoom() and set_print_scale().
-
-    ! Changed default value of fit_to_pages() to allow printed output
-      to be one page wide and as long as required.
-      Thanks Michael Erickson.
-
-    ! Changed handling of undefs in write() method. Thanks Hanc Pavel.
-
-    ! Changed new() to return undef for file creation errors
-      Thanks Felipe Pérez Galiana.
-
-    ! Added check for header/footer length. Thanks Peter Dintelmann.
-
-    ! Added check for duplicate worksheet names. Thanks Keith Miller.
-
-    - Removed spurious return() to fix bug in set_repeat_rows().
-      Thanks Brian White.
-
-    ! Added "use integer" when using shift << to avoid bug with
-      Perl 5.6.0 on HP-UX. Thanks Markus Schmitz, VSarkiss.
-
-    ! Fixed minor bug in Formula.pm. Thanks Sven Passig.
-
-
-0.34 October 23 2001 - Major
-
-    + Added Spreadsheet::WriteExcel::Utility module with helper
-      functions for row/col and dates.
-
-    + Added write_row and write_col methods after many requests.
-
-    + Added ability to insert bitmap images.
-
-    + Added cell protection and formula hiding.
-
-    + Added more examples.
-
-
-0.33 July 30 2001 - Minor
-
-    + Added (hopefully) easier mechanism to add format properties.
-
-    + Added more page setup options: repeat rows and columns, hide
-      gridlines, print area, fit to pages and page breaks.
-
-    ! Added fix to protect print() from -l on the command line.
-      Thanks Cedric Bouvier and Kyle Krom.
-
-    + Added more examples.
-
-
-0.32 May 17 2001 - Minor
-
-    + Added panes option.
-
-    + Added page setup options: paper type, orientation, headers
-      footers, centering.
-
-    + Added panes example.
-
-
-0.31 April 12 2001 - Major
-
-    ! Fixed several minor and major bugs in Formula.pm.
-      Thanks Shane Ashby and Borgar Olsen and Christian Kirsch.
-
-    + Added external worksheet references to formulas.
-
-    + Added A1 notation.
-
-    + Added facility to new() to accept valid filehandles.
-      Thanks Peter Dintelmann.
-
-    + Added more examples. Thanks Tom O'Sullivan.
-
-    ! Updated bigfile.pl example. Thanks to Takanori Kawai.
-
-
-0.30 Feb 26 2001 - Major
-
-    + Added formulas.
-
-    ! Fixed docs for write_url(). Thanks James Holmes.
-
-    ! Fixed bug when using a numeric format string of zeros.
-      Thanks Kenneth Stacey.
-
-
-0.26 Feb 1 2001 - Minor
-
-    ! Fixed bug when using a border with the default colour. This
-      caused the cell format to become unchangeable from within Excel.
-      Thanks Shenyu Zheng.
-
-    ! Changed worksheet code to automatically fall back to storing
-      data in memory if opening a tmp file fails.
-
-
-0.25 Jan 19 2001 - Minor
-
-    ! Changed distro file format back to Unix line endings. The
-      accidental DOS format was causing install problems.
-
-
-0.24 Jan 14 2001 - Minor
-
-    + Added write_url method.
-
-    + Added set_merge() alias for set_align('merge') method.
-
-    + Added warnings about deprecated code when running under -w flag.
-
-    ! Documentation changes.
-
-
-0.23 Dec 10 2000 - Minor
-
-    + Added customisable numeric formats.
-
-    + Added set_row() method.
-
-    + Added set_1904() method.
-
-    + Added extra examples including contributions. Thanks to all.
-
-    + Moved secondary modules to WriteExcel namespace to clean-up
-      Spreadsheet namespace which is now shared with ParseExcel.
-
-    ! Fixed class data bug. Thanks Cedric Bouvier.
-
-    ! Fixed Excel crashing!! bug in STYLE. Thanks Rich Sorden.
-
-    ! Tidied up internal storage of FONTs and XFs.
-
-    + Renamed set_col_width() method to set_column().
-
-    + Renamed set_format() method to set_num_format().
-
-
-0.22 Oct 22 2000 - Major
-
-    + Added Format.pm and the facility for cell formatting.
-
-
-0.21 Oct 1 2000 - Minor
-
-    + Replaced direct access to worksheets array with a workbook
-      method; worksheets().
-
-    + Added set_selection() and set_col_width() worksheet methods.
-
-    ! Replaced the missing thats, including the that that were
-      in the icebox.
-
-    + Added MS Access bug warning; thanks Harold Bamford.
-
-
-0.20 Aug 27 2000 - Major
-
-    + Added multiple worksheets and OLE wrapper. Now compatible with
-      Star Office, Gnumeric and XESS.
-
-
-0.11 Aug 25 2000 - Minor
-
-    ! Changes to documentation. Explanation of how to use WriteExcel
-      in CGI's. Thanks Daniel Gardner.
-
-
-0.10 May 13 2000 - Minor
-
-    ! Bug in close() and DESTROY sequence fixed. Thanks John Wren.
-
-    ! Biff version number fixed. Thanks Aurthur at ais, and then unfixed.
-
-    ! Shakey test and distro fixed. Thanks to many.
-
-
-0.09 Feb 1 2000 - Minor
-
-    ! Code for writing DIMENSIONS updated to account for bug when
-      reading files with QuickView.
-
-    + Renamed xl_write methods to write.
-
-
-0.08 Jan 16 2000
-
-    First CPAN release. Spreadsheet::WriteExcel - Write text and
-    numbers to minimal Excel binary file.
+Revision history for Perl module Spreadsheet::WriteExcel.
+
+2.16 January 6 2005 - Major
+
+    + Rewrote and reinstated the write_comment() method to take
+      account of the changes in the Excel 97+ comment format.
+      Currently conflicts with insert_bitmap(), see docs.
+
+    + Added standard styles such as comma, percent and currency.
+
+    ! Changed write_url() methods to allow numbers or formulas
+      as well as strings as the optional text.
+      Requested by many.
+
+    + Documented use of encoding flag in add_worksheet() to allow
+      handling of UTF-16 sheet names.
+
+    + Added encoding flag to merge_range() method to allow
+      handling of UTF-16 strings. Requested by many.
+      Added merge6.pl example program.
+
+    + Added hide_zero() worksheet method to allow hiding of zero
+      values in cells.
+
+    + Added print_across() worksheet method to allow changing of
+      the default print direction.
+
+    + Added right_to_left() worksheet method to allow changing of
+      the default worksheet direction in eastern versions of Excel.
+
+    + Documented the Worksheet hide() method.
+
+    + Added comments1.pl and comments2.pl example programs.
+
+    + Added tests for the internal methods used by write_comment().
+
+
+
+2.15 September 18 2005 - Minor
+
+    ! Changed OLE container stream name from "Book" to "Workbook"
+      for compatibility with some third party apps.
+      Thanks Wieland Pusch and Kevin McMahon.
+
+    ! Fixed bug that caused all worksheets to be selected in
+      OpenOfficeOrg causing strange linking of data between
+      Worksheets. Thanks  M. Brodbelt. See
+      http://rt.cpan.org/NoAuth/Bug.html?id=14094
+      http://www.openoffice.org/issues/show_bug.cgi?id=52955
+
+    ! Changed file creation from end of program to the start of
+      program in order to avoid race conditions and extra file
+      creation on VMS.
+
+    + Added optional user supplied results for formulas as a
+      workaround for uncalcuated values in some non-Excel apps.
+      Added formula_result.pl example of above.
+
+
+2.14 May 9 2005 - Minor
+
+    ! Fixed handling of Unicode font names.
+
+
+2.13 April 20 2005 - Minor
+
+    ! Made it a fatal error to use a merged format in a non-
+      merged cell (and vice-versa). This is a temporary measure
+      to prevent people from shooting themselves in the foot
+      until the Format.pm code can be refactored.
+
+    + Add 01_merge_formats.t test for above.
+
+    + Added date_time tests.
+
+
+2.12 March 22 2005 - Minor
+
+    + Added further Unicode support. The following methods now
+      handle uft8 in perl 5.8:
+      add_worksheet()
+      set_header()
+      set_footer()
+      set_font()
+      set_num_format()
+
+    + Added unicode_cyrillic.pl example.
+
+    + Added 01_add_worksheet.t test.
+
+
+2.11 September 30 2004 - Minor
+
+    - Removed undocumented date_time handling from write() to
+      avoid potential false matches.
+
+    + Added add_write_handler() method to allow users to add
+      their own data handlers to write().
+
+    + Added 4 write_handler examples.
+
+
+2.10 September 23 2004 - Major
+
+    + Added chart support via external templates.
+      Added Chart.pm and add_chart_ext() method to Workbook object.
+      Added /charts directory with examples and documentation
+
+    + Added write_date_time() worksheet method for writing dates
+      and times in Excel date format.
+      Added date_time.pl example.
+
+    + Added automatic Unicode handling via utf8 in perl 5.8 and
+      later. Thanks Mark Fowler.
+      Added several unicode_*.pl examples in different encodings.
+      Thanks to Sean Burke for the sample encodings.
+
+    + Added write_to_scalar.pl example in order to answer frequently
+      asked question about writing an Excel file to a scalar.
+
+
+2.04 August 18 2004 - Minor
+
+    ! Fixed handling of Euro symbol in num_format() strings.
+
+    ! Renamed the Excel 5 style merge() format to the more correct
+      center_across(). Updated examples accordingly.
+
+    ! Added bug warning about using merge formats outside of
+      merged ranges.
+
+    + Fixed handling of doubled double quotes in formula strings.
+      Thanks to a tip from merlyn.
+
+    + The 2.xx versions are now compatible with MS Access. Removed
+      statements to the contrary.
+
+
+2.03 July 4 2004 - Minor
+
+    ! Fixed bug that prevented column outlines from displaying.
+      Thanks to Marc Rosenthal.
+
+    ! Enhanced add_worksheet() name checking to exclude case-
+      insensitive duplicate names.
+      Thanks to James Wilkinson.
+
+    ! Internal fix to number of rows in several (unseen) places.
+
+    + Added mod_perl 2 example program from Matisse Enzer. Thanks.
+
+
+2.02 May 28 2004 - Minor
+
+    + Fixed internal version numbers to keep CPAN.pm happy.
+      Thanks to David Dyck.
+
+    + Minor changes to demo.pl merge5.pl and the html docs.
+
+
+2.01 May 27 2004 - Major
+
+    This version is a MAJOR revision to Spreadsheet::WriteExcel. The
+    format of the Excel file that it produces has been updated from
+    Excel 5 to Excel 97. This allows support for long, 32k character
+    strings and Unicode.
+
+    DUE TO THE MAJOR INTERNAL CHANGES IT IS RECOMMENDED THAT YOU TEST
+    THIS UPGRADE FULLY BEFORE DEPLOYING IT.
+
+    Also note that this version can be 1.5 to 2 times slower than
+    previous versions and the write_comment() method has been
+    temporarily removed. These issues will be fixed in later releases.
+
+
+    + Changed the default Excel format to Excel 97.
+
+    + Added support for strings up to 32767 character.
+
+    + Added support for Unicode strings.
+
+    + Improved speed in relation to pre-release versions.
+      However, it is still slower than the 1.xx versions.
+
+    + Improved OpenOffice.org support.
+
+    + Added more examples: diag_border.pl, indent.pl,
+      unicode.pl, unicode_japan.pl, unicode_list.pl
+
+    + Changed the distro dir structure.
+
+    - Temporarily removed write_comment() support since the Excel 5
+      version isn't compatible with Excel 97+.
+
+
+1.01 May 24 2004 - Minor
+
+    ! Small non-bug fix to write_comment().
+
+
+0.43 April 28 2004 - Minor
+
+    ! Fixed longstanding bug where page setup features didn't
+      show up in OpenOffice.org.
+
+    ! Fixed localised @_ bug when using threaded perls.
+      Thanks Tamas Gulacsi and Stephan Loescher.
+
+
+0.42 August 26 2003 - Minor
+
+    ! Fixed bug when using IO::Sclalar object as a filehandle.
+      Thanks to Kyle R. Burton and David Robins.
+
+    ! Fixed minor formula parser bug.
+      Thanks Michael Braig
+
+    ! Fixed handling of column sizing for widths less than 1
+      unit (again). Thanks to Rubio (again).
+
+    ! Failed new() returns undef instead of croak()ing as per docs.
+
+
+0.41 April 24 2003 - Minor
+
+    + Added facility for adding outlines to worksheets. Added
+      outline.pl example. Thanks to Franco Venturi.
+
+    + Moved write_comment() code into the core modules. It is now
+      possible to write cell comments.
+
+    + Added option to return a slice from the sheets() method.
+
+    + Added link to latest Excel97 pre-release.
+      http://freshmeat.net/projects/writeexcel/#comment-24916
+
+    ! Changed, once more, the handling of temp files to avoid several
+      file closing bugs. Thanks to many.
+
+    ! Fixed handling of column sizing for widths less than 1 unit.
+      Thanks Rubio.
+
+    ! Renamed addworksheet() and addformat() to add_worksheet()
+      and add_format() for consistency with other method names.
+      Older names are supported but deprecated.
+
+
+0.40 December 21 2002 - Minor
+
+    ! Fixed internal sheet indexing in formulas on some platforms.
+      This caused multi-sheet workbooks with formulas to crash.
+      Thanks Troy Daniels.
+
+    ! Fixed non-lexical filehandles to prevent problems in
+      multi-threaded environments.
+      Thanks Ning Xie.
+
+
+0.39 September 23 2002 - Minor
+
+    + Added the set_codepage() workbook method. This is mainly to
+      prevent a bug that caused Gnumeric to crash but it is also
+      useful for people working with non ascii chars on the Macintosh.
+      Thanks Jody Goldberg.
+
+    ! Fixed the non-deletion of temporary files. Users of version
+      0.38 should probably clean up their tmp dirs manually.
+      Thanks Pierre Laplante.
+
+    ! Changed default handling of set_fg_color and set_bg_color from
+      what Excel expected to what everyone else expected. Setting the
+      fill colour of a cell should now be more intuitive.
+
+    + Replaced the merge_cells() method with the merge_range() method.
+      This is mainly to prevent the Excel 97 crashing bug that occurs
+      when merge_cells() is used correctly. It also provide a simpler
+      interface to the merge feature. Updated merge example programs.
+
+    ! Refactored the error raising mechanism for formulas. The source
+      of errors should now be clearer.
+
+    ! Minor internal fixes to Format.pm.
+
+
+0.38 August 29 2002 - Minor
+
+    + Added formula caching to speed up the writing of formulas.
+      Thanks to Ron McKelvey.
+
+    + Added handling of A:A column notation in formulas and
+      applicable worksheet methods.
+
+    + Changed handling of numbers with leading zeroes so that they
+      can be treated as strings and the zeroes maintained.
+
+    + Modified $workbook->close() to return the value of the system
+      file close.
+
+    + Made file size exceeded a die() error instead of a warning.
+
+    + Added option to hide row with the set_row() method
+
+    + Added more examples: merge4.pl, merge5.pl, sendmail.pl and
+      repeat.pl
+
+    ! Fixed write_url() when handling relative links in the current
+      directory. Thanks Bob Mackay Andre de Bruin
+
+    ! Fixed handling of multiple AND()'s and OR()'s in formulas.
+
+    ! Fixed bug when creating a very large number of files within a
+      single program on Windows.
+
+    ! Added warning about Excel97 crashing bug with merge_cells().
+
+    ! Fixed handling of parentheses in Worksheet names.
+      Thanks Jann Linder.
+
+    ! Fixed minor bugs in Format.pm. Thanks Johann Hanne.
+
+    ! Fixed File::Temp dependency in Makefile. Thanks to many.
+
+
+0.37 April 29 2002 - Minor
+
+    + Added set_tempdir() method to allow a user defined temp
+      directory. This is mainly of use to IIS users.
+
+    + Fixed default format behaviour for formats set via the set_row()
+      and set_column() methods.
+
+    + Extended the hide_gridlines() method to allow hiding of screen
+      gridlines as well as print gridlines.
+
+    + Added long_string.pl a workaround example for the 255 char
+      limit.
+
+    + Added https match to url regex. Thanks The Tilghman.
+
+
+0.36 April 9 2002 - Minor
+
+    + Added user definable colour palette. Thanks Bill Young.
+
+    + Added headers.pl and colors.pl examples.
+
+
+0.35 March 18 2002 - Minor
+
+    + Added internal and external hyperlinks. Thanks Ian Penman.
+
+    + Added worksheet set_zoom() and set_print_scale().
+
+    ! Changed default value of fit_to_pages() to allow printed output
+      to be one page wide and as long as required.
+      Thanks Michael Erickson.
+
+    ! Changed handling of undefs in write() method. Thanks Hanc Pavel.
+
+    ! Changed new() to return undef for file creation errors
+      Thanks Felipe Pérez Galiana.
+
+    ! Added check for header/footer length. Thanks Peter Dintelmann.
+
+    ! Added check for duplicate worksheet names. Thanks Keith Miller.
+
+    - Removed spurious return() to fix bug in set_repeat_rows().
+      Thanks Brian White.
+
+    ! Added "use integer" when using shift << to avoid bug with
+      Perl 5.6.0 on HP-UX. Thanks Markus Schmitz, VSarkiss.
+
+    ! Fixed minor bug in Formula.pm. Thanks Sven Passig.
+
+
+0.34 October 23 2001 - Major
+
+    + Added Spreadsheet::WriteExcel::Utility module with helper
+      functions for row/col and dates.
+
+    + Added write_row and write_col methods after many requests.
+
+    + Added ability to insert bitmap images.
+
+    + Added cell protection and formula hiding.
+
+    + Added more examples.
+
+
+0.33 July 30 2001 - Minor
+
+    + Added (hopefully) easier mechanism to add format properties.
+
+    + Added more page setup options: repeat rows and columns, hide
+      gridlines, print area, fit to pages and page breaks.
+
+    ! Added fix to protect print() from -l on the command line.
+      Thanks Cedric Bouvier and Kyle Krom.
+
+    + Added more examples.
+
+
+0.32 May 17 2001 - Minor
+
+    + Added panes option.
+
+    + Added page setup options: paper type, orientation, headers
+      footers, centering.
+
+    + Added panes example.
+
+
+0.31 April 12 2001 - Major
+
+    ! Fixed several minor and major bugs in Formula.pm.
+      Thanks Shane Ashby and Borgar Olsen and Christian Kirsch.
+
+    + Added external worksheet references to formulas.
+
+    + Added A1 notation.
+
+    + Added facility to new() to accept valid filehandles.
+      Thanks Peter Dintelmann.
+
+    + Added more examples. Thanks Tom O'Sullivan.
+
+    ! Updated bigfile.pl example. Thanks to Takanori Kawai.
+
+
+0.30 Feb 26 2001 - Major
+
+    + Added formulas.
+
+    ! Fixed docs for write_url(). Thanks James Holmes.
+
+    ! Fixed bug when using a numeric format string of zeros.
+      Thanks Kenneth Stacey.
+
+
+0.26 Feb 1 2001 - Minor
+
+    ! Fixed bug when using a border with the default colour. This
+      caused the cell format to become unchangeable from within Excel.
+      Thanks Shenyu Zheng.
+
+    ! Changed worksheet code to automatically fall back to storing
+      data in memory if opening a tmp file fails.
+
+
+0.25 Jan 19 2001 - Minor
+
+    ! Changed distro file format back to Unix line endings. The
+      accidental DOS format was causing install problems.
+
+
+0.24 Jan 14 2001 - Minor
+
+    + Added write_url method.
+
+    + Added set_merge() alias for set_align('merge') method.
+
+    + Added warnings about deprecated code when running under -w flag.
+
+    ! Documentation changes.
+
+
+0.23 Dec 10 2000 - Minor
+
+    + Added customisable numeric formats.
+
+    + Added set_row() method.
+
+    + Added set_1904() method.
+
+    + Added extra examples including contributions. Thanks to all.
+
+    + Moved secondary modules to WriteExcel namespace to clean-up
+      Spreadsheet namespace which is now shared with ParseExcel.
+
+    ! Fixed class data bug. Thanks Cedric Bouvier.
+
+    ! Fixed Excel crashing!! bug in STYLE. Thanks Rich Sorden.
+
+    ! Tidied up internal storage of FONTs and XFs.
+
+    + Renamed set_col_width() method to set_column().
+
+    + Renamed set_format() method to set_num_format().
+
+
+0.22 Oct 22 2000 - Major
+
+    + Added Format.pm and the facility for cell formatting.
+
+
+0.21 Oct 1 2000 - Minor
+
+    + Replaced direct access to worksheets array with a workbook
+      method; worksheets().
+
+    + Added set_selection() and set_col_width() worksheet methods.
+
+    ! Replaced the missing thats, including the that that were
+      in the icebox.
+
+    + Added MS Access bug warning; thanks Harold Bamford.
+
+
+0.20 Aug 27 2000 - Major
+
+    + Added multiple worksheets and OLE wrapper. Now compatible with
+      Star Office, Gnumeric and XESS.
+
+
+0.11 Aug 25 2000 - Minor
+
+    ! Changes to documentation. Explanation of how to use WriteExcel
+      in CGI's. Thanks Daniel Gardner.
+
+
+0.10 May 13 2000 - Minor
+
+    ! Bug in close() and DESTROY sequence fixed. Thanks John Wren.
+
+    ! Biff version number fixed. Thanks Aurthur at ais, and then unfixed.
+
+    ! Shakey test and distro fixed. Thanks to many.
+
+
+0.09 Feb 1 2000 - Minor
+
+    ! Code for writing DIMENSIONS updated to account for bug when
+      reading files with QuickView.
+
+    + Renamed xl_write methods to write.
+
+
+0.08 Jan 16 2000
+
+    First CPAN release. Spreadsheet::WriteExcel - Write text and
+    numbers to minimal Excel binary file.

Modified: packages/libspreadsheet-writeexcel-perl/trunk/INSTALL
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/INSTALL	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/INSTALL	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,124 +1,124 @@
-======================================================================
-NAME
-
-    Spreadsheet::WriteExcel - Write formatted text and numbers to a 
-    cross-platform Excel binary file.
-
-======================================================================
-REQUIREMENTS
-
-    This module requires Perl 5.005 (or later)
-    Parse::RecDescent
-        http://search.cpan.org/search?dist=Parse-RecDescent
-    File::Temp
-        http://search.cpan.org/search?dist=File-Temp
-
-
-======================================================================
-INSTALLATION
-
-    Method 1, standard install with make
-    ====================================
-    Download the zipped tar file from one of the following:
-        http://search.cpan.org/search?dist=Spreadsheet-WriteExcel
-        http://theoryx5.uwinnipeg.ca/mod_perl/cpan-search?idinfo=154
-        ftp://ftp.funet.fi/pub/languages/perl/CPAN/authors/id/J/JM/JMCNAMARA/
-        
-    Unzip the module as follows or use winzip:
-
-           tar -zxvf Spreadsheet-WriteExcel-0.xx.tar.gz
-
-    The module can be installed using the standard Perl procedure:
-
-        perl Makefile.PL
-        make
-        make test
-        make install    # You may need to be root
-        make clean      # or make realclean
-
-    Windows users without a working "make" can get nmake from:
-    
-        ftp://ftp.microsoft.com/Softlib/MSLFILES/nmake15.exe
-
-
-    Method 2, CPAN.pm install
-    =========================
-    If you have CPAN.pm configured you can install the module as
-    follows:
-
-        perl -MCPAN -e "install 'Spreadsheet::WriteExcel'"
-
-
-    Method 3, ActivePerl ppm
-    ========================
-    ActivePerl users can use PPM as follows:
-
-        C:\> ppm
-        PPM> set repository tmp http://homepage.eircom.net/~jmcnamara/perl
-        PPM> install Spreadsheet-WriteExcel
-        PPM> quit
-        C:\>
-
-        If this fails try the following:
-
-        PPM>install http://homepage.eircom.net/~jmcnamara/perl/Spreadsheet-WriteExcel.ppd
-
-    If both of these fail you should ensure that ppm is working
-    correctly. Try to install the File::Slurp module as a test:
-
-        C:\> ppm
-        PPM> install File-Test
-        PPM> quit
-        C:\>
-
-    A failure here will indicate that your ppm isn't configured
-    correctly or, more likely, that you are behind a firewall. Have a
-    look at the "Using PPM" documentation that comes with
-    ActivePerl to see how to resolve these issues.
-
-    Method 4, ActivePerl local ppm
-    ==============================
-    If the previous ppm methods fail you can try a local ppm install
-    as follows. Download the following two files (xx is the most
-    recent version number):
-
-        http://homepage.eircom.net/~jmcnamara/perl/Spreadsheet-WriteExcel.ppd
-        http://homepage.eircom.net/~jmcnamara/perl/Spreadsheet-WriteExcel-0.xx-PPM.tar.gz
-
-    Copy them to a temp directory. There is no need to un-tar or unzip
-    the PPM file.
-
-    In the DOS shell change to the temp directory and run ppm:
-
-         C:\> cd c:\temp
-         C:\Temp> ppm
-
-         PPM> install Spreadsheet-WriteExcel.ppd
-         Install package 'Spreadsheet-WriteExcel.ppd?' (y/N): y
-         Retrieving package 'Spreadsheet-WriteExcel.ppd'...
-         Writing C:\perl\site\lib\auto\Spreadsheet\WriteExcel\.packlist
-         PPM> quit
-         Quit!
-
-    The module should now be installed. Note, you will also have to
-    install Parse::RecDescent and possibly File::Temp if it isn't
-    already installed .
-
-
-======================================================================
-UPDATES
-
-    You can keep up to date with future release by registering as a
-    user with Freshmeat http://freshmeat.net/ and subscribing to
-    Spreadsheet::WriteExcel at the project page:
-    http://freshmeat.net/projects/writeexcel/
-
-    You will then receive mailed updates when a new version is
-    released.
-    
-    Alternatively you can keep an eye on news://comp.lang.perl.announce
-
-======================================================================
-AUTHOR
-
-    John McNamara (jmcnamara at cpan.org)
+======================================================================
+NAME
+
+    Spreadsheet::WriteExcel - Write formatted text and numbers to a 
+    cross-platform Excel binary file.
+
+======================================================================
+REQUIREMENTS
+
+    This module requires Perl 5.005 (or later)
+    Parse::RecDescent
+        http://search.cpan.org/search?dist=Parse-RecDescent
+    File::Temp
+        http://search.cpan.org/search?dist=File-Temp
+
+
+======================================================================
+INSTALLATION
+
+    Method 1, standard install with make
+    ====================================
+    Download the zipped tar file from one of the following:
+        http://search.cpan.org/search?dist=Spreadsheet-WriteExcel
+        http://theoryx5.uwinnipeg.ca/mod_perl/cpan-search?idinfo=154
+        ftp://ftp.funet.fi/pub/languages/perl/CPAN/authors/id/J/JM/JMCNAMARA/
+        
+    Unzip the module as follows or use winzip:
+
+           tar -zxvf Spreadsheet-WriteExcel-0.xx.tar.gz
+
+    The module can be installed using the standard Perl procedure:
+
+        perl Makefile.PL
+        make
+        make test
+        make install    # You may need to be root
+        make clean      # or make realclean
+
+    Windows users without a working "make" can get nmake from:
+    
+        ftp://ftp.microsoft.com/Softlib/MSLFILES/nmake15.exe
+
+
+    Method 2, CPAN.pm install
+    =========================
+    If you have CPAN.pm configured you can install the module as
+    follows:
+
+        perl -MCPAN -e "install 'Spreadsheet::WriteExcel'"
+
+
+    Method 3, ActivePerl ppm
+    ========================
+    ActivePerl users can use PPM as follows:
+
+        C:\> ppm
+        PPM> set repository tmp http://homepage.eircom.net/~jmcnamara/perl
+        PPM> install Spreadsheet-WriteExcel
+        PPM> quit
+        C:\>
+
+        If this fails try the following:
+
+        PPM>install http://homepage.eircom.net/~jmcnamara/perl/Spreadsheet-WriteExcel.ppd
+
+    If both of these fail you should ensure that ppm is working
+    correctly. Try to install the File::Slurp module as a test:
+
+        C:\> ppm
+        PPM> install File-Test
+        PPM> quit
+        C:\>
+
+    A failure here will indicate that your ppm isn't configured
+    correctly or, more likely, that you are behind a firewall. Have a
+    look at the "Using PPM" documentation that comes with
+    ActivePerl to see how to resolve these issues.
+
+    Method 4, ActivePerl local ppm
+    ==============================
+    If the previous ppm methods fail you can try a local ppm install
+    as follows. Download the following two files (xx is the most
+    recent version number):
+
+        http://homepage.eircom.net/~jmcnamara/perl/Spreadsheet-WriteExcel.ppd
+        http://homepage.eircom.net/~jmcnamara/perl/Spreadsheet-WriteExcel-0.xx-PPM.tar.gz
+
+    Copy them to a temp directory. There is no need to un-tar or unzip
+    the PPM file.
+
+    In the DOS shell change to the temp directory and run ppm:
+
+         C:\> cd c:\temp
+         C:\Temp> ppm
+
+         PPM> install Spreadsheet-WriteExcel.ppd
+         Install package 'Spreadsheet-WriteExcel.ppd?' (y/N): y
+         Retrieving package 'Spreadsheet-WriteExcel.ppd'...
+         Writing C:\perl\site\lib\auto\Spreadsheet\WriteExcel\.packlist
+         PPM> quit
+         Quit!
+
+    The module should now be installed. Note, you will also have to
+    install Parse::RecDescent and possibly File::Temp if it isn't
+    already installed .
+
+
+======================================================================
+UPDATES
+
+    You can keep up to date with future release by registering as a
+    user with Freshmeat http://freshmeat.net/ and subscribing to
+    Spreadsheet::WriteExcel at the project page:
+    http://freshmeat.net/projects/writeexcel/
+
+    You will then receive mailed updates when a new version is
+    released.
+    
+    Alternatively you can keep an eye on news://comp.lang.perl.announce
+
+======================================================================
+AUTHOR
+
+    John McNamara (jmcnamara at cpan.org)

Modified: packages/libspreadsheet-writeexcel-perl/trunk/MANIFEST
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/MANIFEST	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/MANIFEST	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,140 +1,148 @@
-Makefile.PL
-Changes
-MANIFEST
-README
-INSTALL
-META.yml
-
-
-lib/Spreadsheet/WriteExcel.pm
-lib/Spreadsheet/WriteExcel/BIFFwriter.pm
-lib/Spreadsheet/WriteExcel/Big.pm
-lib/Spreadsheet/WriteExcel/Chart.pm
-lib/Spreadsheet/WriteExcel/Format.pm
-lib/Spreadsheet/WriteExcel/Formula.pm
-lib/Spreadsheet/WriteExcel/OLEwriter.pm
-lib/Spreadsheet/WriteExcel/Utility.pm
-lib/Spreadsheet/WriteExcel/Workbook.pm
-lib/Spreadsheet/WriteExcel/WorkbookBig.pm
-lib/Spreadsheet/WriteExcel/Worksheet.pm
-
-t/00_IEEE_double.t
-t/01_add_worksheet.t
-t/01_merge_formats.t
-t/11_date_time.t
-t/12_date_only.t
-t/13_date_seconds.t
-
-doc/index.html
-doc/WriteExcel.html
-doc/examples.html
-doc/install.html
-doc/number_formats1.html
-doc/number_formats2.html
-doc/palette.html
-doc/rgb5-97.html
-doc/tpj.html
-doc/merge1.gif
-doc/merge2.gif
-doc/regions.gif
-doc/simple.gif
-doc/stats.gif
-doc/stocks.gif
-doc/textwrap.gif
-doc/tpj0503-0004-01.gif
-doc/tpj0503-0004-02.gif
-doc/tpj0503-0004-03.gif
-doc/tpj0503-0004-04.gif
-doc/tpj0503-0004-05.gif
-doc/win32ole.gif
-
-examples/README
-examples/bigfile.pl
-examples/bug_report.pl
-examples/cgi.pl
-examples/chess.pl
-examples/colors.pl
-examples/convertA1.pl
-examples/copyformat.pl
-examples/csv2xls.pl
-examples/date_time.pl
-examples/datecalc1.pl
-examples/datecalc2.pl
-examples/demo.pl
-examples/diag_border.pl
-examples/easter_egg.pl
-examples/filehandle.pl
-examples/formats.pl
-examples/formula_result.pl
-examples/function_locale.pl
-examples/headers.pl
-examples/hide_sheet.pl
-examples/hyperlink1.pl
-examples/hyperlink2.pl
-examples/images.pl
-examples/indent.pl
-examples/lecxe.pl
-examples/merge1.pl
-examples/merge2.pl
-examples/merge3.pl
-examples/merge4.pl
-examples/merge5.pl
-examples/mod_perl1.pl
-examples/mod_perl2.pl
-examples/outline.pl
-examples/panes.pl
-examples/protection.pl
-examples/regions.pl
-examples/repeat.pl
-examples/republic.bmp
-examples/sales.pl
-examples/sendmail.pl
-examples/simple.pl
-examples/stats.pl
-examples/stats_ext.pl
-examples/stocks.pl
-examples/tab2xls.pl
-examples/textwrap.pl
-examples/unicode.pl
-examples/unicode_2022_jp.pl
-examples/unicode_2022_jp.txt
-examples/unicode_8859_11.pl
-examples/unicode_8859_11.txt
-examples/unicode_8859_7.pl
-examples/unicode_8859_7.txt
-examples/unicode_big5.pl
-examples/unicode_big5.txt
-examples/unicode_cp1251.pl
-examples/unicode_cp1251.txt
-examples/unicode_cp1256.pl
-examples/unicode_cp1256.txt
-examples/unicode_cyrillic.pl
-examples/unicode_japan.pl
-examples/unicode_koi8r.pl
-examples/unicode_koi8r.txt
-examples/unicode_list.pl
-examples/unicode_polish_utf8.pl
-examples/unicode_polish_utf8.txt
-examples/unicode_shift_jis.pl
-examples/unicode_shift_jis.txt
-examples/win32ole.pl
-examples/writeA1.pl
-examples/write_arrays.pl
-examples/write_handler1.pl
-examples/write_handler2.pl
-examples/write_handler3.pl
-examples/write_handler4.pl
-examples/write_to_scalar.pl
-
-charts/README
-charts/chartex.pl
-charts/charts.pod
-charts/charts.txt
-charts/demo1.pl
-charts/demo2.pl
-charts/demo3.pl
-charts/Chart1.xls
-charts/Chart2.xls
-charts/Chart3.xls
-
-bin/chartex
+Makefile.PL
+Changes
+MANIFEST
+README
+INSTALL
+META.yml
+
+
+lib/Spreadsheet/WriteExcel.pm
+lib/Spreadsheet/WriteExcel/BIFFwriter.pm
+lib/Spreadsheet/WriteExcel/Big.pm
+lib/Spreadsheet/WriteExcel/Chart.pm
+lib/Spreadsheet/WriteExcel/Format.pm
+lib/Spreadsheet/WriteExcel/Formula.pm
+lib/Spreadsheet/WriteExcel/OLEwriter.pm
+lib/Spreadsheet/WriteExcel/Utility.pm
+lib/Spreadsheet/WriteExcel/Workbook.pm
+lib/Spreadsheet/WriteExcel/WorkbookBig.pm
+lib/Spreadsheet/WriteExcel/Worksheet.pm
+
+t/00_IEEE_double.t
+t/01_add_worksheet.t
+t/02_merge_formats.t
+t/11_date_time.t
+t/12_date_only.t
+t/13_date_seconds.t
+t/21_escher.t
+t/22_mso_drawing_group.t
+t/23_note.t
+t/24_txo.t
+
+doc/index.html
+doc/WriteExcel.html
+doc/examples.html
+doc/install.html
+doc/number_formats1.html
+doc/number_formats2.html
+doc/palette.html
+doc/rgb5-97.html
+doc/tpj.html
+doc/merge1.gif
+doc/merge2.gif
+doc/regions.gif
+doc/simple.gif
+doc/stats.gif
+doc/stocks.gif
+doc/textwrap.gif
+doc/tpj0503-0004-01.gif
+doc/tpj0503-0004-02.gif
+doc/tpj0503-0004-03.gif
+doc/tpj0503-0004-04.gif
+doc/tpj0503-0004-05.gif
+doc/win32ole.gif
+
+examples/README
+examples/bigfile.pl
+examples/bug_report.pl
+examples/cgi.pl
+examples/chess.pl
+examples/colors.pl
+examples/comments1.pl
+examples/comments2.pl
+examples/convertA1.pl
+examples/copyformat.pl
+examples/csv2xls.pl
+examples/date_time.pl
+examples/datecalc1.pl
+examples/datecalc2.pl
+examples/demo.pl
+examples/diag_border.pl
+examples/easter_egg.pl
+examples/filehandle.pl
+examples/formats.pl
+examples/formula_result.pl
+examples/function_locale.pl
+examples/headers.pl
+examples/hide_sheet.pl
+examples/hyperlink1.pl
+examples/hyperlink2.pl
+examples/images.pl
+examples/indent.pl
+examples/lecxe.pl
+examples/merge1.pl
+examples/merge2.pl
+examples/merge3.pl
+examples/merge4.pl
+examples/merge5.pl
+examples/merge6.pl
+examples/mod_perl1.pl
+examples/mod_perl2.pl
+examples/outline.pl
+examples/panes.pl
+examples/protection.pl
+examples/regions.pl
+examples/repeat.pl
+examples/republic.bmp
+examples/right_to_left.pl
+examples/sales.pl
+examples/sendmail.pl
+examples/simple.pl
+examples/stats.pl
+examples/stats_ext.pl
+examples/stocks.pl
+examples/tab2xls.pl
+examples/textwrap.pl
+examples/unicode.pl
+examples/unicode_2022_jp.pl
+examples/unicode_2022_jp.txt
+examples/unicode_8859_11.pl
+examples/unicode_8859_11.txt
+examples/unicode_8859_7.pl
+examples/unicode_8859_7.txt
+examples/unicode_big5.pl
+examples/unicode_big5.txt
+examples/unicode_cp1251.pl
+examples/unicode_cp1251.txt
+examples/unicode_cp1256.pl
+examples/unicode_cp1256.txt
+examples/unicode_cyrillic.pl
+examples/unicode_japan.pl
+examples/unicode_koi8r.pl
+examples/unicode_koi8r.txt
+examples/unicode_list.pl
+examples/unicode_polish_utf8.pl
+examples/unicode_polish_utf8.txt
+examples/unicode_shift_jis.pl
+examples/unicode_shift_jis.txt
+examples/win32ole.pl
+examples/writeA1.pl
+examples/write_arrays.pl
+examples/write_handler1.pl
+examples/write_handler2.pl
+examples/write_handler3.pl
+examples/write_handler4.pl
+examples/write_to_scalar.pl
+
+charts/README
+charts/chartex.pl
+charts/charts.pod
+charts/charts.txt
+charts/demo1.pl
+charts/demo2.pl
+charts/demo3.pl
+charts/Chart1.xls
+charts/Chart2.xls
+charts/Chart3.xls
+
+bin/chartex

Modified: packages/libspreadsheet-writeexcel-perl/trunk/META.yml
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/META.yml	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/META.yml	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,5 +1,5 @@
 name:         Spreadsheet-WriteExcel
-version:      2.14.2
+version:      2.16
 version_from: lib/Spreadsheet/WriteExcel.pm
 installdirs:  site
 requires:

Modified: packages/libspreadsheet-writeexcel-perl/trunk/Makefile.PL
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/Makefile.PL	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/Makefile.PL	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,17 +1,17 @@
-use ExtUtils::MakeMaker;
-
-# perl 5.005 is required for qr() support in Parse::RecDescent.
-# There are also some 4 arg substr()'s in WriteExcel.
-#
-require 5.005;
-
-WriteMakefile(
-    'AUTHOR'        => 'John McNamara (jmcnamara at cpan.org)',
-    'ABSTRACT'      => 'Write to a cross platform Excel binary file',
-    'NAME'          => 'Spreadsheet::WriteExcel',
-    'VERSION_FROM'  => 'lib/Spreadsheet/WriteExcel.pm',
-    'NEEDS_LINKING' => 0,
-    'PREREQ_PM'     => {Parse::RecDescent => 0, File::Temp => 0},
-    'dist'          => {COMPRESS => 'gzip --best', SUFFIX => 'gz'},
-    'EXE_FILES'     => ['bin/chartex'],
-);
+use ExtUtils::MakeMaker;
+
+# perl 5.005 is required for qr() support in Parse::RecDescent.
+# There are also some 4 arg substr()'s in WriteExcel.
+#
+require 5.005;
+
+WriteMakefile(
+    'AUTHOR'        => 'John McNamara (jmcnamara at cpan.org)',
+    'ABSTRACT'      => 'Write to a cross platform Excel binary file',
+    'NAME'          => 'Spreadsheet::WriteExcel',
+    'VERSION_FROM'  => 'lib/Spreadsheet/WriteExcel.pm',
+    'NEEDS_LINKING' => 0,
+    'PREREQ_PM'     => {Parse::RecDescent => 0, File::Temp => 0},
+    'dist'          => {COMPRESS => 'gzip --best', SUFFIX => 'gz'},
+    'EXE_FILES'     => ['bin/chartex'],
+);

Modified: packages/libspreadsheet-writeexcel-perl/trunk/README
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/README	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/README	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,74 +1,74 @@
-======================================================================
-NAME
-
-    Spreadsheet::WriteExcel - Write formatted text and numbers to a
-    cross-platform Excel binary file.
-
-======================================================================
-DESCRIPTION
-
-    The Spreadsheet::WriteExcel module can be used to create a cross-
-    platform Excel binary file. Multiple worksheets can be added to a
-    workbook and formatting can be applied to cells. Text, numbers,
-    formulas, hyperlinks and images can be written to the cells.
-
-    TThe Excel file produced by this module is compatible with 97,
-    2000, 2002 and 2003.
-
-    The module will work on the majority of Windows, UNIX and
-    Macintosh platforms. Generated files are also compatible with the
-    spreadsheet applications Gnumeric and OpenOffice.org.
-
-    This module cannot be used to read an Excel file. See
-    Spreadsheet::ParseExcel or look at the main documentation for some
-    suggestions. This module cannot be uses to write to an existing
-    Excel file.
-
-======================================================================
-SYNOPSIS
-
-    To write a string, a formatted string, a number and a formula to
-    the first worksheet in an Excel workbook called perl.xls:
-
-        use Spreadsheet::WriteExcel;
-
-        # Create a new Excel workbook
-        my $workbook = Spreadsheet::WriteExcel->new("perl.xls");
-
-        # Add a worksheet
-        $worksheet = $workbook->add_worksheet();
-
-        #  Add and define a format
-        $format = $workbook->add_format(); # Add a format
-        $format->set_bold();
-        $format->set_color('red');
-        $format->set_align('center');
-
-        # Write a formatted and unformatted string.
-        $col = $row = 0;
-        $worksheet->write($row, $col, "Hi Excel!", $format);
-        $worksheet->write(1,    $col, "Hi Excel!");
-
-        # Write a number and a formula using A1 notation
-        $worksheet->write('A3', 1.2345);
-        $worksheet->write('A4', '=SIN(PI()/4)');
-
-======================================================================
-REQUIREMENTS
-
-    This module requires Perl 5.005 (or later), Parse::RecDescent
-    and File::Temp:
-
-    http://search.cpan.org/search?dist=Parse-RecDescent/
-    http://search.cpan.org/search?dist=File-Temp/
-
-======================================================================
-INSTALLATION
-
-    See the INSTALL file for details.
-
-
-======================================================================
-AUTHOR
-
-    John McNamara (jmcnamara at cpan.org)
+======================================================================
+NAME
+
+    Spreadsheet::WriteExcel - Write formatted text and numbers to a
+    cross-platform Excel binary file.
+
+======================================================================
+DESCRIPTION
+
+    The Spreadsheet::WriteExcel module can be used to create a cross-
+    platform Excel binary file. Multiple worksheets can be added to a
+    workbook and formatting can be applied to cells. Text, numbers,
+    formulas, hyperlinks and images can be written to the cells.
+
+    TThe Excel file produced by this module is compatible with 97,
+    2000, 2002 and 2003.
+
+    The module will work on the majority of Windows, UNIX and
+    Macintosh platforms. Generated files are also compatible with the
+    spreadsheet applications Gnumeric and OpenOffice.org.
+
+    This module cannot be used to read an Excel file. See
+    Spreadsheet::ParseExcel or look at the main documentation for some
+    suggestions. This module cannot be uses to write to an existing
+    Excel file.
+
+======================================================================
+SYNOPSIS
+
+    To write a string, a formatted string, a number and a formula to
+    the first worksheet in an Excel workbook called perl.xls:
+
+        use Spreadsheet::WriteExcel;
+
+        # Create a new Excel workbook
+        my $workbook = Spreadsheet::WriteExcel->new("perl.xls");
+
+        # Add a worksheet
+        $worksheet = $workbook->add_worksheet();
+
+        #  Add and define a format
+        $format = $workbook->add_format(); # Add a format
+        $format->set_bold();
+        $format->set_color('red');
+        $format->set_align('center');
+
+        # Write a formatted and unformatted string.
+        $col = $row = 0;
+        $worksheet->write($row, $col, "Hi Excel!", $format);
+        $worksheet->write(1,    $col, "Hi Excel!");
+
+        # Write a number and a formula using A1 notation
+        $worksheet->write('A3', 1.2345);
+        $worksheet->write('A4', '=SIN(PI()/4)');
+
+======================================================================
+REQUIREMENTS
+
+    This module requires Perl 5.005 (or later), Parse::RecDescent
+    and File::Temp:
+
+    http://search.cpan.org/search?dist=Parse-RecDescent/
+    http://search.cpan.org/search?dist=File-Temp/
+
+======================================================================
+INSTALLATION
+
+    See the INSTALL file for details.
+
+
+======================================================================
+AUTHOR
+
+    John McNamara (jmcnamara at cpan.org)

Modified: packages/libspreadsheet-writeexcel-perl/trunk/charts/chartex.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/charts/chartex.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/charts/chartex.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,226 +1,226 @@
-#!/usr/bin/perl -w
-
-#######################################################################
-#
-# chartex - A utility to extract charts from an Excel file for
-# insertion into a Spreadsheet::WriteExcel file.
-#
-# reverse('©'), September 2004, John McNamara, jmcnamara at cpan.org
-#
-# Documentation after __END__
-#
-
-
-use strict;
-use OLE::Storage_Lite;
-use Getopt::Long;
-use Pod::Usage;
-
-
-my $man         = 0;
-my $help        = 0;
-my $in_chart    = 0;
-my $chart_name  = 'chart';
-my $chart_index = 1;
-my $sheet_index = -1;
-my @sheetnames;
-my @exrefs;
-
-
-#
-# Do the Getopt and Pod::Usage routines.
-#
-GetOptions(
-            'help|?'    => \$help,
-            'man'       => \$man,
-            'chart=s'   => \$chart_name,
-          ) or pod2usage(2);
-
-pod2usage(1) if $help;
-pod2usage(-verbose => 2) if $man;
-
-
-# From the Pod::Usage pod:
-# If no arguments were given, then allow STDIN to be used only
-# if it's not connected to a terminal (otherwise print usage)
-pod2usage() if @ARGV == 0 && -t STDIN;
-
-
-
-
-# Check that the file can be opened because OLE::Storage_Lite won't tell us.
-# Possible race condition here. Could fix with latest OLE::Storage_Lite. TODO.
-#
-my $file = $ARGV[0];
-
-open  TMP, $file or die "Couldn't open $file. $!\n";
-close TMP;
-
-my $ole      = OLE::Storage_Lite->new($file);
-my $book97   = pack 'v*', unpack 'C*', 'Workbook';
-my $workbook = ($ole->getPpsSearch([$book97], 1, 1))[0];
-
-die "Couldn't find Excel97 data in file $file.\n" unless $workbook;
-
-
-# Write the data to a file so that we can access it with read().
-my $tmpfile = IO::File->new_tmpfile();
-binmode $tmpfile;
-
-my $biff = $workbook->{Data};
-print {$tmpfile} $biff;
-seek $tmpfile, 0, 0;
-
-
-
-my $header;
-my $data;
-
-# Read the file record by record and look for a chart BOF record.
-#
-while (read $tmpfile, $header, 4) {
-
-    my ($record, $length) = unpack "vv", $header;
-    next unless $record;
-
-    read $tmpfile, $data, $length;
-
-    # BOUNDSHEET
-    if ($record == 0x0085) {
-        push @sheetnames, substr $data, 8;
-    }
-
-    # EXTERNSHEET
-    if ($record == 0x0017) {
-        my $count = unpack 'v', $data;
-
-        for my $i (1 .. $count) {
-            my @tmp = unpack 'vvv', substr($data, 2 +6*($i-1));
-            push @exrefs, [@tmp];
-        }
-
-    }
-
-    # BOF
-    if ($record == 0x0809) {
-        my $type = unpack 'xx v', $data;
-
-        if ($type == 0x0020) {
-            my $filename = sprintf "%s%02d.bin", $chart_name, $chart_index;
-            open    CHART, ">$filename" or die "Couldn't open $filename: $!";
-            binmode CHART;
-            printf "\nExtracting \"%s\" to %s", $sheetnames[$sheet_index],
-                                                $filename;
-            $in_chart = 1;
-            $chart_index++;
-        }
-        $sheet_index++;
-    }
-
-    if ($in_chart) {
-        print CHART $header, $data;
-    }
-
-    # EOF
-    if ($record == 0x000A) {
-            $in_chart = 0;
-    }
-}
-
-
-
-print "\n\n", ('=' x 60), "\n";
-print "Add the following near the start of your program.\n";
-print "Change variable name \$worksheet if required.\n\n";
-
-for my $aref (@exrefs) {
-    my $sheet1 = $sheetnames[$aref->[1]];
-    my $sheet2 = $sheetnames[$aref->[2]];
-
-    my $range;
-
-    if ($sheet1 ne $sheet2) {
-        $range = $sheet1 . ":" .  $sheet2;
-    }
-    else {
-        $range = $sheet1;
-    }
-
-    $range = "'$range'" if $range =~ /[^\w:]/;
-
-    print "    \$worksheet->store_formula('=$range!A1');\n";
-}
-
-
-
-
-__END__
-
-
-=head1 NAME
-
-chartex - A utility to extract charts from an Excel file for insertion into a Spreadsheet::WriteExcel file.
-
-=head1 DESCRIPTION
-
-This program is used for extracting one or more charts from an Excel file in binary format. The charts can then be included in a C<Spreadsheet::WriteExcel> file.
-
-See the C<add_chart_ext()> section of the  Spreadsheet::WriteExcel documentation for more details.
-
-
-=head1 SYNOPSIS
-
-chartex [--chartname --help --man] file.xls
-
-    Options:
-        --chartname -c  The root name for the extracted charts,
-                        defaults to "chart".
-
-
-=head1 OPTIONS
-
-=over 4
-
-=item B<--chartname or -c>
-
-This sets the root name for the extracted charts, defaults to "chart". For example:
-
-    $ chartex file.xls
-
-    Extracting "Chart1" to chart01.bin
-
-
-    $ chartex -c mychart file.xls
-
-    Extracting "Chart1" to mychart01.bin
-
-=item B<--help or -h>
-
-Print a brief help message and exits.
-
-
-=item B<--man or -m>
-
-Prints the manual page and exits.
-
-=back
-
-
-=head1 AUTHOR
-
-John McNamara jmcnamara at cpan.org
-
-
-=head1 VERSION
-
-Version 0.01.
-
-
-=head1 COPYRIGHT
-
-© MMV, John McNamara.
-
-All Rights Reserved. This program is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.
-
-
-=cut
+#!/usr/bin/perl -w
+
+#######################################################################
+#
+# chartex - A utility to extract charts from an Excel file for
+# insertion into a Spreadsheet::WriteExcel file.
+#
+# reverse('©'), September 2004, John McNamara, jmcnamara at cpan.org
+#
+# Documentation after __END__
+#
+
+
+use strict;
+use OLE::Storage_Lite;
+use Getopt::Long;
+use Pod::Usage;
+
+
+my $man         = 0;
+my $help        = 0;
+my $in_chart    = 0;
+my $chart_name  = 'chart';
+my $chart_index = 1;
+my $sheet_index = -1;
+my @sheetnames;
+my @exrefs;
+
+
+#
+# Do the Getopt and Pod::Usage routines.
+#
+GetOptions(
+            'help|?'    => \$help,
+            'man'       => \$man,
+            'chart=s'   => \$chart_name,
+          ) or pod2usage(2);
+
+pod2usage(1) if $help;
+pod2usage(-verbose => 2) if $man;
+
+
+# From the Pod::Usage pod:
+# If no arguments were given, then allow STDIN to be used only
+# if it's not connected to a terminal (otherwise print usage)
+pod2usage() if @ARGV == 0 && -t STDIN;
+
+
+
+
+# Check that the file can be opened because OLE::Storage_Lite won't tell us.
+# Possible race condition here. Could fix with latest OLE::Storage_Lite. TODO.
+#
+my $file = $ARGV[0];
+
+open  TMP, $file or die "Couldn't open $file. $!\n";
+close TMP;
+
+my $ole      = OLE::Storage_Lite->new($file);
+my $book97   = pack 'v*', unpack 'C*', 'Workbook';
+my $workbook = ($ole->getPpsSearch([$book97], 1, 1))[0];
+
+die "Couldn't find Excel97 data in file $file.\n" unless $workbook;
+
+
+# Write the data to a file so that we can access it with read().
+my $tmpfile = IO::File->new_tmpfile();
+binmode $tmpfile;
+
+my $biff = $workbook->{Data};
+print {$tmpfile} $biff;
+seek $tmpfile, 0, 0;
+
+
+
+my $header;
+my $data;
+
+# Read the file record by record and look for a chart BOF record.
+#
+while (read $tmpfile, $header, 4) {
+
+    my ($record, $length) = unpack "vv", $header;
+    next unless $record;
+
+    read $tmpfile, $data, $length;
+
+    # BOUNDSHEET
+    if ($record == 0x0085) {
+        push @sheetnames, substr $data, 8;
+    }
+
+    # EXTERNSHEET
+    if ($record == 0x0017) {
+        my $count = unpack 'v', $data;
+
+        for my $i (1 .. $count) {
+            my @tmp = unpack 'vvv', substr($data, 2 +6*($i-1));
+            push @exrefs, [@tmp];
+        }
+
+    }
+
+    # BOF
+    if ($record == 0x0809) {
+        my $type = unpack 'xx v', $data;
+
+        if ($type == 0x0020) {
+            my $filename = sprintf "%s%02d.bin", $chart_name, $chart_index;
+            open    CHART, ">$filename" or die "Couldn't open $filename: $!";
+            binmode CHART;
+            printf "\nExtracting \"%s\" to %s", $sheetnames[$sheet_index],
+                                                $filename;
+            $in_chart = 1;
+            $chart_index++;
+        }
+        $sheet_index++;
+    }
+
+    if ($in_chart) {
+        print CHART $header, $data;
+    }
+
+    # EOF
+    if ($record == 0x000A) {
+            $in_chart = 0;
+    }
+}
+
+
+
+print "\n\n", ('=' x 60), "\n";
+print "Add the following near the start of your program.\n";
+print "Change variable name \$worksheet if required.\n\n";
+
+for my $aref (@exrefs) {
+    my $sheet1 = $sheetnames[$aref->[1]];
+    my $sheet2 = $sheetnames[$aref->[2]];
+
+    my $range;
+
+    if ($sheet1 ne $sheet2) {
+        $range = $sheet1 . ":" .  $sheet2;
+    }
+    else {
+        $range = $sheet1;
+    }
+
+    $range = "'$range'" if $range =~ /[^\w:]/;
+
+    print "    \$worksheet->store_formula('=$range!A1');\n";
+}
+
+
+
+
+__END__
+
+
+=head1 NAME
+
+chartex - A utility to extract charts from an Excel file for insertion into a Spreadsheet::WriteExcel file.
+
+=head1 DESCRIPTION
+
+This program is used for extracting one or more charts from an Excel file in binary format. The charts can then be included in a C<Spreadsheet::WriteExcel> file.
+
+See the C<add_chart_ext()> section of the  Spreadsheet::WriteExcel documentation for more details.
+
+
+=head1 SYNOPSIS
+
+chartex [--chartname --help --man] file.xls
+
+    Options:
+        --chartname -c  The root name for the extracted charts,
+                        defaults to "chart".
+
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<--chartname or -c>
+
+This sets the root name for the extracted charts, defaults to "chart". For example:
+
+    $ chartex file.xls
+
+    Extracting "Chart1" to chart01.bin
+
+
+    $ chartex -c mychart file.xls
+
+    Extracting "Chart1" to mychart01.bin
+
+=item B<--help or -h>
+
+Print a brief help message and exits.
+
+
+=item B<--man or -m>
+
+Prints the manual page and exits.
+
+=back
+
+
+=head1 AUTHOR
+
+John McNamara jmcnamara at cpan.org
+
+
+=head1 VERSION
+
+Version 0.01.
+
+
+=head1 COPYRIGHT
+
+© MMV, John McNamara.
+
+All Rights Reserved. This program is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.
+
+
+=cut

Modified: packages/libspreadsheet-writeexcel-perl/trunk/charts/charts.pod
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/charts/charts.pod	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/charts/charts.pod	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,196 +1,196 @@
-=head1 NAME
-
-Charts and Spreadsheet::WriteExcel - A short introduction on how to include externally generated charts into a Spreadsheet::WriteExcel file.
-
-=head1 DESCRIPTION
-
-This document explains how to import Excel charts into a C<Spreadsheet::WriteExcel> file.
-
-Please note that this feature is experimental. It may not work in all cases and it is best to start with a simple Excel file and gradually add complexity.
-
-
-=head1 METHODOLOGY
-
-The general methodology is to create a chart in Excel, extract the chart from the binary file, import it into C<Spreadsheet::WriteExcel> and add new data to the series that the chart uses.
-
-The steps involved are as follows:
-
-=over
-
-=item 1. Create a new workbook in Excel or with Spreadsheet::WriteExcel. The file should be in Excel 97 or later format.
-
-=item 2. Add one or more worksheets with sample data of the type and format that you would like to have in the final version.
-
-=item 3. Create a chart on a new chart sheet that refers to a data range in one of the worksheets. B<Note, charts embedded in worksheets aren't currently supported>.
-
-=item 4. Extend the chart data series to cover a sufficient range for any additional data that might be added. For example, if you initially have only 10 data points but you think that you may add up to 2000 at a later stage then increase the chart data series to 2000 points. In this case you should probably also leave the axes on automatic scaling.
-
-=item 5. Format the chart as you would like it to appear in the final version.
-
-=item 6. Save the workbook.
-
-=item 7. Using the C<chartex>* or C<chartex.pl> utility extract the chart(s) from the Excel file:
-
-    chartex file.xls
-
-    or
-
-    perl chartex.pl file.xls
-
-* If you performed a normal installation then the C<chartex> utility should be installed to your C<perl/bin> directory and should be available from the command line.
-
-=item 8. Create a new C<Spreadsheet::WriteExcel> file with the same worksheets as the original file.
-
-=item 9. Add the external chart data to the C<Spreadsheet::WriteExcel> file:
-
-    my $chart = $workbook->add_chart_ext('chart01.bin', 'Chart1');
-
-In this case the C<chart01.bin> file is the chart data that was extracted in the Step 7.
-
-=item 10. Create a link between the chart and the target worksheet using a dummy formula, this is discussed in more detail below:
-
-    $worksheet->store_formula('=Sheet1!A1');
-
-=item 11. Add 3 or more additional formats to match any formats used in the chart, for example in the axis labels or the title. You may also have to adjust  some of the font properties such as C<bold> or C<italic> to obtain the required font formats in the final chart.
-
-    $workbook->add_format(color => $_, bold => 1) for 1 ..5;
-
-If you do not supply enough additional formats then you may see the following error when you open the file in Excel: B<File error: data may have been lost.> The file will still load but some formatting will have been lost.
-
-=item 12. Add new data to the data ranges defined in the chart using the standard Spreadsheet::WriteExcel interface.
-
-=back
-
-
-=head1 EXAMPLE
-
-This following if a short example which uses line chart to display some X-Y data:
-
-    #!/usr/bin/perl -w
-
-    use strict;
-    use Spreadsheet::WriteExcel;
-
-    my $workbook  = Spreadsheet::WriteExcel->new("demo01.xls");
-    my $worksheet = $workbook->add_worksheet();
-
-    my $chart     = $workbook->add_chart_ext('chart01.bin', 'Chart1');
-
-    $worksheet->store_formula('=Sheet1!A1');
-
-    $workbook->add_format(color => 1);
-    $workbook->add_format(color => 2, bold => 1);
-    $workbook->add_format(color => 3);
-
-    my @nums    = (0, 1, 2, 3, 4,  5,  6,  7,  8,  9,  10 );
-    my @squares = (0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100);
-
-    $worksheet->write_col('A1', \@nums   );
-    $worksheet->write_col('B1', \@squares);
-
-
-
-This can be viewed in terms of the steps outlined above:
-
-Steps 1-6. Create a workbook with a chart based on data in the first worksheet. Otherwise use the C<Chart1.xls> file in the C<charts> directory of the distro as a template.
-
-Step 7. Extract the chart data:
-
-    perl chartex.pl file.xls
-
-    Extracting "Chart1" to chart01.bin
-
-    ============================================================
-    Add the following near the start of your program.
-    Change variable name $worksheet if required.
-
-        $worksheet->store_formula("=Sheet1!A1");
-
-
-Step 8. Create the new C<Spreadsheet::WriteExcel> file with the same worksheets as the original file.
-
-    #!/usr/bin/perl -w
-
-    use strict;
-    use Spreadsheet::WriteExcel;
-
-    my $workbook  = Spreadsheet::WriteExcel->new("demo01.xls");
-    my $worksheet = $workbook->add_worksheet();
-
-
-Step 9. Add the external chart data to the C<Spreadsheet::WriteExcel> file:
-
-    my $chart     = $workbook->add_chart_ext('chart01.bin', 'Chart1');
-
-
-Step 10. Create a link between the chart and the worksheet using a dummy formula:
-
-    $worksheet->store_formula('=Sheet1!A1');
-
-Step 11. Add 3 or more additional formats to match any formats used in the chart.
-
-    $workbook->add_format(color => 1);
-    $workbook->add_format(color => 2, bold => 1);
-    $workbook->add_format(color => 3);
-
-Step 12. Add new data to the data ranges defined in the chart.
-
-    my @nums    = (0, 1, 2, 3, 4,  5,  6,  7,  8,  9,  10 );
-    my @squares = (0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100);
-
-    $worksheet->write_col('A1', \@nums   );
-    $worksheet->write_col('B1', \@squares);
-
-See also the C<demo1.pl>, C<demo2.pl> and C<demo3.pl> example programs in the C<charts> directory of the distro.
-
-
-=head1 LINKING CHARTS AND DATA
-
-Excel maintains links between charts and their data using references. For example C<Sheet3> in the following chart series would be stored internally in a reference table using a zero-based integer.
-
-    =SERIES(,Sheet3!$A$2:$A$100,Sheet3!$B$2:$B$100,1)
-
-These references are also shared with formulas that refer to sheetnames. For example the following would share the same reference as the previous chart series:
-
-    =Sheet3!A1
-
-Therefore, we can simulate the link between the chart and the worksheet data using a dummy formula:
-
-    $worksheet->store_formula('=Sheet3!A1');
-
-When you run the C<chartex> program it will suggest the required links:
-
-    ============================================================
-    Add the following near the start of your program.
-    Change variable name $worksheet if required.
-
-        $worksheet->store_formula("=Sheet3!A1");
-
-This method is a workaround and will hopefully be made more transparent in a future release.
-
-
-=head1 SEE ALSO
-
-The Spreadsheet::WriteExcel documentation.
-
-The C<demo1.pl>, C<demo2.pl> and C<demo3.pl> example programs in the C<charts> directory of the distro.
-
-
-=head1 BUGS
-
-If you wish to submit a bug report run the C<bug_report.pl> program in the C<examples> directory of the distro.
-
-
-=head1 AUTHOR
-
-John McNamara jmcnamara at cpan.org
-
-
-=head1 COPYRIGHT
-
-© MMV, John McNamara.
-
-All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.
-
-
-
+=head1 NAME
+
+Charts and Spreadsheet::WriteExcel - A short introduction on how to include externally generated charts into a Spreadsheet::WriteExcel file.
+
+=head1 DESCRIPTION
+
+This document explains how to import Excel charts into a C<Spreadsheet::WriteExcel> file.
+
+Please note that this feature is experimental. It may not work in all cases and it is best to start with a simple Excel file and gradually add complexity.
+
+
+=head1 METHODOLOGY
+
+The general methodology is to create a chart in Excel, extract the chart from the binary file, import it into C<Spreadsheet::WriteExcel> and add new data to the series that the chart uses.
+
+The steps involved are as follows:
+
+=over
+
+=item 1. Create a new workbook in Excel or with Spreadsheet::WriteExcel. The file should be in Excel 97 or later format.
+
+=item 2. Add one or more worksheets with sample data of the type and format that you would like to have in the final version.
+
+=item 3. Create a chart on a new chart sheet that refers to a data range in one of the worksheets. B<Note, charts embedded in worksheets aren't currently supported>.
+
+=item 4. Extend the chart data series to cover a sufficient range for any additional data that might be added. For example, if you initially have only 10 data points but you think that you may add up to 2000 at a later stage then increase the chart data series to 2000 points. In this case you should probably also leave the axes on automatic scaling.
+
+=item 5. Format the chart as you would like it to appear in the final version.
+
+=item 6. Save the workbook.
+
+=item 7. Using the C<chartex>* or C<chartex.pl> utility extract the chart(s) from the Excel file:
+
+    chartex file.xls
+
+    or
+
+    perl chartex.pl file.xls
+
+* If you performed a normal installation then the C<chartex> utility should be installed to your C<perl/bin> directory and should be available from the command line.
+
+=item 8. Create a new C<Spreadsheet::WriteExcel> file with the same worksheets as the original file.
+
+=item 9. Add the external chart data to the C<Spreadsheet::WriteExcel> file:
+
+    my $chart = $workbook->add_chart_ext('chart01.bin', 'Chart1');
+
+In this case the C<chart01.bin> file is the chart data that was extracted in the Step 7.
+
+=item 10. Create a link between the chart and the target worksheet using a dummy formula, this is discussed in more detail below:
+
+    $worksheet->store_formula('=Sheet1!A1');
+
+=item 11. Add 3 or more additional formats to match any formats used in the chart, for example in the axis labels or the title. You may also have to adjust  some of the font properties such as C<bold> or C<italic> to obtain the required font formats in the final chart.
+
+    $workbook->add_format(color => $_, bold => 1) for 1 ..5;
+
+If you do not supply enough additional formats then you may see the following error when you open the file in Excel: B<File error: data may have been lost.> The file will still load but some formatting will have been lost.
+
+=item 12. Add new data to the data ranges defined in the chart using the standard Spreadsheet::WriteExcel interface.
+
+=back
+
+
+=head1 EXAMPLE
+
+This following if a short example which uses line chart to display some X-Y data:
+
+    #!/usr/bin/perl -w
+
+    use strict;
+    use Spreadsheet::WriteExcel;
+
+    my $workbook  = Spreadsheet::WriteExcel->new("demo01.xls");
+    my $worksheet = $workbook->add_worksheet();
+
+    my $chart     = $workbook->add_chart_ext('chart01.bin', 'Chart1');
+
+    $worksheet->store_formula('=Sheet1!A1');
+
+    $workbook->add_format(color => 1);
+    $workbook->add_format(color => 2, bold => 1);
+    $workbook->add_format(color => 3);
+
+    my @nums    = (0, 1, 2, 3, 4,  5,  6,  7,  8,  9,  10 );
+    my @squares = (0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100);
+
+    $worksheet->write_col('A1', \@nums   );
+    $worksheet->write_col('B1', \@squares);
+
+
+
+This can be viewed in terms of the steps outlined above:
+
+Steps 1-6. Create a workbook with a chart based on data in the first worksheet. Otherwise use the C<Chart1.xls> file in the C<charts> directory of the distro as a template.
+
+Step 7. Extract the chart data:
+
+    perl chartex.pl file.xls
+
+    Extracting "Chart1" to chart01.bin
+
+    ============================================================
+    Add the following near the start of your program.
+    Change variable name $worksheet if required.
+
+        $worksheet->store_formula("=Sheet1!A1");
+
+
+Step 8. Create the new C<Spreadsheet::WriteExcel> file with the same worksheets as the original file.
+
+    #!/usr/bin/perl -w
+
+    use strict;
+    use Spreadsheet::WriteExcel;
+
+    my $workbook  = Spreadsheet::WriteExcel->new("demo01.xls");
+    my $worksheet = $workbook->add_worksheet();
+
+
+Step 9. Add the external chart data to the C<Spreadsheet::WriteExcel> file:
+
+    my $chart     = $workbook->add_chart_ext('chart01.bin', 'Chart1');
+
+
+Step 10. Create a link between the chart and the worksheet using a dummy formula:
+
+    $worksheet->store_formula('=Sheet1!A1');
+
+Step 11. Add 3 or more additional formats to match any formats used in the chart.
+
+    $workbook->add_format(color => 1);
+    $workbook->add_format(color => 2, bold => 1);
+    $workbook->add_format(color => 3);
+
+Step 12. Add new data to the data ranges defined in the chart.
+
+    my @nums    = (0, 1, 2, 3, 4,  5,  6,  7,  8,  9,  10 );
+    my @squares = (0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100);
+
+    $worksheet->write_col('A1', \@nums   );
+    $worksheet->write_col('B1', \@squares);
+
+See also the C<demo1.pl>, C<demo2.pl> and C<demo3.pl> example programs in the C<charts> directory of the distro.
+
+
+=head1 LINKING CHARTS AND DATA
+
+Excel maintains links between charts and their data using references. For example C<Sheet3> in the following chart series would be stored internally in a reference table using a zero-based integer.
+
+    =SERIES(,Sheet3!$A$2:$A$100,Sheet3!$B$2:$B$100,1)
+
+These references are also shared with formulas that refer to sheetnames. For example the following would share the same reference as the previous chart series:
+
+    =Sheet3!A1
+
+Therefore, we can simulate the link between the chart and the worksheet data using a dummy formula:
+
+    $worksheet->store_formula('=Sheet3!A1');
+
+When you run the C<chartex> program it will suggest the required links:
+
+    ============================================================
+    Add the following near the start of your program.
+    Change variable name $worksheet if required.
+
+        $worksheet->store_formula("=Sheet3!A1");
+
+This method is a workaround and will hopefully be made more transparent in a future release.
+
+
+=head1 SEE ALSO
+
+The Spreadsheet::WriteExcel documentation.
+
+The C<demo1.pl>, C<demo2.pl> and C<demo3.pl> example programs in the C<charts> directory of the distro.
+
+
+=head1 BUGS
+
+If you wish to submit a bug report run the C<bug_report.pl> program in the C<examples> directory of the distro.
+
+
+=head1 AUTHOR
+
+John McNamara jmcnamara at cpan.org
+
+
+=head1 COPYRIGHT
+
+© MMV, John McNamara.
+
+All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.
+
+
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/charts/demo1.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/charts/demo1.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/charts/demo1.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,45 +1,45 @@
-#!/usr/bin/perl -w
-
-###############################################################################
-#
-# Simple example of how to add an externally created chart to a Spreadsheet::
-# WriteExcel file.
-#
-#
-# This example adds a line chart extracted from the file Chart1.xls as follows:
-#
-#   perl chartex.pl -c=demo1 Chart1.xls
-#
-#
-# reverse('©'), September 2004, John McNamara, jmcnamara at cpan.org
-#
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-my $workbook  = Spreadsheet::WriteExcel->new("demo1.xls");
-my $worksheet = $workbook->add_worksheet();
-
-
-# Add the chart extracted using the chartex utility
-my $chart     = $workbook->add_chart_ext('demo101.bin', 'Chart1');
-
-
-# Link the chart to the worksheet data using a dummy formula.
-$worksheet->store_formula('=Sheet1!A1');
-
-
-# Add some extra formats to cover formats used in the charts.
-$workbook->add_format(color => 1);
-$workbook->add_format(color => 2);
-$workbook->add_format(color => 3);
-
-# Add all other formats (if any).
-
-# Add data to range that the chart refers to.
-my @nums    = (0, 1, 2, 3, 4,  5,  6,  7,  8,  9,  10 );
-my @squares = (0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100);
-
-$worksheet->write_col('A1', \@nums   );
-$worksheet->write_col('B1', \@squares);
-
+#!/usr/bin/perl -w
+
+###############################################################################
+#
+# Simple example of how to add an externally created chart to a Spreadsheet::
+# WriteExcel file.
+#
+#
+# This example adds a line chart extracted from the file Chart1.xls as follows:
+#
+#   perl chartex.pl -c=demo1 Chart1.xls
+#
+#
+# reverse('©'), September 2004, John McNamara, jmcnamara at cpan.org
+#
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+my $workbook  = Spreadsheet::WriteExcel->new("demo1.xls");
+my $worksheet = $workbook->add_worksheet();
+
+
+# Add the chart extracted using the chartex utility
+my $chart     = $workbook->add_chart_ext('demo101.bin', 'Chart1');
+
+
+# Link the chart to the worksheet data using a dummy formula.
+$worksheet->store_formula('=Sheet1!A1');
+
+
+# Add some extra formats to cover formats used in the charts.
+$workbook->add_format(color => 1);
+$workbook->add_format(color => 2);
+$workbook->add_format(color => 3);
+
+# Add all other formats (if any).
+
+# Add data to range that the chart refers to.
+my @nums    = (0, 1, 2, 3, 4,  5,  6,  7,  8,  9,  10 );
+my @squares = (0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100);
+
+$worksheet->write_col('A1', \@nums   );
+$worksheet->write_col('B1', \@squares);
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/charts/demo2.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/charts/demo2.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/charts/demo2.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,64 +1,64 @@
-#!/usr/bin/perl -w
-
-###############################################################################
-#
-# Simple example of how to add an externally created chart to a Spreadsheet::
-# WriteExcel file.
-#
-#
-# This example adds a pie chart extracted from the file Chart2.xls as follows:
-#
-#   perl chartex.pl -c=demo2 Chart2.xls
-#
-#
-# reverse('©'), September 2004, John McNamara, jmcnamara at cpan.org
-#
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-my $workbook  = Spreadsheet::WriteExcel->new("demo2.xls");
-my $worksheet = $workbook->add_worksheet();
-
-
-# Add the chart extracted using the chartex utility
-my $chart     = $workbook->add_chart_ext('demo201.bin', 'Chart1');
-
-
-# Link the chart to the worksheet data using a dummy formula.
-$worksheet->store_formula('=Sheet1!A1');
-
-
-# Add some extra formats to cover formats used in the charts.
-$workbook->add_format(color => 1, bold => 1);
-$workbook->add_format(color => 2);
-$workbook->add_format(color => 3);
-
-
-# Add all other formats.
-my $bold      = $workbook->add_format(bold => 1);
-
-
-# Adjust column widths and add some headers
-$worksheet->set_column('A:B', 20);
-
-$worksheet->write('A1', 'Module',        $bold);
-$worksheet->write('B1', 'No. of lines', $bold);
-
-
-# Add data to range that the chart refers to.
-my @data = (
-
-            ['BIFFwriter.pm',   275],
-            ['Big.pm',           99],
-            ['Chart.pm',        269],
-            ['Format.pm',       724],
-            ['Formula.pm',     1410],
-            ['OLEwriter.pm',    447],
-            ['Utility.pm',      884],
-            ['Workbook.pm',    1925],
-            ['WorkbookBig.pm',  112],
-            ['Worksheet.pm',   3945],
-        );
-
+#!/usr/bin/perl -w
+
+###############################################################################
+#
+# Simple example of how to add an externally created chart to a Spreadsheet::
+# WriteExcel file.
+#
+#
+# This example adds a pie chart extracted from the file Chart2.xls as follows:
+#
+#   perl chartex.pl -c=demo2 Chart2.xls
+#
+#
+# reverse('©'), September 2004, John McNamara, jmcnamara at cpan.org
+#
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+my $workbook  = Spreadsheet::WriteExcel->new("demo2.xls");
+my $worksheet = $workbook->add_worksheet();
+
+
+# Add the chart extracted using the chartex utility
+my $chart     = $workbook->add_chart_ext('demo201.bin', 'Chart1');
+
+
+# Link the chart to the worksheet data using a dummy formula.
+$worksheet->store_formula('=Sheet1!A1');
+
+
+# Add some extra formats to cover formats used in the charts.
+$workbook->add_format(color => 1, bold => 1);
+$workbook->add_format(color => 2);
+$workbook->add_format(color => 3);
+
+
+# Add all other formats.
+my $bold      = $workbook->add_format(bold => 1);
+
+
+# Adjust column widths and add some headers
+$worksheet->set_column('A:B', 20);
+
+$worksheet->write('A1', 'Module',        $bold);
+$worksheet->write('B1', 'No. of lines', $bold);
+
+
+# Add data to range that the chart refers to.
+my @data = (
+
+            ['BIFFwriter.pm',   275],
+            ['Big.pm',           99],
+            ['Chart.pm',        269],
+            ['Format.pm',       724],
+            ['Formula.pm',     1410],
+            ['OLEwriter.pm',    447],
+            ['Utility.pm',      884],
+            ['Workbook.pm',    1925],
+            ['WorkbookBig.pm',  112],
+            ['Worksheet.pm',   3945],
+        );
+
 $worksheet->write_col('A2', \@data);
\ No newline at end of file

Modified: packages/libspreadsheet-writeexcel-perl/trunk/charts/demo3.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/charts/demo3.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/charts/demo3.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,114 +1,114 @@
-#!/usr/bin/perl -w
-
-###############################################################################
-#
-# Simple example of how to add an externally created chart to a Spreadsheet::
-# WriteExcel file.
-#
-#
-# This example adds an "Open-high-low-close" stock chart extracted from the
-# file Chart3.xls as follows:
-#
-#   perl chartex.pl -c=demo3 Chart3.xls
-#
-# reverse('©'), September 2004, John McNamara, jmcnamara at cpan.org
-#
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-my $workbook  = Spreadsheet::WriteExcel->new("demo3.xls");
-my $worksheet = $workbook->add_worksheet();
-
-
-# Add the chart extracted using the chartex utility
-my $chart     = $workbook->add_chart_ext('demo301.bin', 'Chart1');
-
-
-# Link the chart to the worksheet data using a dummy formula.
-$worksheet->store_formula('=Sheet1!A1');
-
-
-# Add some extra formats to cover formats used in the charts.
-$workbook->add_format(color => 1);
-$workbook->add_format(color => 2);
-$workbook->add_format(color => 3, bold => 1);
-$workbook->add_format(color => 4);
-
-
-# Add all other formats.
-my $bold        = $workbook->add_format(bold => 1);
-my $date_format = $workbook->add_format(num_format => 'dd/mm/yyyy');
-
-
-# Adjust column widths and add some headers
-$worksheet->set_column('A:A', 12);
-
-$worksheet->write('A1', 'Date',  $bold);
-$worksheet->write('B1', 'Open',  $bold);
-$worksheet->write('C1', 'High',  $bold);
-$worksheet->write('D1', 'Low', $bold);
-$worksheet->write('E1', 'Close', $bold);
-
-
-# Add data to range that the chart refers to.
-my @dates = (
-
-   "2004-08-19T",
-   "2004-08-20T",
-   "2004-08-23T",
-   "2004-08-24T",
-   "2004-08-25T",
-   "2004-08-26T",
-   "2004-08-27T",
-   "2004-08-30T",
-   "2004-08-31T",
-   "2004-09-01T",
-   "2004-09-02T",
-   "2004-09-03T",
-   "2004-09-07T",
-   "2004-09-08T",
-   "2004-09-09T",
-   "2004-09-10T",
-   "2004-09-13T",
-   "2004-09-14T",
-   "2004-09-15T",
-   "2004-09-16T",
-   "2004-09-17T",
-   "2004-09-20T",
-   "2004-09-21T",
-);
-
-# Open-High-Low-Close prices
-my @prices = (
-
-    [100.00, 104.06,  95.96, 100.34],
-    [101.01, 109.08, 100.50, 108.31],
-    [110.75, 113.48, 109.05, 109.40],
-    [111.24, 111.60, 103.57, 104.87],
-    [104.96, 108.00, 103.88, 106.00],
-    [104.95, 107.95, 104.66, 107.91],
-    [108.10, 108.62, 105.69, 106.15],
-    [105.28, 105.49, 102.01, 102.01],
-    [102.30, 103.71, 102.16, 102.37],
-    [102.70, 102.97,  99.67, 100.25],
-    [ 99.19, 102.37,  98.94, 101.51],
-    [100.95, 101.74,  99.32, 100.01],
-    [101.01, 102.00,  99.61, 101.58],
-    [100.74, 103.03, 100.50, 102.30],
-    [102.53, 102.71, 101.00, 102.31],
-    [101.60, 106.56, 101.30, 105.33],
-    [106.63, 108.41, 106.46, 107.50],
-    [107.45, 112.00, 106.79, 111.49],
-    [110.56, 114.23, 110.20, 112.00],
-    [112.34, 115.80, 111.65, 113.97],
-    [114.42, 117.49, 113.55, 117.49],
-    [116.95, 121.60, 116.77, 119.36],
-    [119.81, 120.42, 117.51, 117.84],
-);
-
-
-
-my $row = 1;
-$worksheet->write_date_time($row++, 0, $_, $date_format) for @dates;
-$worksheet->write_col('B2', \@prices);
+#!/usr/bin/perl -w
+
+###############################################################################
+#
+# Simple example of how to add an externally created chart to a Spreadsheet::
+# WriteExcel file.
+#
+#
+# This example adds an "Open-high-low-close" stock chart extracted from the
+# file Chart3.xls as follows:
+#
+#   perl chartex.pl -c=demo3 Chart3.xls
+#
+# reverse('©'), September 2004, John McNamara, jmcnamara at cpan.org
+#
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+my $workbook  = Spreadsheet::WriteExcel->new("demo3.xls");
+my $worksheet = $workbook->add_worksheet();
+
+
+# Add the chart extracted using the chartex utility
+my $chart     = $workbook->add_chart_ext('demo301.bin', 'Chart1');
+
+
+# Link the chart to the worksheet data using a dummy formula.
+$worksheet->store_formula('=Sheet1!A1');
+
+
+# Add some extra formats to cover formats used in the charts.
+$workbook->add_format(color => 1);
+$workbook->add_format(color => 2);
+$workbook->add_format(color => 3, bold => 1);
+$workbook->add_format(color => 4);
+
+
+# Add all other formats.
+my $bold        = $workbook->add_format(bold => 1);
+my $date_format = $workbook->add_format(num_format => 'dd/mm/yyyy');
+
+
+# Adjust column widths and add some headers
+$worksheet->set_column('A:A', 12);
+
+$worksheet->write('A1', 'Date',  $bold);
+$worksheet->write('B1', 'Open',  $bold);
+$worksheet->write('C1', 'High',  $bold);
+$worksheet->write('D1', 'Low', $bold);
+$worksheet->write('E1', 'Close', $bold);
+
+
+# Add data to range that the chart refers to.
+my @dates = (
+
+   "2004-08-19T",
+   "2004-08-20T",
+   "2004-08-23T",
+   "2004-08-24T",
+   "2004-08-25T",
+   "2004-08-26T",
+   "2004-08-27T",
+   "2004-08-30T",
+   "2004-08-31T",
+   "2004-09-01T",
+   "2004-09-02T",
+   "2004-09-03T",
+   "2004-09-07T",
+   "2004-09-08T",
+   "2004-09-09T",
+   "2004-09-10T",
+   "2004-09-13T",
+   "2004-09-14T",
+   "2004-09-15T",
+   "2004-09-16T",
+   "2004-09-17T",
+   "2004-09-20T",
+   "2004-09-21T",
+);
+
+# Open-High-Low-Close prices
+my @prices = (
+
+    [100.00, 104.06,  95.96, 100.34],
+    [101.01, 109.08, 100.50, 108.31],
+    [110.75, 113.48, 109.05, 109.40],
+    [111.24, 111.60, 103.57, 104.87],
+    [104.96, 108.00, 103.88, 106.00],
+    [104.95, 107.95, 104.66, 107.91],
+    [108.10, 108.62, 105.69, 106.15],
+    [105.28, 105.49, 102.01, 102.01],
+    [102.30, 103.71, 102.16, 102.37],
+    [102.70, 102.97,  99.67, 100.25],
+    [ 99.19, 102.37,  98.94, 101.51],
+    [100.95, 101.74,  99.32, 100.01],
+    [101.01, 102.00,  99.61, 101.58],
+    [100.74, 103.03, 100.50, 102.30],
+    [102.53, 102.71, 101.00, 102.31],
+    [101.60, 106.56, 101.30, 105.33],
+    [106.63, 108.41, 106.46, 107.50],
+    [107.45, 112.00, 106.79, 111.49],
+    [110.56, 114.23, 110.20, 112.00],
+    [112.34, 115.80, 111.65, 113.97],
+    [114.42, 117.49, 113.55, 117.49],
+    [116.95, 121.60, 116.77, 119.36],
+    [119.81, 120.42, 117.51, 117.84],
+);
+
+
+
+my $row = 1;
+$worksheet->write_date_time($row++, 0, $_, $date_format) for @dates;
+$worksheet->write_col('B2', \@prices);

Modified: packages/libspreadsheet-writeexcel-perl/trunk/debian/changelog
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/debian/changelog	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/debian/changelog	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,3 +1,9 @@
+libspreadsheet-writeexcel-perl (2.16-1) unstable; urgency=low
+
+  * New upstream release
+
+ -- Gunnar Wolf <gwolf at debian.org>  Mon, 16 Jan 2006 18:25:09 -0600
+
 libspreadsheet-writeexcel-perl (2.15-1) unstable; urgency=low
 
   * New upstream release

Modified: packages/libspreadsheet-writeexcel-perl/trunk/doc/WriteExcel.html
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/doc/WriteExcel.html	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/doc/WriteExcel.html	2006-01-17 00:30:29 UTC (rev 1960)
@@ -45,7 +45,7 @@
 		<LI><A HREF="#new_">new()</A></LI>
 		<LI><A HREF="#close_">close()</A></LI>
 		<LI><A HREF="#set_tempdir_">set_tempdir()</A></LI>
-		<LI><A HREF="#add_worksheet_sheetname_">add_worksheet($sheetname)</A></LI>
+		<LI><A HREF="#add_worksheet_sheetname_encod">add_worksheet($sheetname, $encoding)</A></LI>
 		<LI><A HREF="#add_chart_ext_chart_data_char">add_chart_ext($chart_data, $chartname)</A></LI>
 		<LI><A HREF="#add_format_properties_">add_format(%properties)</A></LI>
 		<LI><A HREF="#set_custom_color_index_red_">set_custom_color($index, $red, $green, $blue)</A></LI>
@@ -70,17 +70,19 @@
 		<LI><A HREF="#write_row_row_column_array_">write_row($row, $column, $array_ref, $format)</A></LI>
 		<LI><A HREF="#write_col_row_column_array_">write_col($row, $column, $array_ref, $format)</A></LI>
 		<LI><A HREF="#write_date_time_row_col_dat">write_date_time($row, $col, $date_string, $format)</A></LI>
-		<LI><A HREF="#write_url_row_col_url_str">write_url($row, $col, $url, $string, $format)</A></LI>
+		<LI><A HREF="#write_url_row_col_url_lab">write_url($row, $col, $url, $label, $format)</A></LI>
 		<LI><A HREF="#write_url_range_row1_col1_r">write_url_range($row1, $col1, $row2, $col2, $url, $string, $format)</A></LI>
 		<LI><A HREF="#write_formula_row_column_fo">write_formula($row, $column, $formula, $format, $value)</A></LI>
 		<LI><A HREF="#store_formula_formula_">store_formula($formula)</A></LI>
 		<LI><A HREF="#repeat_formula_row_col_form">repeat_formula($row, $col, $formula, $format, ($pattern =&gt; $replace, ...))</A></LI>
-		<LI><A HREF="#write_comment_row_column_st">write_comment($row, $column, $string)</A></LI>
+		<LI><A HREF="#write_comment_row_column_st">write_comment($row, $column, $string, ...)</A></LI>
+		<LI><A HREF="#show_comments_">show_comments()</A></LI>
 		<LI><A HREF="#add_write_handler_re_code_ref">add_write_handler($re, $code_ref)</A></LI>
 		<LI><A HREF="#insert_bitmap_row_col_filen">insert_bitmap($row, $col, $filename, $x, $y, $scale_x, $scale_y)</A></LI>
 		<LI><A HREF="#get_name_">get_name()</A></LI>
 		<LI><A HREF="#activate_">activate()</A></LI>
 		<LI><A HREF="#select_">select()</A></LI>
+		<LI><A HREF="#hide_">hide()</A></LI>
 		<LI><A HREF="#set_first_sheet_">set_first_sheet()</A></LI>
 		<LI><A HREF="#protect_password_">protect($password)</A></LI>
 		<LI><A HREF="#set_selection_first_row_first">set_selection($first_row, $first_col, $last_row, $last_col)</A></LI>
@@ -89,7 +91,7 @@
 		<LI><A HREF="#outline_settings_visible_symb">outline_settings($visible, $symbols_below, $symbols_right, $auto_style)</A></LI>
 		<LI><A HREF="#freeze_panes_row_col_top_ro">freeze_panes($row, $col, $top_row, $left_col)</A></LI>
 		<LI><A HREF="#thaw_panes_y_x_top_row_le">thaw_panes($y, $x, $top_row, $left_col)</A></LI>
-		<LI><A HREF="#merge_range_first_row_first_c">merge_range($first_row, $first_col, $last_row, $last_col, $token, $format)</A></LI>
+		<LI><A HREF="#merge_range_first_row_first_c">merge_range($first_row, $first_col, $last_row, $last_col, $token, $format, $encoding)</A></LI>
 		<LI><A HREF="#set_zoom_scale_">set_zoom($scale)</A></LI>
         </code>
 	</UL>
@@ -111,6 +113,7 @@
 		<LI><A HREF="#hide_gridlines_option_">hide_gridlines($option)</A></LI>
 		<LI><A HREF="#print_row_col_headers_">print_row_col_headers()</A></LI>
 		<LI><A HREF="#print_area_first_row_first_co">print_area($first_row, $first_col, $last_row, $last_col)</A></LI>
+		<LI><A HREF="#print_across_">print_across()</A></LI>
 		<LI><A HREF="#fit_to_pages_width_height_">fit_to_pages($width, $height)</A></LI>
 		<LI><A HREF="#set_print_scale_scale_">set_print_scale($scale)</A></LI>
 		<LI><A HREF="#set_h_pagebreaks_breaks_">set_h_pagebreaks(@breaks)</A></LI>
@@ -198,6 +201,7 @@
 	<LI><A HREF="#TO_DO">TO DO</A></LI>
 	<LI><A HREF="#MAILING_LIST">MAILING LIST</A></LI>
 	<LI><A HREF="#DONATATIONS">DONATATIONS</A></LI>
+	<LI><A HREF="#SEE_ALSO">SEE ALSO</A></LI>
 	<LI><A HREF="#ACKNOWLEDGEMENTS">ACKNOWLEDGEMENTS</A></LI>
 	<LI><A HREF="#AUTHOR">AUTHOR</A></LI>
 	<LI><A HREF="#COPYRIGHT">COPYRIGHT</A></LI>
@@ -215,8 +219,8 @@
 <HR>
 <H1><A NAME="VERSION">VERSION</A></H1>
 <P>
-This document refers to version 2.15 of Spreadsheet::WriteExcel, released
-September 18, 2005.
+This document refers to version 2.16 of Spreadsheet::WriteExcel, released
+January 6, 2006.
 
 </P>
 <P>
@@ -335,7 +339,7 @@
 </P>
 <P>
 This will create an Excel file called <CODE>perl.xls</CODE> with a single worksheet and the text <CODE>&quot;Hi Excel!&quot;</CODE> in the relevant cell. And that's it. Okay, so there is actually a zeroth
-step as well, but <CODE>use module</CODE> goes without saying. There are also more than 40 examples that come with
+step as well, but <CODE>use module</CODE> goes without saying. There are also more than 60 examples that come with
 the distribution and which you can use to get you started. See <A HREF="#EXAMPLES">EXAMPLES</A>.
 
 </P>
@@ -359,6 +363,7 @@
     close()
     set_tempdir()
     add_worksheet()
+    add_chart_ext()
     add_format()
     set_custom_color()
     sheets()
@@ -682,7 +687,7 @@
 </P>
 <P>
 <HR>
-<H2><A NAME="add_worksheet_sheetname_">add_worksheet($sheetname)</A></H2>
+<H2><A NAME="add_worksheet_sheetname_encod">add_worksheet($sheetname, $encoding)</A></H2>
 <P>
 At least one worksheet should be added to a new workbook. A worksheet is
 used to write data into cells:
@@ -698,7 +703,7 @@
 </P>
 <P>
 If <CODE>$sheetname</CODE> is not specified the default Excel convention will be followed, i.e.
-Sheet1, Sheet2, etc.
+Sheet1, Sheet2, etc. The <CODE>$encoding</CODE> parameter is optional, see below.
 
 </P>
 <P>
@@ -713,10 +718,21 @@
 </P>
 <P>
 <PRE>
-    $worksheet5 = $workbook-&gt;add_worksheet(&quot;\x{263a}&quot;); # Smiley
+    $worksheet = $workbook-&gt;add_worksheet(&quot;\x{263a}&quot;); # Smiley
 </PRE>
 </P>
 <P>
+On earlier Perl systems your can specify UTF-16BE worksheet names using an
+additional encoding parameter:
+
+</P>
+<P>
+<PRE>
+    my $name = pack &quot;n&quot;, 0x263a;
+    $worksheet = $workbook-&gt;add_worksheet($name, 1);   # Smiley
+</PRE>
+</P>
+<P>
 <HR>
 <H2><A NAME="add_chart_ext_chart_data_char">add_chart_ext($chart_data, $chartname)</A></H2>
 <P>
@@ -784,6 +800,7 @@
     20   =&gt;   purple
     22   =&gt;   silver
     23   =&gt;   gray
+    33   =&gt;   pink
     53   =&gt;   orange
 </PRE>
 </P>
@@ -957,16 +974,20 @@
     write_blank()
     write_row()
     write_col()
+    write_date_time()
     write_url()
     write_url_range()
     write_formula()
     store_formula()
     repeat_formula()
+    write_comment()
+    show_comments()
     add_write_handler()
     insert_bitmap()
     get_name()
     activate()
     select()
+    hide()
     set_first_sheet()
     protect()
     set_selection()
@@ -977,6 +998,8 @@
     thaw_panes()
     merge_range()
     set_zoom()
+    right_to_left()
+    hide_zero()
 </PRE>
 </P>
 <P>
@@ -1429,9 +1452,9 @@
 <P>
 Note: You can convert ascii encodings to the required UTF-16BE format using
 one of the many Unicode modules on CPAN. For example <CODE>Unicode::Map</CODE> and <CODE>Unicode::String</CODE>: <A
-HREF="http://search.cpan.org/author/MSCHWARTZ/Unicode-Map-0.112/Map.pm">http://search.cpan.org/author/MSCHWARTZ/Unicode-Map-0.112/Map.pm</A>
+HREF="http://search.cpan.org/author/MSCHWARTZ/Unicode-Map/Map.pm">http://search.cpan.org/author/MSCHWARTZ/Unicode-Map/Map.pm</A>
 and <A
-HREF="http://search.cpan.org/author/GAAS/Unicode-String-2.06/String.pm">http://search.cpan.org/author/GAAS/Unicode-String-2.06/String.pm</A>
+HREF="http://search.cpan.org/author/GAAS/Unicode-String/String.pm">http://search.cpan.org/author/GAAS/Unicode-String/String.pm</A>
 
 
 </P>
@@ -1925,16 +1948,16 @@
 </P>
 <P>
 <HR>
-<H2><A NAME="write_url_row_col_url_str">write_url($row, $col, $url, $string, $format)</A></H2>
+<H2><A NAME="write_url_row_col_url_lab">write_url($row, $col, $url, $label, $format)</A></H2>
 <P>
 Write a hyperlink to a URL in the cell specified by <CODE>$row</CODE> and <CODE>$column</CODE>. The hyperlink is comprised of two elements: the visible label and the
 invisible link. The visible label is the same as the link unless an
-alternative string is specified. The parameters <CODE>$string</CODE> and the <CODE>$format</CODE> are optional and their position is interchangeable.
+alternative label is specified. The parameters <CODE>$label</CODE> and the <CODE>$format</CODE> are optional and their position is interchangeable.
 
 </P>
 <P>
-The label is written using the <CODE>write_string()</CODE> method. Therefore the 255 characters string limit applies to the label: the
-URL can be any length.
+The label is written using the <CODE>write()</CODE> method. Therefore it is possible to write strings, numbers or formulas as
+labels.
 
 </P>
 <P>
@@ -2341,15 +2364,16 @@
 </P>
 <P>
 <HR>
-<H2><A NAME="write_comment_row_column_st">write_comment($row, $column, $string)</A></H2>
+<H2><A NAME="write_comment_row_column_st">write_comment($row, $column, $string, ...)</A></H2>
 <P>
-<STRONG>NOTE: this method is not available in this release. Use the 1.xx versions of this module if you need this feature</STRONG>.
+<STRONG>NOTE:</STRONG> This method is currently incompatible with <CODE>insert_bitmap()</CODE>. You can use either method but not both in the same workbook. This will be
+fixed soon.
 
 </P>
 <P>
 The <CODE>write_comment()</CODE> method is used to add a comment to a cell. A cell comment is indicated in
 Excel by a small red triangle in the upper right-hand corner of the cell.
-Moving the cursor over the red triangle will cause the comment to appear.
+Moving the cursor over the red triangle will reveal the comment.
 
 </P>
 <P>
@@ -2358,16 +2382,291 @@
 </P>
 <P>
 <PRE>
-    $worksheet-&gt;write(&quot;C3&quot;, &quot;Hello&quot;);
-    $worksheet-&gt;write_comment(&quot;C3&quot;, &quot;This is a comment.&quot;);
+    $worksheet-&gt;write        (2, 2, 'Hello');
+    $worksheet-&gt;write_comment(2, 2, 'This is a comment.');
 </PRE>
 </P>
 <P>
-The cell comment can be up to 30,000 characters in length.
+As usual you can replace the <CODE>$row</CODE> and <CODE>$column</CODE> parameters with an <CODE>A1</CODE> cell reference. See the note about <A HREF="#Cell_notation">Cell notation</A>.
 
 </P>
 <P>
+<PRE>
+    $worksheet-&gt;write        ('C3', 'Hello');
+    $worksheet-&gt;write_comment('C3', 'This is a comment.');
+</PRE>
+</P>
+<P>
+On systems with <CODE>perl 5.8</CODE> and later the <CODE>write_comment()</CODE> method will also handle strings in Perl's <CODE>utf8</CODE> format.
+
+</P>
+<P>
+<PRE>
+    $worksheet-&gt;write_comment('C3', &quot;\x{263a}&quot;);       # Smiley
+    $worksheet-&gt;write_comment('C4', 'Comment ça va?');
+</PRE>
+</P>
+<P>
+In addition to the basic 3 argument form of <CODE>write_comment()</CODE> you can pass in several optional key/value pairs to control the format of
+the comment. For example:
+
+</P>
+<P>
+<PRE>
+    $worksheet-&gt;write_comment('C3', 'Hello', visible =&gt; 1, author =&gt; 'Perl');
+</PRE>
+</P>
+<P>
+Most of these options are quite specific and in general the default comment
+behaviour will be all that you need. However, should you need greater
+control over the format of the cell comment the following options are
+available:
+
+</P>
+<P>
+<PRE>
+    encoding
+    author
+    author_encoding
+    visible
+    x_scale
+    width
+    y_scale
+    height
+    color
+    start_cell
+    start_row
+    start_col
+    x_offset
+    y_offset
+</PRE>
+</P>
+<DL>
+<DT><A NAME="item_Option">Option: encoding</A><DD>
+<P>
+This option is used to indicate that the comment string is encoded as
+UTF-16BE.
+
+</P>
+<P>
+<PRE>
+    my $comment = pack &quot;n&quot;, 0x263a; # UTF-16BE Smiley symbol
+</PRE>
+</P>
+<P>
+<PRE>
+    $worksheet-&gt;write_comment('C3', $comment, encoding =&gt; 1);
+</PRE>
+</P>
+<P>
+If you wish to use Unicode characters in the comment string then the
+preferred method is to use perl 5.8 and UTF-8 strings.
+
+</P>
+<DT>Option: author<DD>
+<P>
+This option is used to indicate who the author of the comment is. Excel
+displays the author of the comment in the status bar at the bottom of the
+worksheet. This is usually of interest in corporate environments where
+several people might review and provide comments to a workbook.
+
+</P>
+<P>
+<PRE>
+    $worksheet-&gt;write_comment('C3', 'Atonement', author =&gt; 'Ian McEwan');
+</PRE>
+</P>
+<DT>Option: author_encoding<DD>
+<P>
+This option is used to indicate that the author string is encoded as
+UTF-16BE.
+
+</P>
+<DT>Option: visible<DD>
+<P>
+This option is used to make a cell comment visible when the worksheet is
+opened. The default behaviour in Excel is that comments are initially
+hidden. However, it is also possible in Excel to make individual or all
+comments visible. In Spreadsheet::WriteExcel individual comments can be
+made visible as follows:
+
+</P>
+<P>
+<PRE>
+    $worksheet-&gt;write_comment('C3', 'Hello', visible =&gt; 1);
+</PRE>
+</P>
+<P>
+It is possible to make all comments in a worksheet visible using the <CODE>show_comments()</CODE> worksheet method (see below). Alternatively, if all of the cell comments
+have been made visible you can hide individual comments:
+
+</P>
+<P>
+<PRE>
+    $worksheet-&gt;write_comment('C3', 'Hello', visible =&gt; 0);
+</PRE>
+</P>
+<DT>Option: x_scale<DD>
+<P>
+This option is used to set the width of the cell comment box as a factor of
+the default width.
+
+</P>
+<P>
+<PRE>
+    $worksheet-&gt;write_comment('C3', 'Hello', x_scale =&gt; 2);
+    $worksheet-&gt;write_comment('C4', 'Hello', x_scale =&gt; 4.2);
+</PRE>
+</P>
+<DT>Option: width<DD>
+<P>
+This option is used to set the width of the cell comment box explicitly in
+pixels.
+
+</P>
+<P>
+<PRE>
+    $worksheet-&gt;write_comment('C3', 'Hello', width =&gt; 200);
+</PRE>
+</P>
+<DT>Option: y_scale<DD>
+<P>
+This option is used to set the height of the cell comment box as a factor
+of the default height.
+
+</P>
+<P>
+<PRE>
+    $worksheet-&gt;write_comment('C3', 'Hello', y_scale =&gt; 2);
+    $worksheet-&gt;write_comment('C4', 'Hello', y_scale =&gt; 4.2);
+</PRE>
+</P>
+<DT>Option: height<DD>
+<P>
+This option is used to set the height of the cell comment box explicitly in
+pixels.
+
+</P>
+<P>
+<PRE>
+    $worksheet-&gt;write_comment('C3', 'Hello', height =&gt; 200);
+</PRE>
+</P>
+<DT>Option: color<DD>
+<P>
+This option is used to set the background colour of cell comment box. You
+can use one of the named colours recognised by Spreadsheet::WriteExcel or a
+colour index. See <A HREF="#COLOURS_IN_EXCEL">COLOURS IN EXCEL</A>.
+
+</P>
+<P>
+<PRE>
+    $worksheet-&gt;write_comment('C3', 'Hello', color =&gt; 'green');
+    $worksheet-&gt;write_comment('C4', 'Hello', color =&gt; 0x35);    # Orange
+</PRE>
+</P>
+<DT>Option: start_cell<DD>
+<P>
+This option is used to set the cell in which the comment will appear. By
+default Excel displays comments one cell to the right and one cell above
+the cell to which the comment relates. However, you can change this
+behaviour if you wish. In the following example the comment which would
+appear by default in cell <CODE>D2</CODE> is moved to <CODE>E2</CODE>.
+
+</P>
+<P>
+<PRE>
+    $worksheet-&gt;write_comment('C3', 'Hello', start_cell =&gt; 'E2');
+</PRE>
+</P>
+<DT>Option: start_row<DD>
+<P>
+This option is used to set the row in which the comment will appear. See
+the <CODE>start_cell</CODE> option above. The row is zero indexed.
+
+</P>
+<P>
+<PRE>
+    $worksheet-&gt;write_comment('C3', 'Hello', start_row =&gt; 0);
+</PRE>
+</P>
+<DT>Option: start_col<DD>
+<P>
+This option is used to set the column in which the comment will appear. See
+the <CODE>start_cell</CODE> option above. The column is zero indexed.
+
+</P>
+<P>
+<PRE>
+    $worksheet-&gt;write_comment('C3', 'Hello', start_col =&gt; 4);
+</PRE>
+</P>
+<DT>Option: x_offset<DD>
+<P>
+This option is used to change the x offset, in pixels, of a comment within
+a cell:
+
+</P>
+<P>
+<PRE>
+    $worksheet-&gt;write_comment('C3', $comment, x_offset =&gt; 30);
+</PRE>
+</P>
+<DT>Option: y_offset<DD>
+<P>
+This option is used to change the y offset, in pixels, of a comment within
+a cell:
+
+</P>
+<P>
+<PRE>
+    $worksheet-&gt;write_comment('C3', $comment, x_offset =&gt; 30);
+</PRE>
+</P>
+</DL>
+<P>
+You can apply as many of these options as you require.
+
+</P>
+<P>
+<STRONG>Note about row height and comments</STRONG>. If you specify the height of a row that contains a comment then
+Spreadsheet::WriteExcel will adjust the height of the comment to maintain
+the default or user specified dimensions. However, the height of a row can
+also be adjusted automatically by Excel if the text wrap property is set or
+large fonts are used in the cell. This means that the height of the row is
+unknown to WriteExcel at run time and thus the comment box is stretched
+with the row. Use the <CODE>set_row()</CODE> method to specify the row height explicitly and avoid this problem.
+
+</P>
+<P>
 <HR>
+<H2><A NAME="show_comments_">show_comments()</A></H2>
+<P>
+This method is used to make all cell comments visible when a worksheet is
+opened.
+
+</P>
+<P>
+Individual comments can be made visible using the <CODE>visible</CODE> parameter of the <CODE>write_comment</CODE> method (see above):
+
+</P>
+<P>
+<PRE>
+    $worksheet-&gt;write_comment('C3', 'Hello', visible =&gt; 1);
+</PRE>
+</P>
+<P>
+If all of the cell comments have been made visible you can hide individual
+comments as follows:
+
+</P>
+<P>
+<PRE>
+    $worksheet-&gt;write_comment('C3', 'Hello', visible =&gt; 0);
+</PRE>
+</P>
+<P>
+<HR>
 <H2><A NAME="add_write_handler_re_code_ref">add_write_handler($re, $code_ref)</A></H2>
 <P>
 This method is used to extend the Spreadsheet::WriteExcel
@@ -2441,7 +2740,7 @@
     $_[2]   Zero based column number.
     $_[3]   A number or string or token.
     $_[4]   A format ref if any.
-    $_[5]   Any other argruments.
+    $_[5]   Any other arguments.
     ...
 </PRE>
 </P>
@@ -2508,6 +2807,16 @@
 <HR>
 <H2><A NAME="insert_bitmap_row_col_filen">insert_bitmap($row, $col, $filename, $x, $y, $scale_x, $scale_y)</A></H2>
 <P>
+<STRONG>NOTE:</STRONG> This method is currently incompatible with <CODE>write_comment()</CODE>. You can use either method but not both in the same workbook. This will be
+fixed soon.
+
+</P>
+<P>
+<STRONG>NOTE:</STRONG> The images inserted using this method do not display in OpenOffice.org or
+Gnumeric. This is related to the previous note and will also be fixed soon.
+
+</P>
+<P>
 This method can be used to insert a bitmap into a worksheet. The bitmap
 must be a 24 bit, true colour, bitmap. No other format is supported. The <CODE>$x</CODE>, <CODE>$y</CODE>, <CODE>$scale_x</CODE> and <CODE>$scale_y</CODE> parameters are optional.
 
@@ -2660,6 +2969,28 @@
 </P>
 <P>
 <HR>
+<H2><A NAME="hide_">hide()</A></H2>
+<P>
+The <CODE>hide()</CODE> method is used to hide a worksheet:
+
+</P>
+<P>
+<PRE>
+    $worksheet-&gt;hide();
+</PRE>
+</P>
+<P>
+You may wish to hide a worksheet in order to avoid confusing a user with
+intermediate data or calculations.
+
+</P>
+<P>
+A hidden worksheet can not be activated or selected so this method is
+mutually exclusive with the <CODE>activate()</CODE> and <CODE>select()</CODE> methods.
+
+</P>
+<P>
+<HR>
 <H2><A NAME="set_first_sheet_">set_first_sheet()</A></H2>
 <P>
 The <CODE>activate()</CODE> method determines which worksheet is initially selected. However, if there
@@ -3142,9 +3473,9 @@
 </P>
 <P>
 <HR>
-<H2><A NAME="merge_range_first_row_first_c">merge_range($first_row, $first_col, $last_row, $last_col, $token, $format)</A></H2>
+<H2><A NAME="merge_range_first_row_first_c">merge_range($first_row, $first_col, $last_row, $last_col, $token, $format, $encoding)</A></H2>
 <P>
-Merging cells is generally achieved by setting the <CODE>merge</CODE> property of a Format object, see <A HREF="#CELL_FORMATTING">CELL FORMATTING</A>. However, this only allows simple Excel5 style horizontal merging which
+Merging cells can be achieved by setting the <CODE>merge</CODE> property of a Format object, see <A HREF="#CELL_FORMATTING">CELL FORMATTING</A>. However, this only allows simple Excel5 style horizontal merging which
 Excel refers to as "center across selection".
 
 </P>
@@ -3175,6 +3506,10 @@
 
 </P>
 <P>
+The <CODE>$encoding</CODE> parameter is optional, see below.
+
+</P>
+<P>
 <CODE>merge_range()</CODE> writes its <CODE>$token</CODE> argument using the worksheet <CODE>write()</CODE> method. Therefore it will handle numbers, strings, formulas or urls as
 required.
 
@@ -3185,10 +3520,30 @@
 
 </P>
 <P>
-The full possibilities of this method are shown in the <CODE>merge3.pl</CODE>, <CODE>merge4.pl</CODE> and <CODE>merge5.pl</CODE> programs in the <CODE>examples</CODE> directory of the distribution.
+On systems with <CODE>perl 5.8</CODE> and later the <CODE>merge_range()</CODE> method will also handle strings in Perl's <CODE>utf8</CODE> format.
 
 </P>
 <P>
+<PRE>
+    $worksheet-&gt;merge_range('B3:D4', &quot;\x{263a}&quot;, $format); # Smiley
+</PRE>
+</P>
+<P>
+On earlier Perl systems your can specify UTF-16BE worksheet names using an
+additional encoding parameter:
+
+</P>
+<P>
+<PRE>
+    my $str = pack &quot;n&quot;, 0x263a;
+    $worksheet-&gt;merge_range('B3:D4', $str, $format, 1); # Smiley
+</PRE>
+</P>
+<P>
+The full possibilities of this method are shown in the <CODE>merge3.pl</CODE> to <CODE>merge6.pl</CODE> programs in the <CODE>examples</CODE> directory of the distribution.
+
+</P>
+<P>
 <HR>
 <H2><A NAME="set_zoom_scale_">set_zoom($scale)</A></H2>
 <P>
@@ -3214,6 +3569,41 @@
 </P>
 <P>
 <HR>
+<H2><A NAME="right_to_left_">right_to_left()</A></H2>
+<P>
+The <CODE>right_to_left()</CODE> method is used to change the default direction of the worksheet from
+left-to-right, with the A1 cell in the top left, to right-to-left, with the
+he A1 cell in the top right.
+
+</P>
+<P>
+<PRE>
+    $worksheet-&gt;right_to_left();
+</PRE>
+</P>
+<P>
+This is useful when creating Arabic, Hebrew or other near or far eastern
+worksheets that use right-to-left as the default direction.
+
+</P>
+<P>
+<HR>
+<H2><A NAME="hide_zero_">hide_zero()</A></H2>
+<P>
+The <CODE>hide_zero()</CODE> method is used to hide any zero values that appear in cells.
+
+</P>
+<P>
+<PRE>
+    $worksheet-&gt;right_to_left();
+</PRE>
+</P>
+<P>
+In Excel this option is found under Tools->Options->View.
+
+</P>
+<P>
+<HR>
 <H1><A NAME="PAGE_SET_UP_METHODS">PAGE SET-UP METHODS</A></H1>
 <P>
 Page set-up methods affect the way that a worksheet looks when it is
@@ -3241,6 +3631,7 @@
     hide_gridlines()
     print_row_col_headers()
     print_area()
+    print_across()
     fit_to_pages()
     set_print_scale()
     set_h_pagebreaks()
@@ -3792,6 +4183,40 @@
 </P>
 <P>
 <HR>
+<H2><A NAME="print_across_">print_across()</A></H2>
+<P>
+The <CODE>print_across</CODE> method is used to change the default print direction. This is referred to
+by Excel as the sheet "page order".
+
+</P>
+<P>
+<PRE>
+    $worksheet-&gt;print_across();
+</PRE>
+</P>
+<P>
+The default page order is shown below for a worksheet that extends over 4
+pages. The order is called "down then across":
+
+</P>
+<P>
+<PRE>
+    [1] [3]
+    [2] [4]
+</PRE>
+</P>
+<P>
+However, by using the <CODE>print_across</CODE> method the print order will be changed to "across then down":
+
+</P>
+<P>
+<PRE>
+    [1] [2]
+    [3] [4]
+</PRE>
+</P>
+<P>
+<HR>
 <H2><A NAME="fit_to_pages_width_height_">fit_to_pages($width, $height)</A></H2>
 <P>
 The <CODE>fit_to_pages()</CODE> method is used to fit the printed area to a specific number of pages both
@@ -4357,6 +4782,7 @@
                         'magenta'
                         'navy'
                         'orange'
+                        'pink'
                         'purple'
                         'red'
                         'silver'
@@ -4910,7 +5336,7 @@
 </PRE>
 </P>
 <P>
-See also the <CODE>merge1.pl</CODE> to <CODE>merge5.pl</CODE> programs in the <CODE>examples</CODE> directory and the <CODE>merge_range()</CODE> method.
+See also the <CODE>merge1.pl</CODE> to <CODE>merge6.pl</CODE> programs in the <CODE>examples</CODE> directory and the <CODE>merge_range()</CODE> method.
 
 </P>
 <P>
@@ -5237,6 +5663,7 @@
     magenta   =&gt;   14
     navy      =&gt;   18
     orange    =&gt;   53
+    pink      =&gt;   33
     purple    =&gt;   20
     red       =&gt;   10
     silver    =&gt;   22
@@ -5299,7 +5726,7 @@
 </P>
 <P>
 A detailed look at Excel's colour palette: <A
-HREF="http://www.geocities.com/davemcritchie/excel/colors.htm">http://www.geocities.com/davemcritchie/excel/colors.htm</A>
+HREF="http://www.mvps.org/dmcritchie/excel/colors.htm">http://www.mvps.org/dmcritchie/excel/colors.htm</A>
 
 
 </P>
@@ -5351,10 +5778,8 @@
 the epoch starts on 0 January 1900. The second is that the year 1900 is
 erroneously but deliberately treated as a leap year. Therefore you must add
 an extra day to dates after 28 February 1900. The reason for this anomaly
-is explained at <A
-HREF="http://support.microsoft.com/support/kb/articles/Q181/3/70.asp">http://support.microsoft.com/support/kb/articles/Q181/3/70.asp</A>
+is explained in Microsoft Knowledge Base article Q181370.
 
-
 </P>
 <P>
 A date or time in Excel is like any other number. To display the number as
@@ -5747,11 +6172,8 @@
 </P>
 <P>
 For a general introduction to Excel's formulas and an explanation of the
-syntax of the function refer to the Excel help files or the following
-links: <A
-HREF="http://msdn.microsoft.com/library/default.asp?URL=/library/officedev/office97/s88f2.htm">http://msdn.microsoft.com/library/default.asp?URL=/library/officedev/office97/s88f2.htm</A>
-and <A
-HREF="http://msdn.microsoft.com/library/default.asp?URL=/library/en-us/office97/s992f.htm">http://msdn.microsoft.com/library/default.asp?URL=/library/en-us/office97/s992f.htm</A>
+syntax of the function refer to the Excel help files or the following: <A
+HREF="http://office.microsoft.com/en-us/assistance/CH062528031033.aspx">http://office.microsoft.com/en-us/assistance/CH062528031033.aspx</A>
 
 
 </P>
@@ -6287,6 +6709,8 @@
     cgi.pl                  A simple CGI program.
     chess.pl                An example of formatting using properties.
     colors.pl               Demo of the colour palette and named colours.
+    comments1.pl            Add comments to worksheet cells.
+    comments2.pl            Add comments with advanced options.
     copyformat.pl           Example of copying a cell format.
     diag_border.pl          A simple example of diagonal cell borders.
     easter_egg.pl           Expose the Excel97 flight simulator. A must see.
@@ -6302,6 +6726,7 @@
     merge3.pl               Add hyperlinks to merged cells.
     merge4.pl               An advanced example of merging with formatting.
     merge5.pl               An advanced example of merging with formatting.
+    merge6.pl               An example of merging with Unicode strings.
     mod_perl1.pl            A simple mod_perl 1 program.
     mod_perl2.pl            A simple mod_perl 2 program.
     outline.pl              An example of outlines and grouping.
@@ -6309,6 +6734,7 @@
     protection.pl           Example of cell locking and formula hiding.
     hide_sheet.pl           Simple example of hiding a worksheet.
     repeat.pl               Example of writing repeated formulas.
+    right_to_left.pl        Change default sheet direction to right to left.
     sales.pl                An example of a simple sales spreadsheet.
     sendmail.pl             Send an Excel email attachment using Mail::Sender.
     stats_ext.pl            Same as stats.pl with external references.
@@ -6420,7 +6846,7 @@
 </P>
 <P>
 <A
-HREF="http://search.cpan.org/doc/JMCNAMARA/Spreadsheet-WriteExcel-2.11/WriteExcel/doc/install.html">http://search.cpan.org/doc/JMCNAMARA/Spreadsheet-WriteExcel-2.11/WriteExcel/doc/install.html</A>
+HREF="http://search.cpan.org/src/JMCNAMARA/Spreadsheet-WriteExcel-2.16/INSTALL">http://search.cpan.org/src/JMCNAMARA/Spreadsheet-WriteExcel-2.16/INSTALL</A>
 
 
 </P>
@@ -6586,17 +7012,10 @@
 
 </P>
 <P>
-For a open source implementation of the OLE library see the 'cole' library
-at <A HREF="http://atena.com/libole2.php">http://atena.com/libole2.php</A>
-
-</P>
-<P>
 The source code for the Excel plugin of the Gnumeric spreadsheet also
 contains information relevant to the Excel BIFF format and the OLE
 container, <A
 HREF="http://www.gnome.org/projects/gnumeric/">http://www.gnome.org/projects/gnumeric/</A>
-and <A
-HREF="ftp://ftp.ximian.com/pub/ximian-source/">ftp://ftp.ximian.com/pub/ximian-source/</A>
 
 
 </P>
@@ -6606,10 +7025,8 @@
 
 </P>
 <P>
-An article describing Spreadsheet::WriteExcel and how it works appears in
-Issue #19 of The Perl Journal, <A
-HREF="http://www.samag.com/documents/s=1272/sam05030004/">http://www.samag.com/documents/s=1272/sam05030004/</A>
-It is reproduced, by kind permission, in the <CODE>doc</CODE> directory of the distro.
+An article describing Spreadsheet::WriteExcel and how it works appeared in
+Issue 19 of The Perl Journal. It is reproduced, by kind permission, in the <CODE>doc</CODE> directory of the distro.
 
 </P>
 <P>
@@ -6750,10 +7167,9 @@
 <LI><A NAME="item_xlHtml">xlHtml</A>
 <P>
 This is an open source "Excel to HTML Converter" C/C++ project at <A
-HREF="http://www.xlhtml.org/">http://www.xlhtml.org/</A> See also, the OLE
-Filters Project at <A
-HREF="http://atena.com/libole2.php">http://atena.com/libole2.php</A>
+HREF="http://chicago.sourceforge.net/xlhtml/">http://chicago.sourceforge.net/xlhtml/</A>
 
+
 </P>
 <LI><A NAME="item_DBD">DBD::Excel (reading)</A>
 <P>
@@ -6862,11 +7278,6 @@
 
 </P>
 <P>
-This version of the module doesn't support the <CODE>write_comment()</CODE>
-method. This will be fixed soon.
-
-</P>
-<P>
 XML and UTF8 data on Perl 5.6 can cause Excel files created by
 Spreadsheet::WriteExcel to become corrupt. See <A HREF="#Warning_about_XML_Parser_and_Pe">Warning about XML::Parser and Perl 5.6</A> for further details.
 
@@ -6891,12 +7302,14 @@
 
 </P>
 <P>
-OpenOffice.org: Some formatting is not displayed correctly.
+OpenOffice.org: Images are not displayed. Some formatting is not displayed
+correctly.
 
 </P>
 <P>
-Gnumeric: Some formatting is not displayed correctly. URLs are not
-displayed as links. Page setup can cause Gnumeric to crash.
+Gnumeric: Images are not displayed. Some formatting is not displayed
+correctly. URLs are not displayed as links. Page setup may cause Gnumeric
+to crash.
 
 </P>
 <P>
@@ -6917,8 +7330,9 @@
 
 </P>
 <UL>
-<LI><A NAME="item_Add">Add write_comment().</A>
+<LI><A NAME="item_Fix">Fix insert_bitmap to work with write_comment(), OpenOffice.org and Gnumeric.</A>
 <LI><A NAME="item_Add">Add AutoFilters.</A>
+<LI><A NAME="item_Add">Add better defaults for Excel on the Mac.</A>
 </UL>
 <P>
 Also, here are some of the most requested features that probably won't get
@@ -6976,6 +7390,8 @@
   </td></tr>
 </table>
 
+
+</P>
 <P>
 Alternatively you can keep up to date with future releases by subscribing
 at: <A
@@ -7052,12 +7468,6 @@
 
 </P>
 <P>
-"Spreadsheet::WriteExcel" in The Perl Journal: <A
-HREF="http://www.samag.com/documents/s=1272/sam05030004/">http://www.samag.com/documents/s=1272/sam05030004/</A>
-
-
-</P>
-<P>
 Spreadsheet::WriteExcel documentation in Japanese by Takanori Kawai. <A
 HREF="http://member.nifty.ne.jp/hippo2000/perltips/Spreadsheet/WriteExcel.htm">http://member.nifty.ne.jp/hippo2000/perltips/Spreadsheet/WriteExcel.htm</A>
 
@@ -7138,22 +7548,29 @@
 </P>
 <P>
 <PRE>
-    Olha que coisa mais linda
-    Mais cheia de graça. É ela menina
-    Que vem e que passa
-    Num doce balanço a caminho do mar
+    I saw the best minds of my generation destroyed by
+          madness, starving hysterical naked,
+    dragging themselves through the negro streets at dawn
+          looking for an angry fix,
+    angelheaded hipsters burning for the ancient heavenly
+          connection to the starry dynamo in the machin-
+          ery of night,
+    who poverty and tatters and hollow-eyed and high sat
+          up smoking in the supernatural darkness of
+          cold-water flats floating across the tops of cities
+          contemplating jazz,
 </PRE>
 </P>
 <P>
 <PRE>
-        -- Vinicius de Moraes
+        -- Allen Ginsberg
 </PRE>
 </P>
 <P>
 <HR>
 <H1><A NAME="COPYRIGHT">COPYRIGHT</A></H1>
 <P>
-© MM-MMV, John McNamara.
+© MM-MMVI, John McNamara.
 
 </P>
 <P>

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/README
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/README	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/README	2006-01-17 00:30:29 UTC (rev 1960)
@@ -18,6 +18,8 @@
 cgi.pl                  A simple CGI program.
 chess.pl                An example of formatting using properties.
 colors.pl               Demo of the colour palette and named colours.
+comments1.pl            Add comments to worksheet cells.
+comments2.pl            Add comments with advanced options.
 copyformat.pl           Example of copying a cell format.
 diag_border.pl          A simple example of diagonal cell borders.
 easter_egg.pl           Expose the Excel97 flight simulator. A must see.
@@ -33,6 +35,7 @@
 merge3.pl               Add hyperlinks to merged cells.
 merge4.pl               An advanced example of merging with formatting.
 merge5.pl               An advanced example of merging with formatting.
+merge6.pl               An example of merging with Unicode strings.
 mod_perl1.pl            A simple mod_perl 1 program.
 mod_perl2.pl            A simple mod_perl 2 program.
 outline.pl              An example of outlines and grouping.
@@ -40,6 +43,7 @@
 protection.pl           Example of cell locking and formula hiding.
 hide_sheet.pl           Simple example of hiding a worksheet.
 repeat.pl               Example of writing repeated formulas.
+right_to_left.pl        Change default sheet direction to right to left.
 sales.pl                An example of a simple sales spreadsheet.
 sendmail.pl             Send an Excel email attachment using Mail::Sender.
 stats_ext.pl            Same as stats.pl with external references.

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/bigfile.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/bigfile.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/bigfile.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,29 +1,29 @@
-#!/usr/bin/perl -w
-
-###############################################################################
-#
-# Example of how to extend the Spreadsheet::WriteExcel 7MB limit with
-# OLE::Storage_Lite: http://search.cpan.org/search?dist=OLE-Storage_Lite
-#
-# Nov 2000, Kawai, Takanori (Hippo2000)
-#   Mail: GCD00051 at nifty.ne.jp
-#   http://member.nifty.ne.jp/hippo2000
-#
-
-
-use strict;
-use Spreadsheet::WriteExcel::Big; # Note the name
-
-
-my $workbook  = Spreadsheet::WriteExcel::Big->new("big.xls");
-my $worksheet = $workbook->add_worksheet();
-
-$worksheet->set_column(0, 50, 18);
-
-for my $col (0 .. 50) {
-    for my $row (0 .. 6000) {
-        $worksheet->write($row, $col, "Row: $row Col: $col");
-    }
-}
-
-$workbook->close();
+#!/usr/bin/perl -w
+
+###############################################################################
+#
+# Example of how to extend the Spreadsheet::WriteExcel 7MB limit with
+# OLE::Storage_Lite: http://search.cpan.org/search?dist=OLE-Storage_Lite
+#
+# Nov 2000, Kawai, Takanori (Hippo2000)
+#   Mail: GCD00051 at nifty.ne.jp
+#   http://member.nifty.ne.jp/hippo2000
+#
+
+
+use strict;
+use Spreadsheet::WriteExcel::Big; # Note the name
+
+
+my $workbook  = Spreadsheet::WriteExcel::Big->new("big.xls");
+my $worksheet = $workbook->add_worksheet();
+
+$worksheet->set_column(0, 50, 18);
+
+for my $col (0 .. 50) {
+    for my $row (0 .. 6000) {
+        $worksheet->write($row, $col, "Row: $row Col: $col");
+    }
+}
+
+$workbook->close();

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/bug_report.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/bug_report.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/bug_report.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,139 +1,139 @@
-#!/usr/bin/perl -w
-
-
-###############################################################################
-#
-# A template for submitting a bug report.
-#
-# Run this program and read the output from the command line.
-#
-# reverse('©'), March 2004, John McNamara, jmcnamara at cpan.org
-#
-
-
-use strict;
-
-print << 'HINTS_1';
-
-REPORTING A BUG OR ASKING A QUESTION
-
-    Feel free to report bugs or ask questions. However, to save time
-    consider the following steps first:
-
-    Read the documentation:
-
-        The Spreadsheet::WriteExcel documentation has been refined in
-        response to user questions. Therefore, if you have a question it is
-        possible that someone else has asked it before you and that it is
-        already addressed in the documentation. Since there is a lot of
-        documentation to get through you should at least read the table of
-        contents and search for keywords that you are interested in.
-
-    Look at the example programs:
-
-        There are over 40 example programs shipped with the standard
-        Spreadsheet::WriteExcel distribution. Many of these were created in
-        response to user questions. Try to identify an example program that
-        corresponds to your query and adapt it to your needs.
-
-HINTS_1
-print "Press enter ..."; <STDIN>;
-
-print << 'HINTS_2';
-
-    If you submit a bug report here are some pointers.
-
-    1.  Put "WriteExcel:" at the beginning of the subject line. This helps
-        to filter genuine messages from spam.
-
-    2.  Describe the problems as clearly and as concisely as possible.
-
-    3.  Send a sample program. It is often easier to describe a problem in
-        code than in written prose.
-
-    4.  The sample program should be as small as possible to demonstrate the
-        problem. Don't copy and past large sections of your program. The
-        program should also be self contained and working.
-
-    A sample bug report is generated below. If you use this format then it
-    will help to analyse your question and respond to it more quickly.
-
-    Please don't send patches without contacting the author first.
-
-
-HINTS_2
-print "Press enter ..."; <STDIN>;
-
-
-print << 'EMAIL';
-
-=======================================================================
-
-To:      John McNamara <jmcnamara at cpan.org>
-Subject: WriteExcel: Problem with something.
-
-Hi John,
-
-I am using Spreadsheet::WriteExcel and I have encountered a problem. I
-want it to do SOMETHING but the module appears to do SOMETHING_ELSE.
-
-Here is some code that demonstrates the problem.
-
-    #!/usr/bin/perl -w
-
-    use strict;
-    use Spreadsheet::WriteExcel;
-
-    my $workbook  = Spreadsheet::WriteExcel->new("reload.xls");
-    my $worksheet = $workbook->add_worksheet();
-
-    $worksheet->write(0, 0, "Hi Excel!");
-
-    __END__
-
-
-I tested using Excel XX (or Gnumeric or OpenOffice.org).
-
-My automatically generated system details are as follows:
-EMAIL
-
-
-print "\n    Perl version   : $]";
-print "\n    OS name        : $^O";
-print "\n    Module versions: (not all are required)\n";
-
-
-my @modules = qw(
-                  Spreadsheet::WriteExcel
-                  Parse::RecDescent
-                  File::Temp
-                  OLE::Storage_Lite
-                  IO::Stringy
-                );
-
-
-for my $module (@modules) {
-    my $version;
-    eval "require $module";
-
-    if (not $@) {
-        $version = $module->VERSION;
-        $version = '(unknown)' if not defined $version;
-    }
-    else {
-        $version = '(not installed)';
-    }
-
-    printf "%21s%-24s\t%s\n", "", $module, $version;
-}
-
-
-print << "BYE";
-Yours etc.,
-
-A. Person
---
-
-BYE
-
-__END__
+#!/usr/bin/perl -w
+
+
+###############################################################################
+#
+# A template for submitting a bug report.
+#
+# Run this program and read the output from the command line.
+#
+# reverse('©'), March 2004, John McNamara, jmcnamara at cpan.org
+#
+
+
+use strict;
+
+print << 'HINTS_1';
+
+REPORTING A BUG OR ASKING A QUESTION
+
+    Feel free to report bugs or ask questions. However, to save time
+    consider the following steps first:
+
+    Read the documentation:
+
+        The Spreadsheet::WriteExcel documentation has been refined in
+        response to user questions. Therefore, if you have a question it is
+        possible that someone else has asked it before you and that it is
+        already addressed in the documentation. Since there is a lot of
+        documentation to get through you should at least read the table of
+        contents and search for keywords that you are interested in.
+
+    Look at the example programs:
+
+        There are over 40 example programs shipped with the standard
+        Spreadsheet::WriteExcel distribution. Many of these were created in
+        response to user questions. Try to identify an example program that
+        corresponds to your query and adapt it to your needs.
+
+HINTS_1
+print "Press enter ..."; <STDIN>;
+
+print << 'HINTS_2';
+
+    If you submit a bug report here are some pointers.
+
+    1.  Put "WriteExcel:" at the beginning of the subject line. This helps
+        to filter genuine messages from spam.
+
+    2.  Describe the problems as clearly and as concisely as possible.
+
+    3.  Send a sample program. It is often easier to describe a problem in
+        code than in written prose.
+
+    4.  The sample program should be as small as possible to demonstrate the
+        problem. Don't copy and past large sections of your program. The
+        program should also be self contained and working.
+
+    A sample bug report is generated below. If you use this format then it
+    will help to analyse your question and respond to it more quickly.
+
+    Please don't send patches without contacting the author first.
+
+
+HINTS_2
+print "Press enter ..."; <STDIN>;
+
+
+print << 'EMAIL';
+
+=======================================================================
+
+To:      John McNamara <jmcnamara at cpan.org>
+Subject: WriteExcel: Problem with something.
+
+Hi John,
+
+I am using Spreadsheet::WriteExcel and I have encountered a problem. I
+want it to do SOMETHING but the module appears to do SOMETHING_ELSE.
+
+Here is some code that demonstrates the problem.
+
+    #!/usr/bin/perl -w
+
+    use strict;
+    use Spreadsheet::WriteExcel;
+
+    my $workbook  = Spreadsheet::WriteExcel->new("reload.xls");
+    my $worksheet = $workbook->add_worksheet();
+
+    $worksheet->write(0, 0, "Hi Excel!");
+
+    __END__
+
+
+I tested using Excel XX (or Gnumeric or OpenOffice.org).
+
+My automatically generated system details are as follows:
+EMAIL
+
+
+print "\n    Perl version   : $]";
+print "\n    OS name        : $^O";
+print "\n    Module versions: (not all are required)\n";
+
+
+my @modules = qw(
+                  Spreadsheet::WriteExcel
+                  Parse::RecDescent
+                  File::Temp
+                  OLE::Storage_Lite
+                  IO::Stringy
+                );
+
+
+for my $module (@modules) {
+    my $version;
+    eval "require $module";
+
+    if (not $@) {
+        $version = $module->VERSION;
+        $version = '(unknown)' if not defined $version;
+    }
+    else {
+        $version = '(not installed)';
+    }
+
+    printf "%21s%-24s\t%s\n", "", $module, $version;
+}
+
+
+print << "BYE";
+Yours etc.,
+
+A. Person
+--
+
+BYE
+
+__END__

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/cgi.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/cgi.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/cgi.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,45 +1,45 @@
-#!/usr/bin/perl -w
-
-###############################################################################
-#
-# Example of how to use the Spreadsheet::WriteExcel module to send an Excel
-# file to a browser in a CGI program.
-#
-# On Windows the hash-bang line should be something like:
-# #!C:\Perl\bin\perl.exe
-#
-# reverse('©'), March 2001, John McNamara, jmcnamara at cpan.org
-#
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-# Set the filename and send the content type
-my $filename ="cgitest.xls";
-
-print "Content-type: application/vnd.ms-excel\n";
-# The Content-Disposition will generate a prompt to save the file. If you want
-# to stream the file to the browser, comment out the following line.
-print "Content-Disposition: attachment; filename=$filename\n";
-print "\n";
-
-# Create a new workbook and add a worksheet. The special Perl filehandle - will
-# redirect the output to STDOUT
-#
-my $workbook  = Spreadsheet::WriteExcel->new("-");
-my $worksheet = $workbook->add_worksheet();
-
-
-# Set the column width for column 1
-$worksheet->set_column(0, 0, 20);
-
-
-# Create a format
-my $format = $workbook->add_format();
-$format->set_bold();
-$format->set_size(15);
-$format->set_color('blue');
-
-
-# Write to the workbook
-$worksheet->write(0, 0, "Hi Excel!", $format);
+#!/usr/bin/perl -w
+
+###############################################################################
+#
+# Example of how to use the Spreadsheet::WriteExcel module to send an Excel
+# file to a browser in a CGI program.
+#
+# On Windows the hash-bang line should be something like:
+# #!C:\Perl\bin\perl.exe
+#
+# reverse('©'), March 2001, John McNamara, jmcnamara at cpan.org
+#
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+# Set the filename and send the content type
+my $filename ="cgitest.xls";
+
+print "Content-type: application/vnd.ms-excel\n";
+# The Content-Disposition will generate a prompt to save the file. If you want
+# to stream the file to the browser, comment out the following line.
+print "Content-Disposition: attachment; filename=$filename\n";
+print "\n";
+
+# Create a new workbook and add a worksheet. The special Perl filehandle - will
+# redirect the output to STDOUT
+#
+my $workbook  = Spreadsheet::WriteExcel->new("-");
+my $worksheet = $workbook->add_worksheet();
+
+
+# Set the column width for column 1
+$worksheet->set_column(0, 0, 20);
+
+
+# Create a format
+my $format = $workbook->add_format();
+$format->set_bold();
+$format->set_size(15);
+$format->set_color('blue');
+
+
+# Write to the workbook
+$worksheet->write(0, 0, "Hi Excel!", $format);

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/chess.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/chess.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/chess.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,144 +1,144 @@
-#!/usr/bin/perl -w
-
-########################################################################
-#
-# Example of formatting using the Spreadsheet::WriteExcel module via
-# property hashes.
-#
-# Setting format properties via hashes of values is useful when you have
-# to deal with a large number of similar formats. Consider for example a
-# chess board pattern with black squares, white unformatted squares and
-# a border. This relatively simple example requires 14 separate Format
-# objects although there are only 5 different properties: black
-# background, top border, bottom border, left border and right border.
-# Using property hashes it is possible to define these 5 sets of
-# properties and then add them together to create the 14 Format
-# configurations.
-#
-#
-# reverse('©'), July 2001, John McNamara, jmcnamara at cpan.org
-#
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-my $workbook  = Spreadsheet::WriteExcel->new("chess.xls");
-my $worksheet = $workbook->add_worksheet();
-
-
-# Some row and column formatting
-$worksheet->set_column('B:I', 10);
-
-for my $i (1..8) {
-    $worksheet->set_row($i, 50);
-}
-
-
-# Define the property hashes
-#
-my %black = (
-                'fg_color'  => 'black',
-                'pattern'   => 1,
-            );
-
-my %top     = ( 'top'    => 6 );
-my %bottom  = ( 'bottom' => 6 );
-my %left    = ( 'left'   => 6 );
-my %right   = ( 'right'  => 6 );
-
-
-# Define the formats
-#
-my $format01 = $workbook->add_format(%top,    %left          );
-my $format02 = $workbook->add_format(%top,    %black         );
-my $format03 = $workbook->add_format(%top,                   );
-my $format04 = $workbook->add_format(%top,    %right, %black );
-
-my $format05 = $workbook->add_format(%left                   );
-my $format06 = $workbook->add_format(%black                  );
-my $format07 = $workbook->add_format(                        );
-my $format08 = $workbook->add_format(%right,  %black         );
-my $format09 = $workbook->add_format(%right                  );
-my $format10 = $workbook->add_format(%left,   %black         );
-
-my $format11 = $workbook->add_format(%bottom, %left,  %black );
-my $format12 = $workbook->add_format(%bottom                 );
-my $format13 = $workbook->add_format(%bottom, %black         );
-my $format14 = $workbook->add_format(%bottom, %right         );
-
-
-# Draw the pattern
-$worksheet->write('B2', '', $format01);
-$worksheet->write('C2', '', $format02);
-$worksheet->write('D2', '', $format03);
-$worksheet->write('E2', '', $format02);
-$worksheet->write('F2', '', $format03);
-$worksheet->write('G2', '', $format02);
-$worksheet->write('H2', '', $format03);
-$worksheet->write('I2', '', $format04);
-
-$worksheet->write('B3', '', $format10);
-$worksheet->write('C3', '', $format07);
-$worksheet->write('D3', '', $format06);
-$worksheet->write('E3', '', $format07);
-$worksheet->write('F3', '', $format06);
-$worksheet->write('G3', '', $format07);
-$worksheet->write('H3', '', $format06);
-$worksheet->write('I3', '', $format09);
-
-$worksheet->write('B4', '', $format05);
-$worksheet->write('C4', '', $format06);
-$worksheet->write('D4', '', $format07);
-$worksheet->write('E4', '', $format06);
-$worksheet->write('F4', '', $format07);
-$worksheet->write('G4', '', $format06);
-$worksheet->write('H4', '', $format07);
-$worksheet->write('I4', '', $format08);
-
-$worksheet->write('B5', '', $format10);
-$worksheet->write('C5', '', $format07);
-$worksheet->write('D5', '', $format06);
-$worksheet->write('E5', '', $format07);
-$worksheet->write('F5', '', $format06);
-$worksheet->write('G5', '', $format07);
-$worksheet->write('H5', '', $format06);
-$worksheet->write('I5', '', $format09);
-
-$worksheet->write('B6', '', $format05);
-$worksheet->write('C6', '', $format06);
-$worksheet->write('D6', '', $format07);
-$worksheet->write('E6', '', $format06);
-$worksheet->write('F6', '', $format07);
-$worksheet->write('G6', '', $format06);
-$worksheet->write('H6', '', $format07);
-$worksheet->write('I6', '', $format08);
-
-$worksheet->write('B7', '', $format10);
-$worksheet->write('C7', '', $format07);
-$worksheet->write('D7', '', $format06);
-$worksheet->write('E7', '', $format07);
-$worksheet->write('F7', '', $format06);
-$worksheet->write('G7', '', $format07);
-$worksheet->write('H7', '', $format06);
-$worksheet->write('I7', '', $format09);
-
-$worksheet->write('B8', '', $format05);
-$worksheet->write('C8', '', $format06);
-$worksheet->write('D8', '', $format07);
-$worksheet->write('E8', '', $format06);
-$worksheet->write('F8', '', $format07);
-$worksheet->write('G8', '', $format06);
-$worksheet->write('H8', '', $format07);
-$worksheet->write('I8', '', $format08);
-
-$worksheet->write('B9', '', $format11);
-$worksheet->write('C9', '', $format12);
-$worksheet->write('D9', '', $format13);
-$worksheet->write('E9', '', $format12);
-$worksheet->write('F9', '', $format13);
-$worksheet->write('G9', '', $format12);
-$worksheet->write('H9', '', $format13);
-$worksheet->write('I9', '', $format14);
-
-
-
+#!/usr/bin/perl -w
+
+########################################################################
+#
+# Example of formatting using the Spreadsheet::WriteExcel module via
+# property hashes.
+#
+# Setting format properties via hashes of values is useful when you have
+# to deal with a large number of similar formats. Consider for example a
+# chess board pattern with black squares, white unformatted squares and
+# a border. This relatively simple example requires 14 separate Format
+# objects although there are only 5 different properties: black
+# background, top border, bottom border, left border and right border.
+# Using property hashes it is possible to define these 5 sets of
+# properties and then add them together to create the 14 Format
+# configurations.
+#
+#
+# reverse('©'), July 2001, John McNamara, jmcnamara at cpan.org
+#
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+my $workbook  = Spreadsheet::WriteExcel->new("chess.xls");
+my $worksheet = $workbook->add_worksheet();
+
+
+# Some row and column formatting
+$worksheet->set_column('B:I', 10);
+
+for my $i (1..8) {
+    $worksheet->set_row($i, 50);
+}
+
+
+# Define the property hashes
+#
+my %black = (
+                'fg_color'  => 'black',
+                'pattern'   => 1,
+            );
+
+my %top     = ( 'top'    => 6 );
+my %bottom  = ( 'bottom' => 6 );
+my %left    = ( 'left'   => 6 );
+my %right   = ( 'right'  => 6 );
+
+
+# Define the formats
+#
+my $format01 = $workbook->add_format(%top,    %left          );
+my $format02 = $workbook->add_format(%top,    %black         );
+my $format03 = $workbook->add_format(%top,                   );
+my $format04 = $workbook->add_format(%top,    %right, %black );
+
+my $format05 = $workbook->add_format(%left                   );
+my $format06 = $workbook->add_format(%black                  );
+my $format07 = $workbook->add_format(                        );
+my $format08 = $workbook->add_format(%right,  %black         );
+my $format09 = $workbook->add_format(%right                  );
+my $format10 = $workbook->add_format(%left,   %black         );
+
+my $format11 = $workbook->add_format(%bottom, %left,  %black );
+my $format12 = $workbook->add_format(%bottom                 );
+my $format13 = $workbook->add_format(%bottom, %black         );
+my $format14 = $workbook->add_format(%bottom, %right         );
+
+
+# Draw the pattern
+$worksheet->write('B2', '', $format01);
+$worksheet->write('C2', '', $format02);
+$worksheet->write('D2', '', $format03);
+$worksheet->write('E2', '', $format02);
+$worksheet->write('F2', '', $format03);
+$worksheet->write('G2', '', $format02);
+$worksheet->write('H2', '', $format03);
+$worksheet->write('I2', '', $format04);
+
+$worksheet->write('B3', '', $format10);
+$worksheet->write('C3', '', $format07);
+$worksheet->write('D3', '', $format06);
+$worksheet->write('E3', '', $format07);
+$worksheet->write('F3', '', $format06);
+$worksheet->write('G3', '', $format07);
+$worksheet->write('H3', '', $format06);
+$worksheet->write('I3', '', $format09);
+
+$worksheet->write('B4', '', $format05);
+$worksheet->write('C4', '', $format06);
+$worksheet->write('D4', '', $format07);
+$worksheet->write('E4', '', $format06);
+$worksheet->write('F4', '', $format07);
+$worksheet->write('G4', '', $format06);
+$worksheet->write('H4', '', $format07);
+$worksheet->write('I4', '', $format08);
+
+$worksheet->write('B5', '', $format10);
+$worksheet->write('C5', '', $format07);
+$worksheet->write('D5', '', $format06);
+$worksheet->write('E5', '', $format07);
+$worksheet->write('F5', '', $format06);
+$worksheet->write('G5', '', $format07);
+$worksheet->write('H5', '', $format06);
+$worksheet->write('I5', '', $format09);
+
+$worksheet->write('B6', '', $format05);
+$worksheet->write('C6', '', $format06);
+$worksheet->write('D6', '', $format07);
+$worksheet->write('E6', '', $format06);
+$worksheet->write('F6', '', $format07);
+$worksheet->write('G6', '', $format06);
+$worksheet->write('H6', '', $format07);
+$worksheet->write('I6', '', $format08);
+
+$worksheet->write('B7', '', $format10);
+$worksheet->write('C7', '', $format07);
+$worksheet->write('D7', '', $format06);
+$worksheet->write('E7', '', $format07);
+$worksheet->write('F7', '', $format06);
+$worksheet->write('G7', '', $format07);
+$worksheet->write('H7', '', $format06);
+$worksheet->write('I7', '', $format09);
+
+$worksheet->write('B8', '', $format05);
+$worksheet->write('C8', '', $format06);
+$worksheet->write('D8', '', $format07);
+$worksheet->write('E8', '', $format06);
+$worksheet->write('F8', '', $format07);
+$worksheet->write('G8', '', $format06);
+$worksheet->write('H8', '', $format07);
+$worksheet->write('I8', '', $format08);
+
+$worksheet->write('B9', '', $format11);
+$worksheet->write('C9', '', $format12);
+$worksheet->write('D9', '', $format13);
+$worksheet->write('E9', '', $format12);
+$worksheet->write('F9', '', $format13);
+$worksheet->write('G9', '', $format12);
+$worksheet->write('H9', '', $format13);
+$worksheet->write('I9', '', $format14);
+
+
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/colors.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/colors.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/colors.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,104 +1,102 @@
-#!/usr/bin/perl -w
-
-######################################################################
-#
-# Demonstrates Spreadsheet::WriteExcel's named colors and the Excel
-# color palette.
-#
-# reverse('©'), March 2002, John McNamara, jmcnamara at cpan.org
-#
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-my $workbook = Spreadsheet::WriteExcel->new("colors.xls");
-
-# Some common formats
-my $center  = $workbook->add_format(align => 'center');
-my $heading = $workbook->add_format(align => 'center', bold => 1);
-
-# Try this to see the default Excel 5 palette
-# $workbook->set_palette_xl5();
-
-
-######################################################################
-#
-# Demonstrate the named colors.
-#
-
-my %colors = (
-                0x08, 'black',
-                0x0C, 'blue',
-                0x10, 'brown',
-                0x0F, 'cyan',
-                0x17, 'gray',
-                0x11, 'green',
-                0x0B, 'lime',
-                0x0E, 'magenta',
-                0x12, 'navy',
-                0x35, 'orange',
-                0x14, 'purple',
-                0x0A, 'red',
-                0x16, 'silver',
-                0x09, 'white',
-                0x0D, 'yellow',
-             );
-
-my $worksheet1 = $workbook->add_worksheet('Named colors');
-
-$worksheet1->set_column(0, 3, 15);
-
-$worksheet1->write(0, 0, "Index", $heading);
-$worksheet1->write(0, 1, "Index", $heading);
-$worksheet1->write(0, 2, "Name",  $heading);
-$worksheet1->write(0, 3, "Color", $heading);
-
-my $i = 1;
-
-while (my($index, $color) = each %colors) {
-    my $format = $workbook->add_format(
-                                        fg_color => $color,
-                                        pattern  => 1,
-                                        border   => 1
-                                     );
-
-    $worksheet1->write($i+1, 0, $index,                    $center);
-    $worksheet1->write($i+1, 1, sprintf("0x%02X", $index), $center);
-    $worksheet1->write($i+1, 2, $color,                    $center);
-    $worksheet1->write($i+1, 3, '',                        $format);
-    $i++;
-}
-
-
-######################################################################
-#
-# Demonstrate the standard Excel colors in the range 8..63.
-#
-
-my $worksheet2 = $workbook->add_worksheet('Standard colors');
-
-$worksheet2->set_column(0, 3, 15);
-
-$worksheet2->write(0, 0, "Index", $heading);
-$worksheet2->write(0, 1, "Index", $heading);
-$worksheet2->write(0, 2, "Color", $heading);
-$worksheet2->write(0, 3, "Name",  $heading);
-
-for my $i (8..63) {
-    my $format = $workbook->add_format(
-                                        fg_color => $i,
-                                        pattern  => 1,
-                                        border   => 1
-                                     );
-
-    $worksheet2->write(($i -7), 0, $i,                    $center);
-    $worksheet2->write(($i -7), 1, sprintf("0x%02X", $i), $center);
-    $worksheet2->write(($i -7), 2, '',                    $format);
-
-    # Add the  color names
-    if (exists $colors{$i}) {
-        $worksheet2->write(($i -7), 3, $colors{$i}, $center);
-
-    }
-}
-
+#!/usr/bin/perl -w
+
+######################################################################
+#
+# Demonstrates Spreadsheet::WriteExcel's named colors and the Excel
+# color palette.
+#
+# reverse('©'), March 2002, John McNamara, jmcnamara at cpan.org
+#
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+my $workbook = Spreadsheet::WriteExcel->new("colors.xls");
+
+# Some common formats
+my $center  = $workbook->add_format(align => 'center');
+my $heading = $workbook->add_format(align => 'center', bold => 1);
+
+
+######################################################################
+#
+# Demonstrate the named colors.
+#
+
+my %colors = (
+                0x08, 'black',
+                0x0C, 'blue',
+                0x10, 'brown',
+                0x0F, 'cyan',
+                0x17, 'gray',
+                0x11, 'green',
+                0x0B, 'lime',
+                0x0E, 'magenta',
+                0x12, 'navy',
+                0x35, 'orange',
+                0x21, 'pink',
+                0x14, 'purple',
+                0x0A, 'red',
+                0x16, 'silver',
+                0x09, 'white',
+                0x0D, 'yellow',
+             );
+
+my $worksheet1 = $workbook->add_worksheet('Named colors');
+
+$worksheet1->set_column(0, 3, 15);
+
+$worksheet1->write(0, 0, "Index", $heading);
+$worksheet1->write(0, 1, "Index", $heading);
+$worksheet1->write(0, 2, "Name",  $heading);
+$worksheet1->write(0, 3, "Color", $heading);
+
+my $i = 1;
+
+while (my($index, $color) = each %colors) {
+    my $format = $workbook->add_format(
+                                        fg_color => $color,
+                                        pattern  => 1,
+                                        border   => 1
+                                     );
+
+    $worksheet1->write($i+1, 0, $index,                    $center);
+    $worksheet1->write($i+1, 1, sprintf("0x%02X", $index), $center);
+    $worksheet1->write($i+1, 2, $color,                    $center);
+    $worksheet1->write($i+1, 3, '',                        $format);
+    $i++;
+}
+
+
+######################################################################
+#
+# Demonstrate the standard Excel colors in the range 8..63.
+#
+
+my $worksheet2 = $workbook->add_worksheet('Standard colors');
+
+$worksheet2->set_column(0, 3, 15);
+
+$worksheet2->write(0, 0, "Index", $heading);
+$worksheet2->write(0, 1, "Index", $heading);
+$worksheet2->write(0, 2, "Color", $heading);
+$worksheet2->write(0, 3, "Name",  $heading);
+
+for my $i (8..63) {
+    my $format = $workbook->add_format(
+                                        fg_color => $i,
+                                        pattern  => 1,
+                                        border   => 1
+                                     );
+
+    $worksheet2->write(($i -7), 0, $i,                    $center);
+    $worksheet2->write(($i -7), 1, sprintf("0x%02X", $i), $center);
+    $worksheet2->write(($i -7), 2, '',                    $format);
+
+    # Add the  color names
+    if (exists $colors{$i}) {
+        $worksheet2->write(($i -7), 3, $colors{$i}, $center);
+
+    }
+}
+

Copied: packages/libspreadsheet-writeexcel-perl/trunk/examples/comments1.pl (from rev 1957, packages/libspreadsheet-writeexcel-perl/branches/upstream/current/examples/comments1.pl)

Copied: packages/libspreadsheet-writeexcel-perl/trunk/examples/comments2.pl (from rev 1957, packages/libspreadsheet-writeexcel-perl/branches/upstream/current/examples/comments2.pl)

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/convertA1.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/convertA1.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/convertA1.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,219 +1,219 @@
-#!/usr/bin/perl -w
-
-###############################################################################
-#
-# This program contains helper functions to deal with the Excel A1 cell
-# reference  notation.
-#
-# These functions have been superceded by Spreadsheet::WriteExcel::Utility.
-#
-# reverse('©'), March 2001, John McNamara, jmcnamara at cpan.org
-#
-
-use strict;
-
-print "\n";
-print "Cell B7   is equivalent to (";
-print join " ", cell_to_rowcol('B7');
-print ") in row column notation.\n";
-
-print "Cell \$B7  is equivalent to (";
-print join " ", cell_to_rowcol('$B7');
-print ") in row column notation.\n";
-
-print "Cell B\$7  is equivalent to (";
-print join " ", cell_to_rowcol('B$7');
-print ") in row column notation.\n";
-
-print "Cell \$B\$7 is equivalent to (";
-print join " ", cell_to_rowcol('$B$7');
-print ") in row column notation.\n\n";
-
-print "Row and column (1999, 29)       are equivalent to ";
-print rowcol_to_cell(1999, 29),   ".\n";
-
-print "Row and column (1999, 29, 0, 1) are equivalent to ";
-print rowcol_to_cell(1999, 29, 0, 1),   ".\n\n";
-
-print "The base cell is:     Z7\n";
-print "Increment the row:    ", inc_cell_row('Z7'), "\n";
-print "Decrement the row:    ", dec_cell_row('Z7'), "\n";
-print "Increment the column: ", inc_cell_col('Z7'), "\n";
-print "Decrement the column: ", dec_cell_col('Z7'), "\n\n";
-
-
-###############################################################################
-#
-# rowcol_to_cell($row, $col, $row_absolute, $col_absolute)
-#
-# Convert a zero based row and column reference to a A1 reference. For example
-# (0, 2) to C1. $row_absolute, $col_absolute are optional. They are boolean
-# values used to indicate if the row or column value is absolute, i.e. if it is
-# prefixed by a $ sign: eg. (0, 2, 0, 1) converts to $C1.
-#
-# Returns: a cell reference string.
-#
-sub rowcol_to_cell {
-
-    my $row     = $_[0];
-    my $col     = $_[1];
-    my $row_abs = $_[2] || 0;
-    my $col_abs = $_[3] || 0;
-
-
-    if ($row_abs) {
-        $row_abs = '$'
-    }
-    else {
-        $row_abs = ''
-    }
-
-    if ($col_abs) {
-        $col_abs = '$'
-    }
-    else {
-        $col_abs = ''
-    }
-
-
-    my $int  = int ($col / 26);
-    my $frac = $col % 26 +1;
-
-    my $chr1 ='';
-    my $chr2 ='';
-
-
-    if ($frac != 0) {
-        $chr2 = chr (ord('A') + $frac -1);;
-    }
-
-    if ($int > 0) {
-        $chr1 = chr (ord('A') + $int  -1);
-    }
-
-    $row++;     # Zero index to 1-index
-
-    return $col_abs . $chr1 . $chr2 . $row_abs. $row;
-}
-
-
-###############################################################################
-#
-# cell_to_rowcol($cell_ref)
-#
-# Convert an Excel cell reference in A1 notation to a zero based row and column
-# reference; converts C1 to (0, 2, 0, 0).
-#
-# Returns: row, column, row_is_absolute, column_is_absolute
-#
-#
-sub cell_to_rowcol {
-
-    my $cell = shift;
-
-    $cell =~ /(\$?)([A-I]?[A-Z])(\$?)(\d+)/;
-
-    my $col_abs = $1 eq "" ? 0 : 1;
-    my $col     = $2;
-    my $row_abs = $3 eq "" ? 0 : 1;
-    my $row     = $4;
-
-    # Convert base26 column string to number
-    # All your Base are belong to us.
-    my @chars  = split //, $col;
-    my $expn   = 0;
-    $col       = 0;
-
-    while (@chars) {
-        my $char = pop(@chars); # LS char first
-        $col += (ord($char) -ord('A') +1) * (26**$expn);
-        $expn++;
-    }
-
-    # Convert 1-index to zero-index
-    $row--;
-    $col--;
-
-    return $row, $col, $row_abs, $col_abs;
-}
-
-
-###############################################################################
-#
-# inc_cell_row($cell_ref)
-#
-# Increments the row number of an Excel cell reference in A1 notation.
-# For example C3 to C4
-#
-# Returns: a cell reference string.
-#
-sub inc_cell_row {
-
-    my $cell = shift;
-    my ($row, $col, $row_abs, $col_abs) = cell_to_rowcol($cell);
-
-    $row++;
-
-    return rowcol_to_cell($row, $col, $row_abs, $col_abs);
-}
-
-
-###############################################################################
-#
-# dec_cell_row($cell_ref)
-#
-# Decrements the row number of an Excel cell reference in A1 notation.
-# For example C4 to C3
-#
-# Returns: a cell reference string.
-#
-sub dec_cell_row {
-
-    my $cell = shift;
-    my ($row, $col, $row_abs, $col_abs) = cell_to_rowcol($cell);
-
-    $row--;
-
-    return rowcol_to_cell($row, $col, $row_abs, $col_abs);
-}
-
-
-###############################################################################
-#
-# inc_cell_col($cell_ref)
-#
-# Increments the column number of an Excel cell reference in A1 notation.
-# For example C3 to D3
-#
-# Returns: a cell reference string.
-#
-sub inc_cell_col {
-
-    my $cell = shift;
-    my ($row, $col, $row_abs, $col_abs) = cell_to_rowcol($cell);
-
-    $col++;
-
-    return rowcol_to_cell($row, $col, $row_abs, $col_abs);
-}
-
-
-###############################################################################
-#
-# dec_cell_col($cell_ref)
-#
-# Decrements the column number of an Excel cell reference in A1 notation.
-# For example D3 to C3
-#
-# Returns: a cell reference string.
-#
-sub dec_cell_col {
-
-    my $cell = shift;
-    my ($row, $col, $row_abs, $col_abs) = cell_to_rowcol($cell);
-
-    $col--;
-
-    return rowcol_to_cell($row, $col, $row_abs, $col_abs);
-}
-
+#!/usr/bin/perl -w
+
+###############################################################################
+#
+# This program contains helper functions to deal with the Excel A1 cell
+# reference  notation.
+#
+# These functions have been superceded by Spreadsheet::WriteExcel::Utility.
+#
+# reverse('©'), March 2001, John McNamara, jmcnamara at cpan.org
+#
+
+use strict;
+
+print "\n";
+print "Cell B7   is equivalent to (";
+print join " ", cell_to_rowcol('B7');
+print ") in row column notation.\n";
+
+print "Cell \$B7  is equivalent to (";
+print join " ", cell_to_rowcol('$B7');
+print ") in row column notation.\n";
+
+print "Cell B\$7  is equivalent to (";
+print join " ", cell_to_rowcol('B$7');
+print ") in row column notation.\n";
+
+print "Cell \$B\$7 is equivalent to (";
+print join " ", cell_to_rowcol('$B$7');
+print ") in row column notation.\n\n";
+
+print "Row and column (1999, 29)       are equivalent to ";
+print rowcol_to_cell(1999, 29),   ".\n";
+
+print "Row and column (1999, 29, 0, 1) are equivalent to ";
+print rowcol_to_cell(1999, 29, 0, 1),   ".\n\n";
+
+print "The base cell is:     Z7\n";
+print "Increment the row:    ", inc_cell_row('Z7'), "\n";
+print "Decrement the row:    ", dec_cell_row('Z7'), "\n";
+print "Increment the column: ", inc_cell_col('Z7'), "\n";
+print "Decrement the column: ", dec_cell_col('Z7'), "\n\n";
+
+
+###############################################################################
+#
+# rowcol_to_cell($row, $col, $row_absolute, $col_absolute)
+#
+# Convert a zero based row and column reference to a A1 reference. For example
+# (0, 2) to C1. $row_absolute, $col_absolute are optional. They are boolean
+# values used to indicate if the row or column value is absolute, i.e. if it is
+# prefixed by a $ sign: eg. (0, 2, 0, 1) converts to $C1.
+#
+# Returns: a cell reference string.
+#
+sub rowcol_to_cell {
+
+    my $row     = $_[0];
+    my $col     = $_[1];
+    my $row_abs = $_[2] || 0;
+    my $col_abs = $_[3] || 0;
+
+
+    if ($row_abs) {
+        $row_abs = '$'
+    }
+    else {
+        $row_abs = ''
+    }
+
+    if ($col_abs) {
+        $col_abs = '$'
+    }
+    else {
+        $col_abs = ''
+    }
+
+
+    my $int  = int ($col / 26);
+    my $frac = $col % 26 +1;
+
+    my $chr1 ='';
+    my $chr2 ='';
+
+
+    if ($frac != 0) {
+        $chr2 = chr (ord('A') + $frac -1);;
+    }
+
+    if ($int > 0) {
+        $chr1 = chr (ord('A') + $int  -1);
+    }
+
+    $row++;     # Zero index to 1-index
+
+    return $col_abs . $chr1 . $chr2 . $row_abs. $row;
+}
+
+
+###############################################################################
+#
+# cell_to_rowcol($cell_ref)
+#
+# Convert an Excel cell reference in A1 notation to a zero based row and column
+# reference; converts C1 to (0, 2, 0, 0).
+#
+# Returns: row, column, row_is_absolute, column_is_absolute
+#
+#
+sub cell_to_rowcol {
+
+    my $cell = shift;
+
+    $cell =~ /(\$?)([A-I]?[A-Z])(\$?)(\d+)/;
+
+    my $col_abs = $1 eq "" ? 0 : 1;
+    my $col     = $2;
+    my $row_abs = $3 eq "" ? 0 : 1;
+    my $row     = $4;
+
+    # Convert base26 column string to number
+    # All your Base are belong to us.
+    my @chars  = split //, $col;
+    my $expn   = 0;
+    $col       = 0;
+
+    while (@chars) {
+        my $char = pop(@chars); # LS char first
+        $col += (ord($char) -ord('A') +1) * (26**$expn);
+        $expn++;
+    }
+
+    # Convert 1-index to zero-index
+    $row--;
+    $col--;
+
+    return $row, $col, $row_abs, $col_abs;
+}
+
+
+###############################################################################
+#
+# inc_cell_row($cell_ref)
+#
+# Increments the row number of an Excel cell reference in A1 notation.
+# For example C3 to C4
+#
+# Returns: a cell reference string.
+#
+sub inc_cell_row {
+
+    my $cell = shift;
+    my ($row, $col, $row_abs, $col_abs) = cell_to_rowcol($cell);
+
+    $row++;
+
+    return rowcol_to_cell($row, $col, $row_abs, $col_abs);
+}
+
+
+###############################################################################
+#
+# dec_cell_row($cell_ref)
+#
+# Decrements the row number of an Excel cell reference in A1 notation.
+# For example C4 to C3
+#
+# Returns: a cell reference string.
+#
+sub dec_cell_row {
+
+    my $cell = shift;
+    my ($row, $col, $row_abs, $col_abs) = cell_to_rowcol($cell);
+
+    $row--;
+
+    return rowcol_to_cell($row, $col, $row_abs, $col_abs);
+}
+
+
+###############################################################################
+#
+# inc_cell_col($cell_ref)
+#
+# Increments the column number of an Excel cell reference in A1 notation.
+# For example C3 to D3
+#
+# Returns: a cell reference string.
+#
+sub inc_cell_col {
+
+    my $cell = shift;
+    my ($row, $col, $row_abs, $col_abs) = cell_to_rowcol($cell);
+
+    $col++;
+
+    return rowcol_to_cell($row, $col, $row_abs, $col_abs);
+}
+
+
+###############################################################################
+#
+# dec_cell_col($cell_ref)
+#
+# Decrements the column number of an Excel cell reference in A1 notation.
+# For example D3 to C3
+#
+# Returns: a cell reference string.
+#
+sub dec_cell_col {
+
+    my $cell = shift;
+    my ($row, $col, $row_abs, $col_abs) = cell_to_rowcol($cell);
+
+    $col--;
+
+    return rowcol_to_cell($row, $col, $row_abs, $col_abs);
+}
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/copyformat.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/copyformat.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/copyformat.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,49 +1,49 @@
-#!/usr/bin/perl -w
-
-###############################################################################
-#
-# Example of how to use the format copying method with Spreadsheet::WriteExcel #
-# reverse('©'), March 2001, John McNamara, jmcnamara at cpan.org
-#
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-# Create workbook1
-my $workbook1       = Spreadsheet::WriteExcel->new("workbook1.xls");
-my $worksheet1      = $workbook1->add_worksheet();
-my $format1a        = $workbook1->add_format();
-my $format1b        = $workbook1->add_format();
-
-# Create workbook2
-my $workbook2       = Spreadsheet::WriteExcel->new("workbook2.xls");
-my $worksheet2      = $workbook2->add_worksheet();
-my $format2a        = $workbook2->add_format();
-my $format2b        = $workbook2->add_format();
-
-
-# Create a global format object that isn't tied to a workbook
-my $global_format   = Spreadsheet::WriteExcel::Format->new();
-
-# Set the formatting
-$global_format->set_color('blue');
-$global_format->set_bold();
-$global_format->set_italic();
-
-# Create another example format
-$format1b->set_color('red');
-
-# Copy the global format properties to the worksheet formats
-$format1a->copy($global_format);
-$format2a->copy($global_format);
-
-# Copy a format from worksheet1 to worksheet2
-$format2b->copy($format1b);
-
-# Write some output
-$worksheet1->write(0, 0, "Ciao", $format1a);
-$worksheet1->write(1, 0, "Ciao", $format1b);
-
-$worksheet2->write(0, 0, "Hello", $format2a);
-$worksheet2->write(1, 0, "Hello", $format2b);
-
+#!/usr/bin/perl -w
+
+###############################################################################
+#
+# Example of how to use the format copying method with Spreadsheet::WriteExcel #
+# reverse('©'), March 2001, John McNamara, jmcnamara at cpan.org
+#
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+# Create workbook1
+my $workbook1       = Spreadsheet::WriteExcel->new("workbook1.xls");
+my $worksheet1      = $workbook1->add_worksheet();
+my $format1a        = $workbook1->add_format();
+my $format1b        = $workbook1->add_format();
+
+# Create workbook2
+my $workbook2       = Spreadsheet::WriteExcel->new("workbook2.xls");
+my $worksheet2      = $workbook2->add_worksheet();
+my $format2a        = $workbook2->add_format();
+my $format2b        = $workbook2->add_format();
+
+
+# Create a global format object that isn't tied to a workbook
+my $global_format   = Spreadsheet::WriteExcel::Format->new();
+
+# Set the formatting
+$global_format->set_color('blue');
+$global_format->set_bold();
+$global_format->set_italic();
+
+# Create another example format
+$format1b->set_color('red');
+
+# Copy the global format properties to the worksheet formats
+$format1a->copy($global_format);
+$format2a->copy($global_format);
+
+# Copy a format from worksheet1 to worksheet2
+$format2b->copy($format1b);
+
+# Write some output
+$worksheet1->write(0, 0, "Ciao", $format1a);
+$worksheet1->write(1, 0, "Ciao", $format1b);
+
+$worksheet2->write(0, 0, "Hello", $format2a);
+$worksheet2->write(1, 0, "Hello", $format2b);
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/csv2xls.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/csv2xls.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/csv2xls.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,54 +1,54 @@
-#!/usr/bin/perl -w
-
-###############################################################################
-#
-# Example of how to use the WriteExcel module
-#
-# Program to convert a CSV comma-separated value file into an Excel file.
-# This is more or less an non-op since Excel can read CSV files.
-# The program uses Text::CSV_XS to parse the CSV.
-#
-# Usage: csv2xls.pl file.csv newfile.xls
-#
-# reverse('©'), March 2001, John McNamara, jmcnamara at cpan.org
-#
-
-use strict;
-use Spreadsheet::WriteExcel;
-use Text::CSV_XS;
-
-# Check for valid number of arguments
-if (($#ARGV < 1) || ($#ARGV > 2)) {
-   die("Usage: csv2xls csvfile.txt newfile.xls\n");
-};
-
-# Open the Comma Separated Variable file
-open (CSVFILE, $ARGV[0]) or die "$ARGV[0]: $!";
-
-# Create a new Excel workbook
-my $workbook  = Spreadsheet::WriteExcel->new($ARGV[1]);
-my $worksheet = $workbook->add_worksheet();
-
-# Create a new CSV parsing object
-my $csv = Text::CSV_XS->new;
-
-# Row and column are zero indexed
-my $row = 0;
-
-
-while (<CSVFILE>) {
-    if ($csv->parse($_)) {
-        my @Fld = $csv->fields;
-
-        my $col = 0;
-        foreach my $token (@Fld) {
-            $worksheet->write($row, $col, $token);
-            $col++;
-        }
-        $row++;
-    }
-    else {
-        my $err = $csv->error_input;
-        print "Text::CSV_XS parse() failed on argument: ", $err, "\n";
-    }
-}
+#!/usr/bin/perl -w
+
+###############################################################################
+#
+# Example of how to use the WriteExcel module
+#
+# Program to convert a CSV comma-separated value file into an Excel file.
+# This is more or less an non-op since Excel can read CSV files.
+# The program uses Text::CSV_XS to parse the CSV.
+#
+# Usage: csv2xls.pl file.csv newfile.xls
+#
+# reverse('©'), March 2001, John McNamara, jmcnamara at cpan.org
+#
+
+use strict;
+use Spreadsheet::WriteExcel;
+use Text::CSV_XS;
+
+# Check for valid number of arguments
+if (($#ARGV < 1) || ($#ARGV > 2)) {
+   die("Usage: csv2xls csvfile.txt newfile.xls\n");
+};
+
+# Open the Comma Separated Variable file
+open (CSVFILE, $ARGV[0]) or die "$ARGV[0]: $!";
+
+# Create a new Excel workbook
+my $workbook  = Spreadsheet::WriteExcel->new($ARGV[1]);
+my $worksheet = $workbook->add_worksheet();
+
+# Create a new CSV parsing object
+my $csv = Text::CSV_XS->new;
+
+# Row and column are zero indexed
+my $row = 0;
+
+
+while (<CSVFILE>) {
+    if ($csv->parse($_)) {
+        my @Fld = $csv->fields;
+
+        my $col = 0;
+        foreach my $token (@Fld) {
+            $worksheet->write($row, $col, $token);
+            $col++;
+        }
+        $row++;
+    }
+    else {
+        my $err = $csv->error_input;
+        print "Text::CSV_XS parse() failed on argument: ", $err, "\n";
+    }
+}

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/date_time.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/date_time.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/date_time.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,90 +1,90 @@
-#!/usr/bin/perl -w
-
-###############################################################################
-#
-# Spreadsheet::WriteExcel example of writing dates and times using the
-# write_date_time() Worksheet method.
-#
-# reverse('©'), August 2004, John McNamara, jmcnamara at cpan.org
-#
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-
-# Create a new workbook and add a worksheet
-my $workbook  = Spreadsheet::WriteExcel->new("date_time.xls");
-my $worksheet = $workbook->add_worksheet();
-my $bold      = $workbook->add_format(bold => 1);
-my $row       = 0;
-
-
-# Expand the first column so that the date is visible.
-$worksheet->set_column("A:B", 30);
-
-
-# Write the column headers
-$worksheet->write('A1', 'Formatted date', $bold);
-$worksheet->write('B1', 'Format',         $bold);
-
-
-# Examples date and time formats. In the output file compare how changing
-# the format codes change the appearance of the date.
-#
-my @date_formats = (
-    'dd/mm/yy',
-    'mm/dd/yy',
-    '',
-    'd mm yy',
-    'dd mm yy',
-    '',
-    'dd m yy',
-    'dd mm yy',
-    'dd mmm yy',
-    'dd mmmm yy',
-    '',
-    'dd mm y',
-    'dd mm yyy',
-    'dd mm yyyy',
-    '',
-    'd mmmm yyyy',
-    '',
-    'dd/mm/yy',
-    'dd/mm/yy hh:mm',
-    'dd/mm/yy hh:mm:ss',
-    'dd/mm/yy hh:mm:ss.000',
-    '',
-    'hh:mm',
-    'hh:mm:ss',
-    'hh:mm:ss.000',
-);
-
-
-# Write the same date and time using each of the above formats. The empty
-# string formats create a blank line to make the example clearer.
-#
-for my $date_format (@date_formats) {
-    $row++;
-    next if $date_format eq '';
-
-    # Create a format for the date or time.
-    my $format =  $workbook->add_format(
-                                        num_format => $date_format,
-                                        align      => 'left'
-                                       );
-
-    # Write the same date using different formats.
-    $worksheet->write_date_time($row, 0, '2004-08-01T12:30:45.123', $format);
-    $worksheet->write          ($row, 1, $date_format);
-}
-
-
-# The following is an example of an invalid date. It is written as a string instead
-# of a number. This is also Excel's default behaviour.
-#
-$row += 2;
-$worksheet->write_date_time($row, 0, '2004-13-01T12:30:45.123');
-$worksheet->write          ($row, 1, 'Invalid date. Written as string.', $bold);
-
-__END__
-
+#!/usr/bin/perl -w
+
+###############################################################################
+#
+# Spreadsheet::WriteExcel example of writing dates and times using the
+# write_date_time() Worksheet method.
+#
+# reverse('©'), August 2004, John McNamara, jmcnamara at cpan.org
+#
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+
+# Create a new workbook and add a worksheet
+my $workbook  = Spreadsheet::WriteExcel->new("date_time.xls");
+my $worksheet = $workbook->add_worksheet();
+my $bold      = $workbook->add_format(bold => 1);
+my $row       = 0;
+
+
+# Expand the first column so that the date is visible.
+$worksheet->set_column("A:B", 30);
+
+
+# Write the column headers
+$worksheet->write('A1', 'Formatted date', $bold);
+$worksheet->write('B1', 'Format',         $bold);
+
+
+# Examples date and time formats. In the output file compare how changing
+# the format codes change the appearance of the date.
+#
+my @date_formats = (
+    'dd/mm/yy',
+    'mm/dd/yy',
+    '',
+    'd mm yy',
+    'dd mm yy',
+    '',
+    'dd m yy',
+    'dd mm yy',
+    'dd mmm yy',
+    'dd mmmm yy',
+    '',
+    'dd mm y',
+    'dd mm yyy',
+    'dd mm yyyy',
+    '',
+    'd mmmm yyyy',
+    '',
+    'dd/mm/yy',
+    'dd/mm/yy hh:mm',
+    'dd/mm/yy hh:mm:ss',
+    'dd/mm/yy hh:mm:ss.000',
+    '',
+    'hh:mm',
+    'hh:mm:ss',
+    'hh:mm:ss.000',
+);
+
+
+# Write the same date and time using each of the above formats. The empty
+# string formats create a blank line to make the example clearer.
+#
+for my $date_format (@date_formats) {
+    $row++;
+    next if $date_format eq '';
+
+    # Create a format for the date or time.
+    my $format =  $workbook->add_format(
+                                        num_format => $date_format,
+                                        align      => 'left'
+                                       );
+
+    # Write the same date using different formats.
+    $worksheet->write_date_time($row, 0, '2004-08-01T12:30:45.123', $format);
+    $worksheet->write          ($row, 1, $date_format);
+}
+
+
+# The following is an example of an invalid date. It is written as a string instead
+# of a number. This is also Excel's default behaviour.
+#
+$row += 2;
+$worksheet->write_date_time($row, 0, '2004-13-01T12:30:45.123');
+$worksheet->write          ($row, 1, 'Invalid date. Written as string.', $bold);
+
+__END__
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/datecalc1.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/datecalc1.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/datecalc1.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,213 +1,213 @@
-#!/usr/bin/perl -w
-
-
-#
-# NOTE: An easier way of writing dates and times is to use the newer
-#       write_date_time() Worksheet method. See the date_time.pl example.
-#
-
-
-######################################################################
-#
-# Demonstration of writing date/time cells to Excel spreadsheets,
-# using UNIX/Perl time as source of date/time.
-#
-# Copyright 2000, Andrew Benham, adsb at bigfoot.com
-#
-######################################################################
-#
-# UNIX/Perl time is the time since the Epoch (00:00:00 GMT, 1 Jan 1970)
-# measured in seconds.
-#
-# An Excel file can use exactly one of two different date/time systems.
-# In these systems, a floating point number represents the number of days
-# (and fractional parts of the day) since a start point. The floating point
-# number is referred to as a 'serial'.
-# The two systems ('1900' and '1904') use different starting points:
-#  '1900'; '1.00' is 1 Jan 1900 BUT 1900 is erroneously regarded as
-#          a leap year - see:
-#            http://support.microsoft.com/support/kb/articles/Q181/3/70.asp
-#          for the excuse^H^H^H^H^H^Hreason.
-#  '1904'; '1.00' is 2 Jan 1904.
-#
-# The '1904' system is the default for Apple Macs. Windows versions of
-# Excel have the option to use the '1904' system.
-#
-# Note that Visual Basic's "DateSerial" function does NOT erroneously
-# regard 1900 as a leap year, and thus its serials do not agree with
-# the 1900 serials of Excel for dates before 1 Mar 1900.
-#
-# Note that StarOffice (at least at version 5.2) does NOT erroneously
-# regard 1900 as a leap year, and thus its serials do not agree with
-# the 1900 serials of Excel for dates before 1 Mar 1900.
-#
-######################################################################
-#
-# Calculation description
-# =======================
-#
-# 1900 system
-# -----------
-# Unix time is '0' at 00:00:00 GMT 1 Jan 1970, i.e. 70 years after 1 Jan 1900.
-# Of those 70 years, 17 (1904,08,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68)
-# were leap years with an extra day.
-# Thus there were 17 + 70*365 days = 25567 days between 1 Jan 1900 and
-# 1 Jan 1970.
-# In the 1900 system, '1' is 1 Jan 1900, but as 1900 was not a leap year
-# 1 Jan 1900 should really be '2', so 1 Jan 1970 is '25569'.
-#
-# 1904 system
-# -----------
-# Unix time is '0' at 00:00:00 GMT 1 Jan 1970, i.e. 66 years after 1 Jan 1904.
-# Of those 66 years, 17 (1904,08,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68)
-# were leap years with an extra day.
-# Thus there were 17 + 66*365 days = 24107 days between 1 Jan 1904 and
-# 1 Jan 1970.
-# In the 1904 system, 2 Jan 1904 being '1', 1 Jan 1970 is '24107'.
-#
-######################################################################
-#
-# Copyright (c) 2000, Andrew Benham.
-# This program is free software. It may be used, redistributed and/or
-# modified under the same terms as Perl itself.
-#
-# Andrew Benham, adsb at bigfoot.com
-# London, United Kingdom
-# 11 Nov 2000
-#
-######################################################################
-
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-use Time::Local;
-
-use vars qw/$DATE_SYSTEM/;
-
-# Use 1900 date system on all platforms other than Apple Mac (for which
-# use 1904 date system).
-$DATE_SYSTEM = ($^O eq 'MacOS') ? 1 : 0;
-
-my $workbook = Spreadsheet::WriteExcel->new("dates.xls");
-my $worksheet = $workbook->add_worksheet();
-
-my $format_date =  $workbook->add_format();
-$format_date->set_num_format('d mmmm yyy');
-
-$worksheet->set_column(0,1,21);
-
-$worksheet->write_string (0,0,"The epoch (GMT)");
-$worksheet->write_number (0,1,&calc_serial(0,1),0x16);
-
-$worksheet->write_string (1,0,"The epoch (localtime)");
-$worksheet->write_number (1,1,&calc_serial(0,0),0x16);
-
-$worksheet->write_string (2,0,"Today");
-$worksheet->write_number (2,1,&calc_serial(),$format_date);
-
-my $christmas2000 = timelocal(0,0,0,25,11,100);
-$worksheet->write_string (3,0,"Christmas 2000");
-$worksheet->write_number (3,1,&calc_serial($christmas2000),$format_date);
-
-$workbook->close();
-
-#-----------------------------------------------------------
-# calc_serial()
-#
-# Called with (up to) 2 parameters.
-#   1.  Unix timestamp.  If omitted, uses current time.
-#   2.  GMT flag. Set to '1' to return serial in GMT.
-#       If omitted, returns serial in appropriate timezone.
-#
-# Returns date/time serial according to $DATE_SYSTEM selected
-#-----------------------------------------------------------
-sub calc_serial {
-	my $time = (defined $_[0]) ? $_[0] : time();
-	my $gmtflag = (defined $_[1]) ? $_[1] : 0;
-
-	# Divide timestamp by number of seconds in a day.
-	# This gives a date serial with '0' on 1 Jan 1970.
-	my $serial = $time / 86400;
-
-	# Adjust the date serial by the offset appropriate to the
-	# currently selected system (1900/1904).
-	if ($DATE_SYSTEM == 0) {	# use 1900 system
-		$serial += 25569;
-	} else {			# use 1904 system
-		$serial += 24107;
-	}
-
-	unless ($gmtflag) {
-		# Now have a 'raw' serial with the right offset. But this
-		# gives a serial in GMT, which is false unless the timezone
-		# is GMT. We need to adjust the serial by the appropriate
-		# timezone offset.
-		# Calculate the appropriate timezone offset by seeing what
-		# the differences between localtime and gmtime for the given
-		# time are.
-
-		my @gmtime = gmtime($time);
-		my @ltime  = localtime($time);
-
-		# For the first 7 elements of the two arrays, adjust the
-		# date serial where the elements differ.
-		for (0 .. 6) {
-			my $diff = $ltime[$_] - $gmtime[$_];
-			if ($diff) {
-				$serial += _adjustment($diff,$_);
-			}
-		}
-	}
-
-	# Perpetuate the error that 1900 was a leap year by decrementing
-	# the serial if we're using the 1900 system and the date is prior to
-	# 1 Mar 1900. This has the effect of making serial value '60'
-	# 29 Feb 1900.
-
-	# This fix only has any effect if UNIX/Perl time on the platform
-	# can represent 1900. Many can't.
-
-	unless ($DATE_SYSTEM) {
-		$serial-- if ($serial < 61);	# '61' is 1 Mar 1900
-	}
-	return $serial;
-}
-
-sub _adjustment {
-	# Based on the difference in the localtime/gmtime array elements
-	# number, return the adjustment required to the serial.
-
-	# We only look at some elements of the localtime/gmtime arrays:
-	#    seconds    unlikely to be different as all known timezones
-	#               have an offset of integral multiples of 15 minutes,
-	#		but it's easy to do.
-	#    minutes    will be different for timezone offsets which are
-	#		not an exact number of hours.
-	#    hours	very likely to be different.
-	#    weekday	will differ when localtime/gmtime difference
-	#		straddles midnight.
-	#
-	# Assume that difference between localtime and gmtime is less than
-	# 5 days, then don't have to do maths for day of month, month number,
-	# year number, etc...
-
-	my ($delta,$element) = @_;
-	my $adjust = 0;
-
-	if ($element == 0) {		# Seconds
-		$adjust = $delta/86400;		# 60 * 60 * 24
-	} elsif ($element == 1) {	# Minutes
-		$adjust = $delta/1440;		# 60 * 24
-	} elsif ($element == 2) {	# Hours
-		$adjust = $delta/24;		# 24
-	} elsif ($element == 6) {	# Day of week number
-		# Catch difference straddling Sat/Sun in either direction
-		$delta += 7 if ($delta < -4);
-		$delta -= 7 if ($delta > 4);
-
-		$adjust = $delta;
-	}
-	return $adjust;
-}
-
+#!/usr/bin/perl -w
+
+
+#
+# NOTE: An easier way of writing dates and times is to use the newer
+#       write_date_time() Worksheet method. See the date_time.pl example.
+#
+
+
+######################################################################
+#
+# Demonstration of writing date/time cells to Excel spreadsheets,
+# using UNIX/Perl time as source of date/time.
+#
+# Copyright 2000, Andrew Benham, adsb at bigfoot.com
+#
+######################################################################
+#
+# UNIX/Perl time is the time since the Epoch (00:00:00 GMT, 1 Jan 1970)
+# measured in seconds.
+#
+# An Excel file can use exactly one of two different date/time systems.
+# In these systems, a floating point number represents the number of days
+# (and fractional parts of the day) since a start point. The floating point
+# number is referred to as a 'serial'.
+# The two systems ('1900' and '1904') use different starting points:
+#  '1900'; '1.00' is 1 Jan 1900 BUT 1900 is erroneously regarded as
+#          a leap year - see:
+#            http://support.microsoft.com/support/kb/articles/Q181/3/70.asp
+#          for the excuse^H^H^H^H^H^Hreason.
+#  '1904'; '1.00' is 2 Jan 1904.
+#
+# The '1904' system is the default for Apple Macs. Windows versions of
+# Excel have the option to use the '1904' system.
+#
+# Note that Visual Basic's "DateSerial" function does NOT erroneously
+# regard 1900 as a leap year, and thus its serials do not agree with
+# the 1900 serials of Excel for dates before 1 Mar 1900.
+#
+# Note that StarOffice (at least at version 5.2) does NOT erroneously
+# regard 1900 as a leap year, and thus its serials do not agree with
+# the 1900 serials of Excel for dates before 1 Mar 1900.
+#
+######################################################################
+#
+# Calculation description
+# =======================
+#
+# 1900 system
+# -----------
+# Unix time is '0' at 00:00:00 GMT 1 Jan 1970, i.e. 70 years after 1 Jan 1900.
+# Of those 70 years, 17 (1904,08,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68)
+# were leap years with an extra day.
+# Thus there were 17 + 70*365 days = 25567 days between 1 Jan 1900 and
+# 1 Jan 1970.
+# In the 1900 system, '1' is 1 Jan 1900, but as 1900 was not a leap year
+# 1 Jan 1900 should really be '2', so 1 Jan 1970 is '25569'.
+#
+# 1904 system
+# -----------
+# Unix time is '0' at 00:00:00 GMT 1 Jan 1970, i.e. 66 years after 1 Jan 1904.
+# Of those 66 years, 17 (1904,08,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68)
+# were leap years with an extra day.
+# Thus there were 17 + 66*365 days = 24107 days between 1 Jan 1904 and
+# 1 Jan 1970.
+# In the 1904 system, 2 Jan 1904 being '1', 1 Jan 1970 is '24107'.
+#
+######################################################################
+#
+# Copyright (c) 2000, Andrew Benham.
+# This program is free software. It may be used, redistributed and/or
+# modified under the same terms as Perl itself.
+#
+# Andrew Benham, adsb at bigfoot.com
+# London, United Kingdom
+# 11 Nov 2000
+#
+######################################################################
+
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+use Time::Local;
+
+use vars qw/$DATE_SYSTEM/;
+
+# Use 1900 date system on all platforms other than Apple Mac (for which
+# use 1904 date system).
+$DATE_SYSTEM = ($^O eq 'MacOS') ? 1 : 0;
+
+my $workbook = Spreadsheet::WriteExcel->new("dates.xls");
+my $worksheet = $workbook->add_worksheet();
+
+my $format_date =  $workbook->add_format();
+$format_date->set_num_format('d mmmm yyy');
+
+$worksheet->set_column(0,1,21);
+
+$worksheet->write_string (0,0,"The epoch (GMT)");
+$worksheet->write_number (0,1,&calc_serial(0,1),0x16);
+
+$worksheet->write_string (1,0,"The epoch (localtime)");
+$worksheet->write_number (1,1,&calc_serial(0,0),0x16);
+
+$worksheet->write_string (2,0,"Today");
+$worksheet->write_number (2,1,&calc_serial(),$format_date);
+
+my $christmas2000 = timelocal(0,0,0,25,11,100);
+$worksheet->write_string (3,0,"Christmas 2000");
+$worksheet->write_number (3,1,&calc_serial($christmas2000),$format_date);
+
+$workbook->close();
+
+#-----------------------------------------------------------
+# calc_serial()
+#
+# Called with (up to) 2 parameters.
+#   1.  Unix timestamp.  If omitted, uses current time.
+#   2.  GMT flag. Set to '1' to return serial in GMT.
+#       If omitted, returns serial in appropriate timezone.
+#
+# Returns date/time serial according to $DATE_SYSTEM selected
+#-----------------------------------------------------------
+sub calc_serial {
+	my $time = (defined $_[0]) ? $_[0] : time();
+	my $gmtflag = (defined $_[1]) ? $_[1] : 0;
+
+	# Divide timestamp by number of seconds in a day.
+	# This gives a date serial with '0' on 1 Jan 1970.
+	my $serial = $time / 86400;
+
+	# Adjust the date serial by the offset appropriate to the
+	# currently selected system (1900/1904).
+	if ($DATE_SYSTEM == 0) {	# use 1900 system
+		$serial += 25569;
+	} else {			# use 1904 system
+		$serial += 24107;
+	}
+
+	unless ($gmtflag) {
+		# Now have a 'raw' serial with the right offset. But this
+		# gives a serial in GMT, which is false unless the timezone
+		# is GMT. We need to adjust the serial by the appropriate
+		# timezone offset.
+		# Calculate the appropriate timezone offset by seeing what
+		# the differences between localtime and gmtime for the given
+		# time are.
+
+		my @gmtime = gmtime($time);
+		my @ltime  = localtime($time);
+
+		# For the first 7 elements of the two arrays, adjust the
+		# date serial where the elements differ.
+		for (0 .. 6) {
+			my $diff = $ltime[$_] - $gmtime[$_];
+			if ($diff) {
+				$serial += _adjustment($diff,$_);
+			}
+		}
+	}
+
+	# Perpetuate the error that 1900 was a leap year by decrementing
+	# the serial if we're using the 1900 system and the date is prior to
+	# 1 Mar 1900. This has the effect of making serial value '60'
+	# 29 Feb 1900.
+
+	# This fix only has any effect if UNIX/Perl time on the platform
+	# can represent 1900. Many can't.
+
+	unless ($DATE_SYSTEM) {
+		$serial-- if ($serial < 61);	# '61' is 1 Mar 1900
+	}
+	return $serial;
+}
+
+sub _adjustment {
+	# Based on the difference in the localtime/gmtime array elements
+	# number, return the adjustment required to the serial.
+
+	# We only look at some elements of the localtime/gmtime arrays:
+	#    seconds    unlikely to be different as all known timezones
+	#               have an offset of integral multiples of 15 minutes,
+	#		but it's easy to do.
+	#    minutes    will be different for timezone offsets which are
+	#		not an exact number of hours.
+	#    hours	very likely to be different.
+	#    weekday	will differ when localtime/gmtime difference
+	#		straddles midnight.
+	#
+	# Assume that difference between localtime and gmtime is less than
+	# 5 days, then don't have to do maths for day of month, month number,
+	# year number, etc...
+
+	my ($delta,$element) = @_;
+	my $adjust = 0;
+
+	if ($element == 0) {		# Seconds
+		$adjust = $delta/86400;		# 60 * 60 * 24
+	} elsif ($element == 1) {	# Minutes
+		$adjust = $delta/1440;		# 60 * 24
+	} elsif ($element == 2) {	# Hours
+		$adjust = $delta/24;		# 24
+	} elsif ($element == 6) {	# Day of week number
+		# Catch difference straddling Sat/Sun in either direction
+		$delta += 7 if ($delta < -4);
+		$delta -= 7 if ($delta > 4);
+
+		$adjust = $delta;
+	}
+	return $adjust;
+}
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/datecalc2.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/datecalc2.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/datecalc2.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,106 +1,106 @@
-#!/usr/bin/perl -w
-
-###############################################################################
-#
-# Example of how to using the Date::Calc module to calculate Excel dates.
-#
-# NOTE: An easier way of writing dates and times is to use the newer
-#       write_date_time() Worksheet method. See the date_time.pl example.
-#
-# These functions have been superceded by Spreadsheet::WriteExcel::Utility.
-#
-# reverse('©'), June 2001, John McNamara, jmcnamara at cpan.org
-#
-
-use strict;
-use Spreadsheet::WriteExcel;
-use Date::Calc qw(Delta_DHMS); # You may need to install this module.
-
-
-# Create a new workbook and add a worksheet
-my $workbook = Spreadsheet::WriteExcel->new("excel_date2.xls");
-my $worksheet = $workbook->add_worksheet();
-
-# Expand the first column so that the date is visible.
-$worksheet->set_column("A:A", 25);
-
-
-# Add a format for the date
-my $format =  $workbook->add_format();
-$format->set_num_format('d mmmm yyy HH:MM:SS');
-
-
-my $date;
-
-# Write some dates and times
-$date =  excel_date(1900, 1, 1);
-$worksheet->write("A1", $date, $format);
-
-$date =  excel_date(2000, 1, 1);
-$worksheet->write("A2", $date, $format);
-
-$date =  excel_date(2000, 4, 17, 14, 33, 15);
-$worksheet->write("A3", $date, $format);
-
-
-###############################################################################
-#
-# excel_date($years, $months, $days, $hours, $minutes, $seconds)
-#
-# Create an Excel date in the 1900 format. All of the arguments are optional
-# but you should at least add $years.
-#
-# Corrects for Excel's missing leap day in 1900. See excel_time1.pl for an
-# explanation.
-#
-sub excel_date {
-
-    my $years   = $_[0] || 1900;
-    my $months  = $_[1] || 1;
-    my $days    = $_[2] || 1;
-    my $hours   = $_[3] || 0;
-    my $minutes = $_[4] || 0;
-    my $seconds = $_[5] || 0;
-
-    my @date = ($years, $months, $days, $hours, $minutes, $seconds);
-    my @epoch = (1899, 12, 31, 0, 0, 0);
-
-    ($days, $hours, $minutes, $seconds) = Delta_DHMS(@epoch, @date);
-
-    my $date = $days + ($hours*3600 +$minutes*60 +$seconds)/(24*60*60);
-
-    # Add a day for Excel's missing leap day in 1900
-    $date++ if ($date > 59);
-
-    return $date;
-}
-
-###############################################################################
-#
-# excel_date($years, $months, $days, $hours, $minutes, $seconds)
-#
-# Create an Excel date in the 1904 format. All of the arguments are optional
-# but you should at least add $years.
-#
-# You will also need to call $workbook->set_1904() for this format to be valid.
-#
-sub excel_date_1904 {
-
-    my $years   = $_[0] || 1900;
-    my $months  = $_[1] || 1;
-    my $days    = $_[2] || 1;
-    my $hours   = $_[3] || 0;
-    my $minutes = $_[4] || 0;
-    my $seconds = $_[5] || 0;
-
-    my @date = ($years, $months, $days, $hours, $minutes, $seconds);
-    my @epoch = (1904, 1, 1, 0, 0, 0);
-
-    ($days, $hours, $minutes, $seconds) = Delta_DHMS(@epoch, @date);
-
-    my $date = $days + ($hours*3600 +$minutes*60 +$seconds)/(24*60*60);
-
-    return $date;
-}
-
-
+#!/usr/bin/perl -w
+
+###############################################################################
+#
+# Example of how to using the Date::Calc module to calculate Excel dates.
+#
+# NOTE: An easier way of writing dates and times is to use the newer
+#       write_date_time() Worksheet method. See the date_time.pl example.
+#
+# These functions have been superceded by Spreadsheet::WriteExcel::Utility.
+#
+# reverse('©'), June 2001, John McNamara, jmcnamara at cpan.org
+#
+
+use strict;
+use Spreadsheet::WriteExcel;
+use Date::Calc qw(Delta_DHMS); # You may need to install this module.
+
+
+# Create a new workbook and add a worksheet
+my $workbook = Spreadsheet::WriteExcel->new("excel_date2.xls");
+my $worksheet = $workbook->add_worksheet();
+
+# Expand the first column so that the date is visible.
+$worksheet->set_column("A:A", 25);
+
+
+# Add a format for the date
+my $format =  $workbook->add_format();
+$format->set_num_format('d mmmm yyy HH:MM:SS');
+
+
+my $date;
+
+# Write some dates and times
+$date =  excel_date(1900, 1, 1);
+$worksheet->write("A1", $date, $format);
+
+$date =  excel_date(2000, 1, 1);
+$worksheet->write("A2", $date, $format);
+
+$date =  excel_date(2000, 4, 17, 14, 33, 15);
+$worksheet->write("A3", $date, $format);
+
+
+###############################################################################
+#
+# excel_date($years, $months, $days, $hours, $minutes, $seconds)
+#
+# Create an Excel date in the 1900 format. All of the arguments are optional
+# but you should at least add $years.
+#
+# Corrects for Excel's missing leap day in 1900. See excel_time1.pl for an
+# explanation.
+#
+sub excel_date {
+
+    my $years   = $_[0] || 1900;
+    my $months  = $_[1] || 1;
+    my $days    = $_[2] || 1;
+    my $hours   = $_[3] || 0;
+    my $minutes = $_[4] || 0;
+    my $seconds = $_[5] || 0;
+
+    my @date = ($years, $months, $days, $hours, $minutes, $seconds);
+    my @epoch = (1899, 12, 31, 0, 0, 0);
+
+    ($days, $hours, $minutes, $seconds) = Delta_DHMS(@epoch, @date);
+
+    my $date = $days + ($hours*3600 +$minutes*60 +$seconds)/(24*60*60);
+
+    # Add a day for Excel's missing leap day in 1900
+    $date++ if ($date > 59);
+
+    return $date;
+}
+
+###############################################################################
+#
+# excel_date($years, $months, $days, $hours, $minutes, $seconds)
+#
+# Create an Excel date in the 1904 format. All of the arguments are optional
+# but you should at least add $years.
+#
+# You will also need to call $workbook->set_1904() for this format to be valid.
+#
+sub excel_date_1904 {
+
+    my $years   = $_[0] || 1900;
+    my $months  = $_[1] || 1;
+    my $days    = $_[2] || 1;
+    my $hours   = $_[3] || 0;
+    my $minutes = $_[4] || 0;
+    my $seconds = $_[5] || 0;
+
+    my @date = ($years, $months, $days, $hours, $minutes, $seconds);
+    my @epoch = (1904, 1, 1, 0, 0, 0);
+
+    ($days, $hours, $minutes, $seconds) = Delta_DHMS(@epoch, @date);
+
+    my $date = $days + ($hours*3600 +$minutes*60 +$seconds)/(24*60*60);
+
+    return $date;
+}
+
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/demo.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/demo.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/demo.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,115 +1,115 @@
-#!/usr/bin/perl -w
-
-#######################################################################
-#
-# Demo of some of the features of Spreadsheet::WriteExcel.
-# Used to create the project screenshot for Freshmeat.
-#
-#
-# reverse('©'), October 2001, John McNamara, jmcnamara at cpan.org
-#
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-my $workbook   = Spreadsheet::WriteExcel->new("demo.xls");
-my $worksheet  = $workbook->add_worksheet('Demo');
-my $worksheet2 = $workbook->add_worksheet('Another sheet');
-my $worksheet3 = $workbook->add_worksheet('And another');
-
-my $bold       = $workbook->add_format(bold => 1);
-
-
-#######################################################################
-#
-# Write a general heading
-#
-$worksheet->set_column('A:A', 36, $bold);
-$worksheet->set_column('B:B', 20       );
-$worksheet->set_row   (0,     40       );
-
-my $heading  = $workbook->add_format(
-                                        bold    => 1,
-                                        color   => 'blue',
-                                        size    => 16,
-                                        merge   => 1,
-                                        align  => 'vcenter',
-                                        );
-
-my @headings = ('Features of Spreadsheet::WriteExcel', '');
-$worksheet->write_row('A1', \@headings, $heading);
-
-
-#######################################################################
-#
-# Some text examples
-#
-my $text_format  = $workbook->add_format(
-                                            bold    => 1,
-                                            italic  => 1,
-                                            color   => 'red',
-                                            size    => 18,
-                                            font    =>'Lucida Calligraphy'
-                                        );
-
-# A phrase in Cyrillic
-my $unicode = pack "H*", "042d0442043e002004440440043004370430002004".
-                         "3d043000200440044304410441043a043e043c0021";
-
-
-$worksheet->write('A2', "Text");
-$worksheet->write('B2', "Hello Excel");
-$worksheet->write('A3', "Formatted text");
-$worksheet->write('B3', "Hello Excel", $text_format);
-$worksheet->write('A4', "Unicode text");
-$worksheet->write_unicode('B4', $unicode);
-
-#######################################################################
-#
-# Some numeric examples
-#
-my $num1_format  = $workbook->add_format(num_format => '$#,##0.00');
-my $num2_format  = $workbook->add_format(num_format => ' d mmmm yyy');
-
-
-$worksheet->write('A5', "Numbers");
-$worksheet->write('B5', 1234.56);
-$worksheet->write('A6', "Formatted numbers");
-$worksheet->write('B6', 1234.56, $num1_format);
-$worksheet->write('A7', "Formatted numbers");
-$worksheet->write('B7', 37257, $num2_format);
-
-
-#######################################################################
-#
-# Formulae
-#
-$worksheet->set_selection('B8');
-$worksheet->write('A8', 'Formulas and functions, "=SIN(PI()/4)"');
-$worksheet->write('B8', '=SIN(PI()/4)');
-
-
-#######################################################################
-#
-# Hyperlinks
-#
-$worksheet->write('A9', "Hyperlinks");
-$worksheet->write('B9',  'http://www.perl.com/' );
-
-
-#######################################################################
-#
-# Images
-#
-$worksheet->write('A10', "Images");
-$worksheet->insert_bitmap('B10', 'republic.bmp', 16, 8);
-
-
-#######################################################################
-#
-# Misc
-#
-$worksheet->write('A18', "Page/printer setup");
-$worksheet->write('A19', "Multiple worksheets");
-
-
+#!/usr/bin/perl -w
+
+#######################################################################
+#
+# Demo of some of the features of Spreadsheet::WriteExcel.
+# Used to create the project screenshot for Freshmeat.
+#
+#
+# reverse('©'), October 2001, John McNamara, jmcnamara at cpan.org
+#
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+my $workbook   = Spreadsheet::WriteExcel->new("demo.xls");
+my $worksheet  = $workbook->add_worksheet('Demo');
+my $worksheet2 = $workbook->add_worksheet('Another sheet');
+my $worksheet3 = $workbook->add_worksheet('And another');
+
+my $bold       = $workbook->add_format(bold => 1);
+
+
+#######################################################################
+#
+# Write a general heading
+#
+$worksheet->set_column('A:A', 36, $bold);
+$worksheet->set_column('B:B', 20       );
+$worksheet->set_row   (0,     40       );
+
+my $heading  = $workbook->add_format(
+                                        bold    => 1,
+                                        color   => 'blue',
+                                        size    => 16,
+                                        merge   => 1,
+                                        align  => 'vcenter',
+                                        );
+
+my @headings = ('Features of Spreadsheet::WriteExcel', '');
+$worksheet->write_row('A1', \@headings, $heading);
+
+
+#######################################################################
+#
+# Some text examples
+#
+my $text_format  = $workbook->add_format(
+                                            bold    => 1,
+                                            italic  => 1,
+                                            color   => 'red',
+                                            size    => 18,
+                                            font    =>'Lucida Calligraphy'
+                                        );
+
+# A phrase in Cyrillic
+my $unicode = pack "H*", "042d0442043e002004440440043004370430002004".
+                         "3d043000200440044304410441043a043e043c0021";
+
+
+$worksheet->write('A2', "Text");
+$worksheet->write('B2', "Hello Excel");
+$worksheet->write('A3', "Formatted text");
+$worksheet->write('B3', "Hello Excel", $text_format);
+$worksheet->write('A4', "Unicode text");
+$worksheet->write_unicode('B4', $unicode);
+
+#######################################################################
+#
+# Some numeric examples
+#
+my $num1_format  = $workbook->add_format(num_format => '$#,##0.00');
+my $num2_format  = $workbook->add_format(num_format => ' d mmmm yyy');
+
+
+$worksheet->write('A5', "Numbers");
+$worksheet->write('B5', 1234.56);
+$worksheet->write('A6', "Formatted numbers");
+$worksheet->write('B6', 1234.56, $num1_format);
+$worksheet->write('A7', "Formatted numbers");
+$worksheet->write('B7', 37257, $num2_format);
+
+
+#######################################################################
+#
+# Formulae
+#
+$worksheet->set_selection('B8');
+$worksheet->write('A8', 'Formulas and functions, "=SIN(PI()/4)"');
+$worksheet->write('B8', '=SIN(PI()/4)');
+
+
+#######################################################################
+#
+# Hyperlinks
+#
+$worksheet->write('A9', "Hyperlinks");
+$worksheet->write('B9',  'http://www.perl.com/' );
+
+
+#######################################################################
+#
+# Images
+#
+$worksheet->write('A10', "Images");
+$worksheet->insert_bitmap('B10', 'republic.bmp', 16, 8);
+
+
+#######################################################################
+#
+# Misc
+#
+$worksheet->write('A18', "Page/printer setup");
+$worksheet->write('A19', "Multiple worksheets");
+
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/diag_border.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/diag_border.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/diag_border.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,41 +1,41 @@
-#!/usr/bin/perl -w
-
-##############################################################################
-#
-# A simple formatting example using Spreadsheet::WriteExcel.
-#
-# This program demonstrates the diagonal border cell format.
-#
-# reverse('©'), May 2004, John McNamara, jmcnamara at cpan.org
-#
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-
-my $workbook  = Spreadsheet::WriteExcel->new('diag_border.xls');
-my $worksheet = $workbook->add_worksheet();
-
-
-my $format1   = $workbook->add_format(diag_type       => '1');
-
-my $format2   = $workbook->add_format(diag_type       => '2');
-
-my $format3   = $workbook->add_format(diag_type       => '3');
-
-my $format4   = $workbook->add_format(
-                                      diag_type       => '3',
-                                      diag_border     => '7',
-                                      diag_color      => 'red',
-                                     );
-
-
-$worksheet->write('B3',  'Text', $format1);
-$worksheet->write('B6',  'Text', $format2);
-$worksheet->write('B9',  'Text', $format3);
-$worksheet->write('B12', 'Text', $format4);
-
-
-
-__END__
-
+#!/usr/bin/perl -w
+
+##############################################################################
+#
+# A simple formatting example using Spreadsheet::WriteExcel.
+#
+# This program demonstrates the diagonal border cell format.
+#
+# reverse('©'), May 2004, John McNamara, jmcnamara at cpan.org
+#
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+
+my $workbook  = Spreadsheet::WriteExcel->new('diag_border.xls');
+my $worksheet = $workbook->add_worksheet();
+
+
+my $format1   = $workbook->add_format(diag_type       => '1');
+
+my $format2   = $workbook->add_format(diag_type       => '2');
+
+my $format3   = $workbook->add_format(diag_type       => '3');
+
+my $format4   = $workbook->add_format(
+                                      diag_type       => '3',
+                                      diag_border     => '7',
+                                      diag_color      => 'red',
+                                     );
+
+
+$worksheet->write('B3',  'Text', $format1);
+$worksheet->write('B6',  'Text', $format2);
+$worksheet->write('B9',  'Text', $format3);
+$worksheet->write('B12', 'Text', $format4);
+
+
+
+__END__
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/easter_egg.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/easter_egg.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/easter_egg.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,29 +1,29 @@
-#!/usr/bin/perl -w
-
-###############################################################################
-#
-# This uses the Win32::OLE module to expose the Flight Simulator easter egg
-# in Excel 97 SR2. A must see.
-#
-# reverse('©'), March 2001, John McNamara, jmcnamara at cpan.org
-#
-
-use strict;
-use Win32::OLE;
-
-my $application = Win32::OLE->new("Excel.Application");
-my $workbook    = $application->Workbooks->Add;
-my $worksheet   = $workbook->Worksheets(1);
-
-$application->{Visible} = 1;
-
-$worksheet->Range("L97:X97")->Select;
-$worksheet->Range("M97")->Activate;
-
-my $message =  "Hold down Shift and Ctrl and click the ".
-               "Chart Wizard icon on the toolbar.\n\n".
-               "Use the mouse motion and buttons to control ".
-               "movement. Try to find the monolith. ".
-               "Close this dialog first.";
-
-$application->InputBox($message);
+#!/usr/bin/perl -w
+
+###############################################################################
+#
+# This uses the Win32::OLE module to expose the Flight Simulator easter egg
+# in Excel 97 SR2. A must see.
+#
+# reverse('©'), March 2001, John McNamara, jmcnamara at cpan.org
+#
+
+use strict;
+use Win32::OLE;
+
+my $application = Win32::OLE->new("Excel.Application");
+my $workbook    = $application->Workbooks->Add;
+my $worksheet   = $workbook->Worksheets(1);
+
+$application->{Visible} = 1;
+
+$worksheet->Range("L97:X97")->Select;
+$worksheet->Range("M97")->Activate;
+
+my $message =  "Hold down Shift and Ctrl and click the ".
+               "Chart Wizard icon on the toolbar.\n\n".
+               "Use the mouse motion and buttons to control ".
+               "movement. Try to find the monolith. ".
+               "Close this dialog first.";
+
+$application->InputBox($message);

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/filehandle.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/filehandle.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/filehandle.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,113 +1,113 @@
-#!/usr/bin/perl -w
-
-###############################################################################
-#
-# Example of using Spreadsheet::WriteExcel to write to alternative filehandles.
-#
-# reverse('©'), April 2003, John McNamara, jmcnamara at cpan.org
-#
-
-use strict;
-use Spreadsheet::WriteExcel;
-use IO::Scalar;
-
-
-
-
-###############################################################################
-#
-# Example 1. This demonstrates the standard way of creating an Excel file by
-# specifying a file name.
-#
-
-my $workbook1  = Spreadsheet::WriteExcel->new('fh_01.xls');
-my $worksheet1 = $workbook1->add_worksheet();
-
-$worksheet1->write(0, 0,  "Hi Excel!");
-
-
-
-
-###############################################################################
-#
-# Example 2. Write an Excel file to an existing filehandle.
-#
-
-open    TEST, "> fh_02.xls" or die "Couldn't open file: $!";
-binmode TEST; # Always do this regardless of whether the platform requires it.
-
-my $workbook2  = Spreadsheet::WriteExcel->new(\*TEST);
-my $worksheet2 = $workbook2->add_worksheet();
-
-$worksheet2->write(0, 0,  "Hi Excel!");
-
-
-
-
-###############################################################################
-#
-# Example 3. Write an Excel file to an existing OO style filehandle.
-#
-
-my $fh = FileHandle->new("> fh_03.xls")
-         or die "Couldn't open file: $!";
-
-binmode($fh);
-
-my $workbook3  = Spreadsheet::WriteExcel->new($fh);
-my $worksheet3 = $workbook3->add_worksheet();
-
-$worksheet3->write(0, 0,  "Hi Excel!");
-
-
-
-
-###############################################################################
-#
-# Example 4. Write an Excel file to a string via IO::Scalar. Please refer to
-# the IO::Scalar documentation for further details.
-#
-
-my $xls_str;
-
-tie *XLS, 'IO::Scalar', \$xls_str;
-
-my $workbook4  = Spreadsheet::WriteExcel->new(\*XLS);
-my $worksheet4 = $workbook4->add_worksheet();
-
-$worksheet4->write(0, 0, "Hi Excel 4");
-$workbook4->close(); # This is required before we use the scalar
-
-
-# The Excel file is now in $xls_str. As a demonstration, print it to a file.
-open    TMP, "> fh_04.xls" or die "Couldn't open file: $!";
-binmode TMP;
-print   TMP  $xls_str;
-close   TMP;
-
-
-
-
-###############################################################################
-#
-# Example 5. Write an Excel file to a string via IO::Scalar's newer interface.
-# Please refer to the IO::Scalar documentation for further details.
-#
-my $xls_str2;
-
-my $fh5 = IO::Scalar->new(\$xls_str2);
-
-
-my $workbook5  = Spreadsheet::WriteExcel->new($fh5);
-my $worksheet5 = $workbook5->add_worksheet();
-
-$worksheet5->write(0, 0, "Hi Excel 5");
-$workbook5->close(); # This is required before we use the scalar
-
-# The Excel file is now in $xls_str. As a demonstration, print it to a file.
-open    TMP, "> fh_05.xls" or die "Couldn't open file: $!";
-binmode TMP;
-print   TMP  $xls_str2;
-close   TMP;
-
-
+#!/usr/bin/perl -w
+
+###############################################################################
+#
+# Example of using Spreadsheet::WriteExcel to write to alternative filehandles.
+#
+# reverse('©'), April 2003, John McNamara, jmcnamara at cpan.org
+#
+
+use strict;
+use Spreadsheet::WriteExcel;
+use IO::Scalar;
+
+
+
+
+###############################################################################
+#
+# Example 1. This demonstrates the standard way of creating an Excel file by
+# specifying a file name.
+#
+
+my $workbook1  = Spreadsheet::WriteExcel->new('fh_01.xls');
+my $worksheet1 = $workbook1->add_worksheet();
+
+$worksheet1->write(0, 0,  "Hi Excel!");
+
+
+
+
+###############################################################################
+#
+# Example 2. Write an Excel file to an existing filehandle.
+#
+
+open    TEST, "> fh_02.xls" or die "Couldn't open file: $!";
+binmode TEST; # Always do this regardless of whether the platform requires it.
+
+my $workbook2  = Spreadsheet::WriteExcel->new(\*TEST);
+my $worksheet2 = $workbook2->add_worksheet();
+
+$worksheet2->write(0, 0,  "Hi Excel!");
+
+
+
+
+###############################################################################
+#
+# Example 3. Write an Excel file to an existing OO style filehandle.
+#
+
+my $fh = FileHandle->new("> fh_03.xls")
+         or die "Couldn't open file: $!";
+
+binmode($fh);
+
+my $workbook3  = Spreadsheet::WriteExcel->new($fh);
+my $worksheet3 = $workbook3->add_worksheet();
+
+$worksheet3->write(0, 0,  "Hi Excel!");
+
+
+
+
+###############################################################################
+#
+# Example 4. Write an Excel file to a string via IO::Scalar. Please refer to
+# the IO::Scalar documentation for further details.
+#
+
+my $xls_str;
+
+tie *XLS, 'IO::Scalar', \$xls_str;
+
+my $workbook4  = Spreadsheet::WriteExcel->new(\*XLS);
+my $worksheet4 = $workbook4->add_worksheet();
+
+$worksheet4->write(0, 0, "Hi Excel 4");
+$workbook4->close(); # This is required before we use the scalar
+
+
+# The Excel file is now in $xls_str. As a demonstration, print it to a file.
+open    TMP, "> fh_04.xls" or die "Couldn't open file: $!";
+binmode TMP;
+print   TMP  $xls_str;
+close   TMP;
+
+
+
+
+###############################################################################
+#
+# Example 5. Write an Excel file to a string via IO::Scalar's newer interface.
+# Please refer to the IO::Scalar documentation for further details.
+#
+my $xls_str2;
+
+my $fh5 = IO::Scalar->new(\$xls_str2);
+
+
+my $workbook5  = Spreadsheet::WriteExcel->new($fh5);
+my $worksheet5 = $workbook5->add_worksheet();
+
+$worksheet5->write(0, 0, "Hi Excel 5");
+$workbook5->close(); # This is required before we use the scalar
+
+# The Excel file is now in $xls_str. As a demonstration, print it to a file.
+open    TMP, "> fh_05.xls" or die "Couldn't open file: $!";
+binmode TMP;
+print   TMP  $xls_str2;
+close   TMP;
+
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/formats.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/formats.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/formats.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,479 +1,480 @@
-#!/usr/bin/perl -w
-
-######################################################################
-#
-# Examples of formatting using the Spreadsheet::WriteExcel module
-#
-# reverse('©'), September 2002, John McNamara, jmcnamara at cpan.org
-#
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-my $workbook = Spreadsheet::WriteExcel->new('formats.xls');
-
-# Some common formats
-my $center  = $workbook->add_format(align => 'center');
-my $heading = $workbook->add_format(align => 'center', bold => 1);
-
-# The named colors
-my %colors = (
-                0x08, 'black',
-                0x0C, 'blue',
-                0x10, 'brown',
-                0x0F, 'cyan',
-                0x17, 'gray',
-                0x11, 'green',
-                0x0B, 'lime',
-                0x0E, 'magenta',
-                0x12, 'navy',
-                0x35, 'orange',
-                0x14, 'purple',
-                0x0A, 'red',
-                0x16, 'silver',
-                0x09, 'white',
-                0x0D, 'yellow',
-             );
-
-# Call these subroutines to demonstrate different formatting options
-intro();
-fonts();
-named_colors();
-standard_colors();
-numeric_formats();
-borders();
-patterns();
-alignment();
-misc();
-
-# Note: this is required
-$workbook->close();
-
-
-######################################################################
-#
-# Intro.
-#
-sub intro {
-
-    my $worksheet = $workbook->add_worksheet('Introduction');
-
-    $worksheet->set_column(0, 0, 60);
-
-    my $format = $workbook->add_format();
-    $format->set_bold();
-    $format->set_size(14);
-    $format->set_color('blue');
-    $format->set_align('center');
-
-    my $format2 = $workbook->add_format();
-    $format2->set_bold();
-    $format2->set_color('blue');
-
-    $worksheet->write(2, 0, 'This workbook demonstrates some of',  $format);
-    $worksheet->write(3, 0, 'the formatting options provided by',  $format);
-    $worksheet->write(4, 0, 'the Spreadsheet::WriteExcel module.', $format);
-
-    $worksheet->write('A7',  'Sections:', $format2);
-    $worksheet->write('A8',  "internal:Fonts!A1",             'Fonts'          );
-    $worksheet->write('A9',  "internal:'Named colors'!A1",    'Named colors'   );
-    $worksheet->write('A10', "internal:'Standard colors'!A1", 'Standard colors');
-    $worksheet->write('A11', "internal:'Numeric formats'!A1", 'Numeric formats');
-    $worksheet->write('A12', "internal:Borders!A1",           'Borders'        );
-    $worksheet->write('A13', "internal:Patterns!A1",          'Patterns'       );
-    $worksheet->write('A14', "internal:Alignment!A1",         'Alignment'      );
-    $worksheet->write('A15', "internal:Miscellaneous!A1",     'Miscellaneous'  );
-
-}
-
-
-######################################################################
-#
-# Demonstrate the named colors.
-#
-sub named_colors {
-
-    my $worksheet = $workbook->add_worksheet('Named colors');
-
-    $worksheet->set_column(0, 3, 15);
-
-    $worksheet->write(0, 0, "Index", $heading);
-    $worksheet->write(0, 1, "Index", $heading);
-    $worksheet->write(0, 2, "Name",  $heading);
-    $worksheet->write(0, 3, "Color", $heading);
-
-    my $i = 1;
-
-    while (my($index, $color) = each %colors) {
-        my $format = $workbook->add_format(
-                                            bg_color => $color,
-                                            pattern  => 1,
-                                            border   => 1
-                                         );
-
-        $worksheet->write($i+1, 0, $index,                    $center);
-        $worksheet->write($i+1, 1, sprintf("0x%02X", $index), $center);
-        $worksheet->write($i+1, 2, $color,                    $center);
-        $worksheet->write($i+1, 3, '',                        $format);
-        $i++;
-    }
-}
-
-
-######################################################################
-#
-# Demonstrate the standard Excel colors in the range 8..63.
-#
-sub standard_colors {
-
-    my $worksheet = $workbook->add_worksheet('Standard colors');
-
-    $worksheet->set_column(0, 3, 15);
-
-    $worksheet->write(0, 0, "Index", $heading);
-    $worksheet->write(0, 1, "Index", $heading);
-    $worksheet->write(0, 2, "Color", $heading);
-    $worksheet->write(0, 3, "Name",  $heading);
-
-    for my $i (8..63) {
-        my $format = $workbook->add_format(
-                                            bg_color => $i,
-                                            pattern  => 1,
-                                            border   => 1
-                                         );
-
-        $worksheet->write(($i -7), 0, $i,                    $center);
-        $worksheet->write(($i -7), 1, sprintf("0x%02X", $i), $center);
-        $worksheet->write(($i -7), 2, '',                    $format);
-
-        # Add the  color names
-        if (exists $colors{$i}) {
-            $worksheet->write(($i -7), 3, $colors{$i}, $center);
-
-        }
-    }
-}
-
-
-######################################################################
-#
-# Demonstrate the standard numeric formats.
-#
-sub numeric_formats {
-
-    my $worksheet = $workbook->add_worksheet('Numeric formats');
-
-    $worksheet->set_column(0, 4, 15);
-    $worksheet->set_column(5, 5, 45);
-
-    $worksheet->write(0, 0, "Index",       $heading);
-    $worksheet->write(0, 1, "Index",       $heading);
-    $worksheet->write(0, 2, "Unformatted", $heading);
-    $worksheet->write(0, 3, "Formatted",   $heading);
-    $worksheet->write(0, 4, "Negative",    $heading);
-    $worksheet->write(0, 5, "Format",      $heading);
-
-    my @formats;
-    push @formats, [ 0x00, 1234.567,   0,         'General' ];
-    push @formats, [ 0x01, 1234.567,   0,         '0' ];
-    push @formats, [ 0x02, 1234.567,   0,         '0.00' ];
-    push @formats, [ 0x03, 1234.567,   0,         '#,##0' ];
-    push @formats, [ 0x04, 1234.567,   0,         '#,##0.00' ];
-    push @formats, [ 0x05, 1234.567,   -1234.567, '($#,##0_);($#,##0)' ];
-    push @formats, [ 0x06, 1234.567,   -1234.567, '($#,##0_);[Red]($#,##0)' ];
-    push @formats, [ 0x07, 1234.567,   -1234.567, '($#,##0.00_);($#,##0.00)' ];
-    push @formats, [ 0x08, 1234.567,   -1234.567, '($#,##0.00_);[Red]($#,##0.00)' ];
-    push @formats, [ 0x09, 0.567,      0,         '0%' ];
-    push @formats, [ 0x0a, 0.567,      0,         '0.00%' ];
-    push @formats, [ 0x0b, 1234.567,   0,         '0.00E+00' ];
-    push @formats, [ 0x0c, 0.75,       0,         '# ?/?' ];
-    push @formats, [ 0x0d, 0.3125,     0,         '# ??/??' ];
-    push @formats, [ 0x0e, 36892.521,  0,         'm/d/yy' ];
-    push @formats, [ 0x0f, 36892.521,  0,         'd-mmm-yy' ];
-    push @formats, [ 0x10, 36892.521,  0,         'd-mmm' ];
-    push @formats, [ 0x11, 36892.521,  0,         'mmm-yy' ];
-    push @formats, [ 0x12, 36892.521,  0,         'h:mm AM/PM' ];
-    push @formats, [ 0x13, 36892.521,  0,         'h:mm:ss AM/PM' ];
-    push @formats, [ 0x14, 36892.521,  0,         'h:mm' ];
-    push @formats, [ 0x15, 36892.521,  0,         'h:mm:ss' ];
-    push @formats, [ 0x16, 36892.521,  0,         'm/d/yy h:mm' ];
-    push @formats, [ 0x25, 1234.567,   -1234.567, '(#,##0_);(#,##0)' ];
-    push @formats, [ 0x26, 1234.567,   -1234.567, '(#,##0_);[Red](#,##0)' ];
-    push @formats, [ 0x27, 1234.567,   -1234.567, '(#,##0.00_);(#,##0.00)' ];
-    push @formats, [ 0x28, 1234.567,   -1234.567, '(#,##0.00_);[Red](#,##0.00)' ];
-    push @formats, [ 0x29, 1234.567,   -1234.567, '_(* #,##0_);_(* (#,##0);_(* "-"_);_(@_)' ];
-    push @formats, [ 0x2a, 1234.567,   -1234.567, '_($* #,##0_);_($* (#,##0);_($* "-"_);_(@_)' ];
-    push @formats, [ 0x2b, 1234.567,   -1234.567, '_(* #,##0.00_);_(* (#,##0.00);_(* "-"??_);_(@_)' ];
-    push @formats, [ 0x2c, 1234.567,   -1234.567, '_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)' ];
-    push @formats, [ 0x2d, 36892.521,  0,         'mm:ss' ];
-    push @formats, [ 0x2e, 3.0153,     0,         '[h]:mm:ss' ];
-    push @formats, [ 0x2f, 36892.521,  0,         'mm:ss.0' ];
-    push @formats, [ 0x30, 1234.567,   0,         '##0.0E+0' ];
-    push @formats, [ 0x31, 1234.567,   0,         '@' ];
-
-    my $i; # RFC 120
-    foreach my $format (@formats){
-        my $style = $workbook->add_format();
-        $style->set_num_format($$format[0]);
-
-        $i++;
-        $worksheet->write($i, 0, $$format[0],                    $center);
-        $worksheet->write($i, 1, sprintf("0x%02X", $$format[0]), $center);
-        $worksheet->write($i, 2, $$format[1],                    $center);
-        $worksheet->write($i, 3, $$format[1],                    $style);
-
-        if ($$format[2]) {
-            $worksheet->write($i, 4, $$format[2], $style);
-        }
-
-        $worksheet->write_string($i, 5, $$format[3]);
-    }
-}
-
-
-######################################################################
-#
-# Demonstrate the font options.
-#
-sub fonts {
-
-    my $worksheet = $workbook->add_worksheet('Fonts');
-
-    $worksheet->set_column(0, 0, 30);
-    $worksheet->set_column(1, 1, 10);
-
-    $worksheet->write(0, 0, "Font name",   $heading);
-    $worksheet->write(0, 1, "Font size",   $heading);
-
-    my @fonts;
-    push @fonts, [ 10, 'Arial' ];
-    push @fonts, [ 12, 'Arial' ];
-    push @fonts, [ 14, 'Arial' ];
-    push @fonts, [ 12, 'Arial Black' ];
-    push @fonts, [ 12, 'Arial Narrow' ];
-    push @fonts, [ 12, 'Century Schoolbook' ];
-    push @fonts, [ 12, 'Courier' ];
-    push @fonts, [ 12, 'Courier New' ];
-    push @fonts, [ 12, 'Garamond' ];
-    push @fonts, [ 12, 'Impact' ];
-    push @fonts, [ 12, 'Lucida Handwriting'] ;
-    push @fonts, [ 12, 'Times New Roman' ];
-    push @fonts, [ 12, 'Symbol' ];
-    push @fonts, [ 12, 'Wingdings' ];
-    push @fonts, [ 12, 'A font that doesnt exist' ];
-
-    my $i;
-    foreach my $font (@fonts){
-        my $format = $workbook->add_format();
-
-        $format->set_size($$font[0]);
-        $format->set_font($$font[1]);
-
-        $i++;
-        $worksheet->write($i, 0, $$font[1], $format);
-        $worksheet->write($i, 1, $$font[0], $format);
-    }
-
-}
-
-
-######################################################################
-#
-# Demonstrate the standard Excel border styles.
-#
-sub borders {
-
-    my $worksheet = $workbook->add_worksheet('Borders');
-
-    $worksheet->set_column(0, 4, 10);
-    $worksheet->set_column(5, 5, 40);
-
-    $worksheet->write(0, 0, "Index", $heading);
-    $worksheet->write(0, 1, "Index", $heading);
-    $worksheet->write(0, 3, "Style", $heading);
-    $worksheet->write(0, 5, "The style is highlighted in red for ", $heading);
-    $worksheet->write(1, 5, "emphasis, the default color is black.", $heading);
-
-    for my $i (0..7){
-        my $format = $workbook->add_format();
-        $format->set_border($i);
-        $format->set_border_color('red');
-        $format->set_align('center');
-
-        $worksheet->write((2*($i+1)), 0, $i,                    $center);
-        $worksheet->write((2*($i+1)), 1, sprintf("0x%02X", $i), $center);
-
-        $worksheet->write((2*($i+1)), 3, "Border", $format);
-    }
-
-    $worksheet->write(18, 0, "Diag type", $heading);
-    $worksheet->write(18, 1, "Index", $heading);
-    $worksheet->write(18, 3, "Style", $heading);
-
-    for my $i (1..3){
-        my $format = $workbook->add_format();
-        $format->set_diag_type($i);
-        $format->set_diag_border(1);
-        $format->set_diag_color('red');
-        $format->set_align('center');
-
-        $worksheet->write((2*($i+9)), 0, $i,                    $center);
-        $worksheet->write((2*($i+9)), 1, sprintf("0x%02X", 1),  $center);
-
-        $worksheet->write((2*($i+9)), 3, "Border", $format);
-    }
-}
-
-
-
-######################################################################
-#
-# Demonstrate the standard Excel cell patterns.
-#
-sub patterns {
-
-    my $worksheet = $workbook->add_worksheet('Patterns');
-
-    $worksheet->set_column(0, 4, 10);
-    $worksheet->set_column(5, 5, 50);
-
-    $worksheet->write(0, 0, "Index", $heading);
-    $worksheet->write(0, 1, "Index", $heading);
-    $worksheet->write(0, 3, "Pattern", $heading);
-
-    $worksheet->write(0, 5, "The background colour has been set to silver.", $heading);
-    $worksheet->write(1, 5, "The foreground colour has been set to green.",  $heading);
-
-    for my $i (0..18){
-        my $format = $workbook->add_format();
-
-        $format->set_pattern($i);
-        $format->set_bg_color('silver');
-        $format->set_fg_color('green');
-        $format->set_align('center');
-
-        $worksheet->write((2*($i+1)), 0, $i,                    $center);
-        $worksheet->write((2*($i+1)), 1, sprintf("0x%02X", $i), $center);
-
-        $worksheet->write((2*($i+1)), 3, "Pattern", $format);
-
-        if ($i == 1) {
-            $worksheet->write((2*($i+1)), 5, "This is solid colour, the most useful pattern.", $heading);
-        }
-    }
-}
-
-
-######################################################################
-#
-# Demonstrate the standard Excel cell alignments.
-#
-sub alignment {
-
-    my $worksheet = $workbook->add_worksheet('Alignment');
-
-    $worksheet->set_column(0, 7, 12);
-    $worksheet->set_row(0, 40);
-    $worksheet->set_selection(7, 0);
-
-    my $format01 = $workbook->add_format();
-    my $format02 = $workbook->add_format();
-    my $format03 = $workbook->add_format();
-    my $format04 = $workbook->add_format();
-    my $format05 = $workbook->add_format();
-    my $format06 = $workbook->add_format();
-    my $format07 = $workbook->add_format();
-    my $format08 = $workbook->add_format();
-    my $format09 = $workbook->add_format();
-    my $format10 = $workbook->add_format();
-    my $format11 = $workbook->add_format();
-    my $format12 = $workbook->add_format();
-    my $format13 = $workbook->add_format();
-    my $format14 = $workbook->add_format();
-    my $format15 = $workbook->add_format();
-    my $format16 = $workbook->add_format();
-    my $format17 = $workbook->add_format();
-
-    $format02->set_align('top');
-    $format03->set_align('bottom');
-    $format04->set_align('vcenter');
-    $format05->set_align('vjustify');
-    $format06->set_text_wrap();
-
-    $format07->set_align('left');
-    $format08->set_align('right');
-    $format09->set_align('center');
-    $format10->set_align('fill');
-    $format11->set_align('justify');
-    $format12->set_merge();
-
-    $format13->set_rotation(45);
-    $format14->set_rotation(-45);
-    $format15->set_rotation(270);
-
-    $format16->set_shrink();
-    $format17->set_indent(1);
-
-    $worksheet->write(0, 0, 'Vertical',     $heading);
-    $worksheet->write(0, 1, 'top',          $format02);
-    $worksheet->write(0, 2, 'bottom',       $format03);
-    $worksheet->write(0, 3, 'vcenter',      $format04);
-    $worksheet->write(0, 4, 'vjustify',     $format05);
-    $worksheet->write(0, 5, "text\nwrap",   $format06);
-
-    $worksheet->write(2, 0, 'Horizontal',   $heading);
-    $worksheet->write(2, 1, 'left',         $format07);
-    $worksheet->write(2, 2, 'right',        $format08);
-    $worksheet->write(2, 3, 'center',       $format09);
-    $worksheet->write(2, 4, 'fill',         $format10);
-    $worksheet->write(2, 5, 'justify',      $format11);
-
-    $worksheet->write(3, 1, 'merge',        $format12);
-    $worksheet->write(3, 2, '',             $format12);
-
-    $worksheet->write(2, 3, 'Shrink ' x 3,  $format16);
-    $worksheet->write(2, 4, 'Indent',       $format17);
-
-
-    $worksheet->write(5, 0, 'Rotation',     $heading);
-    $worksheet->write(5, 1, 'Rotate 45',    $format13);
-    $worksheet->write(6, 1, 'Rotate -45',   $format14);
-    $worksheet->write(7, 1, 'Rotate 270',   $format15);
-}
-
-
-######################################################################
-#
-# Demonstrate other miscellaneous features.
-#
-sub misc {
-
-    my $worksheet = $workbook->add_worksheet('Miscellaneous');
-
-    $worksheet->set_column(2, 2, 25);
-
-    my $format01 = $workbook->add_format();
-    my $format02 = $workbook->add_format();
-    my $format03 = $workbook->add_format();
-    my $format04 = $workbook->add_format();
-    my $format05 = $workbook->add_format();
-    my $format06 = $workbook->add_format();
-    my $format07 = $workbook->add_format();
-
-    $format01->set_underline(0x01);
-    $format02->set_underline(0x02);
-    $format03->set_underline(0x21);
-    $format04->set_underline(0x22);
-    $format05->set_font_strikeout();
-    $format06->set_font_outline();
-    $format07->set_font_shadow();
-
-    $worksheet->write(1,  2, 'Underline  0x01',          $format01);
-    $worksheet->write(3,  2, 'Underline  0x02',          $format02);
-    $worksheet->write(5,  2, 'Underline  0x21',          $format03);
-    $worksheet->write(7,  2, 'Underline  0x22',          $format04);
-    $worksheet->write(9,  2, 'Strikeout',                $format05);
-    $worksheet->write(11, 2, 'Outline (Macintosh only)', $format06);
-    $worksheet->write(13, 2, 'Shadow (Macintosh only)',  $format07);
-}
-
+#!/usr/bin/perl -w
+
+######################################################################
+#
+# Examples of formatting using the Spreadsheet::WriteExcel module
+#
+# reverse('©'), September 2002, John McNamara, jmcnamara at cpan.org
+#
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+my $workbook = Spreadsheet::WriteExcel->new('formats.xls');
+
+# Some common formats
+my $center  = $workbook->add_format(align => 'center');
+my $heading = $workbook->add_format(align => 'center', bold => 1);
+
+# The named colors
+my %colors = (
+                0x08, 'black',
+                0x0C, 'blue',
+                0x10, 'brown',
+                0x0F, 'cyan',
+                0x17, 'gray',
+                0x11, 'green',
+                0x0B, 'lime',
+                0x0E, 'magenta',
+                0x12, 'navy',
+                0x35, 'orange',
+                0x21, 'pink',
+                0x14, 'purple',
+                0x0A, 'red',
+                0x16, 'silver',
+                0x09, 'white',
+                0x0D, 'yellow',
+             );
+
+# Call these subroutines to demonstrate different formatting options
+intro();
+fonts();
+named_colors();
+standard_colors();
+numeric_formats();
+borders();
+patterns();
+alignment();
+misc();
+
+# Note: this is required
+$workbook->close();
+
+
+######################################################################
+#
+# Intro.
+#
+sub intro {
+
+    my $worksheet = $workbook->add_worksheet('Introduction');
+
+    $worksheet->set_column(0, 0, 60);
+
+    my $format = $workbook->add_format();
+    $format->set_bold();
+    $format->set_size(14);
+    $format->set_color('blue');
+    $format->set_align('center');
+
+    my $format2 = $workbook->add_format();
+    $format2->set_bold();
+    $format2->set_color('blue');
+
+    $worksheet->write(2, 0, 'This workbook demonstrates some of',  $format);
+    $worksheet->write(3, 0, 'the formatting options provided by',  $format);
+    $worksheet->write(4, 0, 'the Spreadsheet::WriteExcel module.', $format);
+
+    $worksheet->write('A7',  'Sections:', $format2);
+    $worksheet->write('A8',  "internal:Fonts!A1",             'Fonts'          );
+    $worksheet->write('A9',  "internal:'Named colors'!A1",    'Named colors'   );
+    $worksheet->write('A10', "internal:'Standard colors'!A1", 'Standard colors');
+    $worksheet->write('A11', "internal:'Numeric formats'!A1", 'Numeric formats');
+    $worksheet->write('A12', "internal:Borders!A1",           'Borders'        );
+    $worksheet->write('A13', "internal:Patterns!A1",          'Patterns'       );
+    $worksheet->write('A14', "internal:Alignment!A1",         'Alignment'      );
+    $worksheet->write('A15', "internal:Miscellaneous!A1",     'Miscellaneous'  );
+
+}
+
+
+######################################################################
+#
+# Demonstrate the named colors.
+#
+sub named_colors {
+
+    my $worksheet = $workbook->add_worksheet('Named colors');
+
+    $worksheet->set_column(0, 3, 15);
+
+    $worksheet->write(0, 0, "Index", $heading);
+    $worksheet->write(0, 1, "Index", $heading);
+    $worksheet->write(0, 2, "Name",  $heading);
+    $worksheet->write(0, 3, "Color", $heading);
+
+    my $i = 1;
+
+    while (my($index, $color) = each %colors) {
+        my $format = $workbook->add_format(
+                                            bg_color => $color,
+                                            pattern  => 1,
+                                            border   => 1
+                                         );
+
+        $worksheet->write($i+1, 0, $index,                    $center);
+        $worksheet->write($i+1, 1, sprintf("0x%02X", $index), $center);
+        $worksheet->write($i+1, 2, $color,                    $center);
+        $worksheet->write($i+1, 3, '',                        $format);
+        $i++;
+    }
+}
+
+
+######################################################################
+#
+# Demonstrate the standard Excel colors in the range 8..63.
+#
+sub standard_colors {
+
+    my $worksheet = $workbook->add_worksheet('Standard colors');
+
+    $worksheet->set_column(0, 3, 15);
+
+    $worksheet->write(0, 0, "Index", $heading);
+    $worksheet->write(0, 1, "Index", $heading);
+    $worksheet->write(0, 2, "Color", $heading);
+    $worksheet->write(0, 3, "Name",  $heading);
+
+    for my $i (8..63) {
+        my $format = $workbook->add_format(
+                                            bg_color => $i,
+                                            pattern  => 1,
+                                            border   => 1
+                                         );
+
+        $worksheet->write(($i -7), 0, $i,                    $center);
+        $worksheet->write(($i -7), 1, sprintf("0x%02X", $i), $center);
+        $worksheet->write(($i -7), 2, '',                    $format);
+
+        # Add the  color names
+        if (exists $colors{$i}) {
+            $worksheet->write(($i -7), 3, $colors{$i}, $center);
+
+        }
+    }
+}
+
+
+######################################################################
+#
+# Demonstrate the standard numeric formats.
+#
+sub numeric_formats {
+
+    my $worksheet = $workbook->add_worksheet('Numeric formats');
+
+    $worksheet->set_column(0, 4, 15);
+    $worksheet->set_column(5, 5, 45);
+
+    $worksheet->write(0, 0, "Index",       $heading);
+    $worksheet->write(0, 1, "Index",       $heading);
+    $worksheet->write(0, 2, "Unformatted", $heading);
+    $worksheet->write(0, 3, "Formatted",   $heading);
+    $worksheet->write(0, 4, "Negative",    $heading);
+    $worksheet->write(0, 5, "Format",      $heading);
+
+    my @formats;
+    push @formats, [ 0x00, 1234.567,   0,         'General' ];
+    push @formats, [ 0x01, 1234.567,   0,         '0' ];
+    push @formats, [ 0x02, 1234.567,   0,         '0.00' ];
+    push @formats, [ 0x03, 1234.567,   0,         '#,##0' ];
+    push @formats, [ 0x04, 1234.567,   0,         '#,##0.00' ];
+    push @formats, [ 0x05, 1234.567,   -1234.567, '($#,##0_);($#,##0)' ];
+    push @formats, [ 0x06, 1234.567,   -1234.567, '($#,##0_);[Red]($#,##0)' ];
+    push @formats, [ 0x07, 1234.567,   -1234.567, '($#,##0.00_);($#,##0.00)' ];
+    push @formats, [ 0x08, 1234.567,   -1234.567, '($#,##0.00_);[Red]($#,##0.00)' ];
+    push @formats, [ 0x09, 0.567,      0,         '0%' ];
+    push @formats, [ 0x0a, 0.567,      0,         '0.00%' ];
+    push @formats, [ 0x0b, 1234.567,   0,         '0.00E+00' ];
+    push @formats, [ 0x0c, 0.75,       0,         '# ?/?' ];
+    push @formats, [ 0x0d, 0.3125,     0,         '# ??/??' ];
+    push @formats, [ 0x0e, 36892.521,  0,         'm/d/yy' ];
+    push @formats, [ 0x0f, 36892.521,  0,         'd-mmm-yy' ];
+    push @formats, [ 0x10, 36892.521,  0,         'd-mmm' ];
+    push @formats, [ 0x11, 36892.521,  0,         'mmm-yy' ];
+    push @formats, [ 0x12, 36892.521,  0,         'h:mm AM/PM' ];
+    push @formats, [ 0x13, 36892.521,  0,         'h:mm:ss AM/PM' ];
+    push @formats, [ 0x14, 36892.521,  0,         'h:mm' ];
+    push @formats, [ 0x15, 36892.521,  0,         'h:mm:ss' ];
+    push @formats, [ 0x16, 36892.521,  0,         'm/d/yy h:mm' ];
+    push @formats, [ 0x25, 1234.567,   -1234.567, '(#,##0_);(#,##0)' ];
+    push @formats, [ 0x26, 1234.567,   -1234.567, '(#,##0_);[Red](#,##0)' ];
+    push @formats, [ 0x27, 1234.567,   -1234.567, '(#,##0.00_);(#,##0.00)' ];
+    push @formats, [ 0x28, 1234.567,   -1234.567, '(#,##0.00_);[Red](#,##0.00)' ];
+    push @formats, [ 0x29, 1234.567,   -1234.567, '_(* #,##0_);_(* (#,##0);_(* "-"_);_(@_)' ];
+    push @formats, [ 0x2a, 1234.567,   -1234.567, '_($* #,##0_);_($* (#,##0);_($* "-"_);_(@_)' ];
+    push @formats, [ 0x2b, 1234.567,   -1234.567, '_(* #,##0.00_);_(* (#,##0.00);_(* "-"??_);_(@_)' ];
+    push @formats, [ 0x2c, 1234.567,   -1234.567, '_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)' ];
+    push @formats, [ 0x2d, 36892.521,  0,         'mm:ss' ];
+    push @formats, [ 0x2e, 3.0153,     0,         '[h]:mm:ss' ];
+    push @formats, [ 0x2f, 36892.521,  0,         'mm:ss.0' ];
+    push @formats, [ 0x30, 1234.567,   0,         '##0.0E+0' ];
+    push @formats, [ 0x31, 1234.567,   0,         '@' ];
+
+    my $i;
+    foreach my $format (@formats){
+        my $style = $workbook->add_format();
+        $style->set_num_format($format->[0]);
+
+        $i++;
+        $worksheet->write($i, 0, $format->[0],                    $center);
+        $worksheet->write($i, 1, sprintf("0x%02X", $format->[0]), $center);
+        $worksheet->write($i, 2, $format->[1],                    $center);
+        $worksheet->write($i, 3, $format->[1],                    $style);
+
+        if ($format->[2]) {
+            $worksheet->write($i, 4, $format->[2], $style);
+        }
+
+        $worksheet->write_string($i, 5, $format->[3]);
+    }
+}
+
+
+######################################################################
+#
+# Demonstrate the font options.
+#
+sub fonts {
+
+    my $worksheet = $workbook->add_worksheet('Fonts');
+
+    $worksheet->set_column(0, 0, 30);
+    $worksheet->set_column(1, 1, 10);
+
+    $worksheet->write(0, 0, "Font name",   $heading);
+    $worksheet->write(0, 1, "Font size",   $heading);
+
+    my @fonts;
+    push @fonts, [ 10, 'Arial' ];
+    push @fonts, [ 12, 'Arial' ];
+    push @fonts, [ 14, 'Arial' ];
+    push @fonts, [ 12, 'Arial Black' ];
+    push @fonts, [ 12, 'Arial Narrow' ];
+    push @fonts, [ 12, 'Century Schoolbook' ];
+    push @fonts, [ 12, 'Courier' ];
+    push @fonts, [ 12, 'Courier New' ];
+    push @fonts, [ 12, 'Garamond' ];
+    push @fonts, [ 12, 'Impact' ];
+    push @fonts, [ 12, 'Lucida Handwriting'] ;
+    push @fonts, [ 12, 'Times New Roman' ];
+    push @fonts, [ 12, 'Symbol' ];
+    push @fonts, [ 12, 'Wingdings' ];
+    push @fonts, [ 12, 'A font that doesnt exist' ];
+
+    my $i;
+    foreach my $font (@fonts){
+        my $format = $workbook->add_format();
+
+        $format->set_size($font->[0]);
+        $format->set_font($font->[1]);
+
+        $i++;
+        $worksheet->write($i, 0, $font->[1], $format);
+        $worksheet->write($i, 1, $font->[0], $format);
+    }
+
+}
+
+
+######################################################################
+#
+# Demonstrate the standard Excel border styles.
+#
+sub borders {
+
+    my $worksheet = $workbook->add_worksheet('Borders');
+
+    $worksheet->set_column(0, 4, 10);
+    $worksheet->set_column(5, 5, 40);
+
+    $worksheet->write(0, 0, "Index", $heading);
+    $worksheet->write(0, 1, "Index", $heading);
+    $worksheet->write(0, 3, "Style", $heading);
+    $worksheet->write(0, 5, "The style is highlighted in red for ", $heading);
+    $worksheet->write(1, 5, "emphasis, the default color is black.", $heading);
+
+    for my $i (0..7){
+        my $format = $workbook->add_format();
+        $format->set_border($i);
+        $format->set_border_color('red');
+        $format->set_align('center');
+
+        $worksheet->write((2*($i+1)), 0, $i,                    $center);
+        $worksheet->write((2*($i+1)), 1, sprintf("0x%02X", $i), $center);
+
+        $worksheet->write((2*($i+1)), 3, "Border", $format);
+    }
+
+    $worksheet->write(18, 0, "Diag type", $heading);
+    $worksheet->write(18, 1, "Index", $heading);
+    $worksheet->write(18, 3, "Style", $heading);
+
+    for my $i (1..3){
+        my $format = $workbook->add_format();
+        $format->set_diag_type($i);
+        $format->set_diag_border(1);
+        $format->set_diag_color('red');
+        $format->set_align('center');
+
+        $worksheet->write((2*($i+9)), 0, $i,                    $center);
+        $worksheet->write((2*($i+9)), 1, sprintf("0x%02X", 1),  $center);
+
+        $worksheet->write((2*($i+9)), 3, "Border", $format);
+    }
+}
+
+
+
+######################################################################
+#
+# Demonstrate the standard Excel cell patterns.
+#
+sub patterns {
+
+    my $worksheet = $workbook->add_worksheet('Patterns');
+
+    $worksheet->set_column(0, 4, 10);
+    $worksheet->set_column(5, 5, 50);
+
+    $worksheet->write(0, 0, "Index", $heading);
+    $worksheet->write(0, 1, "Index", $heading);
+    $worksheet->write(0, 3, "Pattern", $heading);
+
+    $worksheet->write(0, 5, "The background colour has been set to silver.", $heading);
+    $worksheet->write(1, 5, "The foreground colour has been set to green.",  $heading);
+
+    for my $i (0..18){
+        my $format = $workbook->add_format();
+
+        $format->set_pattern($i);
+        $format->set_bg_color('silver');
+        $format->set_fg_color('green');
+        $format->set_align('center');
+
+        $worksheet->write((2*($i+1)), 0, $i,                    $center);
+        $worksheet->write((2*($i+1)), 1, sprintf("0x%02X", $i), $center);
+
+        $worksheet->write((2*($i+1)), 3, "Pattern", $format);
+
+        if ($i == 1) {
+            $worksheet->write((2*($i+1)), 5, "This is solid colour, the most useful pattern.", $heading);
+        }
+    }
+}
+
+
+######################################################################
+#
+# Demonstrate the standard Excel cell alignments.
+#
+sub alignment {
+
+    my $worksheet = $workbook->add_worksheet('Alignment');
+
+    $worksheet->set_column(0, 7, 12);
+    $worksheet->set_row(0, 40);
+    $worksheet->set_selection(7, 0);
+
+    my $format01 = $workbook->add_format();
+    my $format02 = $workbook->add_format();
+    my $format03 = $workbook->add_format();
+    my $format04 = $workbook->add_format();
+    my $format05 = $workbook->add_format();
+    my $format06 = $workbook->add_format();
+    my $format07 = $workbook->add_format();
+    my $format08 = $workbook->add_format();
+    my $format09 = $workbook->add_format();
+    my $format10 = $workbook->add_format();
+    my $format11 = $workbook->add_format();
+    my $format12 = $workbook->add_format();
+    my $format13 = $workbook->add_format();
+    my $format14 = $workbook->add_format();
+    my $format15 = $workbook->add_format();
+    my $format16 = $workbook->add_format();
+    my $format17 = $workbook->add_format();
+
+    $format02->set_align('top');
+    $format03->set_align('bottom');
+    $format04->set_align('vcenter');
+    $format05->set_align('vjustify');
+    $format06->set_text_wrap();
+
+    $format07->set_align('left');
+    $format08->set_align('right');
+    $format09->set_align('center');
+    $format10->set_align('fill');
+    $format11->set_align('justify');
+    $format12->set_merge();
+
+    $format13->set_rotation(45);
+    $format14->set_rotation(-45);
+    $format15->set_rotation(270);
+
+    $format16->set_shrink();
+    $format17->set_indent(1);
+
+    $worksheet->write(0, 0, 'Vertical',     $heading);
+    $worksheet->write(0, 1, 'top',          $format02);
+    $worksheet->write(0, 2, 'bottom',       $format03);
+    $worksheet->write(0, 3, 'vcenter',      $format04);
+    $worksheet->write(0, 4, 'vjustify',     $format05);
+    $worksheet->write(0, 5, "text\nwrap",   $format06);
+
+    $worksheet->write(2, 0, 'Horizontal',   $heading);
+    $worksheet->write(2, 1, 'left',         $format07);
+    $worksheet->write(2, 2, 'right',        $format08);
+    $worksheet->write(2, 3, 'center',       $format09);
+    $worksheet->write(2, 4, 'fill',         $format10);
+    $worksheet->write(2, 5, 'justify',      $format11);
+
+    $worksheet->write(3, 1, 'merge',        $format12);
+    $worksheet->write(3, 2, '',             $format12);
+
+    $worksheet->write(2, 3, 'Shrink ' x 3,  $format16);
+    $worksheet->write(2, 4, 'Indent',       $format17);
+
+
+    $worksheet->write(5, 0, 'Rotation',     $heading);
+    $worksheet->write(5, 1, 'Rotate 45',    $format13);
+    $worksheet->write(6, 1, 'Rotate -45',   $format14);
+    $worksheet->write(7, 1, 'Rotate 270',   $format15);
+}
+
+
+######################################################################
+#
+# Demonstrate other miscellaneous features.
+#
+sub misc {
+
+    my $worksheet = $workbook->add_worksheet('Miscellaneous');
+
+    $worksheet->set_column(2, 2, 25);
+
+    my $format01 = $workbook->add_format();
+    my $format02 = $workbook->add_format();
+    my $format03 = $workbook->add_format();
+    my $format04 = $workbook->add_format();
+    my $format05 = $workbook->add_format();
+    my $format06 = $workbook->add_format();
+    my $format07 = $workbook->add_format();
+
+    $format01->set_underline(0x01);
+    $format02->set_underline(0x02);
+    $format03->set_underline(0x21);
+    $format04->set_underline(0x22);
+    $format05->set_font_strikeout();
+    $format06->set_font_outline();
+    $format07->set_font_shadow();
+
+    $worksheet->write(1,  2, 'Underline  0x01',          $format01);
+    $worksheet->write(3,  2, 'Underline  0x02',          $format02);
+    $worksheet->write(5,  2, 'Underline  0x21',          $format03);
+    $worksheet->write(7,  2, 'Underline  0x22',          $format04);
+    $worksheet->write(9,  2, 'Strikeout',                $format05);
+    $worksheet->write(11, 2, 'Outline (Macintosh only)', $format06);
+    $worksheet->write(13, 2, 'Shadow (Macintosh only)',  $format07);
+}
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/formula_result.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/formula_result.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/formula_result.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,28 +1,28 @@
-#!/usr/bin/perl -w
-
-#######################################################################
-#
-# Example of how to write Spreadsheet::WriteExcel formulas with a user
-# specified result. This is generally only required when writing a
-# spreadsheet for an application other than Excel where the formula
-# isn't evaluated.
-#
-# reverse('©'), August 2005, John McNamara, jmcnamara at cpan.org
-#
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-my $workbook  = Spreadsheet::WriteExcel->new('formula_result.xls');
-my $worksheet = $workbook->add_worksheet();
-my $format    = $workbook->add_format(color => 'blue');
-
-
-$worksheet->write('A1', '=1+2');
-$worksheet->write('A2', '=1+2',                     $format, 4);
-$worksheet->write('A3', '="ABC"',                   undef,   'DEF');
-$worksheet->write('A4', '=IF(A1 > 1, TRUE, FALSE)', undef,   'TRUE');
-$worksheet->write('A5', '=1/0',                     undef,   '#DIV/0!');
-
-
-__END__
+#!/usr/bin/perl -w
+
+#######################################################################
+#
+# Example of how to write Spreadsheet::WriteExcel formulas with a user
+# specified result. This is generally only required when writing a
+# spreadsheet for an application other than Excel where the formula
+# isn't evaluated.
+#
+# reverse('©'), August 2005, John McNamara, jmcnamara at cpan.org
+#
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+my $workbook  = Spreadsheet::WriteExcel->new('formula_result.xls');
+my $worksheet = $workbook->add_worksheet();
+my $format    = $workbook->add_format(color => 'blue');
+
+
+$worksheet->write('A1', '=1+2');
+$worksheet->write('A2', '=1+2',                     $format, 4);
+$worksheet->write('A3', '="ABC"',                   undef,   'DEF');
+$worksheet->write('A4', '=IF(A1 > 1, TRUE, FALSE)', undef,   'TRUE');
+$worksheet->write('A5', '=1/0',                     undef,   '#DIV/0!');
+
+
+__END__

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/function_locale.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/function_locale.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/function_locale.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,361 +1,361 @@
-#!/usr/bin/perl -w
-
-###############################################################################
-#
-# Generate function names for different locales.
-#
-# This program can be used to generate the hash of known functions for use in
-# the Formula.pm module. By default the function names are in English but you
-# can also choose to support the following languages: German, French, Spanish,
-# Portuguese, Dutch, Finnish, Italian and Swedish.
-#
-# This would allow you to do something like the following:
-#
-#       $worksheet->write(0, 0, '=SUM(C1:C3)'  );
-#       $worksheet->write(1, 0, '=SUMME(C1:C3)');
-#       $worksheet->write(2, 0, '=SOMME(C1:C3)');
-#       $worksheet->write(3, 0, '=SUMA(C1:C3)' );
-#       $worksheet->write(4, 0, '=SOMA(C1:C3)' );
-#       $worksheet->write(5, 0, '=SOM(C1:C3)'  );
-#       $worksheet->write(6, 0, '=SUMMA(C1:C3)');
-#       $worksheet->write(7, 0, '=SOMMA(C1:C3)');
-#
-# Unfortunately, if you wish to support more than one language there are some
-# conflicts between function names:
-#
-#       Function        Language 1              Language 2
-#       ========        ==========              ==========
-#       NB              French                  Dutch
-#       NA              English/French          Finnish
-#       TRIM            French                  English
-#       DIA             Spanish/Portuguese      German
-#
-# Therefore, if you try to generate a hash of function names to support both
-# French and English then the function TRIM will be assigned the meaning of the
-# first language that defines it, which in this case is French. You can get
-# around this by renaming the function for one of the languages and documenting
-# the change, for example: TRIM.EN or TRIM.FR.
-#
-# Please note that this only partially solves the problem of localisation.
-# There are also number formats to consider (1.5 == 1,5) and the fact that the
-# list separator "," and the array separator ";" are interchanged in different
-# locales.
-#
-# The longest function name is LOI.NORMALE.STANDARD.INVERSE (29 chars) followed
-# by NORM.JAKAUMA.NORMIT.KÄÄNT (25 chars).
-# The shortest function name in all languages is T.
-#
-#
-# reverse('©'); John McNamara, March 2001, jmcnamara at cpan.org
-#
-
-
-
-use strict;
-
-
-#
-# Modify the following variables to add the language to the function name hash
-#
-my $english    = 1;
-my $german     = 0;
-my $french     = 0;
-my $spanish    = 0;
-my $portuguese = 0;
-my $dutch      = 0;
-my $finnish    = 0;
-my $italian    = 0;
-my $swedish    = 0;
-
-my %funcs;
-
-# Ignore the headings
-<DATA>;
-
-# Print the beginning of the hash definition
-print "    %functions  = (\n";
-print "        #" . " " x 37 ;
-print "ptg  args  class  vol\n";
-
-while (<DATA>){
-    my @F = split " ";
-    my $value = $F[0];
-    my $args  = $F[1];
-    my $ref   = $F[2];
-    my $vol   = $F[3];
-
-    print_function($F[4],  $value, $args, $ref, $vol) if $english;
-    print_function($F[5],  $value, $args, $ref, $vol) if $german;
-    print_function($F[6],  $value, $args, $ref, $vol) if $french;
-    print_function($F[7],  $value, $args, $ref, $vol) if $spanish;
-    print_function($F[8],  $value, $args, $ref, $vol) if $portuguese;
-    print_function($F[9],  $value, $args, $ref, $vol) if $dutch;
-    print_function($F[10], $value, $args, $ref, $vol) if $finnish;
-    print_function($F[11], $value, $args, $ref, $vol) if $italian;
-    print_function($F[12], $value, $args, $ref, $vol) if $swedish;
-}
-# Print the end of the hash definition
-print "    );\n";
-
-
-###############################################################################
-#
-# Function to print the function names. It prints a warning if there is a
-# clash.
-#
-sub print_function {
-
-    my $func  = shift;
-    my $value = shift;
-    my $args  = shift;
-    my $ref   = shift;
-    my $vol   = shift;
-
-    $func = "'$func'";
-
-    if (not exists $funcs{$func}) {
-        printf("        %-31s => [%4d, %4d, %4d, %4d ],\n",
-                                   $func, $value, $args, $ref, $vol);
-        $funcs{$func} = $value;
-    }
-    else {
-        if ($funcs{$func} != $value) {
-            print "        # Warning ";
-            print $func, " is already defined in another language\n";
-            printf("        #%-31s => [%4d, %4d, %4d, %4d ],\n",
-                                        $func, $value, $args, $ref, $vol);
-        }
-    }
-}
-
-
-# Note: The following data contains the function names in the various
-# languages. These lines are LONG.
-
-__DATA__
-Value   Args    Refclass   Volatile   English                            German                             French                             Spanish                            Portuguese                         Dutch                        Finnish                            Italian                            Swedish
-0       -1      0          0          COUNT                              ANZAHL                             NB                                 CONTAR                             CONT.NÚM                           AANTAL                       LASKE                              CONTA.NUMERI                       ANTAL
-1       -1      1          0          IF                                 WENN                               SI                                 SI                                 SE                                 ALS                          JOS                                SE                                 OM
-2        1      1          0          ISNA                               ISTNV                              ESTNA                              ESNOD                              É.NÃO.DISP                         ISNB                         ONPUUTTUU                          VAL.NON.DISP                       ÄRSAKNAD
-3        1      1          0          ISERROR                            ISTFEHLER                          ESTERREUR                          ESERROR                            ÉERROS                             ISFOUT                       ONVIRHE                            VAL.ERRORE                         ÄRFEL
-4       -1      0          0          SUM                                SUMME                              SOMME                              SUMA                               SOMA                               SOM                          SUMMA                              SOMMA                              SUMMA
-5       -1      0          0          AVERAGE                            MITTELWERT                         MOYENNE                            PROMEDIO                           MÉDIA                              GEMIDDELDE                   KESKIARVO                          MEDIA                              MEDEL
-6       -1      0          0          MIN                                MIN                                MIN                                MIN                                MÍNIMO                             MIN                          MIN                                MIN                                MIN
-7       -1      0          0          MAX                                MAX                                MAX                                MAX                                MÁXIMO                             MAX                          MAKS                               MAX                                MAX
-8       -1      0          0          ROW                                ZEILE                              LIGNE                              FILA                               LIN                                RIJ                          RIVI                               RIF.RIGA                           RAD
-9       -1      0          0          COLUMN                             SPALTE                             COLONNE                            COLUMNA                            COL                                KOLOM                        SARAKE                             RIF.COLONNA                        KOLUMN
-10       0      0          0          NA                                 NV                                 NA                                 NOD                                NÃO.DISP                           NB                           PUUTTUU                            NON.DISP                           SAKNAS
-11      -1      1          0          NPV                                NBW                                VAN                                VNA                                VPL                                NHW                          NNA                                VAN                                NETNUVÄRDE
-12      -1      0          0          STDEV                              STABW                              ECARTYPE                           DESVEST                            DESVPAD                            STDEV                        KESKIHAJONTA                       DEV.ST                             STDAV
-13      -1      1          0          DOLLAR                             DM                                 FRANC                              MONEDA                             MOEDA                              GULDEN                       VALUUTTA                           VALUTA                             VALUTA
-14      -1      1          0          FIXED                              FEST                               CTXT                               DECIMAL                            DEF.NÚM.DEC                        VAST                         KIINTEÄ                            FISSO                              FASTTAL
-15       1      1          0          SIN                                SIN                                SIN                                SENO                               SEN                                SIN                          SIN                                SEN                                SIN
-16       1      1          0          COS                                COS                                COS                                COS                                COS                                COS                          COS                                COS                                COS
-17       1      1          0          TAN                                TAN                                TAN                                TAN                                TAN                                TAN                          TAN                                TAN                                TAN
-18       1      1          0          ATAN                               ARCTAN                             ATAN                               ATAN                               ATAN                               BOOGTAN                      ATAN                               ARCTAN                             ARCTAN
-19       0      1          0          PI                                 PI                                 PI                                 PI                                 PI                                 PI                           PII                                PI.GRECO                           PI
-20       1      1          0          SQRT                               WURZEL                             RACINE                             RAIZ                               RAIZ                               WORTEL                       NELIÖJUURI                         RADQ                               ROT
-21       1      1          0          EXP                                EXP                                EXP                                EXP                                EXP                                EXP                          EKSPONENTTI                        EXP                                EXP
-22       1      1          0          LN                                 LN                                 LN                                 LN                                 LN                                 LN                           LUONNLOG                           LN                                 LN
-23       1      1          0          LOG10                              LOG10                              LOG10                              LOG10                              LOG10                              LOG10                        LOG10                              LOG10                              LOG10
-24       1      1          0          ABS                                ABS                                ABS                                ABS                                ABS                                ABS                          ITSEISARVO                         ASS                                ABS
-25       1      1          0          INT                                GANZZAHL                           ENT                                ENTERO                             INT                                INTEGER                      KOKONAISLUKU                       INT                                HELTAL
-26       1      1          0          SIGN                               VORZEICHEN                         SIGNE                              SIGNO                              SINAL                              POS.NEG                      ETUMERKKI                          SEGNO                              TECKEN
-27       2      1          0          ROUND                              RUNDEN                             ARRONDI                            REDONDEAR                          ARRED                              AFRONDEN                     PYÖRISTÄ                           ARROTONDA                          AVRUNDA
-28      -1      0          0          LOOKUP                             VERWEIS                            RECHERCHE                          BUSCAR                             PROC                               ZOEKEN                       HAKU                               CERCA                              LETAUPP
-29      -1      0          1          INDEX                              INDEX                              INDEX                              INDICE                             ÍNDICE                             INDEX                        INDEKSI                            INDICE                             INDEX
-30       2      1          0          REPT                               WIEDERHOLEN                        REPT                               REPETIR                            REPETIR                            HERHALING                    TOISTA                             RIPETI                             REP
-31       3      1          0          MID                                TEIL                               STXT                               EXTRAE                             EXT.TEXTO                          DEEL                         POIMI.TEKSTI                       STRINGA.ESTRAI                     EXTEXT
-32       1      1          0          LEN                                LÄNGE                              NBCAR                              LARGO                              NÚM.CARACT                         LENGTE                       PITUUS                             LUNGHEZZA                          LÄNGD
-33       1      1          0          VALUE                              WERT                               CNUM                               VALOR                              VALOR                              WAARDE                       ARVO                               VALORE                             TEXTNUM
-34       0      1          0          TRUE                               WAHR                               VRAI                               VERDADERO                          VERDADEIRO                         WAAR                         TOSI                               VERO                               SANT
-35       0      1          0          FALSE                              FALSCH                             FAUX                               FALSO                              FALSO                              ONWAAR                       EPÄTOSI                            FALSO                              FALSKT
-36      -1      0          0          AND                                UND                                ET                                 Y                                  E                                  EN                           JA                                 E                                  OCH
-37      -1      0          0          OR                                 ODER                               OU                                 O                                  OU                                 OF                           TAI                                O                                  ELLER
-38       1      1          0          NOT                                NICHT                              NON                                NO                                 NÃO                                NIET                         EI                                 NON                                ICKE
-39       2      1          0          MOD                                REST                               MOD                                RESIDUO                            MOD                                REST                         JAKOJ                              RESTO                              REST
-40       3      0          0          DCOUNT                             DBANZAHL                           BDNB                               BDCONTAR                           BDCONTAR                           DBAANTAL                     TLASKE                             DB.CONTA.NUMERI                    DANTAL
-41       3      0          0          DSUM                               DBSUMME                            BDSOMME                            BDSUMA                             BDSOMA                             DBSOM                        TSUMMA                             DB.SOMMA                           DSUMMA
-42       3      0          0          DAVERAGE                           DBMITTELWERT                       BDMOYENNE                          BDPROMEDIO                         BDMÉDIA                            DBGEMIDDELDE                 TKESKIARVO                         DB.MEDIA                           DMEDEL
-43       3      0          0          DMIN                               DBMIN                              BDMIN                              BDMIN                              BDMÍN                              DBMIN                        TMIN                               DB.MIN                             DMIN
-44       3      0          0          DMAX                               DBMAX                              BDMAX                              BDMAX                              BDMÁX                              DBMAX                        TMAKS                              DB.MAX                             DMAX
-45       3      0          0          DSTDEV                             DBSTDABW                           BDECARTYPE                         BDDESVEST                          BDEST                              DBSTDEV                      TKESKIHAJONTA                      DB.DEV.ST                          DSTDAV
-46      -1      0          0          VAR                                VARIANZ                            VAR                                VAR                                VAR                                VAR                          VAR                                VAR                                VARIANS
-47       3      0          0          DVAR                               DBVARIANZ                          BDVAR                              BDVAR                              BDVAREST                           DBVAR                        TVARIANSSI                         DB.VAR                             DVARIANS
-48       2      1          0          TEXT                               TEXT                               TEXTE                              TEXTO                              TEXTO                              TEKST                        TEKSTI                             TESTO                              TEXT
-49      -1      0          0          LINEST                             RGP                                DROITEREG                          ESTIMACION.LINEAL                  PROJ.LIN                           LIJNSCH                      LINREGR                            REGR.LIN                           REGR
-50      -1      0          0          TREND                              TREND                              TENDANCE                           TENDENCIA                          TENDÊNCIA                          TREND                        SUUNTAUS                           TENDENZA                           TREND
-51      -1      0          0          LOGEST                             RKP                                LOGREG                             ESTIMACION.LOGARITMICA             PROJ.LOG                           LOGSCH                       LOGREGR                            REGR.LOG                           EXPREGR
-52      -1      0          0          GROWTH                             VARIATION                          CROISSANCE                         CRECIMIENTO                        CRESCIMENTO                        GROEI                        KASVU                              CRESCITA                           EXPTREND
-56      -1      1          0          PV                                 BW                                 VA                                 VA                                 VP                                 HW                           NA                                 VA                                 NUVÄRDE
-57      -1      1          0          FV                                 ZW                                 VC                                 VF                                 VF                                 TW                           TULEVA.ARVO                        VAL.FUT                            SLUTVÄRDE
-58      -1      1          0          NPER                               ZZR                                NPM                                NPER                               NPER                               NPER                         NJAKSO                             NUM.RATE                           PERIODER
-59      -1      1          0          PMT                                RMZ                                VPM                                PAGO                               PGTO                               BET                          MAKSU                              RATA                               BETALNING
-60      -1      1          0          RATE                               ZINS                               TAUX                               TASA                               TAXA                               RENTE                        KORKO                              TASSO                              RÄNTA
-61       3      0          0          MIRR                               QIKV                               TRIM                               TIRM                               MTIR                               GIR                          MSISÄINEN                          TIR.VAR                            MODIR
-62      -1      0          0          IRR                                IKV                                TRI                                TIR                                TIR                                IR                           SISÄINEN.KORKO                     TIR.COST                           IR
-63       0      1          1          RAND                               ZUFALLSZAHL                        ALEA                               ALEATORIO                          ALEATÓRIO                          ASELECT                      SATUNNAISLUKU                      CASUALE                            SLUMP
-64      -1      0          0          MATCH                              VERGLEICH                          EQUIV                              COINCIDIR                          CORRESP                            VERGELIJKEN                  VASTINE                            CONFRONTA                          PASSA
-65       3      1          0          DATE                               DATUM                              DATE                               FECHA                              DATA                               DATUM                        PÄIVÄYS                            DATA                               DATUM
-66       3      1          0          TIME                               ZEIT                               TEMPS                              NSHORA                             TEMPO                              TIJD                         AIKA                               ORARIO                             KLOCKSLAG
-67       1      1          0          DAY                                TAG                                JOUR                               DIA                                DIA                                DAG                          PÄIVÄ                              GIORNO                             DAG
-68       1      1          0          MONTH                              MONAT                              MOIS                               MES                                MÊS                                MAAND                        KUUKAUSI                           MESE                               MÅNAD
-69       1      1          0          YEAR                               JAHR                               ANNEE                              AÑO                                ANO                                JAAR                         VUOSI                              ANNO                               ÅR
-70      -1      1          0          WEEKDAY                            WOCHENTAG                          JOURSEM                            DIASEM                             DIA.DA.SEMANA                      WEEKDAG                      VIIKONPÄIVÄ                        GIORNO.SETTIMANA                   VECKODAG
-71       1      1          0          HOUR                               STUNDE                             HEURE                              HORA                               HORA                               UUR                          TUNNIT                             ORA                                TIMME
-72       1      1          0          MINUTE                             MINUTE                             MINUTE                             MINUTO                             MINUTO                             MINUUT                       MINUUTIT                           MINUTO                             MINUT
-73       1      1          0          SECOND                             SEKUNDE                            SECONDE                            SEGUNDO                            SEGUNDO                            SECONDE                      SEKUNNIT                           SECONDO                            SEKUND
-74       0      1          1          NOW                                JETZT                              MAINTENANT                         AHORA                              AGORA                              NU                           NYT                                ADESSO                             NU
-75       1      0          1          AREAS                              BEREICHE                           ZONES                              AREAS                              ÁREAS                              BEREIKEN                     ALUEET                             AREE                               OMRÅDEN
-76       1      0          1          ROWS                               ZEILEN                             LIGNES                             FILAS                              LINS                               RIJEN                        RIVIT                              RIGHE                              RADER
-77       1      0          1          COLUMNS                            SPALTEN                            COLONNES                           COLUMNAS                           COLS                               KOLOMMEN                     SARAKKEET                          COLONNE                            KOLUMNER
-78      -1      0          1          OFFSET                             BEREICH.VERSCHIEBEN                DECALER                            DESREF                             DESLOC                             VERSCHUIVING                 SIIRTYMÄ                           SCARTO                             FÖRSKJUTNING
-82      -1      1          0          SEARCH                             SUCHEN                             CHERCHE                            HALLAR                             LOCALIZAR                          VIND.SPEC                    KÄY.LÄPI                           RICERCA                            SÖK
-83       1      1          0          TRANSPOSE                          MTRANS                             TRANSPOSE                          TRANSPONER                         TRANSPOR                           TRANSPONEREN                 TRANSPONOI                         MATR.TRASPOSTA                     TRANSPONERA
-86       1      1          0          TYPE                               TYP                                TYPE                               TIPO                               TIPO                               TYPE                         TYYPPI                             TIPO                               VÄRDETYP
-97       2      1          0          ATAN2                              ARCTAN2                            ATAN2                              ATAN2                              ATAN2                              BOOGTAN2                     ATAN2                              ARCTAN.2                           ARCTAN2
-98       1      1          0          ASIN                               ARCSIN                             ASIN                               ASENO                              ASEN                               BOOGSIN                      ASIN                               ARCSEN                             ARCSIN
-99       1      1          0          ACOS                               ARCCOS                             ACOS                               ACOS                               ACOS                               BOOGCOS                      ACOS                               ARCCOS                             ARCCOS
-100     -1      1          0          CHOOSE                             WAHL                               CHOISIR                            ELEGIR                             ESCOLHER                           KIEZEN                       VALITSE.INDEKSI                    SCEGLI                             VÄLJ
-101     -1      0          0          HLOOKUP                            WVERWEIS                           RECHERCHEH                         BUSCARH                            PROCH                              HORIZ.ZOEKEN                 VHAKU                              CERCA.ORIZZ                        LETAKOLUMN
-102     -1      0          0          VLOOKUP                            SVERWEIS                           RECHERCHEV                         BUSCARV                            PROCV                              VERT.ZOEKEN                  PHAKU                              CERCA.VERT                         LETARAD
-105      1      0          0          ISREF                              ISTBEZUG                           ESTREF                             ESREF                              ÉREF                               ISVERWIJZING                 ONVIITT                            VAL.RIF                            ÄRREF
-109     -1      1          0          LOG                                LOG                                LOG                                LOG                                LOG                                LOG                          LOG                                LOG                                LOG
-111      1      1          0          CHAR                               ZEICHEN                            CAR                                CARACTER                           CARACT                             TEKEN                        MERKKI                             CODICE.CARATT                      TECKENKOD
-112      1      1          0          LOWER                              KLEIN                              MINUSCULE                          MINUSC                             MINÚSCULA                          KLEINE.LETTERS               PIENET                             MINUSC                             GEMENER
-113      1      1          0          UPPER                              GROSS                              MAJUSCULE                          MAYUSC                             MAIÚSCULA                          HOOFDLETTERS                 ISOT                               MAIUSC                             VERSALER
-114      1      1          0          PROPER                             GROSS2                             NOMPROPRE                          NOMPROPIO                          PRI.MAIÚSCULA                      BEGINLETTERS                 ERISNIMI                           MAIUSC.INIZ                        INITIAL
-115     -1      1          0          LEFT                               LINKS                              GAUCHE                             IZQUIERDA                          ESQUERDA                           LINKS                        VASEN                              SINISTRA                           VÄNSTER
-116     -1      1          0          RIGHT                              RECHTS                             DROITE                             DERECHA                            DIREITA                            RECHTS                       OIKEA                              DESTRA                             HÖGER
-117      2      1          0          EXACT                              IDENTISCH                          EXACT                              IGUAL                              EXATO                              GELIJK                       VERTAA                             IDENTICO                           EXAKT
-118      1      1          0          TRIM                               GLÄTTEN                            SUPPRESPACE                        ESPACIOS                           ARRUMAR                            SPATIES.WISSEN               POISTA.VÄLIT                       ANNULLA.SPAZI                      RENSA
-119      4      1          0          REPLACE                            ERSETZEN                           REMPLACER                          REEMPLAZAR                         MUDAR                              VERVANGEN                    KORVAA                             RIMPIAZZA                          ERSÄTT
-120     -1      1          0          SUBSTITUTE                         WECHSELN                           SUBSTITUE                          SUSTITUIR                          SUBSTITUIR                         SUBSTITUEREN                 VAIHDA                             SOSTITUISCI                        BYT.UT
-121      1      1          0          CODE                               CODE                               CODE                               CODIGO                             CÓDIGO                             CODE                         KOODI                              CODICE                             KOD
-124     -1      1          0          FIND                               FINDEN                             TROUVE                             ENCONTRAR                          PROCURAR                           VIND.ALLES                   ETSI                               TROVA                              HITTA
-125     -1      0          1          CELL                               ZELLE                              CELLULE                            CELDA                              CÉL                                CEL                          SOLU                               CELLA                              CELL
-126      1      1          0          ISERR                              ISTFEHL                            ESTERR                             ESERR                              ÉERRO                              ISFOUT2                      ONVIRH                             VAL.ERR                            ÄRF
-127      1      1          0          ISTEXT                             ISTTEXT                            ESTTEXTE                           ESTEXTO                            ÉTEXTO                             ISTEKST                      ONTEKSTI                           VAL.TESTO                          ÄRTEXT
-128      1      1          0          ISNUMBER                           ISTZAHL                            ESTNUM                             ESNUMERO                           ÉNÚM                               ISGETAL                      ONLUKU                             VAL.NUMERO                         ÄRTAL
-129      1      1          0          ISBLANK                            ISTLEER                            ESTVIDE                            ESBLANCO                           ÉCÉL.VAZIA                         ISLEEG                       ONTYHJÄ                            VAL.VUOTO                          ÄRTOM
-130      1      0          0          T                                  T                                  T                                  T                                  T                                  T                            T                                  T                                  T
-131      1      0          0          N                                  N                                  N                                  N                                  N                                  N                            N                                  NUM                                N
-140      1      1          0          DATEVALUE                          DATWERT                            DATEVAL                            FECHANUMERO                        DATA.VALOR                         DATUMWAARDE                  PÄIVÄYSARVO                        DATA.VALORE                        DATUMVÄRDE
-141      1      1          0          TIMEVALUE                          ZEITWERT                           TEMPSVAL                           HORANUMERO                         VALOR.TEMPO                        TIJDWAARDE                   AIKA_ARVO                          ORARIO.VALORE                      TIDVÄRDE
-142      3      1          0          SLN                                LIA                                AMORLIN                            SLN                                DPD                                LIN.AFSCHR                   STP                                AMMORT.COST                        LINAVSKR
-143      4      1          0          SYD                                DIA                                SYD                                SYD                                SDA                                SYD                          VUOSIPOISTO                        AMMORT.ANNUO                       ÅRSAVSKR
-144     -1      1          0          DDB                                GDA                                DDB                                DDB                                BDD                                DDB                          DDB                                AMMORT                             DEGAVSKR
-148     -1      1          1          INDIRECT                           INDIREKT                           INDIRECT                           INDIRECTO                          INDIRETO                           INDIRECT                     EPÄSUORA                           INDIRETTO                          INDIREKT
-150     -1      1          0          CALL                               AUFRUFEN                           FONCTION.APPELANTE                 LLAMAR                             CHAMAR                             ROEPEN                       KUTSU                              RICHIAMA                           ANROPA
-162      1      1          0          CLEAN                              SÄUBERN                            EPURAGE                            LIMPIAR                            TIRAR                              WISSEN.CONTROL               SIIVOA                             LIBERA                             STÄDA
-163      1      2          0          MDETERM                            MDET                               DETERMAT                           MDETERM                            MATRIZ.DETERM                      DETERMINANTMAT               MDETERM                            MATR.DETERM                        MDETERM
-164      1      2          0          MINVERSE                           MINV                               INVERSEMAT                         MINVERSA                           MATRIZ.INVERSO                     INVERSEMAT                   MKÄÄNTEINEN                        MATR.INVERSA                       MINVERT
-165      2      2          0          MMULT                              MMULT                              PRODUITMAT                         MMULT                              MATRIZ.MULT                        PRODUKTMAT                   MKERRO                             MATR.PRODOTTO                      MMULT
-167     -1      1          0          IPMT                               ZINSZ                              INTPER                             PAGOINT                            IPGTO                              IBET                         IPMT                               INTERESSI                          RBETALNING
-168     -1      1          0          PPMT                               KAPZ                               PRINCPER                           PAGOPRIN                           PPGTO                              PBET                         PPMT                               P.RATA                             AMORT
-169     -1      0          0          COUNTA                             ANZAHL2                            NBVAL                              CONTARA                            CONT.VALORES                       AANTALARG                    LASKE.A                            CONTA.VALORI                       ANTALV
-183     -1      0          0          PRODUCT                            PRODUKT                            PRODUIT                            PRODUCTO                           MULT                               PRODUKT                      TULO                               PRODOTTO                           PRODUKT
-184      1      1          0          FACT                               FAKULTÄT                           FACT                               FACT                               FATORIAL                           FACULTEIT                    KERTOMA                            FATTORIALE                         FAKULTET
-189      3      0          0          DPRODUCT                           DBPRODUKT                          BDPRODUIT                          BDPRODUCTO                         BDMULTIPL                          DBPRODUKT                    TTULO                              DB.PRODOTTO                        DPRODUKT
-190      1      1          0          ISNONTEXT                          ISTKTEXT                           ESTNONTEXTE                        ESNOTEXTO                          É.NÃO.TEXTO                        ISGEENTEKST                  ONEI_TEKSTI                        VAL.NON.TESTO                      ÄREJTEXT
-193     -1      0          0          STDEVP                             STABWN                             ECARTYPEP                          DESVESTP                           DESVPADP                           STDEVP                       KESKIHAJONTAP                      DEV.ST.POP                         STDAVP
-194     -1      0          0          VARP                               VARIANZEN                          VAR.P                              VARP                               VARP                               VARP                         VARP                               VAR.POP                            VARIANSP
-195      3      0          0          DSTDEVP                            DBSTDABWN                          BDECARTYPEP                        BDDESVESTP                         BDDESVPA                           DBSTDEVP                     TKESKIHAJONTAP                     DB.DEV.ST.POP                      DSTDAVP
-196      3      0          0          DVARP                              DBVARIANZEN                        BDVARP                             BDVARP                             BDVARP                             DBVARP                       TVARIANSSIP                        DB.VAR.POP                         DVARIANSP
-197     -1      1          0          TRUNC                              KÜRZEN                             TRONQUE                            TRUNCAR                            TRUNCAR                            GEHEEL                       KATKAISE                           TRONCA                             AVKORTA
-198      1      1          0          ISLOGICAL                          ISTLOG                             ESTLOGIQUE                         ESLOGICO                           ÉLÓGICO                            ISLOGISCH                    ONTOTUUS                           VAL.LOGICO                         ÄRLOGISK
-199      3      0          0          DCOUNTA                            DBANZAHL2                          BDNBVAL                            BDCONTARA                          BDCONTARA                          DBAANTALC                    TLASKEA                            DB.CONTA.VALORI                    DANTALV
-212      2      1          0          ROUNDUP                            AUFRUNDEN                          ARRONDI.SUP                        REDONDEAR.MAS                      ARREDONDAR.PARA.CIMA               AFRONDEN.NAAR.BOVEN          PYÖRISTÄ.DES.YLÖS                  ARROTONDA.PER.ECC                  AVRUNDA.UPPÅT
-213      2      1          0          ROUNDDOWN                          ABRUNDEN                           ARRONDI.INF                        REDONDEAR.MENOS                    ARREDONDAR.PARA.BAIXO              AFRONDEN.NAAR.BENEDEN        PYÖRISTÄ.DES.ALAS                  ARROTONDA.PER.DIF                  AVRUNDA.NEDÅT
-216     -1      0          0          RANK                               RANG                               RANG                               JERARQUIA                          ORDEM                              RANG                         ARVON.MUKAAN                       RANGO                              RANG
-219     -1      1          0          ADDRESS                            ADRESSE                            ADRESSE                            DIRECCION                          ENDEREÇO                           ADRES                        OSOITE                             INDIRIZZO                          ADRESS
-220     -1      1          0          DAYS360                            TAGE360                            JOURS360                           DIAS360                            DIAS360                            DAGEN360                     PÄIVÄT360                          GIORNO360                          DAGAR360
-221      0      1          1          TODAY                              HEUTE                              AUJOURDHUI                         HOY                                HOJE                               VANDAAG                      TÄMÄ.PÄIVÄ                         OGGI                               IDAG
-222     -1      1          0          VDB                                VDB                                VDB                                DVS                                BDV                                VDB                          VDB                                AMMORT.VAR                         VDEGRAVSKR
-227     -1      0          0          MEDIAN                             MEDIAN                             MEDIANE                            MEDIANA                            MED                                MEDIAAN                      MEDIAANI                           MEDIANA                            MEDIAN
-228     -1      2          0          SUMPRODUCT                         SUMMENPRODUKT                      SOMMEPROD                          SUMAPRODUCTO                       SOMARPRODUTO                       SOMPRODUKT                   TULOJEN.SUMMA                      MATR.SOMMA.PRODOTTO                PRODUKTSUMMA
-229      1      1          0          SINH                               SINHYP                             SINH                               SENOH                              SENH                               SINH                         SINH                               SENH                               SINH
-230      1      1          0          COSH                               COSHYP                             COSH                               COSH                               COSH                               COSH                         COSH                               COSH                               COSH
-231      1      1          0          TANH                               TANHYP                             TANH                               TANH                               TANH                               TANH                         TANH                               TANH                               TANH
-232      1      1          0          ASINH                              ARCSINHYP                          ASINH                              ASENOH                             ASENH                              BOOGSINH                     ASINH                              ARCSENH                            ARCSINH
-233      1      1          0          ACOSH                              ARCCOSHYP                          ACOSH                              ACOSH                              ACOSH                              BOOGCOSH                     ACOSH                              ARCCOSH                            ARCCOSH
-234      1      1          0          ATANH                              ARCTANHYP                          ATANH                              ATANH                              ATANH                              BOOGTANH                     ATANH                              ARCTANH                            ARCTANH
-235      3      0          0          DGET                               DBAUSZUG                           BDLIRE                             BDEXTRAER                          BDEXTRAIR                          DBLEZEN                      TNOUDA                             DB.VALORI                          DHÄMTA
-244      1      1          1          INFO                               INFO                               INFO                               INFO                               INFORMAÇÃO                         INFO                         KUVAUS                             AMBIENTE.INFO                      INFO
-247     -1      1          0          DB                                 GDA2                               DB                                 DB                                 BD                                 DB                           DB                                 AMMORT.FISSO                       DB
-252      2      0          0          FREQUENCY                          HÄUFIGKEIT                         FREQUENCE                          FRECUENCIA                         FREQÜÊNCIA                         INTERVAL                     TAAJUUS                            FREQUENZA                          FREKVENS
-261      1      1          0          ERROR.TYPE                         FEHLER.TYP                         TYPE.ERREUR                        TIPO.DE.ERROR                      TIPO.ERRO                          TYPE.FOUT                    VIRHEEN.LAJI                       ERRORE.TIPO                        FEL.TYP
-267     -1      1          0          REGISTER.ID                        REGISTER.KENNUMMER                 REGISTRE.NUMERO                    ID.REGISTRO                        IDENT.REGISTRO                     REGISTRATIE.ID               REKISTERI.TUNNUS                   IDENTIFICATORE.REGISTRO            REGISTRERA.ID
-269     -1      0          0          AVEDEV                             MITTELABW                          ECART.MOYEN                        DESVPROM                           DESV.MÉDIO                         GEM.DEVIATIE                 KESKIPOIKKEAMA                     MEDIA.DEV                          MEDELAVV
-270     -1      1          0          BETADIST                           BETAVERT                           LOI.BETA                           DISTR.BETA                         DISTBETA                           BETA.VERD                    BEETAJAKAUMA                       DISTRIB.BETA                       BETAFÖRD
-271      1      1          0          GAMMALN                            GAMMALN                            LNGAMMA                            GAMMA.LN                           LNGAMA                             GAMMA.LN                     GAMMALN                            LN.GAMMA                           GAMMALN
-272     -1      1          0          BETAINV                            BETAINV                            BETA.INVERSE                       DISTR.BETA.INV                     BETA.ACUM.INV                      BETA.INV                     BEETAJAKAUMA.KÄÄNT                 INV.BETA                           BETAINV
-273      4      1          0          BINOMDIST                          BINOMVERT                          LOI.BINOMIALE                      DISTR.BINOM                        DISTRBINOM                         BINOMIALE.VERD               BINOMIJAKAUMA                      DISTRIB.BINOM                      BINOMFÖRD
-274      2      1          0          CHIDIST                            CHIVERT                            LOI.KHIDEUX                        DISTR.CHI                          DIST.QUI                           CHI.KWADRAAT                 CHIJAKAUMA                         DISTRIB.CHI                        CHI2FÖRD
-275      2      1          0          CHIINV                             CHIINV                             KHIDEUX.INVERSE                    PRUEBA.CHI.INV                     INV.QUI                            CHI.KWADRAAT.INV             CHIJAKAUMA.KÄÄNT                   INV.CHI                            CHI2INV
-276      2      1          0          COMBIN                             KOMBINATIONEN                      COMBIN                             COMBINAT                           COMBIN                             COMBINATIES                  KOMBINAATIO                        COMBINAZIONE                       KOMBIN
-277      3      1          0          CONFIDENCE                         KONFIDENZ                          INTERVALLE.CONFIANCE               INTERVALO.CONFIANZA                INT.CONFIANÇA                      BETROUWBAARHEID              LUOTTAMUSVÄLI                      CONFIDENZA                         KONFIDENS
-278      3      1          0          CRITBINOM                          KRITBINOM                          CRITERE.LOI.BINOMIALE              BINOM.CRIT                         CRIT.BINOM                         CRIT.BINOM                   BINOMIJAKAUMA.KRIT                 CRIT.BINOM                         KRITBINOM
-279      1      1          0          EVEN                               GERADE                             PAIR                               REDONDEA.PAR                       PAR                                EVEN                         PARILLINEN                         PARI                               JÄMN
-280      3      1          0          EXPONDIST                          EXPONVERT                          LOI.EXPONENTIELLE                  DISTR.EXP                          DISTEXPON                          EXPON.VERD                   EKSPONENTIAALIJAKAUMA              DISTRIB.EXP                        EXPONFÖRD
-281      3      1          0          FDIST                              FVERT                              LOI.F                              DISTR.F                            DISTF                              F.VERDELING                  FJAKAUMA                           DISTRIB.F                          FFÖRD
-282      3      1          0          FINV                               FINV                               INVERSE.LOI.F                      DISTR.F.INV                        INVF                               F.INVERSE                    FJAKAUMA.KÄÄNT                     INV.F                              FINV
-283      1      1          0          FISHER                             FISHER                             FISHER                             FISHER                             FISHER                             FISHER                       FISHER                             FISHER                             FISHER
-284      1      1          0          FISHERINV                          FISHERINV                          FISHER.INVERSE                     PRUEBA.FISHER.INV                  FISHERINV                          FISHER.INV                   FISHER.KÄÄNT                       INV.FISHER                         FISHERINV
-285      2      1          0          FLOOR                              UNTERGRENZE                        PLANCHER                           MULTIPLO.INFERIOR                  ARREDMULTB                         AFRONDEN.BENEDEN             PYÖRISTÄ.KERR.ALAS                 ARROTONDA.DIFETTO                  RUNDA.NER
-286      4      1          0          GAMMADIST                          GAMMAVERT                          LOI.GAMMA                          DISTR.GAMMA                        DISTGAMA                           GAMMA.VERD                   GAMMAJAKAUMA                       DISTRIB.GAMMA                      GAMMAFÖRD
-287      3      1          0          GAMMAINV                           GAMMAINV                           LOI.GAMMA.INVERSE                  DISTR.GAMMA.INV                    INVGAMA                            GAMMA.INV                    GAMMAJAKAUMA.KÄÄNT                 INV.GAMMA                          GAMMAINV
-288      2      1          0          CEILING                            OBERGRENZE                         PLAFOND                            MULTIPLO.SUPERIOR                  TETO                               AFRONDEN.BOVEN               PYÖRISTÄ.KERR.YLÖS                 ARROTONDA.ECCESSO                  RUNDA.UPP
-289      4      1          0          HYPGEOMDIST                        HYPGEOMVERT                        LOI.HYPERGEOMETRIQUE               DISTR.HIPERGEOM                    DIST.HIPERGEOM                     HYPERGEO.VERD                HYPERGEOM.JAKAUMA                  DISTRIB.IPERGEOM                   HYPGEOMFÖRD
-290      3      1          0          LOGNORMDIST                        LOGNORMVERT                        LOI.LOGNORMALE                     DISTR.LOG.NORM                     DIST.LOGNORMAL                     LOG.NORM.VERD                LOGNORM.JAKAUMA                    DISTRIB.LOGNORM                    LOGNORMFÖRD
-291      3      1          0          LOGINV                             LOGINV                             LOI.LOGNORMALE.INVERSE             DISTR.LOG.INV                      INVLOG                             LOG.NORM.INV                 LOGNORM.JAKAUMA.KÄÄNT              INV.LOGNORM                        LOGINV
-292      3      1          0          NEGBINOMDIST                       NEGBINOMVERT                       LOI.BINOMIALE.NEG                  NEGBINOMDIST                       DIST.BIN.NEG                       NEG.BINOM.VERD               BINOMIJAKAUMA.NEG                  DISTRIB.BINOM.NEG                  NEGBINOMFÖRD
-293      4      1          0          NORMDIST                           NORMVERT                           LOI.NORMALE                        DISTR.NORM                         DIST.NORM                          NORM.VERD                    NORM.JAKAUMA                       DISTRIB.NORM                       NORMFÖRD
-294      1      1          0          NORMSDIST                          STANDNORMVERT                      LOI.NORMALE.STANDARD               DISTR.NORM.ESTAND                  DIST.NORMP                         STAND.NORM.VERD              NORM.JAKAUMA.NORMIT                DISTRIB.NORM.ST                    NORMSFÖRD
-295      3      1          0          NORMINV                            NORMINV                            LOI.NORMALE.INVERSE                DISTR.NORM.INV                     INV.NORM                           NORM.INV                     NORM.JAKAUMA.KÄÄNT                 INV.NORM                           NORMINV
-296      1      1          0          NORMSINV                           STANDNORMINV                       LOI.NORMALE.STANDARD.INVERSE       DISTR.NORM.ESTAND.INV              INV.NORMP                          STAND.NORM.INV               NORM.JAKAUMA.NORMIT.KÄÄNT          INV.NORM.ST                        NORMSINV
-297      3      1          0          STANDARDIZE                        STANDARDISIERUNG                   CENTREE.REDUITE                    NORMALIZACION                      PADRONIZAR                         NORMALISEREN                 NORMITA                            NORMALIZZA                         STANDARDISERA
-298      1      1          0          ODD                                UNGERADE                           IMPAIR                             REDONDEA.IMPAR                     ÍMPAR                              ONEVEN                       PARITON                            DISPARI                            UDDA
-299      2      1          0          PERMUT                             VARIATIONEN                        PERMUTATION                        PERMUTACIONES                      PERMUT                             PERMUTATIES                  PERMUTAATIO                        PERMUTAZIONE                       PERMUT
-300      3      1          0          POISSON                            POISSON                            LOI.POISSON                        POISSON                            POISSON                            POISSON                      POISSON                            POISSON                            POISSON
-301      3      1          0          TDIST                              TVERT                              LOI.STUDENT                        DISTR.T                            DISTT                              T.VERD                       TJAKAUMA                           DISTRIB.T                          TFÖRD
-302      4      1          0          WEIBULL                            WEIBULL                            LOI.WEIBULL                        DIST.WEIBULL                       WEIBULL                            WEIBULL                      WEIBULL                            WEIBULL                            WEIBULL
-303      2      2          0          SUMXMY2                            SUMMEXMY2                          SOMME.XMY2                         SUMAXMENOSY2                       SOMAXMY2                           SOM.XMINY.2                  EROTUSTEN.NELIÖSUMMA               SOMMA.Q.DIFF                       SUMMAXMY2
-304      2      2          0          SUMX2MY2                           SUMMEX2MY2                         SOMME.X2MY2                        SUMAX2MENOSY2                      SOMAX2DY2                          SOM.X2MINY2                  NELIÖSUMMIEN.EROTUS                SOMMA.DIFF.Q                       SUMMAX2MY2
-305      2      2          0          SUMX2PY2                           SUMMEX2PY2                         SOMME.X2PY2                        SUMAX2MASY2                        SOMAX2SY2                          SOM.X2PLUSY2                 NELIÖSUMMIEN.SUMMA                 SOMMA.SOMMA.Q                      SUMMAX2PY2
-306      2      2          0          CHITEST                            CHITEST                            TEST.KHIDEUX                       PRUEBA.CHI                         TESTE.QUI                          CHI.TOETS                    CHITESTI                           TEST.CHI                           CHI2TEST
-307      2      2          0          CORREL                             KORREL                             COEFFICIENT.CORRELATION            COEF.DE.CORREL                     CORREL                             CORRELATIE                   KORRELAATIO                        CORRELAZIONE                       KORREL
-308      2      2          0          COVAR                              KOVAR                              COVARIANCE                         COVAR                              COVAR                              COVARIANTIE                  KOVARIANSSI                        COVARIANZA                         KOVAR
-309      3      2          0          FORECAST                           SCHÄTZER                           PREVISION                          PRONOSTICO                         PREVISÃO                           VOORSPELLEN                  ENNUSTE                            PREVISIONE                         PREDIKTION
-310      2      2          0          FTEST                              FTEST                              TEST.F                             PRUEBA.F                           TESTEF                             F.TOETS                      FTESTI                             TEST.F                             FTEST
-311      2      2          0          INTERCEPT                          ACHSENABSCHNITT                    ORDONNEE.ORIGINE                   INTERSECCION                       INTERCEPÇÃO                        SNIJPUNT                     LEIKKAUSPISTE                      INTERCETTA                         SKÄRNINGSPUNKT
-312      2      2          0          PEARSON                            PEARSON                            PEARSON                            PEARSON                            PEARSON                            PEARSON                      PEARSON                            PEARSON                            PEARSON
-313      2      2          0          RSQ                                BESTIMMTHEITSMASS                  COEFFICIENT.DETERMINATION          COEFICIENTE.R2                     RQUAD                              R.KWADRAAT                   PEARSON.NELIÖ                      RQ                                 RKV
-314      2      2          0          STEYX                              STFEHLERYX                         ERREUR.TYPE.XY                     ERROR.TIPICO.XY                    EPADYX                             STAND.FOUT.YX                KESKIVIRHE                         ERR.STD.YX                         STDFELYX
-315      2      2          0          SLOPE                              STEIGUNG                           PENTE                              PENDIENTE                          INCLINAÇÃO                         RICHTING                     KULMAKERROIN                       PENDENZA                           LUTNING
-316      4      2          0          TTEST                              TTEST                              TEST.STUDENT                       PRUEBA.T                           TESTET                             T.TOETS                      TTESTI                             TEST.T                             TTEST
-317     -1      2          0          PROB                               WAHRSCHBEREICH                     PROBABILITE                        PROBABILIDAD                       PROB                               KANS                         TODENNÄKÖISYYS                     PROBABILITÀ                        SANNOLIKHET
-318     -1      0          0          DEVSQ                              SUMQUADABW                         SOMME.CARRES.ECARTS                DESVIA2                            DESVQ                              DEV.KWAD                     OIKAISTU.NELIÖSUMMA                DEV.Q                              KVADAVV
-319     -1      0          0          GEOMEAN                            GEOMITTEL                          MOYENNE.GEOMETRIQUE                MEDIA.GEOM                         MÉDIA.GEOMÉTRICA                   MEETK.GEM                    KESKIARVO.GEOM                     MEDIA.GEOMETRICA                   GEOMEDEL
-320     -1      0          0          HARMEAN                            HARMITTEL                          MOYENNE.HARMONIQUE                 MEDIA.ARMO                         MÉDIA.HARMÔNICA                    HARM.GEM                     KESKIARVO.HARM                     MEDIA.ARMONICA                     HARMMEDEL
-321     -1      0          0          SUMSQ                              QUADRATESUMME                      SOMME.CARRES                       SUMA.CUADRADOS                     SOMAQUAD                           KWADRATENSOM                 NELIÖSUMMA                         SOMMA.Q                            KVADRATSUMMA
-322     -1      0          0          KURT                               KURT                               KURTOSIS                           CURTOSIS                           CURT                               KURTOSIS                     KURT                               CURTOSI                            TOPPIGHET
-323     -1      0          0          SKEW                               SCHIEFE                            COEFFICIENT.ASYMETRIE              COEFICIENTE.ASIMETRIA              DISTORÇÃO                          SCHEEFHEID                   JAKAUMAN.VINOUS                    ASIMMETRIA                         SNEDHET
-324     -1      0          0          ZTEST                              GTEST                              TEST.Z                             PRUEBA.Z                           TESTEZ                             Z.TOETS                      ZTESTI                             TEST.Z                             ZTEST
-325      2      0          0          LARGE                              KGRÖSSTE                           GRANDE.VALEUR                      K.ESIMO.MAYOR                      MAIOR                              GROOTSTE                     SUURI                              GRANDE                             STÖRSTA
-326      2      0          0          SMALL                              KKLEINSTE                          PETITE.VALEUR                      K.ESIMO.MENOR                      MENOR                              KLEINSTE                     PIENI                              PICCOLO                            MINSTA
-327      2      0          0          QUARTILE                           QUARTILE                           QUARTILE                           CUARTIL                            QUARTIL                            KWARTIEL                     NELJÄNNES                          QUARTILE                           KVARTIL
-328      2      0          0          PERCENTILE                         QUANTIL                            CENTILE                            PERCENTIL                          PERCENTIL                          PERCENTIEL                   PROSENTTIPISTE                     PERCENTILE                         PERCENTIL
-329     -1      0          0          PERCENTRANK                        QUANTILSRANG                       RANG.POURCENTAGE                   RANGO.PERCENTIL                    ORDEM.PORCENTUAL                   PERCENT.RANG                 PROSENTTIJÄRJESTYS                 PERCENT.RANGO                      PROCENTRANG
-330     -1      2          0          MODE                               MODALWERT                          MODE                               MODA                               MODO                               MODUS                        MOODI                              MODA                               TYPVÄRDE
-331      2      0          0          TRIMMEAN                           GESTUTZTMITTEL                     MOYENNE.REDUITE                    MEDIA.ACOTADA                      MÉDIA.INTERNA                      GETRIMD.GEM                  KESKIARVO.TASATTU                  MEDIA.TRONCATA                     TRIMMEDEL
-332      2      1          0          TINV                               TINV                               LOI.STUDENT.INVERSE                DISTR.T.INV                        INVT                               T.INV                        TJAKAUMA.KÄÄNT                     INV.T                              TINV
-336     -1      1          0          CONCATENATE                        VERKETTEN                          CONCATENER                         CONCATENAR                         CONCATENAR                         TEKST.SAMENVOEGEN            KETJUTA                            CONCATENA                          SAMMANFOGA
-337      2      1          0          POWER                              POTENZ                             PUISSANCE                          POTENCIA                           POTÊNCIA                           MACHT                        POTENSSI                           POTENZA                            UPPHÖJT.TILL
-342      1      1          0          RADIANS                            RADIANT                            RADIANS                            RADIANES                           RADIANOS                           RADIALEN                     RADIAANIT                          RADIANTI                           RADIANER
-343      1      1          0          DEGREES                            GRAD                               DEGRES                             GRADOS                             GRAUS                              GRADEN                       ASTEET                             GRADI                              GRADER
-344     -1      0          0          SUBTOTAL                           TEILERGEBNIS                       SOUS.TOTAL                         SUBTOTALES                         SUBTOTAL                           SUBTOTAAL                    VÄLISUMMA                          SUBTOTALE                          DELSUMMA
-345     -1      0          0          SUMIF                              SUMMEWENN                          SOMME.SI                           SUMAR.SI                           SOMASE                             SOM.ALS                      SUMMA.JOS                          SOMMA.SE                           SUMMA.OM
-346      2      0          0          COUNTIF                            ZÄHLENWENN                         NB.SI                              CONTAR.SI                          CONT.SE                            AANTAL.ALS                   LASKE.JOS                          CONTA.SE                           ANTAL.OM
-347      1      0          0          COUNTBLANK                         ANZAHLLEEREZELLEN                  NB.VIDE                            CONTAR.BLANCO                      CONTAR.VAZIO                       AANTAL.LEGE.CELLEN           LASKE.TYHJÄT                       CONTA.VUOTE                        ANTAL.TOMMA
-354     -1      1          0          ROMAN                              RÖMISCH                            ROMAIN                             NUMERO.ROMANO                      ROMANO                             ROMEINS                      ROMAN                              ROMANO                             ROMERSK
+#!/usr/bin/perl -w
+
+###############################################################################
+#
+# Generate function names for different locales.
+#
+# This program can be used to generate the hash of known functions for use in
+# the Formula.pm module. By default the function names are in English but you
+# can also choose to support the following languages: German, French, Spanish,
+# Portuguese, Dutch, Finnish, Italian and Swedish.
+#
+# This would allow you to do something like the following:
+#
+#       $worksheet->write(0, 0, '=SUM(C1:C3)'  );
+#       $worksheet->write(1, 0, '=SUMME(C1:C3)');
+#       $worksheet->write(2, 0, '=SOMME(C1:C3)');
+#       $worksheet->write(3, 0, '=SUMA(C1:C3)' );
+#       $worksheet->write(4, 0, '=SOMA(C1:C3)' );
+#       $worksheet->write(5, 0, '=SOM(C1:C3)'  );
+#       $worksheet->write(6, 0, '=SUMMA(C1:C3)');
+#       $worksheet->write(7, 0, '=SOMMA(C1:C3)');
+#
+# Unfortunately, if you wish to support more than one language there are some
+# conflicts between function names:
+#
+#       Function        Language 1              Language 2
+#       ========        ==========              ==========
+#       NB              French                  Dutch
+#       NA              English/French          Finnish
+#       TRIM            French                  English
+#       DIA             Spanish/Portuguese      German
+#
+# Therefore, if you try to generate a hash of function names to support both
+# French and English then the function TRIM will be assigned the meaning of the
+# first language that defines it, which in this case is French. You can get
+# around this by renaming the function for one of the languages and documenting
+# the change, for example: TRIM.EN or TRIM.FR.
+#
+# Please note that this only partially solves the problem of localisation.
+# There are also number formats to consider (1.5 == 1,5) and the fact that the
+# list separator "," and the array separator ";" are interchanged in different
+# locales.
+#
+# The longest function name is LOI.NORMALE.STANDARD.INVERSE (29 chars) followed
+# by NORM.JAKAUMA.NORMIT.KÄÄNT (25 chars).
+# The shortest function name in all languages is T.
+#
+#
+# reverse('©'); John McNamara, March 2001, jmcnamara at cpan.org
+#
+
+
+
+use strict;
+
+
+#
+# Modify the following variables to add the language to the function name hash
+#
+my $english    = 1;
+my $german     = 0;
+my $french     = 0;
+my $spanish    = 0;
+my $portuguese = 0;
+my $dutch      = 0;
+my $finnish    = 0;
+my $italian    = 0;
+my $swedish    = 0;
+
+my %funcs;
+
+# Ignore the headings
+<DATA>;
+
+# Print the beginning of the hash definition
+print "    %functions  = (\n";
+print "        #" . " " x 37 ;
+print "ptg  args  class  vol\n";
+
+while (<DATA>){
+    my @F = split " ";
+    my $value = $F[0];
+    my $args  = $F[1];
+    my $ref   = $F[2];
+    my $vol   = $F[3];
+
+    print_function($F[4],  $value, $args, $ref, $vol) if $english;
+    print_function($F[5],  $value, $args, $ref, $vol) if $german;
+    print_function($F[6],  $value, $args, $ref, $vol) if $french;
+    print_function($F[7],  $value, $args, $ref, $vol) if $spanish;
+    print_function($F[8],  $value, $args, $ref, $vol) if $portuguese;
+    print_function($F[9],  $value, $args, $ref, $vol) if $dutch;
+    print_function($F[10], $value, $args, $ref, $vol) if $finnish;
+    print_function($F[11], $value, $args, $ref, $vol) if $italian;
+    print_function($F[12], $value, $args, $ref, $vol) if $swedish;
+}
+# Print the end of the hash definition
+print "    );\n";
+
+
+###############################################################################
+#
+# Function to print the function names. It prints a warning if there is a
+# clash.
+#
+sub print_function {
+
+    my $func  = shift;
+    my $value = shift;
+    my $args  = shift;
+    my $ref   = shift;
+    my $vol   = shift;
+
+    $func = "'$func'";
+
+    if (not exists $funcs{$func}) {
+        printf("        %-31s => [%4d, %4d, %4d, %4d ],\n",
+                                   $func, $value, $args, $ref, $vol);
+        $funcs{$func} = $value;
+    }
+    else {
+        if ($funcs{$func} != $value) {
+            print "        # Warning ";
+            print $func, " is already defined in another language\n";
+            printf("        #%-31s => [%4d, %4d, %4d, %4d ],\n",
+                                        $func, $value, $args, $ref, $vol);
+        }
+    }
+}
+
+
+# Note: The following data contains the function names in the various
+# languages. These lines are LONG.
+
+__DATA__
+Value   Args    Refclass   Volatile   English                            German                             French                             Spanish                            Portuguese                         Dutch                        Finnish                            Italian                            Swedish
+0       -1      0          0          COUNT                              ANZAHL                             NB                                 CONTAR                             CONT.NÚM                           AANTAL                       LASKE                              CONTA.NUMERI                       ANTAL
+1       -1      1          0          IF                                 WENN                               SI                                 SI                                 SE                                 ALS                          JOS                                SE                                 OM
+2        1      1          0          ISNA                               ISTNV                              ESTNA                              ESNOD                              É.NÃO.DISP                         ISNB                         ONPUUTTUU                          VAL.NON.DISP                       ÄRSAKNAD
+3        1      1          0          ISERROR                            ISTFEHLER                          ESTERREUR                          ESERROR                            ÉERROS                             ISFOUT                       ONVIRHE                            VAL.ERRORE                         ÄRFEL
+4       -1      0          0          SUM                                SUMME                              SOMME                              SUMA                               SOMA                               SOM                          SUMMA                              SOMMA                              SUMMA
+5       -1      0          0          AVERAGE                            MITTELWERT                         MOYENNE                            PROMEDIO                           MÉDIA                              GEMIDDELDE                   KESKIARVO                          MEDIA                              MEDEL
+6       -1      0          0          MIN                                MIN                                MIN                                MIN                                MÍNIMO                             MIN                          MIN                                MIN                                MIN
+7       -1      0          0          MAX                                MAX                                MAX                                MAX                                MÁXIMO                             MAX                          MAKS                               MAX                                MAX
+8       -1      0          0          ROW                                ZEILE                              LIGNE                              FILA                               LIN                                RIJ                          RIVI                               RIF.RIGA                           RAD
+9       -1      0          0          COLUMN                             SPALTE                             COLONNE                            COLUMNA                            COL                                KOLOM                        SARAKE                             RIF.COLONNA                        KOLUMN
+10       0      0          0          NA                                 NV                                 NA                                 NOD                                NÃO.DISP                           NB                           PUUTTUU                            NON.DISP                           SAKNAS
+11      -1      1          0          NPV                                NBW                                VAN                                VNA                                VPL                                NHW                          NNA                                VAN                                NETNUVÄRDE
+12      -1      0          0          STDEV                              STABW                              ECARTYPE                           DESVEST                            DESVPAD                            STDEV                        KESKIHAJONTA                       DEV.ST                             STDAV
+13      -1      1          0          DOLLAR                             DM                                 FRANC                              MONEDA                             MOEDA                              GULDEN                       VALUUTTA                           VALUTA                             VALUTA
+14      -1      1          0          FIXED                              FEST                               CTXT                               DECIMAL                            DEF.NÚM.DEC                        VAST                         KIINTEÄ                            FISSO                              FASTTAL
+15       1      1          0          SIN                                SIN                                SIN                                SENO                               SEN                                SIN                          SIN                                SEN                                SIN
+16       1      1          0          COS                                COS                                COS                                COS                                COS                                COS                          COS                                COS                                COS
+17       1      1          0          TAN                                TAN                                TAN                                TAN                                TAN                                TAN                          TAN                                TAN                                TAN
+18       1      1          0          ATAN                               ARCTAN                             ATAN                               ATAN                               ATAN                               BOOGTAN                      ATAN                               ARCTAN                             ARCTAN
+19       0      1          0          PI                                 PI                                 PI                                 PI                                 PI                                 PI                           PII                                PI.GRECO                           PI
+20       1      1          0          SQRT                               WURZEL                             RACINE                             RAIZ                               RAIZ                               WORTEL                       NELIÖJUURI                         RADQ                               ROT
+21       1      1          0          EXP                                EXP                                EXP                                EXP                                EXP                                EXP                          EKSPONENTTI                        EXP                                EXP
+22       1      1          0          LN                                 LN                                 LN                                 LN                                 LN                                 LN                           LUONNLOG                           LN                                 LN
+23       1      1          0          LOG10                              LOG10                              LOG10                              LOG10                              LOG10                              LOG10                        LOG10                              LOG10                              LOG10
+24       1      1          0          ABS                                ABS                                ABS                                ABS                                ABS                                ABS                          ITSEISARVO                         ASS                                ABS
+25       1      1          0          INT                                GANZZAHL                           ENT                                ENTERO                             INT                                INTEGER                      KOKONAISLUKU                       INT                                HELTAL
+26       1      1          0          SIGN                               VORZEICHEN                         SIGNE                              SIGNO                              SINAL                              POS.NEG                      ETUMERKKI                          SEGNO                              TECKEN
+27       2      1          0          ROUND                              RUNDEN                             ARRONDI                            REDONDEAR                          ARRED                              AFRONDEN                     PYÖRISTÄ                           ARROTONDA                          AVRUNDA
+28      -1      0          0          LOOKUP                             VERWEIS                            RECHERCHE                          BUSCAR                             PROC                               ZOEKEN                       HAKU                               CERCA                              LETAUPP
+29      -1      0          1          INDEX                              INDEX                              INDEX                              INDICE                             ÍNDICE                             INDEX                        INDEKSI                            INDICE                             INDEX
+30       2      1          0          REPT                               WIEDERHOLEN                        REPT                               REPETIR                            REPETIR                            HERHALING                    TOISTA                             RIPETI                             REP
+31       3      1          0          MID                                TEIL                               STXT                               EXTRAE                             EXT.TEXTO                          DEEL                         POIMI.TEKSTI                       STRINGA.ESTRAI                     EXTEXT
+32       1      1          0          LEN                                LÄNGE                              NBCAR                              LARGO                              NÚM.CARACT                         LENGTE                       PITUUS                             LUNGHEZZA                          LÄNGD
+33       1      1          0          VALUE                              WERT                               CNUM                               VALOR                              VALOR                              WAARDE                       ARVO                               VALORE                             TEXTNUM
+34       0      1          0          TRUE                               WAHR                               VRAI                               VERDADERO                          VERDADEIRO                         WAAR                         TOSI                               VERO                               SANT
+35       0      1          0          FALSE                              FALSCH                             FAUX                               FALSO                              FALSO                              ONWAAR                       EPÄTOSI                            FALSO                              FALSKT
+36      -1      0          0          AND                                UND                                ET                                 Y                                  E                                  EN                           JA                                 E                                  OCH
+37      -1      0          0          OR                                 ODER                               OU                                 O                                  OU                                 OF                           TAI                                O                                  ELLER
+38       1      1          0          NOT                                NICHT                              NON                                NO                                 NÃO                                NIET                         EI                                 NON                                ICKE
+39       2      1          0          MOD                                REST                               MOD                                RESIDUO                            MOD                                REST                         JAKOJ                              RESTO                              REST
+40       3      0          0          DCOUNT                             DBANZAHL                           BDNB                               BDCONTAR                           BDCONTAR                           DBAANTAL                     TLASKE                             DB.CONTA.NUMERI                    DANTAL
+41       3      0          0          DSUM                               DBSUMME                            BDSOMME                            BDSUMA                             BDSOMA                             DBSOM                        TSUMMA                             DB.SOMMA                           DSUMMA
+42       3      0          0          DAVERAGE                           DBMITTELWERT                       BDMOYENNE                          BDPROMEDIO                         BDMÉDIA                            DBGEMIDDELDE                 TKESKIARVO                         DB.MEDIA                           DMEDEL
+43       3      0          0          DMIN                               DBMIN                              BDMIN                              BDMIN                              BDMÍN                              DBMIN                        TMIN                               DB.MIN                             DMIN
+44       3      0          0          DMAX                               DBMAX                              BDMAX                              BDMAX                              BDMÁX                              DBMAX                        TMAKS                              DB.MAX                             DMAX
+45       3      0          0          DSTDEV                             DBSTDABW                           BDECARTYPE                         BDDESVEST                          BDEST                              DBSTDEV                      TKESKIHAJONTA                      DB.DEV.ST                          DSTDAV
+46      -1      0          0          VAR                                VARIANZ                            VAR                                VAR                                VAR                                VAR                          VAR                                VAR                                VARIANS
+47       3      0          0          DVAR                               DBVARIANZ                          BDVAR                              BDVAR                              BDVAREST                           DBVAR                        TVARIANSSI                         DB.VAR                             DVARIANS
+48       2      1          0          TEXT                               TEXT                               TEXTE                              TEXTO                              TEXTO                              TEKST                        TEKSTI                             TESTO                              TEXT
+49      -1      0          0          LINEST                             RGP                                DROITEREG                          ESTIMACION.LINEAL                  PROJ.LIN                           LIJNSCH                      LINREGR                            REGR.LIN                           REGR
+50      -1      0          0          TREND                              TREND                              TENDANCE                           TENDENCIA                          TENDÊNCIA                          TREND                        SUUNTAUS                           TENDENZA                           TREND
+51      -1      0          0          LOGEST                             RKP                                LOGREG                             ESTIMACION.LOGARITMICA             PROJ.LOG                           LOGSCH                       LOGREGR                            REGR.LOG                           EXPREGR
+52      -1      0          0          GROWTH                             VARIATION                          CROISSANCE                         CRECIMIENTO                        CRESCIMENTO                        GROEI                        KASVU                              CRESCITA                           EXPTREND
+56      -1      1          0          PV                                 BW                                 VA                                 VA                                 VP                                 HW                           NA                                 VA                                 NUVÄRDE
+57      -1      1          0          FV                                 ZW                                 VC                                 VF                                 VF                                 TW                           TULEVA.ARVO                        VAL.FUT                            SLUTVÄRDE
+58      -1      1          0          NPER                               ZZR                                NPM                                NPER                               NPER                               NPER                         NJAKSO                             NUM.RATE                           PERIODER
+59      -1      1          0          PMT                                RMZ                                VPM                                PAGO                               PGTO                               BET                          MAKSU                              RATA                               BETALNING
+60      -1      1          0          RATE                               ZINS                               TAUX                               TASA                               TAXA                               RENTE                        KORKO                              TASSO                              RÄNTA
+61       3      0          0          MIRR                               QIKV                               TRIM                               TIRM                               MTIR                               GIR                          MSISÄINEN                          TIR.VAR                            MODIR
+62      -1      0          0          IRR                                IKV                                TRI                                TIR                                TIR                                IR                           SISÄINEN.KORKO                     TIR.COST                           IR
+63       0      1          1          RAND                               ZUFALLSZAHL                        ALEA                               ALEATORIO                          ALEATÓRIO                          ASELECT                      SATUNNAISLUKU                      CASUALE                            SLUMP
+64      -1      0          0          MATCH                              VERGLEICH                          EQUIV                              COINCIDIR                          CORRESP                            VERGELIJKEN                  VASTINE                            CONFRONTA                          PASSA
+65       3      1          0          DATE                               DATUM                              DATE                               FECHA                              DATA                               DATUM                        PÄIVÄYS                            DATA                               DATUM
+66       3      1          0          TIME                               ZEIT                               TEMPS                              NSHORA                             TEMPO                              TIJD                         AIKA                               ORARIO                             KLOCKSLAG
+67       1      1          0          DAY                                TAG                                JOUR                               DIA                                DIA                                DAG                          PÄIVÄ                              GIORNO                             DAG
+68       1      1          0          MONTH                              MONAT                              MOIS                               MES                                MÊS                                MAAND                        KUUKAUSI                           MESE                               MÅNAD
+69       1      1          0          YEAR                               JAHR                               ANNEE                              AÑO                                ANO                                JAAR                         VUOSI                              ANNO                               ÅR
+70      -1      1          0          WEEKDAY                            WOCHENTAG                          JOURSEM                            DIASEM                             DIA.DA.SEMANA                      WEEKDAG                      VIIKONPÄIVÄ                        GIORNO.SETTIMANA                   VECKODAG
+71       1      1          0          HOUR                               STUNDE                             HEURE                              HORA                               HORA                               UUR                          TUNNIT                             ORA                                TIMME
+72       1      1          0          MINUTE                             MINUTE                             MINUTE                             MINUTO                             MINUTO                             MINUUT                       MINUUTIT                           MINUTO                             MINUT
+73       1      1          0          SECOND                             SEKUNDE                            SECONDE                            SEGUNDO                            SEGUNDO                            SECONDE                      SEKUNNIT                           SECONDO                            SEKUND
+74       0      1          1          NOW                                JETZT                              MAINTENANT                         AHORA                              AGORA                              NU                           NYT                                ADESSO                             NU
+75       1      0          1          AREAS                              BEREICHE                           ZONES                              AREAS                              ÁREAS                              BEREIKEN                     ALUEET                             AREE                               OMRÅDEN
+76       1      0          1          ROWS                               ZEILEN                             LIGNES                             FILAS                              LINS                               RIJEN                        RIVIT                              RIGHE                              RADER
+77       1      0          1          COLUMNS                            SPALTEN                            COLONNES                           COLUMNAS                           COLS                               KOLOMMEN                     SARAKKEET                          COLONNE                            KOLUMNER
+78      -1      0          1          OFFSET                             BEREICH.VERSCHIEBEN                DECALER                            DESREF                             DESLOC                             VERSCHUIVING                 SIIRTYMÄ                           SCARTO                             FÖRSKJUTNING
+82      -1      1          0          SEARCH                             SUCHEN                             CHERCHE                            HALLAR                             LOCALIZAR                          VIND.SPEC                    KÄY.LÄPI                           RICERCA                            SÖK
+83       1      1          0          TRANSPOSE                          MTRANS                             TRANSPOSE                          TRANSPONER                         TRANSPOR                           TRANSPONEREN                 TRANSPONOI                         MATR.TRASPOSTA                     TRANSPONERA
+86       1      1          0          TYPE                               TYP                                TYPE                               TIPO                               TIPO                               TYPE                         TYYPPI                             TIPO                               VÄRDETYP
+97       2      1          0          ATAN2                              ARCTAN2                            ATAN2                              ATAN2                              ATAN2                              BOOGTAN2                     ATAN2                              ARCTAN.2                           ARCTAN2
+98       1      1          0          ASIN                               ARCSIN                             ASIN                               ASENO                              ASEN                               BOOGSIN                      ASIN                               ARCSEN                             ARCSIN
+99       1      1          0          ACOS                               ARCCOS                             ACOS                               ACOS                               ACOS                               BOOGCOS                      ACOS                               ARCCOS                             ARCCOS
+100     -1      1          0          CHOOSE                             WAHL                               CHOISIR                            ELEGIR                             ESCOLHER                           KIEZEN                       VALITSE.INDEKSI                    SCEGLI                             VÄLJ
+101     -1      0          0          HLOOKUP                            WVERWEIS                           RECHERCHEH                         BUSCARH                            PROCH                              HORIZ.ZOEKEN                 VHAKU                              CERCA.ORIZZ                        LETAKOLUMN
+102     -1      0          0          VLOOKUP                            SVERWEIS                           RECHERCHEV                         BUSCARV                            PROCV                              VERT.ZOEKEN                  PHAKU                              CERCA.VERT                         LETARAD
+105      1      0          0          ISREF                              ISTBEZUG                           ESTREF                             ESREF                              ÉREF                               ISVERWIJZING                 ONVIITT                            VAL.RIF                            ÄRREF
+109     -1      1          0          LOG                                LOG                                LOG                                LOG                                LOG                                LOG                          LOG                                LOG                                LOG
+111      1      1          0          CHAR                               ZEICHEN                            CAR                                CARACTER                           CARACT                             TEKEN                        MERKKI                             CODICE.CARATT                      TECKENKOD
+112      1      1          0          LOWER                              KLEIN                              MINUSCULE                          MINUSC                             MINÚSCULA                          KLEINE.LETTERS               PIENET                             MINUSC                             GEMENER
+113      1      1          0          UPPER                              GROSS                              MAJUSCULE                          MAYUSC                             MAIÚSCULA                          HOOFDLETTERS                 ISOT                               MAIUSC                             VERSALER
+114      1      1          0          PROPER                             GROSS2                             NOMPROPRE                          NOMPROPIO                          PRI.MAIÚSCULA                      BEGINLETTERS                 ERISNIMI                           MAIUSC.INIZ                        INITIAL
+115     -1      1          0          LEFT                               LINKS                              GAUCHE                             IZQUIERDA                          ESQUERDA                           LINKS                        VASEN                              SINISTRA                           VÄNSTER
+116     -1      1          0          RIGHT                              RECHTS                             DROITE                             DERECHA                            DIREITA                            RECHTS                       OIKEA                              DESTRA                             HÖGER
+117      2      1          0          EXACT                              IDENTISCH                          EXACT                              IGUAL                              EXATO                              GELIJK                       VERTAA                             IDENTICO                           EXAKT
+118      1      1          0          TRIM                               GLÄTTEN                            SUPPRESPACE                        ESPACIOS                           ARRUMAR                            SPATIES.WISSEN               POISTA.VÄLIT                       ANNULLA.SPAZI                      RENSA
+119      4      1          0          REPLACE                            ERSETZEN                           REMPLACER                          REEMPLAZAR                         MUDAR                              VERVANGEN                    KORVAA                             RIMPIAZZA                          ERSÄTT
+120     -1      1          0          SUBSTITUTE                         WECHSELN                           SUBSTITUE                          SUSTITUIR                          SUBSTITUIR                         SUBSTITUEREN                 VAIHDA                             SOSTITUISCI                        BYT.UT
+121      1      1          0          CODE                               CODE                               CODE                               CODIGO                             CÓDIGO                             CODE                         KOODI                              CODICE                             KOD
+124     -1      1          0          FIND                               FINDEN                             TROUVE                             ENCONTRAR                          PROCURAR                           VIND.ALLES                   ETSI                               TROVA                              HITTA
+125     -1      0          1          CELL                               ZELLE                              CELLULE                            CELDA                              CÉL                                CEL                          SOLU                               CELLA                              CELL
+126      1      1          0          ISERR                              ISTFEHL                            ESTERR                             ESERR                              ÉERRO                              ISFOUT2                      ONVIRH                             VAL.ERR                            ÄRF
+127      1      1          0          ISTEXT                             ISTTEXT                            ESTTEXTE                           ESTEXTO                            ÉTEXTO                             ISTEKST                      ONTEKSTI                           VAL.TESTO                          ÄRTEXT
+128      1      1          0          ISNUMBER                           ISTZAHL                            ESTNUM                             ESNUMERO                           ÉNÚM                               ISGETAL                      ONLUKU                             VAL.NUMERO                         ÄRTAL
+129      1      1          0          ISBLANK                            ISTLEER                            ESTVIDE                            ESBLANCO                           ÉCÉL.VAZIA                         ISLEEG                       ONTYHJÄ                            VAL.VUOTO                          ÄRTOM
+130      1      0          0          T                                  T                                  T                                  T                                  T                                  T                            T                                  T                                  T
+131      1      0          0          N                                  N                                  N                                  N                                  N                                  N                            N                                  NUM                                N
+140      1      1          0          DATEVALUE                          DATWERT                            DATEVAL                            FECHANUMERO                        DATA.VALOR                         DATUMWAARDE                  PÄIVÄYSARVO                        DATA.VALORE                        DATUMVÄRDE
+141      1      1          0          TIMEVALUE                          ZEITWERT                           TEMPSVAL                           HORANUMERO                         VALOR.TEMPO                        TIJDWAARDE                   AIKA_ARVO                          ORARIO.VALORE                      TIDVÄRDE
+142      3      1          0          SLN                                LIA                                AMORLIN                            SLN                                DPD                                LIN.AFSCHR                   STP                                AMMORT.COST                        LINAVSKR
+143      4      1          0          SYD                                DIA                                SYD                                SYD                                SDA                                SYD                          VUOSIPOISTO                        AMMORT.ANNUO                       ÅRSAVSKR
+144     -1      1          0          DDB                                GDA                                DDB                                DDB                                BDD                                DDB                          DDB                                AMMORT                             DEGAVSKR
+148     -1      1          1          INDIRECT                           INDIREKT                           INDIRECT                           INDIRECTO                          INDIRETO                           INDIRECT                     EPÄSUORA                           INDIRETTO                          INDIREKT
+150     -1      1          0          CALL                               AUFRUFEN                           FONCTION.APPELANTE                 LLAMAR                             CHAMAR                             ROEPEN                       KUTSU                              RICHIAMA                           ANROPA
+162      1      1          0          CLEAN                              SÄUBERN                            EPURAGE                            LIMPIAR                            TIRAR                              WISSEN.CONTROL               SIIVOA                             LIBERA                             STÄDA
+163      1      2          0          MDETERM                            MDET                               DETERMAT                           MDETERM                            MATRIZ.DETERM                      DETERMINANTMAT               MDETERM                            MATR.DETERM                        MDETERM
+164      1      2          0          MINVERSE                           MINV                               INVERSEMAT                         MINVERSA                           MATRIZ.INVERSO                     INVERSEMAT                   MKÄÄNTEINEN                        MATR.INVERSA                       MINVERT
+165      2      2          0          MMULT                              MMULT                              PRODUITMAT                         MMULT                              MATRIZ.MULT                        PRODUKTMAT                   MKERRO                             MATR.PRODOTTO                      MMULT
+167     -1      1          0          IPMT                               ZINSZ                              INTPER                             PAGOINT                            IPGTO                              IBET                         IPMT                               INTERESSI                          RBETALNING
+168     -1      1          0          PPMT                               KAPZ                               PRINCPER                           PAGOPRIN                           PPGTO                              PBET                         PPMT                               P.RATA                             AMORT
+169     -1      0          0          COUNTA                             ANZAHL2                            NBVAL                              CONTARA                            CONT.VALORES                       AANTALARG                    LASKE.A                            CONTA.VALORI                       ANTALV
+183     -1      0          0          PRODUCT                            PRODUKT                            PRODUIT                            PRODUCTO                           MULT                               PRODUKT                      TULO                               PRODOTTO                           PRODUKT
+184      1      1          0          FACT                               FAKULTÄT                           FACT                               FACT                               FATORIAL                           FACULTEIT                    KERTOMA                            FATTORIALE                         FAKULTET
+189      3      0          0          DPRODUCT                           DBPRODUKT                          BDPRODUIT                          BDPRODUCTO                         BDMULTIPL                          DBPRODUKT                    TTULO                              DB.PRODOTTO                        DPRODUKT
+190      1      1          0          ISNONTEXT                          ISTKTEXT                           ESTNONTEXTE                        ESNOTEXTO                          É.NÃO.TEXTO                        ISGEENTEKST                  ONEI_TEKSTI                        VAL.NON.TESTO                      ÄREJTEXT
+193     -1      0          0          STDEVP                             STABWN                             ECARTYPEP                          DESVESTP                           DESVPADP                           STDEVP                       KESKIHAJONTAP                      DEV.ST.POP                         STDAVP
+194     -1      0          0          VARP                               VARIANZEN                          VAR.P                              VARP                               VARP                               VARP                         VARP                               VAR.POP                            VARIANSP
+195      3      0          0          DSTDEVP                            DBSTDABWN                          BDECARTYPEP                        BDDESVESTP                         BDDESVPA                           DBSTDEVP                     TKESKIHAJONTAP                     DB.DEV.ST.POP                      DSTDAVP
+196      3      0          0          DVARP                              DBVARIANZEN                        BDVARP                             BDVARP                             BDVARP                             DBVARP                       TVARIANSSIP                        DB.VAR.POP                         DVARIANSP
+197     -1      1          0          TRUNC                              KÜRZEN                             TRONQUE                            TRUNCAR                            TRUNCAR                            GEHEEL                       KATKAISE                           TRONCA                             AVKORTA
+198      1      1          0          ISLOGICAL                          ISTLOG                             ESTLOGIQUE                         ESLOGICO                           ÉLÓGICO                            ISLOGISCH                    ONTOTUUS                           VAL.LOGICO                         ÄRLOGISK
+199      3      0          0          DCOUNTA                            DBANZAHL2                          BDNBVAL                            BDCONTARA                          BDCONTARA                          DBAANTALC                    TLASKEA                            DB.CONTA.VALORI                    DANTALV
+212      2      1          0          ROUNDUP                            AUFRUNDEN                          ARRONDI.SUP                        REDONDEAR.MAS                      ARREDONDAR.PARA.CIMA               AFRONDEN.NAAR.BOVEN          PYÖRISTÄ.DES.YLÖS                  ARROTONDA.PER.ECC                  AVRUNDA.UPPÅT
+213      2      1          0          ROUNDDOWN                          ABRUNDEN                           ARRONDI.INF                        REDONDEAR.MENOS                    ARREDONDAR.PARA.BAIXO              AFRONDEN.NAAR.BENEDEN        PYÖRISTÄ.DES.ALAS                  ARROTONDA.PER.DIF                  AVRUNDA.NEDÅT
+216     -1      0          0          RANK                               RANG                               RANG                               JERARQUIA                          ORDEM                              RANG                         ARVON.MUKAAN                       RANGO                              RANG
+219     -1      1          0          ADDRESS                            ADRESSE                            ADRESSE                            DIRECCION                          ENDEREÇO                           ADRES                        OSOITE                             INDIRIZZO                          ADRESS
+220     -1      1          0          DAYS360                            TAGE360                            JOURS360                           DIAS360                            DIAS360                            DAGEN360                     PÄIVÄT360                          GIORNO360                          DAGAR360
+221      0      1          1          TODAY                              HEUTE                              AUJOURDHUI                         HOY                                HOJE                               VANDAAG                      TÄMÄ.PÄIVÄ                         OGGI                               IDAG
+222     -1      1          0          VDB                                VDB                                VDB                                DVS                                BDV                                VDB                          VDB                                AMMORT.VAR                         VDEGRAVSKR
+227     -1      0          0          MEDIAN                             MEDIAN                             MEDIANE                            MEDIANA                            MED                                MEDIAAN                      MEDIAANI                           MEDIANA                            MEDIAN
+228     -1      2          0          SUMPRODUCT                         SUMMENPRODUKT                      SOMMEPROD                          SUMAPRODUCTO                       SOMARPRODUTO                       SOMPRODUKT                   TULOJEN.SUMMA                      MATR.SOMMA.PRODOTTO                PRODUKTSUMMA
+229      1      1          0          SINH                               SINHYP                             SINH                               SENOH                              SENH                               SINH                         SINH                               SENH                               SINH
+230      1      1          0          COSH                               COSHYP                             COSH                               COSH                               COSH                               COSH                         COSH                               COSH                               COSH
+231      1      1          0          TANH                               TANHYP                             TANH                               TANH                               TANH                               TANH                         TANH                               TANH                               TANH
+232      1      1          0          ASINH                              ARCSINHYP                          ASINH                              ASENOH                             ASENH                              BOOGSINH                     ASINH                              ARCSENH                            ARCSINH
+233      1      1          0          ACOSH                              ARCCOSHYP                          ACOSH                              ACOSH                              ACOSH                              BOOGCOSH                     ACOSH                              ARCCOSH                            ARCCOSH
+234      1      1          0          ATANH                              ARCTANHYP                          ATANH                              ATANH                              ATANH                              BOOGTANH                     ATANH                              ARCTANH                            ARCTANH
+235      3      0          0          DGET                               DBAUSZUG                           BDLIRE                             BDEXTRAER                          BDEXTRAIR                          DBLEZEN                      TNOUDA                             DB.VALORI                          DHÄMTA
+244      1      1          1          INFO                               INFO                               INFO                               INFO                               INFORMAÇÃO                         INFO                         KUVAUS                             AMBIENTE.INFO                      INFO
+247     -1      1          0          DB                                 GDA2                               DB                                 DB                                 BD                                 DB                           DB                                 AMMORT.FISSO                       DB
+252      2      0          0          FREQUENCY                          HÄUFIGKEIT                         FREQUENCE                          FRECUENCIA                         FREQÜÊNCIA                         INTERVAL                     TAAJUUS                            FREQUENZA                          FREKVENS
+261      1      1          0          ERROR.TYPE                         FEHLER.TYP                         TYPE.ERREUR                        TIPO.DE.ERROR                      TIPO.ERRO                          TYPE.FOUT                    VIRHEEN.LAJI                       ERRORE.TIPO                        FEL.TYP
+267     -1      1          0          REGISTER.ID                        REGISTER.KENNUMMER                 REGISTRE.NUMERO                    ID.REGISTRO                        IDENT.REGISTRO                     REGISTRATIE.ID               REKISTERI.TUNNUS                   IDENTIFICATORE.REGISTRO            REGISTRERA.ID
+269     -1      0          0          AVEDEV                             MITTELABW                          ECART.MOYEN                        DESVPROM                           DESV.MÉDIO                         GEM.DEVIATIE                 KESKIPOIKKEAMA                     MEDIA.DEV                          MEDELAVV
+270     -1      1          0          BETADIST                           BETAVERT                           LOI.BETA                           DISTR.BETA                         DISTBETA                           BETA.VERD                    BEETAJAKAUMA                       DISTRIB.BETA                       BETAFÖRD
+271      1      1          0          GAMMALN                            GAMMALN                            LNGAMMA                            GAMMA.LN                           LNGAMA                             GAMMA.LN                     GAMMALN                            LN.GAMMA                           GAMMALN
+272     -1      1          0          BETAINV                            BETAINV                            BETA.INVERSE                       DISTR.BETA.INV                     BETA.ACUM.INV                      BETA.INV                     BEETAJAKAUMA.KÄÄNT                 INV.BETA                           BETAINV
+273      4      1          0          BINOMDIST                          BINOMVERT                          LOI.BINOMIALE                      DISTR.BINOM                        DISTRBINOM                         BINOMIALE.VERD               BINOMIJAKAUMA                      DISTRIB.BINOM                      BINOMFÖRD
+274      2      1          0          CHIDIST                            CHIVERT                            LOI.KHIDEUX                        DISTR.CHI                          DIST.QUI                           CHI.KWADRAAT                 CHIJAKAUMA                         DISTRIB.CHI                        CHI2FÖRD
+275      2      1          0          CHIINV                             CHIINV                             KHIDEUX.INVERSE                    PRUEBA.CHI.INV                     INV.QUI                            CHI.KWADRAAT.INV             CHIJAKAUMA.KÄÄNT                   INV.CHI                            CHI2INV
+276      2      1          0          COMBIN                             KOMBINATIONEN                      COMBIN                             COMBINAT                           COMBIN                             COMBINATIES                  KOMBINAATIO                        COMBINAZIONE                       KOMBIN
+277      3      1          0          CONFIDENCE                         KONFIDENZ                          INTERVALLE.CONFIANCE               INTERVALO.CONFIANZA                INT.CONFIANÇA                      BETROUWBAARHEID              LUOTTAMUSVÄLI                      CONFIDENZA                         KONFIDENS
+278      3      1          0          CRITBINOM                          KRITBINOM                          CRITERE.LOI.BINOMIALE              BINOM.CRIT                         CRIT.BINOM                         CRIT.BINOM                   BINOMIJAKAUMA.KRIT                 CRIT.BINOM                         KRITBINOM
+279      1      1          0          EVEN                               GERADE                             PAIR                               REDONDEA.PAR                       PAR                                EVEN                         PARILLINEN                         PARI                               JÄMN
+280      3      1          0          EXPONDIST                          EXPONVERT                          LOI.EXPONENTIELLE                  DISTR.EXP                          DISTEXPON                          EXPON.VERD                   EKSPONENTIAALIJAKAUMA              DISTRIB.EXP                        EXPONFÖRD
+281      3      1          0          FDIST                              FVERT                              LOI.F                              DISTR.F                            DISTF                              F.VERDELING                  FJAKAUMA                           DISTRIB.F                          FFÖRD
+282      3      1          0          FINV                               FINV                               INVERSE.LOI.F                      DISTR.F.INV                        INVF                               F.INVERSE                    FJAKAUMA.KÄÄNT                     INV.F                              FINV
+283      1      1          0          FISHER                             FISHER                             FISHER                             FISHER                             FISHER                             FISHER                       FISHER                             FISHER                             FISHER
+284      1      1          0          FISHERINV                          FISHERINV                          FISHER.INVERSE                     PRUEBA.FISHER.INV                  FISHERINV                          FISHER.INV                   FISHER.KÄÄNT                       INV.FISHER                         FISHERINV
+285      2      1          0          FLOOR                              UNTERGRENZE                        PLANCHER                           MULTIPLO.INFERIOR                  ARREDMULTB                         AFRONDEN.BENEDEN             PYÖRISTÄ.KERR.ALAS                 ARROTONDA.DIFETTO                  RUNDA.NER
+286      4      1          0          GAMMADIST                          GAMMAVERT                          LOI.GAMMA                          DISTR.GAMMA                        DISTGAMA                           GAMMA.VERD                   GAMMAJAKAUMA                       DISTRIB.GAMMA                      GAMMAFÖRD
+287      3      1          0          GAMMAINV                           GAMMAINV                           LOI.GAMMA.INVERSE                  DISTR.GAMMA.INV                    INVGAMA                            GAMMA.INV                    GAMMAJAKAUMA.KÄÄNT                 INV.GAMMA                          GAMMAINV
+288      2      1          0          CEILING                            OBERGRENZE                         PLAFOND                            MULTIPLO.SUPERIOR                  TETO                               AFRONDEN.BOVEN               PYÖRISTÄ.KERR.YLÖS                 ARROTONDA.ECCESSO                  RUNDA.UPP
+289      4      1          0          HYPGEOMDIST                        HYPGEOMVERT                        LOI.HYPERGEOMETRIQUE               DISTR.HIPERGEOM                    DIST.HIPERGEOM                     HYPERGEO.VERD                HYPERGEOM.JAKAUMA                  DISTRIB.IPERGEOM                   HYPGEOMFÖRD
+290      3      1          0          LOGNORMDIST                        LOGNORMVERT                        LOI.LOGNORMALE                     DISTR.LOG.NORM                     DIST.LOGNORMAL                     LOG.NORM.VERD                LOGNORM.JAKAUMA                    DISTRIB.LOGNORM                    LOGNORMFÖRD
+291      3      1          0          LOGINV                             LOGINV                             LOI.LOGNORMALE.INVERSE             DISTR.LOG.INV                      INVLOG                             LOG.NORM.INV                 LOGNORM.JAKAUMA.KÄÄNT              INV.LOGNORM                        LOGINV
+292      3      1          0          NEGBINOMDIST                       NEGBINOMVERT                       LOI.BINOMIALE.NEG                  NEGBINOMDIST                       DIST.BIN.NEG                       NEG.BINOM.VERD               BINOMIJAKAUMA.NEG                  DISTRIB.BINOM.NEG                  NEGBINOMFÖRD
+293      4      1          0          NORMDIST                           NORMVERT                           LOI.NORMALE                        DISTR.NORM                         DIST.NORM                          NORM.VERD                    NORM.JAKAUMA                       DISTRIB.NORM                       NORMFÖRD
+294      1      1          0          NORMSDIST                          STANDNORMVERT                      LOI.NORMALE.STANDARD               DISTR.NORM.ESTAND                  DIST.NORMP                         STAND.NORM.VERD              NORM.JAKAUMA.NORMIT                DISTRIB.NORM.ST                    NORMSFÖRD
+295      3      1          0          NORMINV                            NORMINV                            LOI.NORMALE.INVERSE                DISTR.NORM.INV                     INV.NORM                           NORM.INV                     NORM.JAKAUMA.KÄÄNT                 INV.NORM                           NORMINV
+296      1      1          0          NORMSINV                           STANDNORMINV                       LOI.NORMALE.STANDARD.INVERSE       DISTR.NORM.ESTAND.INV              INV.NORMP                          STAND.NORM.INV               NORM.JAKAUMA.NORMIT.KÄÄNT          INV.NORM.ST                        NORMSINV
+297      3      1          0          STANDARDIZE                        STANDARDISIERUNG                   CENTREE.REDUITE                    NORMALIZACION                      PADRONIZAR                         NORMALISEREN                 NORMITA                            NORMALIZZA                         STANDARDISERA
+298      1      1          0          ODD                                UNGERADE                           IMPAIR                             REDONDEA.IMPAR                     ÍMPAR                              ONEVEN                       PARITON                            DISPARI                            UDDA
+299      2      1          0          PERMUT                             VARIATIONEN                        PERMUTATION                        PERMUTACIONES                      PERMUT                             PERMUTATIES                  PERMUTAATIO                        PERMUTAZIONE                       PERMUT
+300      3      1          0          POISSON                            POISSON                            LOI.POISSON                        POISSON                            POISSON                            POISSON                      POISSON                            POISSON                            POISSON
+301      3      1          0          TDIST                              TVERT                              LOI.STUDENT                        DISTR.T                            DISTT                              T.VERD                       TJAKAUMA                           DISTRIB.T                          TFÖRD
+302      4      1          0          WEIBULL                            WEIBULL                            LOI.WEIBULL                        DIST.WEIBULL                       WEIBULL                            WEIBULL                      WEIBULL                            WEIBULL                            WEIBULL
+303      2      2          0          SUMXMY2                            SUMMEXMY2                          SOMME.XMY2                         SUMAXMENOSY2                       SOMAXMY2                           SOM.XMINY.2                  EROTUSTEN.NELIÖSUMMA               SOMMA.Q.DIFF                       SUMMAXMY2
+304      2      2          0          SUMX2MY2                           SUMMEX2MY2                         SOMME.X2MY2                        SUMAX2MENOSY2                      SOMAX2DY2                          SOM.X2MINY2                  NELIÖSUMMIEN.EROTUS                SOMMA.DIFF.Q                       SUMMAX2MY2
+305      2      2          0          SUMX2PY2                           SUMMEX2PY2                         SOMME.X2PY2                        SUMAX2MASY2                        SOMAX2SY2                          SOM.X2PLUSY2                 NELIÖSUMMIEN.SUMMA                 SOMMA.SOMMA.Q                      SUMMAX2PY2
+306      2      2          0          CHITEST                            CHITEST                            TEST.KHIDEUX                       PRUEBA.CHI                         TESTE.QUI                          CHI.TOETS                    CHITESTI                           TEST.CHI                           CHI2TEST
+307      2      2          0          CORREL                             KORREL                             COEFFICIENT.CORRELATION            COEF.DE.CORREL                     CORREL                             CORRELATIE                   KORRELAATIO                        CORRELAZIONE                       KORREL
+308      2      2          0          COVAR                              KOVAR                              COVARIANCE                         COVAR                              COVAR                              COVARIANTIE                  KOVARIANSSI                        COVARIANZA                         KOVAR
+309      3      2          0          FORECAST                           SCHÄTZER                           PREVISION                          PRONOSTICO                         PREVISÃO                           VOORSPELLEN                  ENNUSTE                            PREVISIONE                         PREDIKTION
+310      2      2          0          FTEST                              FTEST                              TEST.F                             PRUEBA.F                           TESTEF                             F.TOETS                      FTESTI                             TEST.F                             FTEST
+311      2      2          0          INTERCEPT                          ACHSENABSCHNITT                    ORDONNEE.ORIGINE                   INTERSECCION                       INTERCEPÇÃO                        SNIJPUNT                     LEIKKAUSPISTE                      INTERCETTA                         SKÄRNINGSPUNKT
+312      2      2          0          PEARSON                            PEARSON                            PEARSON                            PEARSON                            PEARSON                            PEARSON                      PEARSON                            PEARSON                            PEARSON
+313      2      2          0          RSQ                                BESTIMMTHEITSMASS                  COEFFICIENT.DETERMINATION          COEFICIENTE.R2                     RQUAD                              R.KWADRAAT                   PEARSON.NELIÖ                      RQ                                 RKV
+314      2      2          0          STEYX                              STFEHLERYX                         ERREUR.TYPE.XY                     ERROR.TIPICO.XY                    EPADYX                             STAND.FOUT.YX                KESKIVIRHE                         ERR.STD.YX                         STDFELYX
+315      2      2          0          SLOPE                              STEIGUNG                           PENTE                              PENDIENTE                          INCLINAÇÃO                         RICHTING                     KULMAKERROIN                       PENDENZA                           LUTNING
+316      4      2          0          TTEST                              TTEST                              TEST.STUDENT                       PRUEBA.T                           TESTET                             T.TOETS                      TTESTI                             TEST.T                             TTEST
+317     -1      2          0          PROB                               WAHRSCHBEREICH                     PROBABILITE                        PROBABILIDAD                       PROB                               KANS                         TODENNÄKÖISYYS                     PROBABILITÀ                        SANNOLIKHET
+318     -1      0          0          DEVSQ                              SUMQUADABW                         SOMME.CARRES.ECARTS                DESVIA2                            DESVQ                              DEV.KWAD                     OIKAISTU.NELIÖSUMMA                DEV.Q                              KVADAVV
+319     -1      0          0          GEOMEAN                            GEOMITTEL                          MOYENNE.GEOMETRIQUE                MEDIA.GEOM                         MÉDIA.GEOMÉTRICA                   MEETK.GEM                    KESKIARVO.GEOM                     MEDIA.GEOMETRICA                   GEOMEDEL
+320     -1      0          0          HARMEAN                            HARMITTEL                          MOYENNE.HARMONIQUE                 MEDIA.ARMO                         MÉDIA.HARMÔNICA                    HARM.GEM                     KESKIARVO.HARM                     MEDIA.ARMONICA                     HARMMEDEL
+321     -1      0          0          SUMSQ                              QUADRATESUMME                      SOMME.CARRES                       SUMA.CUADRADOS                     SOMAQUAD                           KWADRATENSOM                 NELIÖSUMMA                         SOMMA.Q                            KVADRATSUMMA
+322     -1      0          0          KURT                               KURT                               KURTOSIS                           CURTOSIS                           CURT                               KURTOSIS                     KURT                               CURTOSI                            TOPPIGHET
+323     -1      0          0          SKEW                               SCHIEFE                            COEFFICIENT.ASYMETRIE              COEFICIENTE.ASIMETRIA              DISTORÇÃO                          SCHEEFHEID                   JAKAUMAN.VINOUS                    ASIMMETRIA                         SNEDHET
+324     -1      0          0          ZTEST                              GTEST                              TEST.Z                             PRUEBA.Z                           TESTEZ                             Z.TOETS                      ZTESTI                             TEST.Z                             ZTEST
+325      2      0          0          LARGE                              KGRÖSSTE                           GRANDE.VALEUR                      K.ESIMO.MAYOR                      MAIOR                              GROOTSTE                     SUURI                              GRANDE                             STÖRSTA
+326      2      0          0          SMALL                              KKLEINSTE                          PETITE.VALEUR                      K.ESIMO.MENOR                      MENOR                              KLEINSTE                     PIENI                              PICCOLO                            MINSTA
+327      2      0          0          QUARTILE                           QUARTILE                           QUARTILE                           CUARTIL                            QUARTIL                            KWARTIEL                     NELJÄNNES                          QUARTILE                           KVARTIL
+328      2      0          0          PERCENTILE                         QUANTIL                            CENTILE                            PERCENTIL                          PERCENTIL                          PERCENTIEL                   PROSENTTIPISTE                     PERCENTILE                         PERCENTIL
+329     -1      0          0          PERCENTRANK                        QUANTILSRANG                       RANG.POURCENTAGE                   RANGO.PERCENTIL                    ORDEM.PORCENTUAL                   PERCENT.RANG                 PROSENTTIJÄRJESTYS                 PERCENT.RANGO                      PROCENTRANG
+330     -1      2          0          MODE                               MODALWERT                          MODE                               MODA                               MODO                               MODUS                        MOODI                              MODA                               TYPVÄRDE
+331      2      0          0          TRIMMEAN                           GESTUTZTMITTEL                     MOYENNE.REDUITE                    MEDIA.ACOTADA                      MÉDIA.INTERNA                      GETRIMD.GEM                  KESKIARVO.TASATTU                  MEDIA.TRONCATA                     TRIMMEDEL
+332      2      1          0          TINV                               TINV                               LOI.STUDENT.INVERSE                DISTR.T.INV                        INVT                               T.INV                        TJAKAUMA.KÄÄNT                     INV.T                              TINV
+336     -1      1          0          CONCATENATE                        VERKETTEN                          CONCATENER                         CONCATENAR                         CONCATENAR                         TEKST.SAMENVOEGEN            KETJUTA                            CONCATENA                          SAMMANFOGA
+337      2      1          0          POWER                              POTENZ                             PUISSANCE                          POTENCIA                           POTÊNCIA                           MACHT                        POTENSSI                           POTENZA                            UPPHÖJT.TILL
+342      1      1          0          RADIANS                            RADIANT                            RADIANS                            RADIANES                           RADIANOS                           RADIALEN                     RADIAANIT                          RADIANTI                           RADIANER
+343      1      1          0          DEGREES                            GRAD                               DEGRES                             GRADOS                             GRAUS                              GRADEN                       ASTEET                             GRADI                              GRADER
+344     -1      0          0          SUBTOTAL                           TEILERGEBNIS                       SOUS.TOTAL                         SUBTOTALES                         SUBTOTAL                           SUBTOTAAL                    VÄLISUMMA                          SUBTOTALE                          DELSUMMA
+345     -1      0          0          SUMIF                              SUMMEWENN                          SOMME.SI                           SUMAR.SI                           SOMASE                             SOM.ALS                      SUMMA.JOS                          SOMMA.SE                           SUMMA.OM
+346      2      0          0          COUNTIF                            ZÄHLENWENN                         NB.SI                              CONTAR.SI                          CONT.SE                            AANTAL.ALS                   LASKE.JOS                          CONTA.SE                           ANTAL.OM
+347      1      0          0          COUNTBLANK                         ANZAHLLEEREZELLEN                  NB.VIDE                            CONTAR.BLANCO                      CONTAR.VAZIO                       AANTAL.LEGE.CELLEN           LASKE.TYHJÄT                       CONTA.VUOTE                        ANTAL.TOMMA
+354     -1      1          0          ROMAN                              RÖMISCH                            ROMAIN                             NUMERO.ROMANO                      ROMANO                             ROMEINS                      ROMAN                              ROMANO                             ROMERSK

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/headers.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/headers.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/headers.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,142 +1,142 @@
-#!/usr/bin/perl -w
-
-######################################################################
-#
-# This program shows several examples of how to set up headers and
-# footers with Spreadsheet::WriteExcel.
-#
-# The control characters used in the header/footer strings are:
-#
-#   Control             Category            Description
-#   =======             ========            ===========
-#   &L                  Justification       Left
-#   &C                                      Center
-#   &R                                      Right
-#
-#   &P                  Information         Page number
-#   &N                                      Total number of pages
-#   &D                                      Date
-#   &T                                      Time
-#   &F                                      File name
-#   &A                                      Worksheet name
-#
-#   &fontsize           Font                Font size
-#   &"font,style"                           Font name and style
-#   &U                                      Single underline
-#   &E                                      Double underline
-#   &S                                      Strikethrough
-#   &X                                      Superscript
-#   &Y                                      Subscript
-#
-#   &&                  Miscellaneous       Literal ampersand &
-#
-#
-# reverse('©'), March 2002, John McNamara, jmcnamara at cpan.org
-#
-
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-my $workbook  = Spreadsheet::WriteExcel->new("headers.xls");
-my $preview   = "Select Print Preview to see the header and footer";
-
-
-######################################################################
-#
-# A simple example to start
-#
-my $worksheet1  = $workbook->add_worksheet('Simple');
-
-my $header1     = '&CHere is some centred text.';
-
-my $footer1     = '&LHere is some left aligned text.';
-
-
-$worksheet1->set_header($header1);
-$worksheet1->set_footer($footer1);
-
-$worksheet1->set_column('A:A', 50);
-$worksheet1->write('A1', $preview);
-
-
-
-
-######################################################################
-#
-# This is an example of some of the header/footer variables.
-#
-my $worksheet2  = $workbook->add_worksheet('Variables');
-
-my $header2     = '&LPage &P of &N'.
-                  '&CFilename: &F' .
-                  '&RSheetname: &A';
-
-my $footer2     = '&LCurrent date: &D'.
-                  '&RCurrent time: &T';
-
-
-
-$worksheet2->set_header($header2);
-$worksheet2->set_footer($footer2);
-
-
-$worksheet2->set_column('A:A', 50);
-$worksheet2->write('A1', $preview);
-$worksheet2->write('A21', "Next sheet");
-$worksheet2->set_h_pagebreaks(20);
-
-
-
-######################################################################
-#
-# This example shows how to use more than one font
-#
-my $worksheet3 = $workbook->add_worksheet('Mixed fonts');
-
-my $header3    = '&C' .
-                 '&"Courier New,Bold"Hello ' .
-                 '&"Arial,Italic"World';
-
-my $footer3    = '&C' .
-                 '&"Symbol"e' .
-                 '&"Arial" = mc&X2';
-
-$worksheet3->set_header($header3);
-$worksheet3->set_footer($footer3);
-
-$worksheet3->set_column('A:A', 50);
-$worksheet3->write('A1', $preview);
-
-
-
-
-######################################################################
-#
-# Example of line wrapping
-#
-my $worksheet4 = $workbook->add_worksheet('Word wrap');
-
-my $header4    = "&CHeading 1\nHeading 2\nHeading 3";
-
-$worksheet4->set_header($header4);
-
-$worksheet4->set_column('A:A', 50);
-$worksheet4->write('A1', $preview);
-
-
-
-
-######################################################################
-#
-# Example of inserting a literal ampersand &
-#
-my $worksheet5 = $workbook->add_worksheet('Ampersand');
-
-my $header5    = "&CCuriouser && Curiouser - Attorneys at Law";
-
-$worksheet5->set_header($header5);
-
-$worksheet5->set_column('A:A', 50);
-$worksheet5->write('A1', $preview);
-
+#!/usr/bin/perl -w
+
+######################################################################
+#
+# This program shows several examples of how to set up headers and
+# footers with Spreadsheet::WriteExcel.
+#
+# The control characters used in the header/footer strings are:
+#
+#   Control             Category            Description
+#   =======             ========            ===========
+#   &L                  Justification       Left
+#   &C                                      Center
+#   &R                                      Right
+#
+#   &P                  Information         Page number
+#   &N                                      Total number of pages
+#   &D                                      Date
+#   &T                                      Time
+#   &F                                      File name
+#   &A                                      Worksheet name
+#
+#   &fontsize           Font                Font size
+#   &"font,style"                           Font name and style
+#   &U                                      Single underline
+#   &E                                      Double underline
+#   &S                                      Strikethrough
+#   &X                                      Superscript
+#   &Y                                      Subscript
+#
+#   &&                  Miscellaneous       Literal ampersand &
+#
+#
+# reverse('©'), March 2002, John McNamara, jmcnamara at cpan.org
+#
+
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+my $workbook  = Spreadsheet::WriteExcel->new("headers.xls");
+my $preview   = "Select Print Preview to see the header and footer";
+
+
+######################################################################
+#
+# A simple example to start
+#
+my $worksheet1  = $workbook->add_worksheet('Simple');
+
+my $header1     = '&CHere is some centred text.';
+
+my $footer1     = '&LHere is some left aligned text.';
+
+
+$worksheet1->set_header($header1);
+$worksheet1->set_footer($footer1);
+
+$worksheet1->set_column('A:A', 50);
+$worksheet1->write('A1', $preview);
+
+
+
+
+######################################################################
+#
+# This is an example of some of the header/footer variables.
+#
+my $worksheet2  = $workbook->add_worksheet('Variables');
+
+my $header2     = '&LPage &P of &N'.
+                  '&CFilename: &F' .
+                  '&RSheetname: &A';
+
+my $footer2     = '&LCurrent date: &D'.
+                  '&RCurrent time: &T';
+
+
+
+$worksheet2->set_header($header2);
+$worksheet2->set_footer($footer2);
+
+
+$worksheet2->set_column('A:A', 50);
+$worksheet2->write('A1', $preview);
+$worksheet2->write('A21', "Next sheet");
+$worksheet2->set_h_pagebreaks(20);
+
+
+
+######################################################################
+#
+# This example shows how to use more than one font
+#
+my $worksheet3 = $workbook->add_worksheet('Mixed fonts');
+
+my $header3    = '&C' .
+                 '&"Courier New,Bold"Hello ' .
+                 '&"Arial,Italic"World';
+
+my $footer3    = '&C' .
+                 '&"Symbol"e' .
+                 '&"Arial" = mc&X2';
+
+$worksheet3->set_header($header3);
+$worksheet3->set_footer($footer3);
+
+$worksheet3->set_column('A:A', 50);
+$worksheet3->write('A1', $preview);
+
+
+
+
+######################################################################
+#
+# Example of line wrapping
+#
+my $worksheet4 = $workbook->add_worksheet('Word wrap');
+
+my $header4    = "&CHeading 1\nHeading 2\nHeading 3";
+
+$worksheet4->set_header($header4);
+
+$worksheet4->set_column('A:A', 50);
+$worksheet4->write('A1', $preview);
+
+
+
+
+######################################################################
+#
+# Example of inserting a literal ampersand &
+#
+my $worksheet5 = $workbook->add_worksheet('Ampersand');
+
+my $header5    = "&CCuriouser && Curiouser - Attorneys at Law";
+
+$worksheet5->set_header($header5);
+
+$worksheet5->set_column('A:A', 50);
+$worksheet5->write('A1', $preview);
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/hide_sheet.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/hide_sheet.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/hide_sheet.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,26 +1,26 @@
-#!/usr/bin/perl -w
-
-#######################################################################
-#
-# Example of how to hide a worksheet with Spreadsheet::WriteExcel.
-#
-# reverse('©'), April 2005, John McNamara, jmcnamara at cpan.org
-#
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-my $workbook   = Spreadsheet::WriteExcel->new('hidden.xls');
-my $worksheet1 = $workbook->add_worksheet();
-my $worksheet2 = $workbook->add_worksheet();
-my $worksheet3 = $workbook->add_worksheet();
-
-# Sheet2 won't be visible until it is unhidden in Excel.
-$worksheet2->hide();
-
-$worksheet1->write(0, 0, "Hello");
-$worksheet2->write(0, 0, "Hello");
-$worksheet3->write(0, 0, "Hello");
-
-
-__END__
+#!/usr/bin/perl -w
+
+#######################################################################
+#
+# Example of how to hide a worksheet with Spreadsheet::WriteExcel.
+#
+# reverse('©'), April 2005, John McNamara, jmcnamara at cpan.org
+#
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+my $workbook   = Spreadsheet::WriteExcel->new('hidden.xls');
+my $worksheet1 = $workbook->add_worksheet();
+my $worksheet2 = $workbook->add_worksheet();
+my $worksheet3 = $workbook->add_worksheet();
+
+# Sheet2 won't be visible until it is unhidden in Excel.
+$worksheet2->hide();
+
+$worksheet1->write(0, 0, "Hello");
+$worksheet2->write(0, 0, "Hello");
+$worksheet3->write(0, 0, "Hello");
+
+
+__END__

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/hyperlink1.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/hyperlink1.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/hyperlink1.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,40 +1,40 @@
-#!/usr/bin/perl -w
-
-###############################################################################
-#
-# Example of how to use the WriteExcel module to write hyperlinks
-#
-# See also hyperlink2.pl for worksheet URL examples.
-#
-# reverse('©'), March 2001, John McNamara, jmcnamara at cpan.org
-#
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-# Create a new workbook and add a worksheet
-my $workbook  = Spreadsheet::WriteExcel->new("hyperlink.xls");
-my $worksheet = $workbook->add_worksheet('Hyperlinks');
-
-# Format the first column
-$worksheet->set_column('A:A', 30);
-$worksheet->set_selection('B1');
-
-
-# Add a sample format
-my $format = $workbook->add_format();
-$format->set_size(12);
-$format->set_bold();
-$format->set_color('red');
-$format->set_underline();
-
-
-# Write some hyperlinks
-$worksheet->write('A1', 'http://www.perl.com/'                );
-$worksheet->write('A3', 'http://www.perl.com/', 'Perl home'   );
-$worksheet->write('A5', 'http://www.perl.com/', undef, $format);
-$worksheet->write('A7', 'mailto:jmcnamara at cpan.org', 'Mail me');
-
-# Write a URL that isn't a hyperlink
-$worksheet->write_string('A9', 'http://www.perl.com/');
-
+#!/usr/bin/perl -w
+
+###############################################################################
+#
+# Example of how to use the WriteExcel module to write hyperlinks
+#
+# See also hyperlink2.pl for worksheet URL examples.
+#
+# reverse('©'), March 2001, John McNamara, jmcnamara at cpan.org
+#
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+# Create a new workbook and add a worksheet
+my $workbook  = Spreadsheet::WriteExcel->new("hyperlink.xls");
+my $worksheet = $workbook->add_worksheet('Hyperlinks');
+
+# Format the first column
+$worksheet->set_column('A:A', 30);
+$worksheet->set_selection('B1');
+
+
+# Add a sample format
+my $format = $workbook->add_format();
+$format->set_size(12);
+$format->set_bold();
+$format->set_color('red');
+$format->set_underline();
+
+
+# Write some hyperlinks
+$worksheet->write('A1', 'http://www.perl.com/'                );
+$worksheet->write('A3', 'http://www.perl.com/', 'Perl home'   );
+$worksheet->write('A5', 'http://www.perl.com/', undef, $format);
+$worksheet->write('A7', 'mailto:jmcnamara at cpan.org', 'Mail me');
+
+# Write a URL that isn't a hyperlink
+$worksheet->write_string('A9', 'http://www.perl.com/');
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/hyperlink2.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/hyperlink2.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/hyperlink2.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,125 +1,125 @@
-#!/usr/bin/perl -w
-
-###############################################################################
-#
-# Example of how to use the WriteExcel module to write internal and internal
-# hyperlinks.
-#
-# If you wish to run this program and follow the hyperlinks you should create
-# the following directory structure:
-#
-# C:\ -- Temp --+-- Europe
-#               |
-#               \-- Asia
-#
-#
-# See also hyperlink1.pl for web URL examples.
-#
-# reverse('©'), February 2002, John McNamara, jmcnamara at cpan.org
-#
-
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-# Create three workbooks:
-#   C:\Temp\Europe\Ireland.xls
-#   C:\Temp\Europe\Italy.xls
-#   C:\Temp\Asia\China.xls
-#
-my $ireland   = Spreadsheet::WriteExcel->new('C:\Temp\Europe\Ireland.xls');
-my $ire_links = $ireland->add_worksheet('Links');
-my $ire_sales = $ireland->add_worksheet('Sales');
-my $ire_data  = $ireland->add_worksheet('Product Data');
-
-my $italy     = Spreadsheet::WriteExcel->new('C:\Temp\Europe\Italy.xls');
-my $ita_links = $italy->add_worksheet('Links');
-my $ita_sales = $italy->add_worksheet('Sales');
-my $ita_data  = $italy->add_worksheet('Product Data');
-
-my $china     = Spreadsheet::WriteExcel->new('C:\Temp\Asia\China.xls');
-my $cha_links = $china->add_worksheet('Links');
-my $cha_sales = $china->add_worksheet('Sales');
-my $cha_data  = $china->add_worksheet('Product Data');
-
-# Add a format
-my $format = $ireland->add_format(color => 'green', bold => 1);
-$ire_links->set_column('A:B', 25);
-
-
-###############################################################################
-#
-# Examples of internal links
-#
-$ire_links->write('A1', 'Internal links', $format);
-
-# Internal link
-$ire_links->write('A2', 'internal:Sales!A2');
-
-# Internal link to a range
-$ire_links->write('A3', 'internal:Sales!A3:D3');
-
-# Internal link with an alternative string
-$ire_links->write('A4', 'internal:Sales!A4', 'Link');
-
-# Internal link with a format
-$ire_links->write('A5', 'internal:Sales!A5', $format);
-
-# Internal link with an alternative string and format
-$ire_links->write('A6', 'internal:Sales!A6', 'Link', $format);
-
-# Internal link (spaces in worksheet name)
-$ire_links->write('A7', q{internal:'Product Data'!A7});
-
-
-###############################################################################
-#
-# Examples of external links
-#
-$ire_links->write('B1', 'External links', $format);
-
-# External link to a local file
-$ire_links->write('B2', 'external:Italy.xls');
-
-# External link to a local file with worksheet
-$ire_links->write('B3', 'external:Italy.xls#Sales!B3');
-
-# External link to a local file with worksheet and alternative string
-$ire_links->write('B4', 'external:Italy.xls#Sales!B4', 'Link');
-
-# External link to a local file with worksheet and format
-$ire_links->write('B5', 'external:Italy.xls#Sales!B5', $format);
-
-# External link to a remote file, absolute path
-$ire_links->write('B6', 'external:c:/Temp/Asia/China.xls');
-
-# External link to a remote file, relative path
-$ire_links->write('B7', 'external:../Asia/China.xls');
-
-# External link to a remote file with worksheet
-$ire_links->write('B8', 'external:c:/Temp/Asia/China.xls#Sales!B8');
-
-# External link to a remote file with worksheet (with spaces in the name)
-$ire_links->write('B9', q{external:c:/Temp/Asia/China.xls#'Product Data'!B9});
-
-
-###############################################################################
-#
-# Some utility links to return to the main sheet
-#
-$ire_sales->write('A2', 'internal:Links!A2', 'Back');
-$ire_sales->write('A3', 'internal:Links!A3', 'Back');
-$ire_sales->write('A4', 'internal:Links!A4', 'Back');
-$ire_sales->write('A5', 'internal:Links!A5', 'Back');
-$ire_sales->write('A6', 'internal:Links!A6', 'Back');
-$ire_data-> write('A7', 'internal:Links!A7', 'Back');
-
-$ita_links->write('A1', 'external:Ireland.xls#Links!B2', 'Back');
-$ita_sales->write('B3', 'external:Ireland.xls#Links!B3', 'Back');
-$ita_sales->write('B4', 'external:Ireland.xls#Links!B4', 'Back');
-$ita_sales->write('B5', 'external:Ireland.xls#Links!B5', 'Back');
-$cha_links->write('A1', 'external:../Europe/Ireland.xls#Links!B6', 'Back');
-$cha_sales->write('B8', 'external:../Europe/Ireland.xls#Links!B8', 'Back');
-$cha_data-> write('B9', 'external:../Europe/Ireland.xls#Links!B9', 'Back');
-
-
+#!/usr/bin/perl -w
+
+###############################################################################
+#
+# Example of how to use the WriteExcel module to write internal and internal
+# hyperlinks.
+#
+# If you wish to run this program and follow the hyperlinks you should create
+# the following directory structure:
+#
+# C:\ -- Temp --+-- Europe
+#               |
+#               \-- Asia
+#
+#
+# See also hyperlink1.pl for web URL examples.
+#
+# reverse('©'), February 2002, John McNamara, jmcnamara at cpan.org
+#
+
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+# Create three workbooks:
+#   C:\Temp\Europe\Ireland.xls
+#   C:\Temp\Europe\Italy.xls
+#   C:\Temp\Asia\China.xls
+#
+my $ireland   = Spreadsheet::WriteExcel->new('C:\Temp\Europe\Ireland.xls');
+my $ire_links = $ireland->add_worksheet('Links');
+my $ire_sales = $ireland->add_worksheet('Sales');
+my $ire_data  = $ireland->add_worksheet('Product Data');
+
+my $italy     = Spreadsheet::WriteExcel->new('C:\Temp\Europe\Italy.xls');
+my $ita_links = $italy->add_worksheet('Links');
+my $ita_sales = $italy->add_worksheet('Sales');
+my $ita_data  = $italy->add_worksheet('Product Data');
+
+my $china     = Spreadsheet::WriteExcel->new('C:\Temp\Asia\China.xls');
+my $cha_links = $china->add_worksheet('Links');
+my $cha_sales = $china->add_worksheet('Sales');
+my $cha_data  = $china->add_worksheet('Product Data');
+
+# Add a format
+my $format = $ireland->add_format(color => 'green', bold => 1);
+$ire_links->set_column('A:B', 25);
+
+
+###############################################################################
+#
+# Examples of internal links
+#
+$ire_links->write('A1', 'Internal links', $format);
+
+# Internal link
+$ire_links->write('A2', 'internal:Sales!A2');
+
+# Internal link to a range
+$ire_links->write('A3', 'internal:Sales!A3:D3');
+
+# Internal link with an alternative string
+$ire_links->write('A4', 'internal:Sales!A4', 'Link');
+
+# Internal link with a format
+$ire_links->write('A5', 'internal:Sales!A5', $format);
+
+# Internal link with an alternative string and format
+$ire_links->write('A6', 'internal:Sales!A6', 'Link', $format);
+
+# Internal link (spaces in worksheet name)
+$ire_links->write('A7', q{internal:'Product Data'!A7});
+
+
+###############################################################################
+#
+# Examples of external links
+#
+$ire_links->write('B1', 'External links', $format);
+
+# External link to a local file
+$ire_links->write('B2', 'external:Italy.xls');
+
+# External link to a local file with worksheet
+$ire_links->write('B3', 'external:Italy.xls#Sales!B3');
+
+# External link to a local file with worksheet and alternative string
+$ire_links->write('B4', 'external:Italy.xls#Sales!B4', 'Link');
+
+# External link to a local file with worksheet and format
+$ire_links->write('B5', 'external:Italy.xls#Sales!B5', $format);
+
+# External link to a remote file, absolute path
+$ire_links->write('B6', 'external:c:/Temp/Asia/China.xls');
+
+# External link to a remote file, relative path
+$ire_links->write('B7', 'external:../Asia/China.xls');
+
+# External link to a remote file with worksheet
+$ire_links->write('B8', 'external:c:/Temp/Asia/China.xls#Sales!B8');
+
+# External link to a remote file with worksheet (with spaces in the name)
+$ire_links->write('B9', q{external:c:/Temp/Asia/China.xls#'Product Data'!B9});
+
+
+###############################################################################
+#
+# Some utility links to return to the main sheet
+#
+$ire_sales->write('A2', 'internal:Links!A2', 'Back');
+$ire_sales->write('A3', 'internal:Links!A3', 'Back');
+$ire_sales->write('A4', 'internal:Links!A4', 'Back');
+$ire_sales->write('A5', 'internal:Links!A5', 'Back');
+$ire_sales->write('A6', 'internal:Links!A6', 'Back');
+$ire_data-> write('A7', 'internal:Links!A7', 'Back');
+
+$ita_links->write('A1', 'external:Ireland.xls#Links!B2', 'Back');
+$ita_sales->write('B3', 'external:Ireland.xls#Links!B3', 'Back');
+$ita_sales->write('B4', 'external:Ireland.xls#Links!B4', 'Back');
+$ita_sales->write('B5', 'external:Ireland.xls#Links!B5', 'Back');
+$cha_links->write('A1', 'external:../Europe/Ireland.xls#Links!B6', 'Back');
+$cha_sales->write('B8', 'external:../Europe/Ireland.xls#Links!B8', 'Back');
+$cha_data-> write('B9', 'external:../Europe/Ireland.xls#Links!B9', 'Back');
+
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/images.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/images.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/images.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,50 +1,50 @@
-#!/usr/bin/perl -w
-
-#######################################################################
-#
-# Example of how to insert images into an Excel worksheet using the
-# Spreadsheet::WriteExcel insert_bitmap() method.
-#
-# reverse('©'), October 2001, John McNamara, jmcnamara at cpan.org
-#
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-# Create a new workbook called simple.xls and add a worksheet
-my $workbook   = Spreadsheet::WriteExcel->new("images.xls");
-my $worksheet1 = $workbook->add_worksheet('Image 1');
-my $worksheet2 = $workbook->add_worksheet('Image 2');
-my $worksheet3 = $workbook->add_worksheet('Image 3');
-my $worksheet4 = $workbook->add_worksheet('Image 4');
-
-# Insert a basic image
-$worksheet1->write('A10', "Image inserted into worksheet.");
-$worksheet1->insert_bitmap('A1', 'republic.bmp');
-
-
-# Insert an image with an offset
-$worksheet2->write('A10', "Image inserted with an offset.");
-$worksheet2->insert_bitmap('A1', 'republic.bmp', 32, 10);
-
-# Insert a scaled image
-$worksheet3->write('A10', "Image scaled: width x 2, height x 0.8.");
-$worksheet3->insert_bitmap('A1', 'republic.bmp', 0, 0, 2, 0.8);
-
-# Insert an image over varied column and row sizes
-# This does not require any additional work
-
-# Set the cols and row sizes
-# NOTE: you must do this before you call insert_bitmap()
-$worksheet4->set_column('A:A', 5);
-$worksheet4->set_column('B:B', undef, undef, 1); # Hidden
-$worksheet4->set_column('C:D', 10);
-$worksheet4->set_row(0, 30);
-$worksheet4->set_row(3, 5);
-
-$worksheet4->write('A10', "Image inserted over scaled rows and columns.");
-$worksheet4->insert_bitmap('A1', 'republic.bmp');
-
-
-
-
+#!/usr/bin/perl -w
+
+#######################################################################
+#
+# Example of how to insert images into an Excel worksheet using the
+# Spreadsheet::WriteExcel insert_bitmap() method.
+#
+# reverse('©'), October 2001, John McNamara, jmcnamara at cpan.org
+#
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+# Create a new workbook called simple.xls and add a worksheet
+my $workbook   = Spreadsheet::WriteExcel->new("images.xls");
+my $worksheet1 = $workbook->add_worksheet('Image 1');
+my $worksheet2 = $workbook->add_worksheet('Image 2');
+my $worksheet3 = $workbook->add_worksheet('Image 3');
+my $worksheet4 = $workbook->add_worksheet('Image 4');
+
+# Insert a basic image
+$worksheet1->write('A10', "Image inserted into worksheet.");
+$worksheet1->insert_bitmap('A1', 'republic.bmp');
+
+
+# Insert an image with an offset
+$worksheet2->write('A10', "Image inserted with an offset.");
+$worksheet2->insert_bitmap('A1', 'republic.bmp', 32, 10);
+
+# Insert a scaled image
+$worksheet3->write('A10', "Image scaled: width x 2, height x 0.8.");
+$worksheet3->insert_bitmap('A1', 'republic.bmp', 0, 0, 2, 0.8);
+
+# Insert an image over varied column and row sizes
+# This does not require any additional work
+
+# Set the cols and row sizes
+# NOTE: you must do this before you call insert_bitmap()
+$worksheet4->set_column('A:A', 5);
+$worksheet4->set_column('B:B', undef, undef, 1); # Hidden
+$worksheet4->set_column('C:D', 10);
+$worksheet4->set_row(0, 30);
+$worksheet4->set_row(3, 5);
+
+$worksheet4->write('A10', "Image inserted over scaled rows and columns.");
+$worksheet4->insert_bitmap('A1', 'republic.bmp');
+
+
+
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/indent.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/indent.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/indent.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,29 +1,29 @@
-#!/usr/bin/perl -w
-
-##############################################################################
-#
-# A simple formatting example using Spreadsheet::WriteExcel.
-#
-# This program demonstrates the indentation cell format.
-#
-# reverse('©'), May 2004, John McNamara, jmcnamara at cpan.org
-#
-
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-my $workbook  = Spreadsheet::WriteExcel->new('indent.xls');
-
-my $worksheet = $workbook->add_worksheet();
-my $indent1   = $workbook->add_format(indent => 1);
-my $indent2   = $workbook->add_format(indent => 2);
-
-$worksheet->set_column('A:A', 40);
-
-
-$worksheet->write('A1', "This text is indented 1 level",  $indent1);
-$worksheet->write('A2', "This text is indented 2 levels", $indent2);
-
-
-__END__
+#!/usr/bin/perl -w
+
+##############################################################################
+#
+# A simple formatting example using Spreadsheet::WriteExcel.
+#
+# This program demonstrates the indentation cell format.
+#
+# reverse('©'), May 2004, John McNamara, jmcnamara at cpan.org
+#
+
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+my $workbook  = Spreadsheet::WriteExcel->new('indent.xls');
+
+my $worksheet = $workbook->add_worksheet();
+my $indent1   = $workbook->add_format(indent => 1);
+my $indent2   = $workbook->add_format(indent => 2);
+
+$worksheet->set_column('A:A', 40);
+
+
+$worksheet->write('A1', "This text is indented 1 level",  $indent1);
+$worksheet->write('A2', "This text is indented 2 levels", $indent2);
+
+
+__END__

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/lecxe.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/lecxe.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/lecxe.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,349 +1,349 @@
-#!/usr/bin/perl -w
-#
-# lecxe program
-# by t0mas at netlords.net
-#
-# Version
-# 0.01a    Initial release (alpha)
-
-
-# Modules
-use strict;
-use Win32::OLE;
-use Win32::OLE::Const;
-use Getopt::Std;
-
-
-# Vars
-use vars qw(%opts);
-
-
-# Get options
-getopts('i:o:v',\%opts);
-
-
-# Not enough options
-exit &usage unless ($opts{i} && $opts{o});
-
-
-# Create Excel object
-my $Excel = new Win32::OLE("Excel.Application","Quit") or
-        die "Can't start excel: $!";
-
-
-# Get constants
-my $ExcelConst=Win32::OLE::Const->Load("Microsoft Excel");
-
-
-# Show Excel
-$Excel->{Visible} = 1 if ($opts{v});
-
-
-# Open infile
-my $Workbook = $Excel->Workbooks->Open({Filename=>$opts{i}});
-
-
-# Open outfile
-open (OUTFILE,">$opts{o}") or die "Can't open outfile $opts{o}: $!";
-
-
-# Print header for outfile
-print OUTFILE <<'EOH';
-#!/usr/bin/perl -w
-
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-
-use vars qw($workbook %worksheets %formats);
-
-
-$workbook = Spreadsheet::WriteExcel->new("_change_me_.xls");
-
-
-EOH
-
-
-# Loop all sheets
-foreach my $sheetnum (1..$Excel->Workbooks(1)->Worksheets->Count) {
-
-
-        # Format sheet
-        my $name=$Excel->Workbooks(1)->Worksheets($sheetnum)->Name;
-        print "Sheet $name\n" if ($opts{v});
-        print OUTFILE "# Sheet $name\n";
-        print OUTFILE "\$worksheets{'$name'} = \$workbook->add_worksheet('$name');\n";
-
-
-        # Get usedrange of cells in worksheet
-        my $usedrange=$Excel->Workbooks(1)->Worksheets($sheetnum)->UsedRange;
-
-
-        # Loop all columns in used range
-        foreach my $j (1..$usedrange->Columns->Count){
-
-
-                # Format column
-                print "Col $j\n" if ($opts{v});
-                my ($colwidth);
-                $colwidth=$usedrange->Columns($j)->ColumnWidth;
-                print OUTFILE "# Column $j\n";
-                print OUTFILE "\$worksheets{'$name'}->set_column(".($j-1).",".($j-1).
-                        ", $colwidth);\n";
-
-
-                # Loop all rows in used range
-                foreach my $i (1..$usedrange->Rows->Count){
-
-
-                        # Format row
-                        print "Row $i\n" if ($opts{v});
-                        print OUTFILE "# Row $i\n";
-                        do {
-                                my ($rowheight);
-                                $rowheight=$usedrange->Rows($i)->RowHeight;
-                                print OUTFILE "\$worksheets{'$name'}->set_row(".($i-1).
-                                        ", $rowheight);\n";
-                        } if ($j==1);
-
-
-                        # Start creating cell format
-                        my $fname="\$formats{'".$name.'R'.$i.'C'.$j."'}";
-                        my $format="$fname=\$workbook->add_format();\n";
-                        my $print_format=0;
-
-                        # Check for borders
-                        my @bfnames=qw(left right top bottom);
-                        foreach my $k (1..$usedrange->Cells($i,$j)->Borders->Count) {
-                                my $lstyle=$usedrange->Cells($i,$j)->Borders($k)->LineStyle;
-                                if ($lstyle > 0) {
-                                        $format.=$fname."->set_".$bfnames[$k-1]."($lstyle);\n";
-                                        $print_format=1;
-                                }
-                        }
-
-
-                        # Check for font
-                        my ($fontattr,$prop,$func,%fontsets,$fontColor);
-                        %fontsets=(Name=>'set_font',
-                                                Size=>'set_size');
-                        while (($prop,$func) = each %fontsets) {
-                                $fontattr=$usedrange->Cells($i,$j)->Font->$prop;
-                                if ($fontattr ne "") {
-                                        $format.=$fname."->$func('$fontattr');\n";
-                                        $print_format=1;
-                                }
-
-
-                        }
-                        %fontsets=(Bold=>'set_bold(1)',
-                                                Italic=>'set_italic(1)',
-                                                Underline=>'set_underline(1)',
-                                                Strikethrough=>'set_strikeout(1)',
-                                                Superscript=>'set_script(1)',
-                                                Subscript=>'set_script(2)',
-                                                OutlineFont=>'set_outline(1)',
-                                                Shadow=>'set_shadow(1)');
-                        while (($prop,$func) = each %fontsets) {
-                                $fontattr=$usedrange->Cells($i,$j)->Font->$prop;
-                                if ($fontattr==1) {
-                                        $format.=$fname."->$func;\n" ;
-
-                                        $print_format=1;
-                                }
-                        }
-                        $fontColor=$usedrange->Cells($i,$j)->Font->ColorIndex();
-                        if ($fontColor>0&&$fontColor!=$ExcelConst->{xlColorIndexAutomatic}) {
-                                $format.=$fname."->set_color(".($fontColor+7).");\n" ;
-                                $print_format=1;
-                        }
-
-
-
-                        # Check text alignment, merging and wrapping
-                        my ($halign,$valign,$merge,$wrap);
-                        $halign=$usedrange->Cells($i,$j)->HorizontalAlignment;
-                        my %hAligns=($ExcelConst->{xlHAlignCenter}=>"'center'",
-                                $ExcelConst->{xlHAlignJustify}=>"'justify'",
-                                $ExcelConst->{xlHAlignLeft}=>"'left'",
-                                $ExcelConst->{xlHAlignRight}=>"'right'",
-                                $ExcelConst->{xlHAlignFill}=>"'fill'",
-                                $ExcelConst->{xlHAlignCenterAcrossSelection}=>"'merge'");
-                        if ($halign!=$ExcelConst->{xlHAlignGeneral}) {
-                                $format.=$fname."->set_align($hAligns{$halign});\n";
-                                $print_format=1;
-                        }
-                        $valign=$usedrange->Cells($i,$j)->VerticalAlignment;
-                        my %vAligns=($ExcelConst->{xlVAlignBottom}=>"'bottom'",
-                                $ExcelConst->{xlVAlignCenter}=>"'vcenter'",
-                                $ExcelConst->{xlVAlignJustify}=>"'vjustify'",
-                                $ExcelConst->{xlVAlignTop}=>"'top'");
-                        if ($valign) {
-                                $format.=$fname."->set_align($vAligns{$valign});\n";
-                                $print_format=1;
-                        }
-                        $merge=$usedrange->Cells($i,$j)->MergeCells;
-                        if ($merge==1) {
-                                $format.=$fname."->set_merge();\n";
-
-                                $print_format=1;
-                        }
-                        $wrap=$usedrange->Cells($i,$j)->WrapText;
-                        if ($wrap==1) {
-                                $format.=$fname."->set_text_wrap(1);\n";
-
-                                $print_format=1;
-                        }
-
-
-                        # Check patterns
-                        my ($pattern,%pats);
-                        %pats=(-4142=>0,-4125=>2,-4126=>3,-4124=>4,-4128=>5,-4166=>6,
-                                        -4121=>7,-4162=>8);
-                        $pattern=$usedrange->Cells($i,$j)->Interior->Pattern;
-                        if ($pattern&&$pattern!=$ExcelConst->{xlPatternAutomatic}) {
-                                $pattern=$pats{$pattern} if ($pattern<0 && defined $pats{$pattern});
-                                $format.=$fname."->set_pattern($pattern);\n";
-
-                                # Colors fg/bg
-                                my ($cIndex);
-                                $cIndex=$usedrange->Cells($i,$j)->Interior->PatternColorIndex;
-                                if ($cIndex>0&&$cIndex!=$ExcelConst->{xlColorIndexAutomatic}) {
-                                        $format.=$fname."->set_bg_color(".($cIndex+7).");\n";
-                                }
-                                $cIndex=$usedrange->Cells($i,$j)->Interior->ColorIndex;
-                                if ($cIndex>0&&$cIndex!=$ExcelConst->{xlColorIndexAutomatic}) {
-                                        $format.=$fname."->set_fg_color(".($cIndex+7).");\n";
-                                }
-                                $print_format=1;
-                        }
-
-
-                        # Check for number format
-                        my ($num_format);
-                        $num_format=$usedrange->Cells($i,$j)->NumberFormat;
-                        if ($num_format ne "") {
-                                $format.=$fname."->set_num_format('$num_format');\n";
-                                $print_format=1;
-                        }
-
-
-                        # Check for contents (text or formula)
-                        my ($contents);
-                        $contents=$usedrange->Cells($i,$j)->Formula;
-                        $contents=$usedrange->Cells($i,$j)->Text if ($contents eq "");
-
-
-                        # Print cell
-                        if ($contents ne "" or $print_format) {
-                                print OUTFILE "# Cell($i,$j)\n";
-                                print OUTFILE $format if ($print_format);
-                                print OUTFILE "\$worksheets{'$name'}->write(".($i-1).",".($j-1).
-                                        ",'$contents'";
-                                print OUTFILE ",$fname" if ($print_format);
-                                print OUTFILE ");\n";
-                        }
-                }
-        }
-}
-
-
-# Famous last words...
-print OUTFILE "\$workbook->close();\n";
-
-
-# Close outfile
-close (OUTFILE) or die "Can't close outfile $opts{o}: $!";
-
-
-####################################################################
-sub usage {
-        printf STDERR "usage: $0 [options]\n".
-                "\tOptions:\n".
-                "\t\t-v       \tverbose mode\n" .
-                "\t\t-i <name>\tname of input file\n" .
-                "\t\t-o <name>\tname of output file\n";
-}
-
-
-####################################################################
-sub END {
-        # Quit excel
-        do {
-                $Excel->{DisplayAlerts} = 0;
-                $Excel->Quit;
-        } if (defined $Excel);
-}
-
-
-__END__
-
-
-=head1 NAME
-
-
-lecxe - A Excel file to Spreadsheet::WriteExcel code converter
-
-
-=head1 DESCRIPTION
-
-
-This program takes an MS Excel workbook file as input and from
-that file, produces an output file with Perl code that uses the
-Spreadsheet::WriteExcel module to reproduce the original
-file.
-
-
-=head1 STUFF
-
-
-Additional hands-on editing of the output file might be neccecary
-as:
-
-
-* This program always names the file produced by output script
-  _change_me_.xls
-
-
-* Users of international Excel versions will have som work to do
-  on list separators and numeric punctation characters.
-
-
-=head1 SEE ALSO
-
-
-L<Win32::OLE>, L<Win32::OLE::Variant>, L<Spreadsheet::WriteExcel>
-
-
-=head1 BUGS
-
-
-* Picks wrong color on cells sometimes.
-
-
-* Probably a few other...
-
-
-=head1 DISCLAIMER
-
-
-I do not guarantee B<ANYTHING> with this program. If you use it you
-are doing so B<AT YOUR OWN RISK>! I may or may not support this
-depending on my time schedule...
-
-
-=head1 AUTHOR
-
-
-t0mas at netlords.net
-
-
-=head1 COPYRIGHT
-
-
-Copyright 2001, t0mas at netlords.net
-
-
-This package is free software; you can redistribute it and/or
-modify it under the same terms as Perl itself.
+#!/usr/bin/perl -w
+#
+# lecxe program
+# by t0mas at netlords.net
+#
+# Version
+# 0.01a    Initial release (alpha)
+
+
+# Modules
+use strict;
+use Win32::OLE;
+use Win32::OLE::Const;
+use Getopt::Std;
+
+
+# Vars
+use vars qw(%opts);
+
+
+# Get options
+getopts('i:o:v',\%opts);
+
+
+# Not enough options
+exit &usage unless ($opts{i} && $opts{o});
+
+
+# Create Excel object
+my $Excel = new Win32::OLE("Excel.Application","Quit") or
+        die "Can't start excel: $!";
+
+
+# Get constants
+my $ExcelConst=Win32::OLE::Const->Load("Microsoft Excel");
+
+
+# Show Excel
+$Excel->{Visible} = 1 if ($opts{v});
+
+
+# Open infile
+my $Workbook = $Excel->Workbooks->Open({Filename=>$opts{i}});
+
+
+# Open outfile
+open (OUTFILE,">$opts{o}") or die "Can't open outfile $opts{o}: $!";
+
+
+# Print header for outfile
+print OUTFILE <<'EOH';
+#!/usr/bin/perl -w
+
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+
+use vars qw($workbook %worksheets %formats);
+
+
+$workbook = Spreadsheet::WriteExcel->new("_change_me_.xls");
+
+
+EOH
+
+
+# Loop all sheets
+foreach my $sheetnum (1..$Excel->Workbooks(1)->Worksheets->Count) {
+
+
+        # Format sheet
+        my $name=$Excel->Workbooks(1)->Worksheets($sheetnum)->Name;
+        print "Sheet $name\n" if ($opts{v});
+        print OUTFILE "# Sheet $name\n";
+        print OUTFILE "\$worksheets{'$name'} = \$workbook->add_worksheet('$name');\n";
+
+
+        # Get usedrange of cells in worksheet
+        my $usedrange=$Excel->Workbooks(1)->Worksheets($sheetnum)->UsedRange;
+
+
+        # Loop all columns in used range
+        foreach my $j (1..$usedrange->Columns->Count){
+
+
+                # Format column
+                print "Col $j\n" if ($opts{v});
+                my ($colwidth);
+                $colwidth=$usedrange->Columns($j)->ColumnWidth;
+                print OUTFILE "# Column $j\n";
+                print OUTFILE "\$worksheets{'$name'}->set_column(".($j-1).",".($j-1).
+                        ", $colwidth);\n";
+
+
+                # Loop all rows in used range
+                foreach my $i (1..$usedrange->Rows->Count){
+
+
+                        # Format row
+                        print "Row $i\n" if ($opts{v});
+                        print OUTFILE "# Row $i\n";
+                        do {
+                                my ($rowheight);
+                                $rowheight=$usedrange->Rows($i)->RowHeight;
+                                print OUTFILE "\$worksheets{'$name'}->set_row(".($i-1).
+                                        ", $rowheight);\n";
+                        } if ($j==1);
+
+
+                        # Start creating cell format
+                        my $fname="\$formats{'".$name.'R'.$i.'C'.$j."'}";
+                        my $format="$fname=\$workbook->add_format();\n";
+                        my $print_format=0;
+
+                        # Check for borders
+                        my @bfnames=qw(left right top bottom);
+                        foreach my $k (1..$usedrange->Cells($i,$j)->Borders->Count) {
+                                my $lstyle=$usedrange->Cells($i,$j)->Borders($k)->LineStyle;
+                                if ($lstyle > 0) {
+                                        $format.=$fname."->set_".$bfnames[$k-1]."($lstyle);\n";
+                                        $print_format=1;
+                                }
+                        }
+
+
+                        # Check for font
+                        my ($fontattr,$prop,$func,%fontsets,$fontColor);
+                        %fontsets=(Name=>'set_font',
+                                                Size=>'set_size');
+                        while (($prop,$func) = each %fontsets) {
+                                $fontattr=$usedrange->Cells($i,$j)->Font->$prop;
+                                if ($fontattr ne "") {
+                                        $format.=$fname."->$func('$fontattr');\n";
+                                        $print_format=1;
+                                }
+
+
+                        }
+                        %fontsets=(Bold=>'set_bold(1)',
+                                                Italic=>'set_italic(1)',
+                                                Underline=>'set_underline(1)',
+                                                Strikethrough=>'set_strikeout(1)',
+                                                Superscript=>'set_script(1)',
+                                                Subscript=>'set_script(2)',
+                                                OutlineFont=>'set_outline(1)',
+                                                Shadow=>'set_shadow(1)');
+                        while (($prop,$func) = each %fontsets) {
+                                $fontattr=$usedrange->Cells($i,$j)->Font->$prop;
+                                if ($fontattr==1) {
+                                        $format.=$fname."->$func;\n" ;
+
+                                        $print_format=1;
+                                }
+                        }
+                        $fontColor=$usedrange->Cells($i,$j)->Font->ColorIndex();
+                        if ($fontColor>0&&$fontColor!=$ExcelConst->{xlColorIndexAutomatic}) {
+                                $format.=$fname."->set_color(".($fontColor+7).");\n" ;
+                                $print_format=1;
+                        }
+
+
+
+                        # Check text alignment, merging and wrapping
+                        my ($halign,$valign,$merge,$wrap);
+                        $halign=$usedrange->Cells($i,$j)->HorizontalAlignment;
+                        my %hAligns=($ExcelConst->{xlHAlignCenter}=>"'center'",
+                                $ExcelConst->{xlHAlignJustify}=>"'justify'",
+                                $ExcelConst->{xlHAlignLeft}=>"'left'",
+                                $ExcelConst->{xlHAlignRight}=>"'right'",
+                                $ExcelConst->{xlHAlignFill}=>"'fill'",
+                                $ExcelConst->{xlHAlignCenterAcrossSelection}=>"'merge'");
+                        if ($halign!=$ExcelConst->{xlHAlignGeneral}) {
+                                $format.=$fname."->set_align($hAligns{$halign});\n";
+                                $print_format=1;
+                        }
+                        $valign=$usedrange->Cells($i,$j)->VerticalAlignment;
+                        my %vAligns=($ExcelConst->{xlVAlignBottom}=>"'bottom'",
+                                $ExcelConst->{xlVAlignCenter}=>"'vcenter'",
+                                $ExcelConst->{xlVAlignJustify}=>"'vjustify'",
+                                $ExcelConst->{xlVAlignTop}=>"'top'");
+                        if ($valign) {
+                                $format.=$fname."->set_align($vAligns{$valign});\n";
+                                $print_format=1;
+                        }
+                        $merge=$usedrange->Cells($i,$j)->MergeCells;
+                        if ($merge==1) {
+                                $format.=$fname."->set_merge();\n";
+
+                                $print_format=1;
+                        }
+                        $wrap=$usedrange->Cells($i,$j)->WrapText;
+                        if ($wrap==1) {
+                                $format.=$fname."->set_text_wrap(1);\n";
+
+                                $print_format=1;
+                        }
+
+
+                        # Check patterns
+                        my ($pattern,%pats);
+                        %pats=(-4142=>0,-4125=>2,-4126=>3,-4124=>4,-4128=>5,-4166=>6,
+                                        -4121=>7,-4162=>8);
+                        $pattern=$usedrange->Cells($i,$j)->Interior->Pattern;
+                        if ($pattern&&$pattern!=$ExcelConst->{xlPatternAutomatic}) {
+                                $pattern=$pats{$pattern} if ($pattern<0 && defined $pats{$pattern});
+                                $format.=$fname."->set_pattern($pattern);\n";
+
+                                # Colors fg/bg
+                                my ($cIndex);
+                                $cIndex=$usedrange->Cells($i,$j)->Interior->PatternColorIndex;
+                                if ($cIndex>0&&$cIndex!=$ExcelConst->{xlColorIndexAutomatic}) {
+                                        $format.=$fname."->set_bg_color(".($cIndex+7).");\n";
+                                }
+                                $cIndex=$usedrange->Cells($i,$j)->Interior->ColorIndex;
+                                if ($cIndex>0&&$cIndex!=$ExcelConst->{xlColorIndexAutomatic}) {
+                                        $format.=$fname."->set_fg_color(".($cIndex+7).");\n";
+                                }
+                                $print_format=1;
+                        }
+
+
+                        # Check for number format
+                        my ($num_format);
+                        $num_format=$usedrange->Cells($i,$j)->NumberFormat;
+                        if ($num_format ne "") {
+                                $format.=$fname."->set_num_format('$num_format');\n";
+                                $print_format=1;
+                        }
+
+
+                        # Check for contents (text or formula)
+                        my ($contents);
+                        $contents=$usedrange->Cells($i,$j)->Formula;
+                        $contents=$usedrange->Cells($i,$j)->Text if ($contents eq "");
+
+
+                        # Print cell
+                        if ($contents ne "" or $print_format) {
+                                print OUTFILE "# Cell($i,$j)\n";
+                                print OUTFILE $format if ($print_format);
+                                print OUTFILE "\$worksheets{'$name'}->write(".($i-1).",".($j-1).
+                                        ",'$contents'";
+                                print OUTFILE ",$fname" if ($print_format);
+                                print OUTFILE ");\n";
+                        }
+                }
+        }
+}
+
+
+# Famous last words...
+print OUTFILE "\$workbook->close();\n";
+
+
+# Close outfile
+close (OUTFILE) or die "Can't close outfile $opts{o}: $!";
+
+
+####################################################################
+sub usage {
+        printf STDERR "usage: $0 [options]\n".
+                "\tOptions:\n".
+                "\t\t-v       \tverbose mode\n" .
+                "\t\t-i <name>\tname of input file\n" .
+                "\t\t-o <name>\tname of output file\n";
+}
+
+
+####################################################################
+sub END {
+        # Quit excel
+        do {
+                $Excel->{DisplayAlerts} = 0;
+                $Excel->Quit;
+        } if (defined $Excel);
+}
+
+
+__END__
+
+
+=head1 NAME
+
+
+lecxe - A Excel file to Spreadsheet::WriteExcel code converter
+
+
+=head1 DESCRIPTION
+
+
+This program takes an MS Excel workbook file as input and from
+that file, produces an output file with Perl code that uses the
+Spreadsheet::WriteExcel module to reproduce the original
+file.
+
+
+=head1 STUFF
+
+
+Additional hands-on editing of the output file might be neccecary
+as:
+
+
+* This program always names the file produced by output script
+  _change_me_.xls
+
+
+* Users of international Excel versions will have som work to do
+  on list separators and numeric punctation characters.
+
+
+=head1 SEE ALSO
+
+
+L<Win32::OLE>, L<Win32::OLE::Variant>, L<Spreadsheet::WriteExcel>
+
+
+=head1 BUGS
+
+
+* Picks wrong color on cells sometimes.
+
+
+* Probably a few other...
+
+
+=head1 DISCLAIMER
+
+
+I do not guarantee B<ANYTHING> with this program. If you use it you
+are doing so B<AT YOUR OWN RISK>! I may or may not support this
+depending on my time schedule...
+
+
+=head1 AUTHOR
+
+
+t0mas at netlords.net
+
+
+=head1 COPYRIGHT
+
+
+Copyright 2001, t0mas at netlords.net
+
+
+This package is free software; you can redistribute it and/or
+modify it under the same terms as Perl itself.

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/merge1.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/merge1.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/merge1.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,35 +1,35 @@
-#!/usr/bin/perl -w
-
-###############################################################################
-#
-# Simple example of merging cells using the Spreadsheet::WriteExcel module.
-#
-# This merges three cells using the "Centre Across Selection" alignment.
-# This was the Excel 5 method of achieving a merge. Use the merge_range()
-# worksheet method instead. See merge3.pl - merge4.pl.
-#
-# reverse('©'), August 2002, John McNamara, jmcnamara at cpan.org
-#
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-# Create a new workbook and add a worksheet
-my $workbook  = Spreadsheet::WriteExcel->new("merge1.xls");
-my $worksheet = $workbook->add_worksheet();
-
-
-# Increase the cell size of the merged cells to highlight the formatting.
-$worksheet->set_column('B:D', 20);
-$worksheet->set_row(2, 30);
-
-
-# Create a merge format
-my $format = $workbook->add_format(center_across => 1);
-
-
-# Only one cell should contain text, the others should be blank.
-$worksheet->write      (2, 1, "Center across selection", $format);
-$worksheet->write_blank(2, 2,                 $format);
-$worksheet->write_blank(2, 3,                 $format);
-
+#!/usr/bin/perl -w
+
+###############################################################################
+#
+# Simple example of merging cells using the Spreadsheet::WriteExcel module.
+#
+# This merges three cells using the "Centre Across Selection" alignment.
+# This was the Excel 5 method of achieving a merge. Use the merge_range()
+# worksheet method instead. See merge3.pl - merge4.pl.
+#
+# reverse('©'), August 2002, John McNamara, jmcnamara at cpan.org
+#
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+# Create a new workbook and add a worksheet
+my $workbook  = Spreadsheet::WriteExcel->new("merge1.xls");
+my $worksheet = $workbook->add_worksheet();
+
+
+# Increase the cell size of the merged cells to highlight the formatting.
+$worksheet->set_column('B:D', 20);
+$worksheet->set_row(2, 30);
+
+
+# Create a merge format
+my $format = $workbook->add_format(center_across => 1);
+
+
+# Only one cell should contain text, the others should be blank.
+$worksheet->write      (2, 1, "Center across selection", $format);
+$worksheet->write_blank(2, 2,                 $format);
+$worksheet->write_blank(2, 3,                 $format);
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/merge2.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/merge2.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/merge2.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,44 +1,44 @@
-#!/usr/bin/perl -w
-
-###############################################################################
-#
-# Simple example of merging cells using the Spreadsheet::WriteExcel module
-#
-# This merges two formatted cells using the "Centre Across Selection" alignment.
-# This was the Excel 5 method of achieving a merge. Use the merge_range()
-# worksheet method instead. See merge3.pl - merge4.pl.
-##
-# reverse('©'), August 2002, John McNamara, jmcnamara at cpan.org
-#
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-# Create a new workbook and add a worksheet
-my $workbook  = Spreadsheet::WriteExcel->new("merge2.xls");
-my $worksheet = $workbook->add_worksheet();
-
-
-# Increase the cell size of the merged cells to highlight the formatting.
-$worksheet->set_column(1, 2, 30);
-$worksheet->set_row(2, 40);
-
-
-# Create a merged format
-my $format = $workbook->add_format(
-                                        merge        => 1,
-                                        bold         => 1,
-                                        size         => 15,
-                                        pattern      => 1,
-                                        border       => 6,
-                                        color        => 'white',
-                                        fg_color     => 'green',
-                                        border_color => 'yellow',
-                                        align        => 'vcenter',
-                                  );
-
-
-# Only one cell should contain text, the others should be blank.
-$worksheet->write      (2, 1, "Center across selection", $format);
-$worksheet->write_blank(2, 2,                 $format);
-
+#!/usr/bin/perl -w
+
+###############################################################################
+#
+# Simple example of merging cells using the Spreadsheet::WriteExcel module
+#
+# This merges two formatted cells using the "Centre Across Selection" alignment.
+# This was the Excel 5 method of achieving a merge. Use the merge_range()
+# worksheet method instead. See merge3.pl - merge4.pl.
+##
+# reverse('©'), August 2002, John McNamara, jmcnamara at cpan.org
+#
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+# Create a new workbook and add a worksheet
+my $workbook  = Spreadsheet::WriteExcel->new("merge2.xls");
+my $worksheet = $workbook->add_worksheet();
+
+
+# Increase the cell size of the merged cells to highlight the formatting.
+$worksheet->set_column(1, 2, 30);
+$worksheet->set_row(2, 40);
+
+
+# Create a merged format
+my $format = $workbook->add_format(
+                                        merge        => 1,
+                                        bold         => 1,
+                                        size         => 15,
+                                        pattern      => 1,
+                                        border       => 6,
+                                        color        => 'white',
+                                        fg_color     => 'green',
+                                        border_color => 'yellow',
+                                        align        => 'vcenter',
+                                  );
+
+
+# Only one cell should contain text, the others should be blank.
+$worksheet->write      (2, 1, "Center across selection", $format);
+$worksheet->write_blank(2, 2,                            $format);
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/merge3.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/merge3.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/merge3.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,65 +1,65 @@
-#!/usr/bin/perl -w
-
-###############################################################################
-#
-# Example of how to use Spreadsheet::WriteExcel to write a hyperlink in a
-# merged cell. There are two options write_url_range() with a standard merge
-# format or merge_range().
-#
-# reverse('©'), September 2002, John McNamara, jmcnamara at cpan.org
-#
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-# Create a new workbook and add a worksheet
-my $workbook  = Spreadsheet::WriteExcel->new('merge3.xls');
-my $worksheet = $workbook->add_worksheet();
-
-
-# Increase the cell size of the merged cells to highlight the formatting.
-$worksheet->set_row($_, 30) for (1, 3, 6, 7);
-$worksheet->set_column('B:D', 20);
-
-
-###############################################################################
-#
-# Example 1: Merge cells containing a hyperlink using write_url_range()
-# and the standard Excel 5+ merge property.
-#
-my $format1 = $workbook->add_format(
-                                    merge       => 1,
-                                    border      => 1,
-                                    underline   => 1,
-                                    color       => 'blue',
-                                 );
-
-# Write the cells to be merged
-$worksheet->write_url_range('B2:D2', 'http://www.perl.com', $format1);
-$worksheet->write_blank('C2', $format1);
-$worksheet->write_blank('D2', $format1);
-
-
-
-###############################################################################
-#
-# Example 2: Merge cells containing a hyperlink using merge_range().
-#
-my $format2 = $workbook->add_format(
-                                    border      => 1,
-                                    underline   => 1,
-                                    color       => 'blue',
-                                    align       => 'center',
-                                    valign      => 'vcenter',
-                                  );
-
-# Merge 3 cells
-$worksheet->merge_range('B4:D4', 'http://www.perl.com', $format2);
-
-
-# Merge 3 cells over two rows
-$worksheet->merge_range('B7:D8', 'http://www.perl.com', $format2);
-
-
-
-
+#!/usr/bin/perl -w
+
+###############################################################################
+#
+# Example of how to use Spreadsheet::WriteExcel to write a hyperlink in a
+# merged cell. There are two options write_url_range() with a standard merge
+# format or merge_range().
+#
+# reverse('©'), September 2002, John McNamara, jmcnamara at cpan.org
+#
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+# Create a new workbook and add a worksheet
+my $workbook  = Spreadsheet::WriteExcel->new('merge3.xls');
+my $worksheet = $workbook->add_worksheet();
+
+
+# Increase the cell size of the merged cells to highlight the formatting.
+$worksheet->set_row($_, 30) for (1, 3, 6, 7);
+$worksheet->set_column('B:D', 20);
+
+
+###############################################################################
+#
+# Example 1: Merge cells containing a hyperlink using write_url_range()
+# and the standard Excel 5+ merge property.
+#
+my $format1 = $workbook->add_format(
+                                    merge       => 1,
+                                    border      => 1,
+                                    underline   => 1,
+                                    color       => 'blue',
+                                 );
+
+# Write the cells to be merged
+$worksheet->write_url_range('B2:D2', 'http://www.perl.com', $format1);
+$worksheet->write_blank('C2', $format1);
+$worksheet->write_blank('D2', $format1);
+
+
+
+###############################################################################
+#
+# Example 2: Merge cells containing a hyperlink using merge_range().
+#
+my $format2 = $workbook->add_format(
+                                    border      => 1,
+                                    underline   => 1,
+                                    color       => 'blue',
+                                    align       => 'center',
+                                    valign      => 'vcenter',
+                                  );
+
+# Merge 3 cells
+$worksheet->merge_range('B4:D4', 'http://www.perl.com', $format2);
+
+
+# Merge 3 cells over two rows
+$worksheet->merge_range('B7:D8', 'http://www.perl.com', $format2);
+
+
+
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/merge4.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/merge4.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/merge4.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,90 +1,90 @@
-#!/usr/bin/perl -w
-
-###############################################################################
-#
-# Example of how to use the Spreadsheet::WriteExcel merge_range() workbook
-# method with complex formatting.
-#
-# reverse('©'), September 2002, John McNamara, jmcnamara at cpan.org
-#
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-# Create a new workbook and add a worksheet
-my $workbook  = Spreadsheet::WriteExcel->new('merge4.xls');
-my $worksheet = $workbook->add_worksheet();
-
-
-# Increase the cell size of the merged cells to highlight the formatting.
-$worksheet->set_row($_, 30) for (1..11);
-$worksheet->set_column('B:D', 20);
-
-
-###############################################################################
-#
-# Example 1: Text centered vertically and horizontally
-#
-my $format1 = $workbook->add_format(
-                                    border  => 6,
-                                    bold    => 1,
-                                    color   => 'red',
-                                    valign  => 'vcenter',
-                                    align   => 'center',
-                                   );
-
-
-
-$worksheet->merge_range('B2:D3', 'Vertical and horizontal', $format1);
-
-
-###############################################################################
-#
-# Example 2: Text aligned to the top and left
-#
-my $format2 = $workbook->add_format(
-                                    border  => 6,
-                                    bold    => 1,
-                                    color   => 'red',
-                                    valign  => 'top',
-                                    align   => 'left',
-                                  );
-
-
-
-$worksheet->merge_range('B5:D6', 'Aligned to the top and left', $format2);
-
-
-###############################################################################
-#
-# Example 3:  Text aligned to the bottom and right
-#
-my $format3 = $workbook->add_format(
-                                    border  => 6,
-                                    bold    => 1,
-                                    color   => 'red',
-                                    valign  => 'bottom',
-                                    align   => 'right',
-                                  );
-
-
-
-$worksheet->merge_range('B8:D9', 'Aligned to the bottom and right', $format3);
-
-
-###############################################################################
-#
-# Example 4:  Text justified (i.e. wrapped) in the cell
-#
-my $format4 = $workbook->add_format(
-                                    border  => 6,
-                                    bold    => 1,
-                                    color   => 'red',
-                                    valign  => 'top',
-                                    align   => 'justify',
-                                  );
-
-
-
-$worksheet->merge_range('B11:D12', 'Justified: '.'so on and ' x18, $format4);
-
+#!/usr/bin/perl -w
+
+###############################################################################
+#
+# Example of how to use the Spreadsheet::WriteExcel merge_range() workbook
+# method with complex formatting.
+#
+# reverse('©'), September 2002, John McNamara, jmcnamara at cpan.org
+#
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+# Create a new workbook and add a worksheet
+my $workbook  = Spreadsheet::WriteExcel->new('merge4.xls');
+my $worksheet = $workbook->add_worksheet();
+
+
+# Increase the cell size of the merged cells to highlight the formatting.
+$worksheet->set_row($_, 30) for (1..11);
+$worksheet->set_column('B:D', 20);
+
+
+###############################################################################
+#
+# Example 1: Text centered vertically and horizontally
+#
+my $format1 = $workbook->add_format(
+                                    border  => 6,
+                                    bold    => 1,
+                                    color   => 'red',
+                                    valign  => 'vcenter',
+                                    align   => 'center',
+                                   );
+
+
+
+$worksheet->merge_range('B2:D3', 'Vertical and horizontal', $format1);
+
+
+###############################################################################
+#
+# Example 2: Text aligned to the top and left
+#
+my $format2 = $workbook->add_format(
+                                    border  => 6,
+                                    bold    => 1,
+                                    color   => 'red',
+                                    valign  => 'top',
+                                    align   => 'left',
+                                  );
+
+
+
+$worksheet->merge_range('B5:D6', 'Aligned to the top and left', $format2);
+
+
+###############################################################################
+#
+# Example 3:  Text aligned to the bottom and right
+#
+my $format3 = $workbook->add_format(
+                                    border  => 6,
+                                    bold    => 1,
+                                    color   => 'red',
+                                    valign  => 'bottom',
+                                    align   => 'right',
+                                  );
+
+
+
+$worksheet->merge_range('B8:D9', 'Aligned to the bottom and right', $format3);
+
+
+###############################################################################
+#
+# Example 4:  Text justified (i.e. wrapped) in the cell
+#
+my $format4 = $workbook->add_format(
+                                    border  => 6,
+                                    bold    => 1,
+                                    color   => 'red',
+                                    valign  => 'top',
+                                    align   => 'justify',
+                                  );
+
+
+
+$worksheet->merge_range('B11:D12', 'Justified: '.'so on and ' x18, $format4);
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/merge5.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/merge5.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/merge5.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,75 +1,75 @@
-#!/usr/bin/perl -w
-
-###############################################################################
-#
-# Example of how to use the Spreadsheet::WriteExcel merge_cells() workbook
-# method with complex formatting and rotation.
-#
-#
-# reverse('©'), September 2002, John McNamara, jmcnamara at cpan.org
-#
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-# Create a new workbook and add a worksheet
-my $workbook  = Spreadsheet::WriteExcel->new('merge5.xls');
-my $worksheet = $workbook->add_worksheet();
-
-
-# Increase the cell size of the merged cells to highlight the formatting.
-$worksheet->set_row($_, 36)         for (3..8);
-$worksheet->set_column($_, $_ , 15) for (1,3,5);
-
-
-###############################################################################
-#
-# Rotation 1, letters run from top to bottom
-#
-my $format1 = $workbook->add_format(
-                                    border      => 6,
-                                    bold        => 1,
-                                    color       => 'red',
-                                    valign      => 'vcentre',
-                                    align       => 'centre',
-                                    rotation    => 270,
-                                  );
-
-
-$worksheet->merge_range('B4:B9', 'Rotation 270', $format1);
-
-
-###############################################################################
-#
-# Rotation 2, 90° anticlockwise
-#
-my $format2 = $workbook->add_format(
-                                    border      => 6,
-                                    bold        => 1,
-                                    color       => 'red',
-                                    valign      => 'vcentre',
-                                    align       => 'centre',
-                                    rotation    => 90,
-                                  );
-
-
-$worksheet->merge_range('D4:D9', 'Rotation 90°', $format2);
-
-
-
-###############################################################################
-#
-# Rotation 3, 90° clockwise
-#
-my $format3 = $workbook->add_format(
-                                    border      => 6,
-                                    bold        => 1,
-                                    color       => 'red',
-                                    valign      => 'vcentre',
-                                    align       => 'centre',
-                                    rotation    => -90,
-                                  );
-
-
-$worksheet->merge_range('F4:F9', 'Rotation -90°', $format3);
-
+#!/usr/bin/perl -w
+
+###############################################################################
+#
+# Example of how to use the Spreadsheet::WriteExcel merge_cells() workbook
+# method with complex formatting and rotation.
+#
+#
+# reverse('©'), September 2002, John McNamara, jmcnamara at cpan.org
+#
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+# Create a new workbook and add a worksheet
+my $workbook  = Spreadsheet::WriteExcel->new('merge5.xls');
+my $worksheet = $workbook->add_worksheet();
+
+
+# Increase the cell size of the merged cells to highlight the formatting.
+$worksheet->set_row($_, 36)         for (3..8);
+$worksheet->set_column($_, $_ , 15) for (1,3,5);
+
+
+###############################################################################
+#
+# Rotation 1, letters run from top to bottom
+#
+my $format1 = $workbook->add_format(
+                                    border      => 6,
+                                    bold        => 1,
+                                    color       => 'red',
+                                    valign      => 'vcentre',
+                                    align       => 'centre',
+                                    rotation    => 270,
+                                  );
+
+
+$worksheet->merge_range('B4:B9', 'Rotation 270', $format1);
+
+
+###############################################################################
+#
+# Rotation 2, 90° anticlockwise
+#
+my $format2 = $workbook->add_format(
+                                    border      => 6,
+                                    bold        => 1,
+                                    color       => 'red',
+                                    valign      => 'vcentre',
+                                    align       => 'centre',
+                                    rotation    => 90,
+                                  );
+
+
+$worksheet->merge_range('D4:D9', 'Rotation 90°', $format2);
+
+
+
+###############################################################################
+#
+# Rotation 3, 90° clockwise
+#
+my $format3 = $workbook->add_format(
+                                    border      => 6,
+                                    bold        => 1,
+                                    color       => 'red',
+                                    valign      => 'vcentre',
+                                    align       => 'centre',
+                                    rotation    => -90,
+                                  );
+
+
+$worksheet->merge_range('F4:F9', 'Rotation -90°', $format3);
+

Copied: packages/libspreadsheet-writeexcel-perl/trunk/examples/merge6.pl (from rev 1957, packages/libspreadsheet-writeexcel-perl/branches/upstream/current/examples/merge6.pl)

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/mod_perl1.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/mod_perl1.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/mod_perl1.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,93 +1,93 @@
-###############################################################################
-#
-# Example of how to use the Spreadsheet::WriteExcel module to send an Excel
-# file to a browser using mod_perl 1 and Apache
-#
-# This module ties *XLS directly to Apache, and with the correct
-# content-disposition/types it will prompt the user to save
-# the file, or open it at this location.
-#
-# This script is a modification of the example cgi.pm script bundled
-# with Spreadsheet::WriteExcel.
-#
-# Apr 2001, Thomas Sullivan, webmaster at 860.org
-# Feb 2001, John McNamara, jmcnamara at cpan.org
-#
-# Change the name of this file to Cgi.pm.
-# Change the package location to where-ever you locate this package.
-# Below, I have this located in the WriteExcel directory.
-#
-# Your httpd.conf entry for this module, should you choose to use it
-# as a stand alone app, should look similar to the following:
-#
-# <Location /spreadsheet-test>
-# SetHandler perl-script
-# PerlHandler Spreadsheet::WriteExcel::Cgi
-# PerlSendHeader On
-# </Location>
-#
-# PerlHandler and the package line below have to match.
-# I promise.
-package Spreadsheet::WriteExcel::Cgi;
-
-##########################################
-# Pragma Definitions
-##########################################
-use strict;
-
-##########################################
-# Required Modules
-##########################################
-use Apache::Constants qw(:common);
-use Apache::Request;
-use Apache::URI; # This may not be needed
-use Spreadsheet::WriteExcel;
-
-##########################################
-# Main App Body
-##########################################
-sub handler {
-    # New apache object
-    # Should you decide to use it.
-    my $r = Apache::Request->new(shift);
-
-    # Set the filename and send the content type
-    # This will appear when they save the spreadsheet
-    my $filename ="cgitest.xls";
-
-    ####################################################
-    ## Send the content type headers
-    ####################################################
-    print "Content-disposition: attachment;filename=$filename\n";
-    print "Content-type: application/vnd.ms-excel\n\n";
-
-    ####################################################
-    # Tie a filehandle to Apache's STDOUT.
-    # Create a new workbook and add a worksheet.
-    ####################################################
-    tie *XLS => 'Apache';
-    binmode(*XLS);
-
-    my $workbook  = Spreadsheet::WriteExcel->new(\*XLS);
-    my $worksheet = $workbook->add_worksheet();
-
-
-    # Set the column width for column 1
-    $worksheet->set_column(0, 0, 20);
-
-
-    # Create a format
-    my $format = $workbook->add_format();
-    $format->set_bold();
-    $format->set_size(15);
-    $format->set_color('blue');
-
-
-    # Write to the workbook
-    $worksheet->write(0, 0, "Hi Excel!", $format);
-
-    # You must close the workbook for Content-disposition
-    $workbook->close();
-}
-
-1;
+###############################################################################
+#
+# Example of how to use the Spreadsheet::WriteExcel module to send an Excel
+# file to a browser using mod_perl 1 and Apache
+#
+# This module ties *XLS directly to Apache, and with the correct
+# content-disposition/types it will prompt the user to save
+# the file, or open it at this location.
+#
+# This script is a modification of the example cgi.pm script bundled
+# with Spreadsheet::WriteExcel.
+#
+# Apr 2001, Thomas Sullivan, webmaster at 860.org
+# Feb 2001, John McNamara, jmcnamara at cpan.org
+#
+# Change the name of this file to Cgi.pm.
+# Change the package location to where-ever you locate this package.
+# Below, I have this located in the WriteExcel directory.
+#
+# Your httpd.conf entry for this module, should you choose to use it
+# as a stand alone app, should look similar to the following:
+#
+# <Location /spreadsheet-test>
+# SetHandler perl-script
+# PerlHandler Spreadsheet::WriteExcel::Cgi
+# PerlSendHeader On
+# </Location>
+#
+# PerlHandler and the package line below have to match.
+# I promise.
+package Spreadsheet::WriteExcel::Cgi;
+
+##########################################
+# Pragma Definitions
+##########################################
+use strict;
+
+##########################################
+# Required Modules
+##########################################
+use Apache::Constants qw(:common);
+use Apache::Request;
+use Apache::URI; # This may not be needed
+use Spreadsheet::WriteExcel;
+
+##########################################
+# Main App Body
+##########################################
+sub handler {
+    # New apache object
+    # Should you decide to use it.
+    my $r = Apache::Request->new(shift);
+
+    # Set the filename and send the content type
+    # This will appear when they save the spreadsheet
+    my $filename ="cgitest.xls";
+
+    ####################################################
+    ## Send the content type headers
+    ####################################################
+    print "Content-disposition: attachment;filename=$filename\n";
+    print "Content-type: application/vnd.ms-excel\n\n";
+
+    ####################################################
+    # Tie a filehandle to Apache's STDOUT.
+    # Create a new workbook and add a worksheet.
+    ####################################################
+    tie *XLS => 'Apache';
+    binmode(*XLS);
+
+    my $workbook  = Spreadsheet::WriteExcel->new(\*XLS);
+    my $worksheet = $workbook->add_worksheet();
+
+
+    # Set the column width for column 1
+    $worksheet->set_column(0, 0, 20);
+
+
+    # Create a format
+    my $format = $workbook->add_format();
+    $format->set_bold();
+    $format->set_size(15);
+    $format->set_color('blue');
+
+
+    # Write to the workbook
+    $worksheet->write(0, 0, "Hi Excel!", $format);
+
+    # You must close the workbook for Content-disposition
+    $workbook->close();
+}
+
+1;

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/mod_perl2.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/mod_perl2.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/mod_perl2.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,91 +1,91 @@
-###############################################################################
-#
-# Example of how to use the Spreadsheet::WriteExcel module to send an Excel
-# file to a browser using mod_perl 2 and Apache
-#
-# This module ties *XLS directly to Apache, and with the correct
-# content-disposition/types it will prompt the user to save
-# the file, or open it at this location.
-#
-# This script is a modification of the example cgi.pm script bundled
-# with Spreadsheet::WriteExcel.
-#
-# Jun 2004, Matisse Enzer, matisse at matisse.net  (mod_perl 2 version)
-# Apr 2001, Thomas Sullivan, webmaster at 860.org
-# Feb 2001, John McNamara, jmcnamara at cpan.org
-#
-# Change the name of this file to MP2Test.pm.
-# Change the package location to where-ever you locate this package.
-# Below, I have this located in the WriteExcel directory.
-#
-# Your httpd.conf entry for this module, should you choose to use it
-# as a stand alone app, should look similar to the following:
-#
-# PerlModule Spreadsheet::WriteExcel::MP2Test
-# <Location /spreadsheet-test>
-#    SetHandler perl-script
-#    PerlResponseHandler Spreadsheet::WriteExcel::MP2Test
-# </Location>
-#
-# PerlResponseHandler and the package line below have to match.
-# I promise.
-package Spreadsheet::WriteExcel::MP2Test;
-
-##########################################
-# Pragma Definitions
-##########################################
-use strict;
-
-##########################################
-# Required Modules
-##########################################
-use Apache::Const -compile => qw( :common );
-use Spreadsheet::WriteExcel;
-
-##########################################
-# Main App Body
-##########################################
-sub handler {
-    my($r) = @_;  # Apache request object is passed to handler in mod_perl 2
-
-    # Set the filename and send the content type
-    # This will appear when they save the spreadsheet
-    my $filename ="mod_perl2_test.xls";
-
-    ####################################################
-    ## Send the content type headers the mod_perl 2 way
-    ####################################################
-    $r->headers_out->{'Content-Disposition'} = "attachment;filename=$filename";
-    $r->content_type('application/vnd.ms-excel');
-
-    ####################################################
-    # Tie a filehandle to Apache's STDOUT.
-    # Create a new workbook and add a worksheet.
-    ####################################################
-    tie *XLS => $r;  # The mod_perl 2 way. Tie to the Apache::RequestRec object
-    binmode(*XLS);
-
-    my $workbook  = Spreadsheet::WriteExcel->new(\*XLS);
-    my $worksheet = $workbook->add_worksheet();
-
-
-    # Set the column width for column 1
-    $worksheet->set_column(0, 0, 20);
-
-
-    # Create a format
-    my $format = $workbook->add_format();
-    $format->set_bold();
-    $format->set_size(15);
-    $format->set_color('blue');
-
-
-    # Write to the workbook
-    $worksheet->write(0, 0, 'Hi Excel! from ' . $r->hostname , $format);
-
-    # You must close the workbook for Content-disposition
-    $workbook->close();
-    return Apache::OK;
-}
-
-1;
+###############################################################################
+#
+# Example of how to use the Spreadsheet::WriteExcel module to send an Excel
+# file to a browser using mod_perl 2 and Apache
+#
+# This module ties *XLS directly to Apache, and with the correct
+# content-disposition/types it will prompt the user to save
+# the file, or open it at this location.
+#
+# This script is a modification of the example cgi.pm script bundled
+# with Spreadsheet::WriteExcel.
+#
+# Jun 2004, Matisse Enzer, matisse at matisse.net  (mod_perl 2 version)
+# Apr 2001, Thomas Sullivan, webmaster at 860.org
+# Feb 2001, John McNamara, jmcnamara at cpan.org
+#
+# Change the name of this file to MP2Test.pm.
+# Change the package location to where-ever you locate this package.
+# Below, I have this located in the WriteExcel directory.
+#
+# Your httpd.conf entry for this module, should you choose to use it
+# as a stand alone app, should look similar to the following:
+#
+# PerlModule Spreadsheet::WriteExcel::MP2Test
+# <Location /spreadsheet-test>
+#    SetHandler perl-script
+#    PerlResponseHandler Spreadsheet::WriteExcel::MP2Test
+# </Location>
+#
+# PerlResponseHandler and the package line below have to match.
+# I promise.
+package Spreadsheet::WriteExcel::MP2Test;
+
+##########################################
+# Pragma Definitions
+##########################################
+use strict;
+
+##########################################
+# Required Modules
+##########################################
+use Apache::Const -compile => qw( :common );
+use Spreadsheet::WriteExcel;
+
+##########################################
+# Main App Body
+##########################################
+sub handler {
+    my($r) = @_;  # Apache request object is passed to handler in mod_perl 2
+
+    # Set the filename and send the content type
+    # This will appear when they save the spreadsheet
+    my $filename ="mod_perl2_test.xls";
+
+    ####################################################
+    ## Send the content type headers the mod_perl 2 way
+    ####################################################
+    $r->headers_out->{'Content-Disposition'} = "attachment;filename=$filename";
+    $r->content_type('application/vnd.ms-excel');
+
+    ####################################################
+    # Tie a filehandle to Apache's STDOUT.
+    # Create a new workbook and add a worksheet.
+    ####################################################
+    tie *XLS => $r;  # The mod_perl 2 way. Tie to the Apache::RequestRec object
+    binmode(*XLS);
+
+    my $workbook  = Spreadsheet::WriteExcel->new(\*XLS);
+    my $worksheet = $workbook->add_worksheet();
+
+
+    # Set the column width for column 1
+    $worksheet->set_column(0, 0, 20);
+
+
+    # Create a format
+    my $format = $workbook->add_format();
+    $format->set_bold();
+    $format->set_size(15);
+    $format->set_color('blue');
+
+
+    # Write to the workbook
+    $worksheet->write(0, 0, 'Hi Excel! from ' . $r->hostname , $format);
+
+    # You must close the workbook for Content-disposition
+    $workbook->close();
+    return Apache::OK;
+}
+
+1;

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/outline.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/outline.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/outline.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,201 +1,201 @@
-#!/usr/bin/perl -w
-
-###############################################################################
-#
-# Example of how use Spreadsheet::WriteExcel to generate Excel outlines and
-# grouping.
-#
-#
-# reverse('©'), April 2003, John McNamara, jmcnamara at cpan.org
-#
-
-
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-# Create a new workbook and add some worksheets
-my $workbook   = Spreadsheet::WriteExcel->new('outline.xls');
-my $worksheet1 = $workbook->add_worksheet('Outlined Rows');
-my $worksheet2 = $workbook->add_worksheet('Collapsed Rows');
-my $worksheet3 = $workbook->add_worksheet('Outline Columns');
-my $worksheet4 = $workbook->add_worksheet('Outline levels');
-
-# Add a general format
-my $bold = $workbook->add_format(bold => 1);
-
-
-
-###############################################################################
-#
-# Example 1: Create a worksheet with outlined rows. It also includes SUBTOTAL()
-# functions so that it looks like the type of automatic outlines that are
-# generated when you use the Excel Data->SubTotals menu item.
-#
-
-
-# For outlines the important parameters are $hidden and $level. Rows with the
-# same $level are grouped together. The group will be collapsed if $hidden is
-# non-zero. $height and $XF are assigned default values if they are undef.
-#
-# The syntax is: set_row($row, $height, $XF, $hidden, $level)
-#
-$worksheet1->set_row(1,  undef, undef, 0, 2);
-$worksheet1->set_row(2,  undef, undef, 0, 2);
-$worksheet1->set_row(3,  undef, undef, 0, 2);
-$worksheet1->set_row(4,  undef, undef, 0, 2);
-$worksheet1->set_row(5,  undef, undef, 0, 1);
-
-$worksheet1->set_row(6,  undef, undef, 0, 2);
-$worksheet1->set_row(7,  undef, undef, 0, 2);
-$worksheet1->set_row(8,  undef, undef, 0, 2);
-$worksheet1->set_row(9,  undef, undef, 0, 2);
-$worksheet1->set_row(10, undef, undef, 0, 1);
-
-
-# Add a column format for clarity
-$worksheet1->set_column('A:A', 20);
-
-# Add the data, labels and formulas
-$worksheet1->write('A1',  'Region', $bold);
-$worksheet1->write('A2',  'North');
-$worksheet1->write('A3',  'North');
-$worksheet1->write('A4',  'North');
-$worksheet1->write('A5',  'North');
-$worksheet1->write('A6',  'North Total', $bold);
-
-$worksheet1->write('B1',  'Sales',  $bold);
-$worksheet1->write('B2',  1000);
-$worksheet1->write('B3',  1200);
-$worksheet1->write('B4',  900);
-$worksheet1->write('B5',  1200);
-$worksheet1->write('B6',  '=SUBTOTAL(9,B2:B5)', $bold);
-
-$worksheet1->write('A7',  'South');
-$worksheet1->write('A8',  'South');
-$worksheet1->write('A9',  'South');
-$worksheet1->write('A10', 'South');
-$worksheet1->write('A11', 'South Total', $bold);
-
-$worksheet1->write('B7',  400);
-$worksheet1->write('B8',  600);
-$worksheet1->write('B9',  500);
-$worksheet1->write('B10', 600);
-$worksheet1->write('B11', '=SUBTOTAL(9,B7:B10)', $bold);
-
-$worksheet1->write('A12', 'Grand Total', $bold);
-$worksheet1->write('B12', '=SUBTOTAL(9,B2:B10)', $bold);
-
-
-###############################################################################
-#
-# Example 2: Create a worksheet with outlined rows. This is the same as the
-# previous example except that the rows are collapsed.
-#
-
-
-# The group will be collapsed if $hidden is non-zero.
-# The syntax is: set_row($row, $height, $XF, $hidden, $level)
-#
-$worksheet2->set_row(1,  undef, undef, 1, 2);
-$worksheet2->set_row(2,  undef, undef, 1, 2);
-$worksheet2->set_row(3,  undef, undef, 1, 2);
-$worksheet2->set_row(4,  undef, undef, 1, 2);
-$worksheet2->set_row(5,  undef, undef, 1, 1);
-
-$worksheet2->set_row(6,  undef, undef, 1, 2);
-$worksheet2->set_row(7,  undef, undef, 1, 2);
-$worksheet2->set_row(8,  undef, undef, 1, 2);
-$worksheet2->set_row(9,  undef, undef, 1, 2);
-$worksheet2->set_row(10, undef, undef, 1, 1);
-
-
-# Add a column format for clarity
-$worksheet2->set_column('A:A', 20);
-
-# Add the data, labels and formulas
-$worksheet2->write('A1',  'Region', $bold);
-$worksheet2->write('A2',  'North');
-$worksheet2->write('A3',  'North');
-$worksheet2->write('A4',  'North');
-$worksheet2->write('A5',  'North');
-$worksheet2->write('A6',  'North Total', $bold);
-
-$worksheet2->write('B1',  'Sales',  $bold);
-$worksheet2->write('B2',  1000);
-$worksheet2->write('B3',  1200);
-$worksheet2->write('B4',  900);
-$worksheet2->write('B5',  1200);
-$worksheet2->write('B6',  '=SUBTOTAL(9,B2:B5)', $bold);
-
-$worksheet2->write('A7',  'South');
-$worksheet2->write('A8',  'South');
-$worksheet2->write('A9',  'South');
-$worksheet2->write('A10', 'South');
-$worksheet2->write('A11', 'South Total', $bold);
-
-$worksheet2->write('B7',  400);
-$worksheet2->write('B8',  600);
-$worksheet2->write('B9',  500);
-$worksheet2->write('B10', 600);
-$worksheet2->write('B11', '=SUBTOTAL(9,B7:B10)', $bold);
-
-$worksheet2->write('A12', 'Grand Total', $bold);
-$worksheet2->write('B12', '=SUBTOTAL(9,B2:B10)', $bold);
-
-
-
-###############################################################################
-#
-# Example 3: Create a worksheet with outlined columns.
-#
-my $data = [
-            ['Month', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',' Total'],
-            ['North', 50,    20,    15,    25,    65,    80,    ,'=SUM(B2:G2)'],
-            ['South', 10,    20,    30,    50,    50,    50,    ,'=SUM(B3:G3)'],
-            ['East',  45,    75,    50,    15,    75,    100,   ,'=SUM(B4:G4)'],
-            ['West',  15,    15,    55,    35,    20,    50,    ,'=SUM(B5:G6)'],
-           ];
-
-# Add bold format to the first row
-$worksheet3->set_row(0, undef, $bold);
-
-# The syntax is: set_column($first, $last, $height, $XF, $hidden, $level)
-$worksheet3->set_column('A:A', 10, $bold      );
-$worksheet3->set_column('B:G', 5,  undef, 0, 1);
-$worksheet3->set_column('H:H', 10);
-
-# Write the data and a formula
-$worksheet3->write_col('A1', $data);
-$worksheet3->write('H6', '=SUM(H2:H5)', $bold);
-
-
-
-###############################################################################
-#
-# Example 4: Show all possible outline levels.
-#
-my $levels = ["Level 1", "Level 2", "Level 3", "Level 4",
-              "Level 5", "Level 6", "Level 7", "Level 6",
-              "Level 5", "Level 4", "Level 3", "Level 2", "Level 1"];
-
-
-$worksheet4->write_col('A1', $levels);
-
-$worksheet4->set_row(0,  undef, undef, undef, 1);
-$worksheet4->set_row(1,  undef, undef, undef, 2);
-$worksheet4->set_row(2,  undef, undef, undef, 3);
-$worksheet4->set_row(3,  undef, undef, undef, 4);
-$worksheet4->set_row(4,  undef, undef, undef, 5);
-$worksheet4->set_row(5,  undef, undef, undef, 6);
-$worksheet4->set_row(6,  undef, undef, undef, 7);
-$worksheet4->set_row(7,  undef, undef, undef, 6);
-$worksheet4->set_row(8,  undef, undef, undef, 5);
-$worksheet4->set_row(9,  undef, undef, undef, 4);
-$worksheet4->set_row(10, undef, undef, undef, 3);
-$worksheet4->set_row(11, undef, undef, undef, 2);
-$worksheet4->set_row(12, undef, undef, undef, 1);
-
-
-
-__END__
+#!/usr/bin/perl -w
+
+###############################################################################
+#
+# Example of how use Spreadsheet::WriteExcel to generate Excel outlines and
+# grouping.
+#
+#
+# reverse('©'), April 2003, John McNamara, jmcnamara at cpan.org
+#
+
+
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+# Create a new workbook and add some worksheets
+my $workbook   = Spreadsheet::WriteExcel->new('outline.xls');
+my $worksheet1 = $workbook->add_worksheet('Outlined Rows');
+my $worksheet2 = $workbook->add_worksheet('Collapsed Rows');
+my $worksheet3 = $workbook->add_worksheet('Outline Columns');
+my $worksheet4 = $workbook->add_worksheet('Outline levels');
+
+# Add a general format
+my $bold = $workbook->add_format(bold => 1);
+
+
+
+###############################################################################
+#
+# Example 1: Create a worksheet with outlined rows. It also includes SUBTOTAL()
+# functions so that it looks like the type of automatic outlines that are
+# generated when you use the Excel Data->SubTotals menu item.
+#
+
+
+# For outlines the important parameters are $hidden and $level. Rows with the
+# same $level are grouped together. The group will be collapsed if $hidden is
+# non-zero. $height and $XF are assigned default values if they are undef.
+#
+# The syntax is: set_row($row, $height, $XF, $hidden, $level)
+#
+$worksheet1->set_row(1,  undef, undef, 0, 2);
+$worksheet1->set_row(2,  undef, undef, 0, 2);
+$worksheet1->set_row(3,  undef, undef, 0, 2);
+$worksheet1->set_row(4,  undef, undef, 0, 2);
+$worksheet1->set_row(5,  undef, undef, 0, 1);
+
+$worksheet1->set_row(6,  undef, undef, 0, 2);
+$worksheet1->set_row(7,  undef, undef, 0, 2);
+$worksheet1->set_row(8,  undef, undef, 0, 2);
+$worksheet1->set_row(9,  undef, undef, 0, 2);
+$worksheet1->set_row(10, undef, undef, 0, 1);
+
+
+# Add a column format for clarity
+$worksheet1->set_column('A:A', 20);
+
+# Add the data, labels and formulas
+$worksheet1->write('A1',  'Region', $bold);
+$worksheet1->write('A2',  'North');
+$worksheet1->write('A3',  'North');
+$worksheet1->write('A4',  'North');
+$worksheet1->write('A5',  'North');
+$worksheet1->write('A6',  'North Total', $bold);
+
+$worksheet1->write('B1',  'Sales',  $bold);
+$worksheet1->write('B2',  1000);
+$worksheet1->write('B3',  1200);
+$worksheet1->write('B4',  900);
+$worksheet1->write('B5',  1200);
+$worksheet1->write('B6',  '=SUBTOTAL(9,B2:B5)', $bold);
+
+$worksheet1->write('A7',  'South');
+$worksheet1->write('A8',  'South');
+$worksheet1->write('A9',  'South');
+$worksheet1->write('A10', 'South');
+$worksheet1->write('A11', 'South Total', $bold);
+
+$worksheet1->write('B7',  400);
+$worksheet1->write('B8',  600);
+$worksheet1->write('B9',  500);
+$worksheet1->write('B10', 600);
+$worksheet1->write('B11', '=SUBTOTAL(9,B7:B10)', $bold);
+
+$worksheet1->write('A12', 'Grand Total', $bold);
+$worksheet1->write('B12', '=SUBTOTAL(9,B2:B10)', $bold);
+
+
+###############################################################################
+#
+# Example 2: Create a worksheet with outlined rows. This is the same as the
+# previous example except that the rows are collapsed.
+#
+
+
+# The group will be collapsed if $hidden is non-zero.
+# The syntax is: set_row($row, $height, $XF, $hidden, $level)
+#
+$worksheet2->set_row(1,  undef, undef, 1, 2);
+$worksheet2->set_row(2,  undef, undef, 1, 2);
+$worksheet2->set_row(3,  undef, undef, 1, 2);
+$worksheet2->set_row(4,  undef, undef, 1, 2);
+$worksheet2->set_row(5,  undef, undef, 1, 1);
+
+$worksheet2->set_row(6,  undef, undef, 1, 2);
+$worksheet2->set_row(7,  undef, undef, 1, 2);
+$worksheet2->set_row(8,  undef, undef, 1, 2);
+$worksheet2->set_row(9,  undef, undef, 1, 2);
+$worksheet2->set_row(10, undef, undef, 1, 1);
+
+
+# Add a column format for clarity
+$worksheet2->set_column('A:A', 20);
+
+# Add the data, labels and formulas
+$worksheet2->write('A1',  'Region', $bold);
+$worksheet2->write('A2',  'North');
+$worksheet2->write('A3',  'North');
+$worksheet2->write('A4',  'North');
+$worksheet2->write('A5',  'North');
+$worksheet2->write('A6',  'North Total', $bold);
+
+$worksheet2->write('B1',  'Sales',  $bold);
+$worksheet2->write('B2',  1000);
+$worksheet2->write('B3',  1200);
+$worksheet2->write('B4',  900);
+$worksheet2->write('B5',  1200);
+$worksheet2->write('B6',  '=SUBTOTAL(9,B2:B5)', $bold);
+
+$worksheet2->write('A7',  'South');
+$worksheet2->write('A8',  'South');
+$worksheet2->write('A9',  'South');
+$worksheet2->write('A10', 'South');
+$worksheet2->write('A11', 'South Total', $bold);
+
+$worksheet2->write('B7',  400);
+$worksheet2->write('B8',  600);
+$worksheet2->write('B9',  500);
+$worksheet2->write('B10', 600);
+$worksheet2->write('B11', '=SUBTOTAL(9,B7:B10)', $bold);
+
+$worksheet2->write('A12', 'Grand Total', $bold);
+$worksheet2->write('B12', '=SUBTOTAL(9,B2:B10)', $bold);
+
+
+
+###############################################################################
+#
+# Example 3: Create a worksheet with outlined columns.
+#
+my $data = [
+            ['Month', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',' Total'],
+            ['North', 50,    20,    15,    25,    65,    80,    ,'=SUM(B2:G2)'],
+            ['South', 10,    20,    30,    50,    50,    50,    ,'=SUM(B3:G3)'],
+            ['East',  45,    75,    50,    15,    75,    100,   ,'=SUM(B4:G4)'],
+            ['West',  15,    15,    55,    35,    20,    50,    ,'=SUM(B5:G6)'],
+           ];
+
+# Add bold format to the first row
+$worksheet3->set_row(0, undef, $bold);
+
+# The syntax is: set_column($first, $last, $height, $XF, $hidden, $level)
+$worksheet3->set_column('A:A', 10, $bold      );
+$worksheet3->set_column('B:G', 5,  undef, 0, 1);
+$worksheet3->set_column('H:H', 10);
+
+# Write the data and a formula
+$worksheet3->write_col('A1', $data);
+$worksheet3->write('H6', '=SUM(H2:H5)', $bold);
+
+
+
+###############################################################################
+#
+# Example 4: Show all possible outline levels.
+#
+my $levels = ["Level 1", "Level 2", "Level 3", "Level 4",
+              "Level 5", "Level 6", "Level 7", "Level 6",
+              "Level 5", "Level 4", "Level 3", "Level 2", "Level 1"];
+
+
+$worksheet4->write_col('A1', $levels);
+
+$worksheet4->set_row(0,  undef, undef, undef, 1);
+$worksheet4->set_row(1,  undef, undef, undef, 2);
+$worksheet4->set_row(2,  undef, undef, undef, 3);
+$worksheet4->set_row(3,  undef, undef, undef, 4);
+$worksheet4->set_row(4,  undef, undef, undef, 5);
+$worksheet4->set_row(5,  undef, undef, undef, 6);
+$worksheet4->set_row(6,  undef, undef, undef, 7);
+$worksheet4->set_row(7,  undef, undef, undef, 6);
+$worksheet4->set_row(8,  undef, undef, undef, 5);
+$worksheet4->set_row(9,  undef, undef, undef, 4);
+$worksheet4->set_row(10, undef, undef, undef, 3);
+$worksheet4->set_row(11, undef, undef, undef, 2);
+$worksheet4->set_row(12, undef, undef, undef, 1);
+
+
+
+__END__

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/panes.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/panes.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/panes.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,133 +1,133 @@
-#!/usr/bin/perl -w
-
-#######################################################################
-#
-# Example of using the WriteExcel module to create worksheet panes.
-#
-# reverse('©'), May 2001, John McNamara, jmcnamara at cpan.org
-#
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-my $workbook  = Spreadsheet::WriteExcel->new("panes.xls");
-
-my $worksheet1 = $workbook->add_worksheet('Panes 1');
-my $worksheet2 = $workbook->add_worksheet('Panes 2');
-my $worksheet3 = $workbook->add_worksheet('Panes 3');
-my $worksheet4 = $workbook->add_worksheet('Panes 4');
-
-# Frozen panes
-$worksheet1->freeze_panes(1, 0); # 1 row
-$worksheet2->freeze_panes(0, 1); # 1 column
-$worksheet3->freeze_panes(1, 1); # 1 row and column
-
-# Un-frozen panes. The divisions must be specified in terms of row and column
-# dimensions. The default row height is 12.75 and the default column width
-# is 8.43
-#
-$worksheet4->thaw_panes(12.75, 8.43, 1, 1); # 1 row and column
-
-
-
-
-#######################################################################
-#
-# Set up some formatting and text to highlight the panes
-#
-
-my $header = $workbook->add_format();
-$header->set_color('white');
-$header->set_align('center');
-$header->set_align('vcenter');
-$header->set_pattern();
-$header->set_fg_color('green');
-
-my $center = $workbook->add_format();
-$center->set_align('center');
-
-
-#######################################################################
-#
-# Sheet 1
-#
-
-$worksheet1->set_column('A:I', 16);
-$worksheet1->set_row(0, 20);
-$worksheet1->set_selection('C3');
-
-for my $i (0..8){
-    $worksheet1->write(0, $i, 'Scroll down', $header);
-}
-
-for my $i (1..100){
-    for my $j (0..8){
-        $worksheet1->write($i, $j, $i+1, $center);
-    }
-}
-
-
-#######################################################################
-#
-# Sheet 2
-#
-
-$worksheet2->set_column('A:A', 16);
-$worksheet2->set_selection('C3');
-
-for my $i (0..49){
-    $worksheet2->set_row($i, 15);
-    $worksheet2->write($i, 0, 'Scroll right', $header);
-}
-
-for my $i (0..49){
-    for my $j (1..25){
-        $worksheet2->write($i, $j, $j, $center);
-    }
-}
-
-
-#######################################################################
-#
-# Sheet 3
-#
-
-$worksheet3->set_column('A:Z', 16);
-$worksheet3->set_selection('C3');
-
-for my $i (1..25){
-    $worksheet3->write(0, $i, 'Scroll down',  $header);
-}
-
-for my $i (1..49){
-    $worksheet3->write($i, 0, 'Scroll right', $header);
-}
-
-for my $i (1..49){
-    for my $j (1..25){
-        $worksheet3->write($i, $j, $j, $center);
-    }
-}
-
-
-#######################################################################
-#
-# Sheet 4
-#
-
-$worksheet4->set_selection('C3');
-
-for my $i (1..25){
-    $worksheet4->write(0, $i, 'Scroll', $center);
-}
-
-for my $i (1..49){
-    $worksheet4->write($i, 0, 'Scroll', $center);
-}
-
-for my $i (1..49){
-    for my $j (1..25){
-        $worksheet4->write($i, $j, $j, $center);
-    }
-}
-
+#!/usr/bin/perl -w
+
+#######################################################################
+#
+# Example of using the WriteExcel module to create worksheet panes.
+#
+# reverse('©'), May 2001, John McNamara, jmcnamara at cpan.org
+#
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+my $workbook  = Spreadsheet::WriteExcel->new("panes.xls");
+
+my $worksheet1 = $workbook->add_worksheet('Panes 1');
+my $worksheet2 = $workbook->add_worksheet('Panes 2');
+my $worksheet3 = $workbook->add_worksheet('Panes 3');
+my $worksheet4 = $workbook->add_worksheet('Panes 4');
+
+# Frozen panes
+$worksheet1->freeze_panes(1, 0); # 1 row
+$worksheet2->freeze_panes(0, 1); # 1 column
+$worksheet3->freeze_panes(1, 1); # 1 row and column
+
+# Un-frozen panes. The divisions must be specified in terms of row and column
+# dimensions. The default row height is 12.75 and the default column width
+# is 8.43
+#
+$worksheet4->thaw_panes(12.75, 8.43, 1, 1); # 1 row and column
+
+
+
+
+#######################################################################
+#
+# Set up some formatting and text to highlight the panes
+#
+
+my $header = $workbook->add_format();
+$header->set_color('white');
+$header->set_align('center');
+$header->set_align('vcenter');
+$header->set_pattern();
+$header->set_fg_color('green');
+
+my $center = $workbook->add_format();
+$center->set_align('center');
+
+
+#######################################################################
+#
+# Sheet 1
+#
+
+$worksheet1->set_column('A:I', 16);
+$worksheet1->set_row(0, 20);
+$worksheet1->set_selection('C3');
+
+for my $i (0..8){
+    $worksheet1->write(0, $i, 'Scroll down', $header);
+}
+
+for my $i (1..100){
+    for my $j (0..8){
+        $worksheet1->write($i, $j, $i+1, $center);
+    }
+}
+
+
+#######################################################################
+#
+# Sheet 2
+#
+
+$worksheet2->set_column('A:A', 16);
+$worksheet2->set_selection('C3');
+
+for my $i (0..49){
+    $worksheet2->set_row($i, 15);
+    $worksheet2->write($i, 0, 'Scroll right', $header);
+}
+
+for my $i (0..49){
+    for my $j (1..25){
+        $worksheet2->write($i, $j, $j, $center);
+    }
+}
+
+
+#######################################################################
+#
+# Sheet 3
+#
+
+$worksheet3->set_column('A:Z', 16);
+$worksheet3->set_selection('C3');
+
+for my $i (1..25){
+    $worksheet3->write(0, $i, 'Scroll down',  $header);
+}
+
+for my $i (1..49){
+    $worksheet3->write($i, 0, 'Scroll right', $header);
+}
+
+for my $i (1..49){
+    for my $j (1..25){
+        $worksheet3->write($i, $j, $j, $center);
+    }
+}
+
+
+#######################################################################
+#
+# Sheet 4
+#
+
+$worksheet4->set_selection('C3');
+
+for my $i (1..25){
+    $worksheet4->write(0, $i, 'Scroll', $center);
+}
+
+for my $i (1..49){
+    $worksheet4->write($i, 0, 'Scroll', $center);
+}
+
+for my $i (1..49){
+    for my $j (1..25){
+        $worksheet4->write($i, $j, $j, $center);
+    }
+}
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/protection.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/protection.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/protection.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,42 +1,42 @@
-#!/usr/bin/perl -w
-
-########################################################################
-#
-# Example of cell locking and formula hiding in an Excel  worksheet via
-# the Spreadsheet::WriteExcel module.
-#
-# reverse('©'), August 2001, John McNamara, jmcnamara at cpan.org
-#
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-my $workbook  = Spreadsheet::WriteExcel->new("protection.xls");
-my $worksheet = $workbook->add_worksheet();
-
-# Create some format objects
-my $locked    = $workbook->add_format(locked => 1);
-my $unlocked  = $workbook->add_format(locked => 0);
-my $hidden    = $workbook->add_format(hidden => 1);
-
-# Format the columns
-$worksheet->set_column('A:A', 42);
-$worksheet->set_selection('B3:B3');
-
-# Protect the worksheet
-$worksheet->protect();
-
-# Examples of cell locking and hiding
-$worksheet->write('A1', 'Cell B1 is locked. It cannot be edited.');
-$worksheet->write('B1', '=1+2', $locked);
-
-$worksheet->write('A2', 'Cell B2 is unlocked. It can be edited.');
-$worksheet->write('B2', '=1+2', $unlocked);
-
-$worksheet->write('A3', "Cell B3 is hidden. The formula isn't visible.");
-$worksheet->write('B3', '=1+2', $hidden);
-
-$worksheet->write('A5', 'Use Menu->Tools->Protection->Unprotect Sheet');
-$worksheet->write('A6', 'to remove the worksheet protection.   ');
-
-
+#!/usr/bin/perl -w
+
+########################################################################
+#
+# Example of cell locking and formula hiding in an Excel  worksheet via
+# the Spreadsheet::WriteExcel module.
+#
+# reverse('©'), August 2001, John McNamara, jmcnamara at cpan.org
+#
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+my $workbook  = Spreadsheet::WriteExcel->new("protection.xls");
+my $worksheet = $workbook->add_worksheet();
+
+# Create some format objects
+my $locked    = $workbook->add_format(locked => 1);
+my $unlocked  = $workbook->add_format(locked => 0);
+my $hidden    = $workbook->add_format(hidden => 1);
+
+# Format the columns
+$worksheet->set_column('A:A', 42);
+$worksheet->set_selection('B3:B3');
+
+# Protect the worksheet
+$worksheet->protect();
+
+# Examples of cell locking and hiding
+$worksheet->write('A1', 'Cell B1 is locked. It cannot be edited.');
+$worksheet->write('B1', '=1+2', $locked);
+
+$worksheet->write('A2', 'Cell B2 is unlocked. It can be edited.');
+$worksheet->write('B2', '=1+2', $unlocked);
+
+$worksheet->write('A3', "Cell B3 is hidden. The formula isn't visible.");
+$worksheet->write('B3', '=1+2', $hidden);
+
+$worksheet->write('A5', 'Use Menu->Tools->Protection->Unprotect Sheet');
+$worksheet->write('A6', 'to remove the worksheet protection.   ');
+
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/regions.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/regions.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/regions.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,46 +1,46 @@
-#!/usr/bin/perl -w
-
-###############################################################################
-#
-# Example of how to use the WriteExcel module to write a basic multiple
-# worksheet Excel file.
-#
-# reverse('©'), March 2001, John McNamara, jmcnamara at cpan.org
-#
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-# Create a new Excel workbook
-my $workbook = Spreadsheet::WriteExcel->new("regions.xls");
-
-# Add some worksheets
-my $north = $workbook->add_worksheet("North");
-my $south = $workbook->add_worksheet("South");
-my $east  = $workbook->add_worksheet("East");
-my $west  = $workbook->add_worksheet("West");
-
-# Add a Format
-my $format = $workbook->add_format();
-$format->set_bold();
-$format->set_color('blue');
-
-# Add a caption to each worksheet
-foreach my $worksheet ($workbook->sheets()) {
-    $worksheet->write(0, 0, "Sales", $format);
-}
-
-# Write some data
-$north->write(0, 1, 200000);
-$south->write(0, 1, 100000);
-$east->write (0, 1, 150000);
-$west->write (0, 1, 100000);
-
-# Set the active worksheet
-$south->activate();
-
-# Set the width of the first column
-$south->set_column(0, 0, 20);
-
-# Set the active cell
-$south->set_selection(0, 1);
+#!/usr/bin/perl -w
+
+###############################################################################
+#
+# Example of how to use the WriteExcel module to write a basic multiple
+# worksheet Excel file.
+#
+# reverse('©'), March 2001, John McNamara, jmcnamara at cpan.org
+#
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+# Create a new Excel workbook
+my $workbook = Spreadsheet::WriteExcel->new("regions.xls");
+
+# Add some worksheets
+my $north = $workbook->add_worksheet("North");
+my $south = $workbook->add_worksheet("South");
+my $east  = $workbook->add_worksheet("East");
+my $west  = $workbook->add_worksheet("West");
+
+# Add a Format
+my $format = $workbook->add_format();
+$format->set_bold();
+$format->set_color('blue');
+
+# Add a caption to each worksheet
+foreach my $worksheet ($workbook->sheets()) {
+    $worksheet->write(0, 0, "Sales", $format);
+}
+
+# Write some data
+$north->write(0, 1, 200000);
+$south->write(0, 1, 100000);
+$east->write (0, 1, 150000);
+$west->write (0, 1, 100000);
+
+# Set the active worksheet
+$south->activate();
+
+# Set the width of the first column
+$south->set_column(0, 0, 20);
+
+# Set the active cell
+$south->set_selection(0, 1);

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/repeat.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/repeat.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/repeat.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,45 +1,46 @@
-#!/usr/bin/perl -w
-
-######################################################################
-#
-# Example of writing repeated formulas.
-#
-# reverse('©'), August 2002, John McNamara, jmcnamara at cpan.org
-#
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-my $workbook  = Spreadsheet::WriteExcel->new("repeat.xls");
-my $worksheet = $workbook->add_worksheet();
-
-
-my $limit = 1000;
-
-# Write a column of numbers
-for my $row (0..$limit) {
-    $worksheet->write($row, 0,  $row);
-}
-
-
-# Store a formula
-my $formula = $worksheet->store_formula('=A1*5+4');
-
-
-# Write a column of formulas based on the stored formula
-for my $row (0..$limit) {
-    $worksheet->repeat_formula($row, 1, $formula, undef, 'A1', 'A'.($row+1));
-}
-
-
-# Direct formula writing. As a speed comparison uncomment the
-# following and run the program again
-
-#for my $row (0..$limit) {
-#    $worksheet->write_formula($row, 2, '=A'.($row+1).'*5+4');
-#}
-
-
-
-__END__
-
+#!/usr/bin/perl -w
+
+######################################################################
+#
+# Example of writing repeated formulas.
+#
+# reverse('©'), August 2002, John McNamara, jmcnamara at cpan.org
+#
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+my $workbook  = Spreadsheet::WriteExcel->new("repeat.xls");
+my $worksheet = $workbook->add_worksheet();
+
+
+my $limit = 1000;
+
+# Write a column of numbers
+for my $row (0..$limit) {
+    $worksheet->write($row, 0,  $row);
+}
+
+
+# Store a formula
+my $formula = $worksheet->store_formula('=A1*5+4');
+
+
+# Write a column of formulas based on the stored formula
+for my $row (0..$limit) {
+    $worksheet->repeat_formula($row, 1, $formula, undef,
+                                        qr/^A1$/, 'A'.($row+1));
+}
+
+
+# Direct formula writing. As a speed comparison uncomment the
+# following and run the program again
+
+#for my $row (0..$limit) {
+#    $worksheet->write_formula($row, 2, '=A'.($row+1).'*5+4');
+#}
+
+
+
+__END__
+

Copied: packages/libspreadsheet-writeexcel-perl/trunk/examples/right_to_left.pl (from rev 1957, packages/libspreadsheet-writeexcel-perl/branches/upstream/current/examples/right_to_left.pl)

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/sales.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/sales.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/sales.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,106 +1,106 @@
-#!/usr/bin/perl -w
-
-###############################################################################
-#
-# Example of fictional sales sheet to demonstrate several different features.
-# Also uses functions from the Spreadsheet::WriteExcel::Utility module.
-#
-# reverse('©'), October 2001, John McNamara, jmcnamara at cpan.org
-#
-
-use strict;
-use Spreadsheet::WriteExcel;
-use Spreadsheet::WriteExcel::Utility;
-
-# Create a new workbook and add a worksheet
-my $workbook        = Spreadsheet::WriteExcel->new("sales.xls");
-my $worksheet       = $workbook->add_worksheet('May Sales');
-
-
-# Set up some formats
-my %heading         =   (
-                            bold        => 1,
-                            pattern     => 1,
-                            fg_color    => 19,
-                            border      => 1,
-                            align       => 'center',
-                        );
-
-my %total           =   (
-                        bold        => 1,
-                        top         => 1,
-                        num_format  => '$#,##0.00'
-                        );
-
-my $heading         = $workbook->add_format(%heading);
-my $total_format    = $workbook->add_format(%total);
-my $price_format    = $workbook->add_format(num_format => '$#,##0.00');
-my $date_format     = $workbook->add_format(num_format => 'mmm d yyy');
-
-
-# Write the main headings
-$worksheet->freeze_panes(1); # Freeze the first row
-$worksheet->write('A1', 'Item',     $heading);
-$worksheet->write('B1', 'Quantity', $heading);
-$worksheet->write('C1', 'Price',    $heading);
-$worksheet->write('D1', 'Total',    $heading);
-$worksheet->write('E1', 'Date',     $heading);
-
-# Set the column widths
-$worksheet->set_column('A:A', 25);
-$worksheet->set_column('B:B', 10);
-$worksheet->set_column('C:E', 16);
-
-
-# Extract the sales data from the __DATA__ section at the end of the file.
-# In reality this information would probably come from a database
-my @sales;
-
-foreach my $line (<DATA>) {
-    chomp $line;
-    next if $line eq '';
-    # Simple-minded processing of CSV data. Refer to the Text::CSV_XS
-    # and Text::xSV modules for a more complete CVS handling.
-    my @items = split /,/, $line;
-    push @sales, \@items;
-}
-
-
-# Write out the items from each row
-my $row = 1;
-foreach my $sale (@sales) {
-
-    $worksheet->write($row, 0, @$sale[0]);
-    $worksheet->write($row, 1, @$sale[1]);
-    $worksheet->write($row, 2, @$sale[2], $price_format);
-
-    # Create a formula like '=B2*C2'
-    my $formula =   '='
-                    . xl_rowcol_to_cell($row, 1)
-                    . "*"
-                    . xl_rowcol_to_cell($row, 2);
-
-    $worksheet->write($row, 3, $formula, $price_format);
-
-    # Parse the date
-    my $date = xl_decode_date_US(@$sale[3]);
-    $worksheet->write($row, 4, $date, $date_format);
-    $row++;
-}
-
-# Create a formula to sum the totals, like '=SUM(D2:D6)'
-my $total = '=SUM(D2:'
-            . xl_rowcol_to_cell($row-1, 3)
-            . ")";
-
-$worksheet->write($row, 3, $total, $total_format);
-
-
-
-__DATA__
-586 card,20,125.50,5/12/01
-Flat Screen Monitor,1,1300.00,5/12/01
-64 MB dimms,45,49.99,5/13/01
-15 GB HD,12,300.00,5/13/01
-Speakers (pair),5,15.50,5/14/01
-
+#!/usr/bin/perl -w
+
+###############################################################################
+#
+# Example of fictional sales sheet to demonstrate several different features.
+# Also uses functions from the Spreadsheet::WriteExcel::Utility module.
+#
+# reverse('©'), October 2001, John McNamara, jmcnamara at cpan.org
+#
+
+use strict;
+use Spreadsheet::WriteExcel;
+use Spreadsheet::WriteExcel::Utility;
+
+# Create a new workbook and add a worksheet
+my $workbook        = Spreadsheet::WriteExcel->new("sales.xls");
+my $worksheet       = $workbook->add_worksheet('May Sales');
+
+
+# Set up some formats
+my %heading         =   (
+                            bold        => 1,
+                            pattern     => 1,
+                            fg_color    => 19,
+                            border      => 1,
+                            align       => 'center',
+                        );
+
+my %total           =   (
+                        bold        => 1,
+                        top         => 1,
+                        num_format  => '$#,##0.00'
+                        );
+
+my $heading         = $workbook->add_format(%heading);
+my $total_format    = $workbook->add_format(%total);
+my $price_format    = $workbook->add_format(num_format => '$#,##0.00');
+my $date_format     = $workbook->add_format(num_format => 'mmm d yyy');
+
+
+# Write the main headings
+$worksheet->freeze_panes(1); # Freeze the first row
+$worksheet->write('A1', 'Item',     $heading);
+$worksheet->write('B1', 'Quantity', $heading);
+$worksheet->write('C1', 'Price',    $heading);
+$worksheet->write('D1', 'Total',    $heading);
+$worksheet->write('E1', 'Date',     $heading);
+
+# Set the column widths
+$worksheet->set_column('A:A', 25);
+$worksheet->set_column('B:B', 10);
+$worksheet->set_column('C:E', 16);
+
+
+# Extract the sales data from the __DATA__ section at the end of the file.
+# In reality this information would probably come from a database
+my @sales;
+
+foreach my $line (<DATA>) {
+    chomp $line;
+    next if $line eq '';
+    # Simple-minded processing of CSV data. Refer to the Text::CSV_XS
+    # and Text::xSV modules for a more complete CVS handling.
+    my @items = split /,/, $line;
+    push @sales, \@items;
+}
+
+
+# Write out the items from each row
+my $row = 1;
+foreach my $sale (@sales) {
+
+    $worksheet->write($row, 0, @$sale[0]);
+    $worksheet->write($row, 1, @$sale[1]);
+    $worksheet->write($row, 2, @$sale[2], $price_format);
+
+    # Create a formula like '=B2*C2'
+    my $formula =   '='
+                    . xl_rowcol_to_cell($row, 1)
+                    . "*"
+                    . xl_rowcol_to_cell($row, 2);
+
+    $worksheet->write($row, 3, $formula, $price_format);
+
+    # Parse the date
+    my $date = xl_decode_date_US(@$sale[3]);
+    $worksheet->write($row, 4, $date, $date_format);
+    $row++;
+}
+
+# Create a formula to sum the totals, like '=SUM(D2:D6)'
+my $total = '=SUM(D2:'
+            . xl_rowcol_to_cell($row-1, 3)
+            . ")";
+
+$worksheet->write($row, 3, $total, $total_format);
+
+
+
+__DATA__
+586 card,20,125.50,5/12/01
+Flat Screen Monitor,1,1300.00,5/12/01
+64 MB dimms,45,49.99,5/13/01
+15 GB HD,12,300.00,5/13/01
+Speakers (pair),5,15.50,5/14/01
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/sendmail.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/sendmail.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/sendmail.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,43 +1,43 @@
-#!/usr/bin/perl -w
-
-###############################################################################
-#
-# Example of how to use Mail::Sender to send a Spreadsheet::WriteExcel Excel
-# file as an attachment.
-#
-# See the Mail::Sender module for further details.
-#
-# reverse('©'), August 2002, John McNamara, jmcnamara at cpan.org
-#
-
-
-use strict;
-use Spreadsheet::WriteExcel;
-use Mail::Sender;
-
-# Create an Excel file
-my $workbook  = Spreadsheet::WriteExcel->new("sendmail.xls");
-my $worksheet = $workbook->add_worksheet;
-
-$worksheet->write('A1', "Hello World!");
-
-$workbook->close(); # Must close before sending
-
-
-
-# Send the file.  Change all variables to suit
-my $sender = new Mail::Sender
-{
-    smtp => '123.123.123.123',
-    from => 'Someone'
-};
-
-$sender->MailFile(
-{
-    to      => 'another at mail.com',
-    subject => 'Excel file',
-    msg     => "Here is the data.\n",
-    file    => 'mail.xls',
-});
-
-
+#!/usr/bin/perl -w
+
+###############################################################################
+#
+# Example of how to use Mail::Sender to send a Spreadsheet::WriteExcel Excel
+# file as an attachment.
+#
+# See the Mail::Sender module for further details.
+#
+# reverse('©'), August 2002, John McNamara, jmcnamara at cpan.org
+#
+
+
+use strict;
+use Spreadsheet::WriteExcel;
+use Mail::Sender;
+
+# Create an Excel file
+my $workbook  = Spreadsheet::WriteExcel->new("sendmail.xls");
+my $worksheet = $workbook->add_worksheet;
+
+$worksheet->write('A1', "Hello World!");
+
+$workbook->close(); # Must close before sending
+
+
+
+# Send the file.  Change all variables to suit
+my $sender = new Mail::Sender
+{
+    smtp => '123.123.123.123',
+    from => 'Someone'
+};
+
+$sender->MailFile(
+{
+    to      => 'another at mail.com',
+    subject => 'Excel file',
+    msg     => "Here is the data.\n",
+    file    => 'mail.xls',
+});
+
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/simple.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/simple.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/simple.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,39 +1,39 @@
-#!/usr/bin/perl -w
-
-#######################################################################
-#
-# Example of how to use the WriteExcel module to write text and numbers
-# to an Excel binary file.
-#
-# reverse('©'), March 2001, John McNamara, jmcnamara at cpan.org
-#
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-# Create a new workbook called simple.xls and add a worksheet
-my $workbook  = Spreadsheet::WriteExcel->new("simple.xls");
-my $worksheet = $workbook->add_worksheet();
-
-# The general syntax is write($row, $column, $token). Note that row and
-# column are zero indexed
-#
-
-# Write some text
-$worksheet->write(0, 0,  "Hi Excel!");
-
-
-# Write some numbers
-$worksheet->write(2, 0,  3);          # Writes 3
-$worksheet->write(3, 0,  3.00000);    # Writes 3
-$worksheet->write(4, 0,  3.00001);    # Writes 3.00001
-$worksheet->write(5, 0,  3.14159);    # TeX revision no.?
-
-
-# Write some formulas
-$worksheet->write(7, 0,  '=A3 + A6');
-$worksheet->write(8, 0,  '=IF(A5>3,"Yes", "No")');
-
-
-# Write a hyperlink
+#!/usr/bin/perl -w
+
+#######################################################################
+#
+# Example of how to use the WriteExcel module to write text and numbers
+# to an Excel binary file.
+#
+# reverse('©'), March 2001, John McNamara, jmcnamara at cpan.org
+#
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+# Create a new workbook called simple.xls and add a worksheet
+my $workbook  = Spreadsheet::WriteExcel->new("simple.xls");
+my $worksheet = $workbook->add_worksheet();
+
+# The general syntax is write($row, $column, $token). Note that row and
+# column are zero indexed
+#
+
+# Write some text
+$worksheet->write(0, 0,  "Hi Excel!");
+
+
+# Write some numbers
+$worksheet->write(2, 0,  3);          # Writes 3
+$worksheet->write(3, 0,  3.00000);    # Writes 3
+$worksheet->write(4, 0,  3.00001);    # Writes 3.00001
+$worksheet->write(5, 0,  3.14159);    # TeX revision no.?
+
+
+# Write some formulas
+$worksheet->write(7, 0,  '=A3 + A6');
+$worksheet->write(8, 0,  '=IF(A5>3,"Yes", "No")');
+
+
+# Write a hyperlink
 $worksheet->write(10, 0, 'http://www.perl.com/');
\ No newline at end of file

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/stats.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/stats.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/stats.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,69 +1,69 @@
-#!/usr/bin/perl -w
-
-###############################################################################
-#
-# This is a simple example of how to use functions with the
-# Spreadsheet::WriteExcel module.
-#
-# reverse('©'), March 2001, John McNamara, jmcnamara at cpan.org
-#
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-# Create a new workbook and add a worksheet
-my $workbook  = Spreadsheet::WriteExcel->new("stats.xls");
-my $worksheet = $workbook->add_worksheet('Test data');
-
-# Set the column width for columns 1
-$worksheet->set_column(0, 0, 20);
-
-
-# Create a format for the headings
-my $format = $workbook->add_format();
-$format->set_bold();
-
-
-# Write the sample data
-$worksheet->write(0, 0, 'Sample', $format);
-$worksheet->write(0, 1, 1);
-$worksheet->write(0, 2, 2);
-$worksheet->write(0, 3, 3);
-$worksheet->write(0, 4, 4);
-$worksheet->write(0, 5, 5);
-$worksheet->write(0, 6, 6);
-$worksheet->write(0, 7, 7);
-$worksheet->write(0, 8, 8);
-
-$worksheet->write(1, 0, 'Length', $format);
-$worksheet->write(1, 1, 25.4);
-$worksheet->write(1, 2, 25.4);
-$worksheet->write(1, 3, 24.8);
-$worksheet->write(1, 4, 25.0);
-$worksheet->write(1, 5, 25.3);
-$worksheet->write(1, 6, 24.9);
-$worksheet->write(1, 7, 25.2);
-$worksheet->write(1, 8, 24.8);
-
-# Write some statistical functions
-$worksheet->write(4,  0, 'Count', $format);
-$worksheet->write(4,  1, '=COUNT(B1:I1)');
-
-$worksheet->write(5,  0, 'Sum', $format);
-$worksheet->write(5,  1, '=SUM(B2:I2)');
-
-$worksheet->write(6,  0, 'Average', $format);
-$worksheet->write(6,  1, '=AVERAGE(B2:I2)');
-
-$worksheet->write(7,  0, 'Min', $format);
-$worksheet->write(7,  1, '=MIN(B2:I2)');
-
-$worksheet->write(8,  0, 'Max', $format);
-$worksheet->write(8,  1, '=MAX(B2:I2)');
-
-$worksheet->write(9,  0, 'Standard Deviation', $format);
-$worksheet->write(9,  1, '=STDEV(B2:I2)');
-
-$worksheet->write(10, 0, 'Kurtosis', $format);
-$worksheet->write(10, 1, '=KURT(B2:I2)');
-
+#!/usr/bin/perl -w
+
+###############################################################################
+#
+# This is a simple example of how to use functions with the
+# Spreadsheet::WriteExcel module.
+#
+# reverse('©'), March 2001, John McNamara, jmcnamara at cpan.org
+#
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+# Create a new workbook and add a worksheet
+my $workbook  = Spreadsheet::WriteExcel->new("stats.xls");
+my $worksheet = $workbook->add_worksheet('Test data');
+
+# Set the column width for columns 1
+$worksheet->set_column(0, 0, 20);
+
+
+# Create a format for the headings
+my $format = $workbook->add_format();
+$format->set_bold();
+
+
+# Write the sample data
+$worksheet->write(0, 0, 'Sample', $format);
+$worksheet->write(0, 1, 1);
+$worksheet->write(0, 2, 2);
+$worksheet->write(0, 3, 3);
+$worksheet->write(0, 4, 4);
+$worksheet->write(0, 5, 5);
+$worksheet->write(0, 6, 6);
+$worksheet->write(0, 7, 7);
+$worksheet->write(0, 8, 8);
+
+$worksheet->write(1, 0, 'Length', $format);
+$worksheet->write(1, 1, 25.4);
+$worksheet->write(1, 2, 25.4);
+$worksheet->write(1, 3, 24.8);
+$worksheet->write(1, 4, 25.0);
+$worksheet->write(1, 5, 25.3);
+$worksheet->write(1, 6, 24.9);
+$worksheet->write(1, 7, 25.2);
+$worksheet->write(1, 8, 24.8);
+
+# Write some statistical functions
+$worksheet->write(4,  0, 'Count', $format);
+$worksheet->write(4,  1, '=COUNT(B1:I1)');
+
+$worksheet->write(5,  0, 'Sum', $format);
+$worksheet->write(5,  1, '=SUM(B2:I2)');
+
+$worksheet->write(6,  0, 'Average', $format);
+$worksheet->write(6,  1, '=AVERAGE(B2:I2)');
+
+$worksheet->write(7,  0, 'Min', $format);
+$worksheet->write(7,  1, '=MIN(B2:I2)');
+
+$worksheet->write(8,  0, 'Max', $format);
+$worksheet->write(8,  1, '=MAX(B2:I2)');
+
+$worksheet->write(9,  0, 'Standard Deviation', $format);
+$worksheet->write(9,  1, '=STDEV(B2:I2)');
+
+$worksheet->write(10, 0, 'Kurtosis', $format);
+$worksheet->write(10, 1, '=KURT(B2:I2)');
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/stats_ext.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/stats_ext.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/stats_ext.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,78 +1,78 @@
-#!/usr/bin/perl -w
-
-###############################################################################
-#
-# Example of formatting using the Spreadsheet::WriteExcel module
-#
-# This is a simple example of how to use functions that reference cells in
-# other worksheets within the same workbook.
-#
-# reverse('©'), March 2001, John McNamara, jmcnamara at cpan.org
-#
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-# Create a new workbook and add a worksheet
-my $workbook  = Spreadsheet::WriteExcel->new("stats_ext.xls");
-my $worksheet1 = $workbook->add_worksheet('Test results');
-my $worksheet2 = $workbook->add_worksheet('Data');
-
-# Set the column width for columns 1
-$worksheet1->set_column('A:A', 20);
-
-
-# Create a format for the headings
-my $heading = $workbook->add_format();
-$heading->set_bold();
-
-# Create a numerical format
-my $numformat = $workbook->add_format();
-$numformat->set_num_format('0.00');
-
-
-
-
-# Write some statistical functions
-$worksheet1->write('A1', 'Count', $heading);
-$worksheet1->write('B1', '=COUNT(Data!B2:B9)');
-
-$worksheet1->write('A2', 'Sum', $heading);
-$worksheet1->write('B2', '=SUM(Data!B2:B9)');
-
-$worksheet1->write('A3', 'Average', $heading);
-$worksheet1->write('B3', '=AVERAGE(Data!B2:B9)');
-
-$worksheet1->write('A4', 'Min', $heading);
-$worksheet1->write('B4', '=MIN(Data!B2:B9)');
-
-$worksheet1->write('A5', 'Max', $heading);
-$worksheet1->write('B5', '=MAX(Data!B2:B9)');
-
-$worksheet1->write('A6', 'Standard Deviation', $heading);
-$worksheet1->write('B6', '=STDEV(Data!B2:B9)');
-
-$worksheet1->write('A7', 'Kurtosis', $heading);
-$worksheet1->write('B7', '=KURT(Data!B2:B9)');
-
-
-# Write the sample data
-$worksheet2->write('A1', 'Sample', $heading);
-$worksheet2->write('A2', 1);
-$worksheet2->write('A3', 2);
-$worksheet2->write('A4', 3);
-$worksheet2->write('A5', 4);
-$worksheet2->write('A6', 5);
-$worksheet2->write('A7', 6);
-$worksheet2->write('A8', 7);
-$worksheet2->write('A9', 8);
-
-$worksheet2->write('B1', 'Length', $heading);
-$worksheet2->write('B2', 25.4, $numformat);
-$worksheet2->write('B3', 25.4, $numformat);
-$worksheet2->write('B4', 24.8, $numformat);
-$worksheet2->write('B5', 25.0, $numformat);
-$worksheet2->write('B6', 25.3, $numformat);
-$worksheet2->write('B7', 24.9, $numformat);
-$worksheet2->write('B8', 25.2, $numformat);
-$worksheet2->write('B9', 24.8, $numformat);
+#!/usr/bin/perl -w
+
+###############################################################################
+#
+# Example of formatting using the Spreadsheet::WriteExcel module
+#
+# This is a simple example of how to use functions that reference cells in
+# other worksheets within the same workbook.
+#
+# reverse('©'), March 2001, John McNamara, jmcnamara at cpan.org
+#
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+# Create a new workbook and add a worksheet
+my $workbook  = Spreadsheet::WriteExcel->new("stats_ext.xls");
+my $worksheet1 = $workbook->add_worksheet('Test results');
+my $worksheet2 = $workbook->add_worksheet('Data');
+
+# Set the column width for columns 1
+$worksheet1->set_column('A:A', 20);
+
+
+# Create a format for the headings
+my $heading = $workbook->add_format();
+$heading->set_bold();
+
+# Create a numerical format
+my $numformat = $workbook->add_format();
+$numformat->set_num_format('0.00');
+
+
+
+
+# Write some statistical functions
+$worksheet1->write('A1', 'Count', $heading);
+$worksheet1->write('B1', '=COUNT(Data!B2:B9)');
+
+$worksheet1->write('A2', 'Sum', $heading);
+$worksheet1->write('B2', '=SUM(Data!B2:B9)');
+
+$worksheet1->write('A3', 'Average', $heading);
+$worksheet1->write('B3', '=AVERAGE(Data!B2:B9)');
+
+$worksheet1->write('A4', 'Min', $heading);
+$worksheet1->write('B4', '=MIN(Data!B2:B9)');
+
+$worksheet1->write('A5', 'Max', $heading);
+$worksheet1->write('B5', '=MAX(Data!B2:B9)');
+
+$worksheet1->write('A6', 'Standard Deviation', $heading);
+$worksheet1->write('B6', '=STDEV(Data!B2:B9)');
+
+$worksheet1->write('A7', 'Kurtosis', $heading);
+$worksheet1->write('B7', '=KURT(Data!B2:B9)');
+
+
+# Write the sample data
+$worksheet2->write('A1', 'Sample', $heading);
+$worksheet2->write('A2', 1);
+$worksheet2->write('A3', 2);
+$worksheet2->write('A4', 3);
+$worksheet2->write('A5', 4);
+$worksheet2->write('A6', 5);
+$worksheet2->write('A7', 6);
+$worksheet2->write('A8', 7);
+$worksheet2->write('A9', 8);
+
+$worksheet2->write('B1', 'Length', $heading);
+$worksheet2->write('B2', 25.4, $numformat);
+$worksheet2->write('B3', 25.4, $numformat);
+$worksheet2->write('B4', 24.8, $numformat);
+$worksheet2->write('B5', 25.0, $numformat);
+$worksheet2->write('B6', 25.3, $numformat);
+$worksheet2->write('B7', 24.9, $numformat);
+$worksheet2->write('B8', 25.2, $numformat);
+$worksheet2->write('B9', 24.8, $numformat);

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/stocks.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/stocks.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/stocks.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,77 +1,77 @@
-#!/usr/bin/perl -w
-
-###############################################################################
-#
-# Example of formatting using the Spreadsheet::WriteExcel module
-#
-# This example shows how to use a conditional numerical format
-# with colours to indicate if a share price has gone up or down.
-#
-# reverse('©'), March 2001, John McNamara, jmcnamara at cpan.org
-#
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-# Create a new workbook and add a worksheet
-my $workbook  = Spreadsheet::WriteExcel->new("stocks.xls");
-my $worksheet = $workbook->add_worksheet();
-
-# Set the column width for columns 1, 2, 3 and 4
-$worksheet->set_column(0, 3, 15);
-
-
-# Create a format for the column headings
-my $header = $workbook->add_format();
-$header->set_bold();
-$header->set_size(12);
-$header->set_color('blue');
-
-
-# Create a format for the stock price
-my $f_price = $workbook->add_format();
-$f_price->set_align('left');
-$f_price->set_num_format('$0.00');
-
-
-# Create a format for the stock volume
-my $f_volume = $workbook->add_format();
-$f_volume->set_align('left');
-$f_volume->set_num_format('#,##0');
-
-
-# Create a format for the price change. This is an example of a conditional
-# format. The number is formatted as a percentage. If it is positive it is
-# formatted in green, if it is negative it is formatted in red and if it is
-# zero it is formatted as the default font colour (in this case black).
-# Note: the [Green] format produces an unappealing lime green. Try
-# [Color 10] instead for a dark green.
-#
-my $f_change = $workbook->add_format();
-$f_change->set_align('left');
-$f_change->set_num_format('[Green]0.0%;[Red]-0.0%;0.0%');
-
-
-# Write out the data
-$worksheet->write(0, 0, 'Company', $header);
-$worksheet->write(0, 1, 'Price',   $header);
-$worksheet->write(0, 2, 'Volume',  $header);
-$worksheet->write(0, 3, 'Change',  $header);
-
-$worksheet->write(1, 0, 'Damage Inc.'     );
-$worksheet->write(1, 1, 30.25,     $f_price);  # $30.25
-$worksheet->write(1, 2, 1234567,   $f_volume); # 1,234,567
-$worksheet->write(1, 3, 0.085,     $f_change); # 8.5% in green
-
-$worksheet->write(2, 0, 'Dump Corp.'      );
-$worksheet->write(2, 1, 1.56,      $f_price);  # $1.56
-$worksheet->write(2, 2, 7564,      $f_volume); # 7,564
-$worksheet->write(2, 3, -0.015,    $f_change); # -1.5% in red
-
-$worksheet->write(3, 0, 'Rev Ltd.'        );
-$worksheet->write(3, 1, 0.13,      $f_price);  # $0.13
-$worksheet->write(3, 2, 321,       $f_volume); # 321
-$worksheet->write(3, 3, 0,         $f_change); # 0 in the font color (black)
-
-
-
+#!/usr/bin/perl -w
+
+###############################################################################
+#
+# Example of formatting using the Spreadsheet::WriteExcel module
+#
+# This example shows how to use a conditional numerical format
+# with colours to indicate if a share price has gone up or down.
+#
+# reverse('©'), March 2001, John McNamara, jmcnamara at cpan.org
+#
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+# Create a new workbook and add a worksheet
+my $workbook  = Spreadsheet::WriteExcel->new("stocks.xls");
+my $worksheet = $workbook->add_worksheet();
+
+# Set the column width for columns 1, 2, 3 and 4
+$worksheet->set_column(0, 3, 15);
+
+
+# Create a format for the column headings
+my $header = $workbook->add_format();
+$header->set_bold();
+$header->set_size(12);
+$header->set_color('blue');
+
+
+# Create a format for the stock price
+my $f_price = $workbook->add_format();
+$f_price->set_align('left');
+$f_price->set_num_format('$0.00');
+
+
+# Create a format for the stock volume
+my $f_volume = $workbook->add_format();
+$f_volume->set_align('left');
+$f_volume->set_num_format('#,##0');
+
+
+# Create a format for the price change. This is an example of a conditional
+# format. The number is formatted as a percentage. If it is positive it is
+# formatted in green, if it is negative it is formatted in red and if it is
+# zero it is formatted as the default font colour (in this case black).
+# Note: the [Green] format produces an unappealing lime green. Try
+# [Color 10] instead for a dark green.
+#
+my $f_change = $workbook->add_format();
+$f_change->set_align('left');
+$f_change->set_num_format('[Green]0.0%;[Red]-0.0%;0.0%');
+
+
+# Write out the data
+$worksheet->write(0, 0, 'Company', $header);
+$worksheet->write(0, 1, 'Price',   $header);
+$worksheet->write(0, 2, 'Volume',  $header);
+$worksheet->write(0, 3, 'Change',  $header);
+
+$worksheet->write(1, 0, 'Damage Inc.'     );
+$worksheet->write(1, 1, 30.25,     $f_price);  # $30.25
+$worksheet->write(1, 2, 1234567,   $f_volume); # 1,234,567
+$worksheet->write(1, 3, 0.085,     $f_change); # 8.5% in green
+
+$worksheet->write(2, 0, 'Dump Corp.'      );
+$worksheet->write(2, 1, 1.56,      $f_price);  # $1.56
+$worksheet->write(2, 2, 7564,      $f_volume); # 7,564
+$worksheet->write(2, 3, -0.015,    $f_change); # -1.5% in red
+
+$worksheet->write(3, 0, 'Rev Ltd.'        );
+$worksheet->write(3, 1, 0.13,      $f_price);  # $0.13
+$worksheet->write(3, 2, 321,       $f_volume); # 321
+$worksheet->write(3, 3, 0,         $f_change); # 0 in the font color (black)
+
+
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/tab2xls.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/tab2xls.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/tab2xls.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,47 +1,47 @@
-#!/usr/bin/perl -w
-
-######################################################################
-#
-# Example of how to use the WriteExcel module
-#
-# The following converts a tab separated file into an Excel file
-#
-# Usage: tab2xls.pl tabfile.txt newfile.xls
-#
-# reverse('©'), March 2001, John McNamara, jmcnamara at cpan.org
-#
-
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-
-# Check for valid number of arguments
-if (($#ARGV < 1) || ($#ARGV > 2)) {
-    die("Usage: tab2xls tabfile.txt newfile.xls\n");
-};
-
-
-# Open the tab delimited file
-open (TABFILE, $ARGV[0]) or die "$ARGV[0]: $!";
-
-
-# Create a new Excel workbook
-my $workbook  = Spreadsheet::WriteExcel->new($ARGV[1]);
-my $worksheet = $workbook->add_worksheet();
-
-# Row and column are zero indexed
-my $row = 0;
-
-while (<TABFILE>) {
-    chomp;
-    # Split on single tab
-    my @Fld = split('\t', $_);
-
-    my $col = 0;
-    foreach my $token (@Fld) {
-        $worksheet->write($row, $col, $token);
-        $col++;
-    }
-    $row++;
-}
+#!/usr/bin/perl -w
+
+######################################################################
+#
+# Example of how to use the WriteExcel module
+#
+# The following converts a tab separated file into an Excel file
+#
+# Usage: tab2xls.pl tabfile.txt newfile.xls
+#
+# reverse('©'), March 2001, John McNamara, jmcnamara at cpan.org
+#
+
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+
+# Check for valid number of arguments
+if (($#ARGV < 1) || ($#ARGV > 2)) {
+    die("Usage: tab2xls tabfile.txt newfile.xls\n");
+};
+
+
+# Open the tab delimited file
+open (TABFILE, $ARGV[0]) or die "$ARGV[0]: $!";
+
+
+# Create a new Excel workbook
+my $workbook  = Spreadsheet::WriteExcel->new($ARGV[1]);
+my $worksheet = $workbook->add_worksheet();
+
+# Row and column are zero indexed
+my $row = 0;
+
+while (<TABFILE>) {
+    chomp;
+    # Split on single tab
+    my @Fld = split('\t', $_);
+
+    my $col = 0;
+    foreach my $token (@Fld) {
+        $worksheet->write($row, $col, $token);
+        $col++;
+    }
+    $row++;
+}

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/textwrap.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/textwrap.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/textwrap.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,79 +1,79 @@
-#!/usr/bin/perl -w
-
-###############################################################################
-#
-# Example of formatting using the Spreadsheet::WriteExcel module
-#
-# This example shows how to wrap text in a cell. There are two alternatives,
-# vertical justification and text wrap. With vertical justification the text
-# is wrapped automatically to fit the column width. With text wrap you must
-# specify a newline with an embedded \n.
-#
-# reverse('©'), March 2001, John McNamara, jmcnamara at cpan.org
-#
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-# Create a new workbook and add a worksheet
-my $workbook  = Spreadsheet::WriteExcel->new("textwrap.xls");
-my $worksheet = $workbook->add_worksheet();
-
-# Set the column width for columns 1, 2 and 3
-$worksheet->set_column(1, 1, 24);
-$worksheet->set_column(2, 2, 34);
-$worksheet->set_column(3, 3, 34);
-
-# Set the row height for rows 1, 4, and 6. The height of row 2 will adjust
-# automatically to fit the text.
-#
-$worksheet->set_row(0, 30);
-$worksheet->set_row(3, 40);
-$worksheet->set_row(5, 80);
-
-
-# No newlines
-my $str1  = "For whatever we lose (like a you or a me) ";
-$str1    .= "it's always ourselves we find in the sea";
-
-# Embedded newlines
-my $str2  = "For whatever we lose\n(like a you or a me)\n";
-   $str2 .= "it's always ourselves\nwe find in the sea";
-
-
-# Create a format for the column headings
-my $header = $workbook->add_format();
-$header->set_bold();
-$header->set_font("Courier New");
-$header->set_align('center');
-$header->set_align('vcenter');
-
-# Create a "vertical justification" format
-my $format1 = $workbook->add_format();
-$format1->set_align('vjustify');
-
-# Create a "text wrap" format
-my $format2 = $workbook->add_format();
-$format2->set_text_wrap();
-
-# Write the headers
-$worksheet->write(0, 1, "set_align('vjustify')", $header);
-$worksheet->write(0, 2, "set_align('vjustify')", $header);
-$worksheet->write(0, 3, "set_text_wrap()", $header);
-
-# Write some examples
-$worksheet->write(1, 1, $str1, $format1);
-$worksheet->write(1, 2, $str1, $format1);
-$worksheet->write(1, 3, $str2, $format2);
-
-$worksheet->write(3, 1, $str1, $format1);
-$worksheet->write(3, 2, $str1, $format1);
-$worksheet->write(3, 3, $str2, $format2);
-
-$worksheet->write(5, 1, $str1, $format1);
-$worksheet->write(5, 2, $str1, $format1);
-$worksheet->write(5, 3, $str2, $format2);
-
-
-
-
+#!/usr/bin/perl -w
+
+###############################################################################
+#
+# Example of formatting using the Spreadsheet::WriteExcel module
+#
+# This example shows how to wrap text in a cell. There are two alternatives,
+# vertical justification and text wrap. With vertical justification the text
+# is wrapped automatically to fit the column width. With text wrap you must
+# specify a newline with an embedded \n.
+#
+# reverse('©'), March 2001, John McNamara, jmcnamara at cpan.org
+#
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+# Create a new workbook and add a worksheet
+my $workbook  = Spreadsheet::WriteExcel->new("textwrap.xls");
+my $worksheet = $workbook->add_worksheet();
+
+# Set the column width for columns 1, 2 and 3
+$worksheet->set_column(1, 1, 24);
+$worksheet->set_column(2, 2, 34);
+$worksheet->set_column(3, 3, 34);
+
+# Set the row height for rows 1, 4, and 6. The height of row 2 will adjust
+# automatically to fit the text.
+#
+$worksheet->set_row(0, 30);
+$worksheet->set_row(3, 40);
+$worksheet->set_row(5, 80);
+
+
+# No newlines
+my $str1  = "For whatever we lose (like a you or a me) ";
+$str1    .= "it's always ourselves we find in the sea";
+
+# Embedded newlines
+my $str2  = "For whatever we lose\n(like a you or a me)\n";
+   $str2 .= "it's always ourselves\nwe find in the sea";
+
+
+# Create a format for the column headings
+my $header = $workbook->add_format();
+$header->set_bold();
+$header->set_font("Courier New");
+$header->set_align('center');
+$header->set_align('vcenter');
+
+# Create a "vertical justification" format
+my $format1 = $workbook->add_format();
+$format1->set_align('vjustify');
+
+# Create a "text wrap" format
+my $format2 = $workbook->add_format();
+$format2->set_text_wrap();
+
+# Write the headers
+$worksheet->write(0, 1, "set_align('vjustify')", $header);
+$worksheet->write(0, 2, "set_align('vjustify')", $header);
+$worksheet->write(0, 3, "set_text_wrap()", $header);
+
+# Write some examples
+$worksheet->write(1, 1, $str1, $format1);
+$worksheet->write(1, 2, $str1, $format1);
+$worksheet->write(1, 3, $str2, $format2);
+
+$worksheet->write(3, 1, $str1, $format1);
+$worksheet->write(3, 2, $str1, $format1);
+$worksheet->write(3, 3, $str2, $format2);
+
+$worksheet->write(5, 1, $str1, $format1);
+$worksheet->write(5, 2, $str1, $format1);
+$worksheet->write(5, 3, $str2, $format2);
+
+
+
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,43 +1,43 @@
-#!/usr/bin/perl -w
-
-##############################################################################
-#
-# A simple example of writing some Unicode text with Spreadsheet::WriteExcel.
-#
-# This example shows UTF16 encoding. With perl 5.8 it is also possible to use
-# utf8 without modification.
-#
-# reverse('©'), May 2004, John McNamara, jmcnamara at cpan.org
-#
-
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-
-my $workbook  = Spreadsheet::WriteExcel->new('unicode.xls');
-my $worksheet = $workbook->add_worksheet();
-
-
-# Write the Unicode smiley face (with increased font for legibility)
-my $smiley    = pack "n", 0x263a;
-my $big_font  = $workbook->add_format(size => 40);
-
-$worksheet->write_unicode('A3', $smiley, $big_font);
-
-
-# Write a phrase in Cyrillic
-my $uni_str = pack "H*", "042d0442043e002004440440043004370430002004".
-                         "3d043000200440044304410441043a043e043c0021";
-
-$worksheet->write_unicode('A5', $uni_str);
-
-
-$worksheet->write_unicode('A7', pack "H*", "0074006500730074");
-
-
-
-
-
-__END__
-
+#!/usr/bin/perl -w
+
+##############################################################################
+#
+# A simple example of writing some Unicode text with Spreadsheet::WriteExcel.
+#
+# This example shows UTF16 encoding. With perl 5.8 it is also possible to use
+# utf8 without modification.
+#
+# reverse('©'), May 2004, John McNamara, jmcnamara at cpan.org
+#
+
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+
+my $workbook  = Spreadsheet::WriteExcel->new('unicode.xls');
+my $worksheet = $workbook->add_worksheet();
+
+
+# Write the Unicode smiley face (with increased font for legibility)
+my $smiley    = pack "n", 0x263a;
+my $big_font  = $workbook->add_format(size => 40);
+
+$worksheet->write_unicode('A3', $smiley, $big_font);
+
+
+# Write a phrase in Cyrillic
+my $uni_str = pack "H*", "042d0442043e002004440440043004370430002004".
+                         "3d043000200440044304410441043a043e043c0021";
+
+$worksheet->write_unicode('A5', $uni_str);
+
+
+$worksheet->write_unicode('A7', pack "H*", "0074006500730074");
+
+
+
+
+
+__END__
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode_2022_jp.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode_2022_jp.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode_2022_jp.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,45 +1,45 @@
-#!/usr/bin/perl -w
-
-##############################################################################
-#
-# A simple example of converting some Unicode text to an Excel file using
-# Spreadsheet::WriteExcel and perl 5.8.
-#
-# This example generates some Japanese from a file with ISO-2022-JP
-# encoded text.
-#
-# reverse('©'), September 2004, John McNamara, jmcnamara at cpan.org
-#
-
-
-
-# Perl 5.8 or later is required for proper utf8 handling. For older perl
-# versions you should use UTF16 and the write_unicode() method.
-# See the write_unicode section of the Spreadsheet::WriteExcel docs.
-#
-require 5.008;
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-
-my $workbook  = Spreadsheet::WriteExcel->new("unicode_2022_jp.xls");
-my $worksheet = $workbook->add_worksheet();
-   $worksheet->set_column('A:A', 50);
-
-
-my $file = 'unicode_2022_jp.txt';
-
-open FH, '<:encoding(iso-2022-jp)', $file  or die "Couldn't open $file: $!\n";
-
-my $row = 0;
-
-while (<FH>) {
-    next if /^#/; # Ignore the comments in the sample file.
-    chomp;
-    $worksheet->write($row++, 0,  $_);
-}
-
-
-__END__
-
+#!/usr/bin/perl -w
+
+##############################################################################
+#
+# A simple example of converting some Unicode text to an Excel file using
+# Spreadsheet::WriteExcel and perl 5.8.
+#
+# This example generates some Japanese from a file with ISO-2022-JP
+# encoded text.
+#
+# reverse('©'), September 2004, John McNamara, jmcnamara at cpan.org
+#
+
+
+
+# Perl 5.8 or later is required for proper utf8 handling. For older perl
+# versions you should use UTF16 and the write_unicode() method.
+# See the write_unicode section of the Spreadsheet::WriteExcel docs.
+#
+require 5.008;
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+
+my $workbook  = Spreadsheet::WriteExcel->new("unicode_2022_jp.xls");
+my $worksheet = $workbook->add_worksheet();
+   $worksheet->set_column('A:A', 50);
+
+
+my $file = 'unicode_2022_jp.txt';
+
+open FH, '<:encoding(iso-2022-jp)', $file  or die "Couldn't open $file: $!\n";
+
+my $row = 0;
+
+while (<FH>) {
+    next if /^#/; # Ignore the comments in the sample file.
+    chomp;
+    $worksheet->write($row++, 0,  $_);
+}
+
+
+__END__
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode_8859_11.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode_8859_11.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode_8859_11.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,45 +1,45 @@
-#!/usr/bin/perl -w
-
-##############################################################################
-#
-# A simple example of converting some Unicode text to an Excel file using
-# Spreadsheet::WriteExcel and perl 5.8.
-#
-# This example generates some Thai from a file with ISO-8859-11 encoded text.
-#
-#
-# reverse('©'), September 2004, John McNamara, jmcnamara at cpan.org
-#
-
-
-
-# Perl 5.8 or later is required for proper utf8 handling. For older perl
-# versions you should use UTF16 and the write_unicode() method.
-# See the write_unicode section of the Spreadsheet::WriteExcel docs.
-#
-require 5.008;
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-
-my $workbook  = Spreadsheet::WriteExcel->new("unicode_8859_11.xls");
-my $worksheet = $workbook->add_worksheet();
-   $worksheet->set_column('A:A', 50);
-
-
-my $file = 'unicode_8859_11.txt';
-
-open FH, '<:encoding(iso-8859-11)', $file  or die "Couldn't open $file: $!\n";
-
-my $row = 0;
-
-while (<FH>) {
-    next if /^#/; # Ignore the comments in the sample file.
-    chomp;
-    $worksheet->write($row++, 0,  $_);
-}
-
-
-__END__
-
+#!/usr/bin/perl -w
+
+##############################################################################
+#
+# A simple example of converting some Unicode text to an Excel file using
+# Spreadsheet::WriteExcel and perl 5.8.
+#
+# This example generates some Thai from a file with ISO-8859-11 encoded text.
+#
+#
+# reverse('©'), September 2004, John McNamara, jmcnamara at cpan.org
+#
+
+
+
+# Perl 5.8 or later is required for proper utf8 handling. For older perl
+# versions you should use UTF16 and the write_unicode() method.
+# See the write_unicode section of the Spreadsheet::WriteExcel docs.
+#
+require 5.008;
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+
+my $workbook  = Spreadsheet::WriteExcel->new("unicode_8859_11.xls");
+my $worksheet = $workbook->add_worksheet();
+   $worksheet->set_column('A:A', 50);
+
+
+my $file = 'unicode_8859_11.txt';
+
+open FH, '<:encoding(iso-8859-11)', $file  or die "Couldn't open $file: $!\n";
+
+my $row = 0;
+
+while (<FH>) {
+    next if /^#/; # Ignore the comments in the sample file.
+    chomp;
+    $worksheet->write($row++, 0,  $_);
+}
+
+
+__END__
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode_8859_7.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode_8859_7.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode_8859_7.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,45 +1,45 @@
-#!/usr/bin/perl -w
-
-##############################################################################
-#
-# A simple example of converting some Unicode text to an Excel file using
-# Spreadsheet::WriteExcel and perl 5.8.
-#
-# This example generates some Greek from a file with ISO-8859-7 encoded text.
-#
-#
-# reverse('©'), September 2004, John McNamara, jmcnamara at cpan.org
-#
-
-
-
-# Perl 5.8 or later is required for proper utf8 handling. For older perl
-# versions you should use UTF16 and the write_unicode() method.
-# See the write_unicode section of the Spreadsheet::WriteExcel docs.
-#
-require 5.008;
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-
-my $workbook  = Spreadsheet::WriteExcel->new("unicode_8859_7.xls");
-my $worksheet = $workbook->add_worksheet();
-   $worksheet->set_column('A:A', 50);
-
-
-my $file = 'unicode_8859_7.txt';
-
-open FH, '<:encoding(iso-8859-7)', $file  or die "Couldn't open $file: $!\n";
-
-my $row = 0;
-
-while (<FH>) {
-    next if /^#/; # Ignore the comments in the sample file.
-    chomp;
-    $worksheet->write($row++, 0,  $_);
-}
-
-
-__END__
-
+#!/usr/bin/perl -w
+
+##############################################################################
+#
+# A simple example of converting some Unicode text to an Excel file using
+# Spreadsheet::WriteExcel and perl 5.8.
+#
+# This example generates some Greek from a file with ISO-8859-7 encoded text.
+#
+#
+# reverse('©'), September 2004, John McNamara, jmcnamara at cpan.org
+#
+
+
+
+# Perl 5.8 or later is required for proper utf8 handling. For older perl
+# versions you should use UTF16 and the write_unicode() method.
+# See the write_unicode section of the Spreadsheet::WriteExcel docs.
+#
+require 5.008;
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+
+my $workbook  = Spreadsheet::WriteExcel->new("unicode_8859_7.xls");
+my $worksheet = $workbook->add_worksheet();
+   $worksheet->set_column('A:A', 50);
+
+
+my $file = 'unicode_8859_7.txt';
+
+open FH, '<:encoding(iso-8859-7)', $file  or die "Couldn't open $file: $!\n";
+
+my $row = 0;
+
+while (<FH>) {
+    next if /^#/; # Ignore the comments in the sample file.
+    chomp;
+    $worksheet->write($row++, 0,  $_);
+}
+
+
+__END__
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode_big5.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode_big5.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode_big5.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,45 +1,45 @@
-#!/usr/bin/perl -w
-
-##############################################################################
-#
-# A simple example of converting some Unicode text to an Excel file using
-# Spreadsheet::WriteExcel and perl 5.8.
-#
-# This example generates some Chinese from a file with BIG5 encoded text.
-#
-#
-# reverse('©'), September 2004, John McNamara, jmcnamara at cpan.org
-#
-
-
-
-# Perl 5.8 or later is required for proper utf8 handling. For older perl
-# versions you should use UTF16 and the write_unicode() method.
-# See the write_unicode section of the Spreadsheet::WriteExcel docs.
-#
-require 5.008;
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-
-my $workbook  = Spreadsheet::WriteExcel->new("unicode_big5.xls");
-my $worksheet = $workbook->add_worksheet();
-   $worksheet->set_column('A:A', 80);
-
-
-my $file = 'unicode_big5.txt';
-
-open FH, '<:encoding(big5)', $file  or die "Couldn't open $file: $!\n";
-
-my $row = 0;
-
-while (<FH>) {
-    next if /^#/; # Ignore the comments in the sample file.
-    chomp;
-    $worksheet->write($row++, 0,  $_);
-}
-
-
-__END__
-
+#!/usr/bin/perl -w
+
+##############################################################################
+#
+# A simple example of converting some Unicode text to an Excel file using
+# Spreadsheet::WriteExcel and perl 5.8.
+#
+# This example generates some Chinese from a file with BIG5 encoded text.
+#
+#
+# reverse('©'), September 2004, John McNamara, jmcnamara at cpan.org
+#
+
+
+
+# Perl 5.8 or later is required for proper utf8 handling. For older perl
+# versions you should use UTF16 and the write_unicode() method.
+# See the write_unicode section of the Spreadsheet::WriteExcel docs.
+#
+require 5.008;
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+
+my $workbook  = Spreadsheet::WriteExcel->new("unicode_big5.xls");
+my $worksheet = $workbook->add_worksheet();
+   $worksheet->set_column('A:A', 80);
+
+
+my $file = 'unicode_big5.txt';
+
+open FH, '<:encoding(big5)', $file  or die "Couldn't open $file: $!\n";
+
+my $row = 0;
+
+while (<FH>) {
+    next if /^#/; # Ignore the comments in the sample file.
+    chomp;
+    $worksheet->write($row++, 0,  $_);
+}
+
+
+__END__
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode_cp1251.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode_cp1251.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode_cp1251.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,45 +1,45 @@
-#!/usr/bin/perl -w
-
-##############################################################################
-#
-# A simple example of converting some Unicode text to an Excel file using
-# Spreadsheet::WriteExcel and perl 5.8.
-#
-# This example generates some Russian from a file with CP1251 encoded text.
-#
-#
-# reverse('©'), September 2004, John McNamara, jmcnamara at cpan.org
-#
-
-
-
-# Perl 5.8 or later is required for proper utf8 handling. For older perl
-# versions you should use UTF16 and the write_unicode() method.
-# See the write_unicode section of the Spreadsheet::WriteExcel docs.
-#
-require 5.008;
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-
-my $workbook  = Spreadsheet::WriteExcel->new("unicode_cp1251.xls");
-my $worksheet = $workbook->add_worksheet();
-   $worksheet->set_column('A:A', 50);
-
-
-my $file = 'unicode_cp1251.txt';
-
-open FH, '<:encoding(cp1251)', $file  or die "Couldn't open $file: $!\n";
-
-my $row = 0;
-
-while (<FH>) {
-    next if /^#/; # Ignore the comments in the sample file.
-    chomp;
-    $worksheet->write($row++, 0,  $_);
-}
-
-
-__END__
-
+#!/usr/bin/perl -w
+
+##############################################################################
+#
+# A simple example of converting some Unicode text to an Excel file using
+# Spreadsheet::WriteExcel and perl 5.8.
+#
+# This example generates some Russian from a file with CP1251 encoded text.
+#
+#
+# reverse('©'), September 2004, John McNamara, jmcnamara at cpan.org
+#
+
+
+
+# Perl 5.8 or later is required for proper utf8 handling. For older perl
+# versions you should use UTF16 and the write_unicode() method.
+# See the write_unicode section of the Spreadsheet::WriteExcel docs.
+#
+require 5.008;
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+
+my $workbook  = Spreadsheet::WriteExcel->new("unicode_cp1251.xls");
+my $worksheet = $workbook->add_worksheet();
+   $worksheet->set_column('A:A', 50);
+
+
+my $file = 'unicode_cp1251.txt';
+
+open FH, '<:encoding(cp1251)', $file  or die "Couldn't open $file: $!\n";
+
+my $row = 0;
+
+while (<FH>) {
+    next if /^#/; # Ignore the comments in the sample file.
+    chomp;
+    $worksheet->write($row++, 0,  $_);
+}
+
+
+__END__
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode_cp1256.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode_cp1256.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode_cp1256.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,45 +1,45 @@
-#!/usr/bin/perl -w
-
-##############################################################################
-#
-# A simple example of converting some Unicode text to an Excel file using
-# Spreadsheet::WriteExcel and perl 5.8.
-#
-# This example generates some Arabic text from a CP-1256 encoded file.
-#
-#
-# reverse('©'), September 2004, John McNamara, jmcnamara at cpan.org
-#
-
-
-
-# Perl 5.8 or later is required for proper utf8 handling. For older perl
-# versions you should use UTF16 and the write_unicode() method.
-# See the write_unicode section of the Spreadsheet::WriteExcel docs.
-#
-require 5.008;
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-
-my $workbook  = Spreadsheet::WriteExcel->new("unicode_cp1256.xls");
-my $worksheet = $workbook->add_worksheet();
-   $worksheet->set_column('A:A', 50);
-
-
-my $file = 'unicode_cp1256.txt';
-
-open FH, '<:encoding(cp1256)', $file  or die "Couldn't open $file: $!\n";
-
-my $row = 0;
-
-while (<FH>) {
-    next if /^#/; # Ignore the comments in the sample file.
-    chomp;
-    $worksheet->write($row++, 0,  $_);
-}
-
-
-__END__
-
+#!/usr/bin/perl -w
+
+##############################################################################
+#
+# A simple example of converting some Unicode text to an Excel file using
+# Spreadsheet::WriteExcel and perl 5.8.
+#
+# This example generates some Arabic text from a CP-1256 encoded file.
+#
+#
+# reverse('©'), September 2004, John McNamara, jmcnamara at cpan.org
+#
+
+
+
+# Perl 5.8 or later is required for proper utf8 handling. For older perl
+# versions you should use UTF16 and the write_unicode() method.
+# See the write_unicode section of the Spreadsheet::WriteExcel docs.
+#
+require 5.008;
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+
+my $workbook  = Spreadsheet::WriteExcel->new("unicode_cp1256.xls");
+my $worksheet = $workbook->add_worksheet();
+   $worksheet->set_column('A:A', 50);
+
+
+my $file = 'unicode_cp1256.txt';
+
+open FH, '<:encoding(cp1256)', $file  or die "Couldn't open $file: $!\n";
+
+my $row = 0;
+
+while (<FH>) {
+    next if /^#/; # Ignore the comments in the sample file.
+    chomp;
+    $worksheet->write($row++, 0,  $_);
+}
+
+
+__END__
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode_cyrillic.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode_cyrillic.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode_cyrillic.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,48 +1,48 @@
-#!/usr/bin/perl -w
-
-##############################################################################
-#
-# A simple example of writing some Russian cyrillic text using
-# Spreadsheet::WriteExcel and perl 5.8.
-#
-# reverse('©'), March 2005, John McNamara, jmcnamara at cpan.org
-#
-
-
-
-# Perl 5.8 or later is required for proper utf8 handling. For older perl
-# versions you should use UTF16 and the write_unicode() method.
-# See the write_unicode section of the Spreadsheet::WriteExcel docs.
-#
-require 5.008;
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-
-# In this example we generate utf8 strings from character data but in a
-# real application we would expect them to come from an external source.
-#
-
-
-# Create a Russian worksheet name in utf8.
-my $sheet   = pack "U*", 0x0421, 0x0442, 0x0440, 0x0430, 0x043D, 0x0438,
-                         0x0446, 0x0430;
-
-
-# Create a Russian string.
-my $str     = pack "U*", 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441,
-                         0x0442, 0x0432, 0x0443, 0x0439, 0x0020, 0x041C,
-                         0x0438, 0x0440, 0x0021;
-
-
-
-my $workbook  = Spreadsheet::WriteExcel->new("unicode_cyrillic.xls");
-my $worksheet = $workbook->add_worksheet($sheet . '1');
-
-   $worksheet->set_column('A:A', 18);
-   $worksheet->write('A1', $str);
-
-
-__END__
-
+#!/usr/bin/perl -w
+
+##############################################################################
+#
+# A simple example of writing some Russian cyrillic text using
+# Spreadsheet::WriteExcel and perl 5.8.
+#
+# reverse('©'), March 2005, John McNamara, jmcnamara at cpan.org
+#
+
+
+
+# Perl 5.8 or later is required for proper utf8 handling. For older perl
+# versions you should use UTF16 and the write_unicode() method.
+# See the write_unicode section of the Spreadsheet::WriteExcel docs.
+#
+require 5.008;
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+
+# In this example we generate utf8 strings from character data but in a
+# real application we would expect them to come from an external source.
+#
+
+
+# Create a Russian worksheet name in utf8.
+my $sheet   = pack "U*", 0x0421, 0x0442, 0x0440, 0x0430, 0x043D, 0x0438,
+                         0x0446, 0x0430;
+
+
+# Create a Russian string.
+my $str     = pack "U*", 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441,
+                         0x0442, 0x0432, 0x0443, 0x0439, 0x0020, 0x041C,
+                         0x0438, 0x0440, 0x0021;
+
+
+
+my $workbook  = Spreadsheet::WriteExcel->new("unicode_cyrillic.xls");
+my $worksheet = $workbook->add_worksheet($sheet . '1');
+
+   $worksheet->set_column('A:A', 18);
+   $worksheet->write('A1', $str);
+
+
+__END__
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode_japan.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode_japan.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode_japan.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,49 +1,49 @@
-#!/usr/bin/perl -w
-
-##############################################################################
-#
-# A simple example of writing some Unicode text with Spreadsheet::WriteExcel.
-#
-# This creates an Excel file with the word Nippon in 3 character sets.
-#
-# This example shows UTF16 encoding. With perl 5.8 it is also possible to use
-# utf8 without modification.
-#
-# See also the unicode_2022_jp.pl and unicode_shift_jis.pl examples.
-#
-# reverse('©'), May 2004, John McNamara, jmcnamara at cpan.org
-#
-
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-
-my $workbook  = Spreadsheet::WriteExcel->new('japan.xls');
-my $worksheet = $workbook->add_worksheet();
-
-
-# Set a Unicode font.
-my $uni_font  = $workbook->add_format(font => 'Arial Unicode MS');
-
-
-# Create some UTF-16BE Unicode text.
-my $kanji     = pack 'n*', 0x65e5, 0x672c;
-my $katakana  = pack 'n*', 0xff86, 0xff8e, 0xff9d;
-my $hiragana  = pack 'n*', 0x306b, 0x307b, 0x3093;
-
-
-
-$worksheet->write_unicode('A1', $kanji,    $uni_font);
-$worksheet->write_unicode('A2', $katakana, $uni_font);
-$worksheet->write_unicode('A3', $hiragana, $uni_font);
-
-
-$worksheet->write('B1', 'Kanji');
-$worksheet->write('B2', 'Katakana');
-$worksheet->write('B3', 'Hiragana');
-
-
-__END__
-
-
+#!/usr/bin/perl -w
+
+##############################################################################
+#
+# A simple example of writing some Unicode text with Spreadsheet::WriteExcel.
+#
+# This creates an Excel file with the word Nippon in 3 character sets.
+#
+# This example shows UTF16 encoding. With perl 5.8 it is also possible to use
+# utf8 without modification.
+#
+# See also the unicode_2022_jp.pl and unicode_shift_jis.pl examples.
+#
+# reverse('©'), May 2004, John McNamara, jmcnamara at cpan.org
+#
+
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+
+my $workbook  = Spreadsheet::WriteExcel->new('japan.xls');
+my $worksheet = $workbook->add_worksheet();
+
+
+# Set a Unicode font.
+my $uni_font  = $workbook->add_format(font => 'Arial Unicode MS');
+
+
+# Create some UTF-16BE Unicode text.
+my $kanji     = pack 'n*', 0x65e5, 0x672c;
+my $katakana  = pack 'n*', 0xff86, 0xff8e, 0xff9d;
+my $hiragana  = pack 'n*', 0x306b, 0x307b, 0x3093;
+
+
+
+$worksheet->write_unicode('A1', $kanji,    $uni_font);
+$worksheet->write_unicode('A2', $katakana, $uni_font);
+$worksheet->write_unicode('A3', $hiragana, $uni_font);
+
+
+$worksheet->write('B1', 'Kanji');
+$worksheet->write('B2', 'Katakana');
+$worksheet->write('B3', 'Hiragana');
+
+
+__END__
+
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode_koi8r.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode_koi8r.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode_koi8r.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,45 +1,45 @@
-#!/usr/bin/perl -w
-
-##############################################################################
-#
-# A simple example of converting some Unicode text to an Excel file using
-# Spreadsheet::WriteExcel and perl 5.8.
-#
-# This example generates some Russian from a file with KOI8-R encoded text.
-#
-#
-# reverse('©'), September 2004, John McNamara, jmcnamara at cpan.org
-#
-
-
-
-# Perl 5.8 or later is required for proper utf8 handling. For older perl
-# versions you should use UTF16 and the write_unicode() method.
-# See the write_unicode section of the Spreadsheet::WriteExcel docs.
-#
-require 5.008;
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-
-my $workbook  = Spreadsheet::WriteExcel->new("unicode_koi8r.xls");
-my $worksheet = $workbook->add_worksheet();
-   $worksheet->set_column('A:A', 50);
-
-
-my $file = 'unicode_koi8r.txt';
-
-open FH, '<:encoding(koi8-r)', $file  or die "Couldn't open $file: $!\n";
-
-my $row = 0;
-
-while (<FH>) {
-    next if /^#/; # Ignore the comments in the sample file.
-    chomp;
-    $worksheet->write($row++, 0,  $_);
-}
-
-
-__END__
-
+#!/usr/bin/perl -w
+
+##############################################################################
+#
+# A simple example of converting some Unicode text to an Excel file using
+# Spreadsheet::WriteExcel and perl 5.8.
+#
+# This example generates some Russian from a file with KOI8-R encoded text.
+#
+#
+# reverse('©'), September 2004, John McNamara, jmcnamara at cpan.org
+#
+
+
+
+# Perl 5.8 or later is required for proper utf8 handling. For older perl
+# versions you should use UTF16 and the write_unicode() method.
+# See the write_unicode section of the Spreadsheet::WriteExcel docs.
+#
+require 5.008;
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+
+my $workbook  = Spreadsheet::WriteExcel->new("unicode_koi8r.xls");
+my $worksheet = $workbook->add_worksheet();
+   $worksheet->set_column('A:A', 50);
+
+
+my $file = 'unicode_koi8r.txt';
+
+open FH, '<:encoding(koi8-r)', $file  or die "Couldn't open $file: $!\n";
+
+my $row = 0;
+
+while (<FH>) {
+    next if /^#/; # Ignore the comments in the sample file.
+    chomp;
+    $worksheet->write($row++, 0,  $_);
+}
+
+
+__END__
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode_list.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode_list.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode_list.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,49 +1,49 @@
-#!/usr/bin/perl -w
-
-##############################################################################
-#
-# A simple example using Spreadsheet::WriteExcel to display all available
-# Unicode characters in a font.
-#
-# reverse('©'), May 2004, John McNamara, jmcnamara at cpan.org
-#
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-
-my $workbook  = Spreadsheet::WriteExcel->new('unicode_list.xls');
-my $worksheet = $workbook->add_worksheet();
-
-
-# Set a Unicode font.
-my $uni_font  = $workbook->add_format(font => 'Arial Unicode MS');
-
-# Ascii font for labels.
-my $courier   = $workbook->add_format(font => 'Courier New');
-
-
-my $char = 0;
-
-# Loop through all 32768 UTF-16BE characters.
-#
-for my $row (0 .. 2 ** 12 -1) {
-    for my $col (0 .. 31) {
-
-        last if $char == 0xffff;
-
-        if ($col % 2 == 0){
-            $worksheet->write_string($row, $col,
-                                           sprintf('0x%04X', $char), $courier);
-        }
-        else {
-            $worksheet->write_unicode($row, $col,
-                                            pack('n', $char++), $uni_font);
-        }
-    }
-}
-
-
-
-__END__
-
+#!/usr/bin/perl -w
+
+##############################################################################
+#
+# A simple example using Spreadsheet::WriteExcel to display all available
+# Unicode characters in a font.
+#
+# reverse('©'), May 2004, John McNamara, jmcnamara at cpan.org
+#
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+
+my $workbook  = Spreadsheet::WriteExcel->new('unicode_list.xls');
+my $worksheet = $workbook->add_worksheet();
+
+
+# Set a Unicode font.
+my $uni_font  = $workbook->add_format(font => 'Arial Unicode MS');
+
+# Ascii font for labels.
+my $courier   = $workbook->add_format(font => 'Courier New');
+
+
+my $char = 0;
+
+# Loop through all 32768 UTF-16BE characters.
+#
+for my $row (0 .. 2 ** 12 -1) {
+    for my $col (0 .. 31) {
+
+        last if $char == 0xffff;
+
+        if ($col % 2 == 0){
+            $worksheet->write_string($row, $col,
+                                           sprintf('0x%04X', $char), $courier);
+        }
+        else {
+            $worksheet->write_unicode($row, $col,
+                                            pack('n', $char++), $uni_font);
+        }
+    }
+}
+
+
+
+__END__
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode_polish_utf8.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode_polish_utf8.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode_polish_utf8.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,45 +1,45 @@
-#!/usr/bin/perl -w
-
-##############################################################################
-#
-# A simple example of converting some Unicode text to an Excel file using
-# Spreadsheet::WriteExcel and perl 5.8.
-#
-# This example generates some Polish from a file with UTF8 encoded text.
-#
-#
-# reverse('©'), September 2004, John McNamara, jmcnamara at cpan.org
-#
-
-
-
-# Perl 5.8 or later is required for proper utf8 handling. For older perl
-# versions you should use UTF16 and the write_unicode() method.
-# See the write_unicode section of the Spreadsheet::WriteExcel docs.
-#
-require 5.008;
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-
-my $workbook  = Spreadsheet::WriteExcel->new("unicode_polish_utf8.xls");
-my $worksheet = $workbook->add_worksheet();
-   $worksheet->set_column('A:A', 50);
-
-
-my $file = 'unicode_polish_utf8.txt';
-
-open FH, '<:encoding(utf8)', $file  or die "Couldn't open $file: $!\n";
-
-my $row = 0;
-
-while (<FH>) {
-    next if /^#/; # Ignore the comments in the sample file.
-    chomp;
-    $worksheet->write($row++, 0,  $_);
-}
-
-
-__END__
-
+#!/usr/bin/perl -w
+
+##############################################################################
+#
+# A simple example of converting some Unicode text to an Excel file using
+# Spreadsheet::WriteExcel and perl 5.8.
+#
+# This example generates some Polish from a file with UTF8 encoded text.
+#
+#
+# reverse('©'), September 2004, John McNamara, jmcnamara at cpan.org
+#
+
+
+
+# Perl 5.8 or later is required for proper utf8 handling. For older perl
+# versions you should use UTF16 and the write_unicode() method.
+# See the write_unicode section of the Spreadsheet::WriteExcel docs.
+#
+require 5.008;
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+
+my $workbook  = Spreadsheet::WriteExcel->new("unicode_polish_utf8.xls");
+my $worksheet = $workbook->add_worksheet();
+   $worksheet->set_column('A:A', 50);
+
+
+my $file = 'unicode_polish_utf8.txt';
+
+open FH, '<:encoding(utf8)', $file  or die "Couldn't open $file: $!\n";
+
+my $row = 0;
+
+while (<FH>) {
+    next if /^#/; # Ignore the comments in the sample file.
+    chomp;
+    $worksheet->write($row++, 0,  $_);
+}
+
+
+__END__
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode_shift_jis.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode_shift_jis.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/unicode_shift_jis.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,45 +1,45 @@
-#!/usr/bin/perl -w
-
-##############################################################################
-#
-# A simple example of converting some Unicode text to an Excel file using
-# Spreadsheet::WriteExcel and perl 5.8.
-#
-# This example generates some Japenese text from a file with Shift-JIS
-# encoded text.
-#
-# reverse('©'), September 2004, John McNamara, jmcnamara at cpan.org
-#
-
-
-
-# Perl 5.8 or later is required for proper utf8 handling. For older perl
-# versions you should use UTF16 and the write_unicode() method.
-# See the write_unicode section of the Spreadsheet::WriteExcel docs.
-#
-require 5.008;
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-
-my $workbook  = Spreadsheet::WriteExcel->new("unicode_shift_jis.xls");
-my $worksheet = $workbook->add_worksheet();
-   $worksheet->set_column('A:A', 50);
-
-
-my $file = 'unicode_shift_jis.txt';
-
-open FH, '<:encoding(shiftjis)', $file  or die "Couldn't open $file: $!\n";
-
-my $row = 0;
-
-while (<FH>) {
-    next if /^#/; # Ignore the comments in the sample file.
-    chomp;
-    $worksheet->write($row++, 0,  $_);
-}
-
-
-__END__
-
+#!/usr/bin/perl -w
+
+##############################################################################
+#
+# A simple example of converting some Unicode text to an Excel file using
+# Spreadsheet::WriteExcel and perl 5.8.
+#
+# This example generates some Japenese text from a file with Shift-JIS
+# encoded text.
+#
+# reverse('©'), September 2004, John McNamara, jmcnamara at cpan.org
+#
+
+
+
+# Perl 5.8 or later is required for proper utf8 handling. For older perl
+# versions you should use UTF16 and the write_unicode() method.
+# See the write_unicode section of the Spreadsheet::WriteExcel docs.
+#
+require 5.008;
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+
+my $workbook  = Spreadsheet::WriteExcel->new("unicode_shift_jis.xls");
+my $worksheet = $workbook->add_worksheet();
+   $worksheet->set_column('A:A', 50);
+
+
+my $file = 'unicode_shift_jis.txt';
+
+open FH, '<:encoding(shiftjis)', $file  or die "Couldn't open $file: $!\n";
+
+my $row = 0;
+
+while (<FH>) {
+    next if /^#/; # Ignore the comments in the sample file.
+    chomp;
+    $worksheet->write($row++, 0,  $_);
+}
+
+
+__END__
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/win32ole.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/win32ole.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/win32ole.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,44 +1,44 @@
-#!/usr/bin/perl -w
-
-###############################################################################
-#
-# This is a simple example of how to create an Excel file using the
-# Win32::OLE module.
-#
-# reverse('©'), March 2001, John McNamara, jmcnamara at cpan.org
-#
-
-use strict;
-use Cwd;
-use Win32::OLE;
-use Win32::OLE::Const 'Microsoft Excel';
-
-
-my $application = Win32::OLE->new("Excel.Application");
-my $workbook    = $application->Workbooks->Add;
-my $worksheet   = $workbook->Worksheets(1);
-
-$worksheet->Cells(1,1)->{Value} = "Hello World";
-$worksheet->Cells(2,1)->{Value} = "One";
-$worksheet->Cells(3,1)->{Value} = "Two";
-$worksheet->Cells(4,1)->{Value} =  3;
-$worksheet->Cells(5,1)->{Value} =  4.0000001;
-
-# Add some formatting
-$worksheet->Cells(1,1)->Font->{Bold}       = "True";
-$worksheet->Cells(1,1)->Font->{Size}       = 16;
-$worksheet->Cells(1,1)->Font->{ColorIndex} = 3;
-$worksheet->Columns("A:A")->{ColumnWidth}  = 25;
-
-# Write a hyperlink
-my $range = $worksheet->Range("A7:A7");
-$worksheet->Hyperlinks->Add({ Anchor => $range, Address => "http://www.perl.com/"});
-
-# Get current directory using Cwd.pm
-my $dir = cwd();
-
-$workbook->SaveAs({
-                    FileName   => $dir . '/win32ole.xls', 
-                    FileFormat => xlNormal,
-                  });
-$workbook->Close;
+#!/usr/bin/perl -w
+
+###############################################################################
+#
+# This is a simple example of how to create an Excel file using the
+# Win32::OLE module.
+#
+# reverse('©'), March 2001, John McNamara, jmcnamara at cpan.org
+#
+
+use strict;
+use Cwd;
+use Win32::OLE;
+use Win32::OLE::Const 'Microsoft Excel';
+
+
+my $application = Win32::OLE->new("Excel.Application");
+my $workbook    = $application->Workbooks->Add;
+my $worksheet   = $workbook->Worksheets(1);
+
+$worksheet->Cells(1,1)->{Value} = "Hello World";
+$worksheet->Cells(2,1)->{Value} = "One";
+$worksheet->Cells(3,1)->{Value} = "Two";
+$worksheet->Cells(4,1)->{Value} =  3;
+$worksheet->Cells(5,1)->{Value} =  4.0000001;
+
+# Add some formatting
+$worksheet->Cells(1,1)->Font->{Bold}       = "True";
+$worksheet->Cells(1,1)->Font->{Size}       = 16;
+$worksheet->Cells(1,1)->Font->{ColorIndex} = 3;
+$worksheet->Columns("A:A")->{ColumnWidth}  = 25;
+
+# Write a hyperlink
+my $range = $worksheet->Range("A7:A7");
+$worksheet->Hyperlinks->Add({ Anchor => $range, Address => "http://www.perl.com/"});
+
+# Get current directory using Cwd.pm
+my $dir = cwd();
+
+$workbook->SaveAs({
+                    FileName   => $dir . '/win32ole.xls',
+                    FileFormat => xlNormal,
+                  });
+$workbook->Close;

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/writeA1.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/writeA1.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/writeA1.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,87 +1,87 @@
-#!/usr/bin/perl -w
-
-###############################################################################
-#
-# This is an example of how to extend the Spreadsheet::WriteExcel module.
-#
-# Code is appended to the Spreadsheet::WriteExcel::Worksheet module by reusing
-# the package name. The new code provides a write() method that allows you to
-# use Excels A1 style cell references.  This is not particularly useful but it
-# serves as an example of how the module can be extended without modifying the
-# code directly.
-#
-# reverse('©'), March 2001, John McNamara, jmcnamara at cpan.org
-#
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-# Create a new workbook called simple.xls and add a worksheet
-my $workbook  = Spreadsheet::WriteExcel->new("writeA1.xls");
-my $worksheet = $workbook->add_worksheet();
-
-# Write numbers or text
-$worksheet->write  (0, 0, "Hello");
-$worksheet->writeA1("A3", "A3"   );
-$worksheet->writeA1("A5", 1.2345 );
-
-
-###############################################################################
-#
-# The following will be appended to the Spreadsheet::WriteExcel::Worksheet
-# package.
-#
-
-package Spreadsheet::WriteExcel::Worksheet;
-
-###############################################################################
-#
-# writeA1($cell, $token, $format)
-#
-# Convert $cell from Excel A1 notation to $row, $col notation and
-# call write() on $token.
-#
-# Returns: return value of called subroutine or -4 for invalid cell
-# reference.
-#
-sub writeA1 {
-    my $self = shift;
-    my $cell = shift;
-    my $col;
-    my $row;
-
-    if ($cell =~ /([A-z]+)(\d+)/) {
-       ($row, $col) = _convertA1($2, $1);
-       $self->write($row, $col, @_);
-    } else {
-        return -4;
-    }
-}
-
-###############################################################################
-#
-# _convertA1($row, $col)
-#
-# Convert Excel A1 notation to $row, $col notation. Convert base26 column
-# string to a number.
-#
-sub _convertA1 {
-    my $row    = $_[0];
-    my $col    = $_[1]; # String in AA notation
-
-    my @chars  = split //, $col;
-    my $expn   = 0;
-    $col       = 0;
-
-    while (@chars) {
-        my $char = uc(pop(@chars)); # LS char first
-        $col += (ord($char) -ord('A') +1) * (26**$expn);
-        $expn++;
-    }
-
-    # Convert 1 index to 0 index
-    $row--;
-    $col--;
-
-    return($row, $col);
-}
+#!/usr/bin/perl -w
+
+###############################################################################
+#
+# This is an example of how to extend the Spreadsheet::WriteExcel module.
+#
+# Code is appended to the Spreadsheet::WriteExcel::Worksheet module by reusing
+# the package name. The new code provides a write() method that allows you to
+# use Excels A1 style cell references.  This is not particularly useful but it
+# serves as an example of how the module can be extended without modifying the
+# code directly.
+#
+# reverse('©'), March 2001, John McNamara, jmcnamara at cpan.org
+#
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+# Create a new workbook called simple.xls and add a worksheet
+my $workbook  = Spreadsheet::WriteExcel->new("writeA1.xls");
+my $worksheet = $workbook->add_worksheet();
+
+# Write numbers or text
+$worksheet->write  (0, 0, "Hello");
+$worksheet->writeA1("A3", "A3"   );
+$worksheet->writeA1("A5", 1.2345 );
+
+
+###############################################################################
+#
+# The following will be appended to the Spreadsheet::WriteExcel::Worksheet
+# package.
+#
+
+package Spreadsheet::WriteExcel::Worksheet;
+
+###############################################################################
+#
+# writeA1($cell, $token, $format)
+#
+# Convert $cell from Excel A1 notation to $row, $col notation and
+# call write() on $token.
+#
+# Returns: return value of called subroutine or -4 for invalid cell
+# reference.
+#
+sub writeA1 {
+    my $self = shift;
+    my $cell = shift;
+    my $col;
+    my $row;
+
+    if ($cell =~ /([A-z]+)(\d+)/) {
+       ($row, $col) = _convertA1($2, $1);
+       $self->write($row, $col, @_);
+    } else {
+        return -4;
+    }
+}
+
+###############################################################################
+#
+# _convertA1($row, $col)
+#
+# Convert Excel A1 notation to $row, $col notation. Convert base26 column
+# string to a number.
+#
+sub _convertA1 {
+    my $row    = $_[0];
+    my $col    = $_[1]; # String in AA notation
+
+    my @chars  = split //, $col;
+    my $expn   = 0;
+    $col       = 0;
+
+    while (@chars) {
+        my $char = uc(pop(@chars)); # LS char first
+        $col += (ord($char) -ord('A') +1) * (26**$expn);
+        $expn++;
+    }
+
+    # Convert 1 index to 0 index
+    $row--;
+    $col--;
+
+    return($row, $col);
+}

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/write_arrays.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/write_arrays.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/write_arrays.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,70 +1,70 @@
-#!/usr/bin/perl -w
-
-#######################################################################
-#
-# Example of how to use the Spreadsheet::WriteExcel module to
-# write 1D and 2D arrays of data.
-#
-# To find out more about array references refer(!!) to the perlref and
-# perlreftut manpages. To find out more about 2D arrays or "list of
-# lists" refer to the perllol manpage.
-#
-# reverse('©'), March 2002, John McNamara, jmcnamara at cpan.org
-#
-
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-
-my $workbook   = Spreadsheet::WriteExcel->new("write_arrays.xls");
-my $worksheet1 = $workbook->add_worksheet('Example 1');
-my $worksheet2 = $workbook->add_worksheet('Example 2');
-my $worksheet3 = $workbook->add_worksheet('Example 3');
-my $worksheet4 = $workbook->add_worksheet('Example 4');
-my $worksheet5 = $workbook->add_worksheet('Example 5');
-my $worksheet6 = $workbook->add_worksheet('Example 6');
-my $worksheet7 = $workbook->add_worksheet('Example 7');
-my $worksheet8 = $workbook->add_worksheet('Example 8');
-
-my $format     = $workbook->add_format(color => 'red', bold => 1);
-
-
-# Data arrays used in the following examples.
-# undef values are written as blank cells (with format if specified).
-#
-my @array   =   ( 'one', 'two', undef, 'four' );
-
-my @array2d =   (
-                    ['maggie', 'milly', 'molly', 'may'  ],
-                    [13,       14,      15,      16     ],
-                    ['shell',  'star',  'crab',  'stone'],
-                );
-
-
-# 1. Write a row of data using an array reference.
-$worksheet1->write('A1', \@array);
-
-# 2. Same as 1. above using an anonymous array ref.
-$worksheet2->write('A1', [ @array ]);
-
-# 3. Write a row of data using an explicit write_row() method call.
-#    This is the same as calling write() in Ex. 1 above.
-#
-$worksheet3->write_row('A1', \@array);
-
-# 4. Write a column of data using the write_col() method call.
-$worksheet4->write_col('A1', \@array);
-
-# 5. Write a column of data using a ref to an array ref, i.e. a 2D array.
-$worksheet5->write('A1', [ \@array ]);
-
-# 6. Write a 2D array in col-row order.
-$worksheet6->write('A1', \@array2d);
-
-# 7. Write a 2D array in row-col order.
-$worksheet7->write_col('A1', \@array2d);
-
-# 8. Write a row of data with formatting. The blank cell is also formatted.
-$worksheet8->write('A1', \@array, $format);
-
+#!/usr/bin/perl -w
+
+#######################################################################
+#
+# Example of how to use the Spreadsheet::WriteExcel module to
+# write 1D and 2D arrays of data.
+#
+# To find out more about array references refer(!!) to the perlref and
+# perlreftut manpages. To find out more about 2D arrays or "list of
+# lists" refer to the perllol manpage.
+#
+# reverse('©'), March 2002, John McNamara, jmcnamara at cpan.org
+#
+
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+
+my $workbook   = Spreadsheet::WriteExcel->new("write_arrays.xls");
+my $worksheet1 = $workbook->add_worksheet('Example 1');
+my $worksheet2 = $workbook->add_worksheet('Example 2');
+my $worksheet3 = $workbook->add_worksheet('Example 3');
+my $worksheet4 = $workbook->add_worksheet('Example 4');
+my $worksheet5 = $workbook->add_worksheet('Example 5');
+my $worksheet6 = $workbook->add_worksheet('Example 6');
+my $worksheet7 = $workbook->add_worksheet('Example 7');
+my $worksheet8 = $workbook->add_worksheet('Example 8');
+
+my $format     = $workbook->add_format(color => 'red', bold => 1);
+
+
+# Data arrays used in the following examples.
+# undef values are written as blank cells (with format if specified).
+#
+my @array   =   ( 'one', 'two', undef, 'four' );
+
+my @array2d =   (
+                    ['maggie', 'milly', 'molly', 'may'  ],
+                    [13,       14,      15,      16     ],
+                    ['shell',  'star',  'crab',  'stone'],
+                );
+
+
+# 1. Write a row of data using an array reference.
+$worksheet1->write('A1', \@array);
+
+# 2. Same as 1. above using an anonymous array ref.
+$worksheet2->write('A1', [ @array ]);
+
+# 3. Write a row of data using an explicit write_row() method call.
+#    This is the same as calling write() in Ex. 1 above.
+#
+$worksheet3->write_row('A1', \@array);
+
+# 4. Write a column of data using the write_col() method call.
+$worksheet4->write_col('A1', \@array);
+
+# 5. Write a column of data using a ref to an array ref, i.e. a 2D array.
+$worksheet5->write('A1', [ \@array ]);
+
+# 6. Write a 2D array in col-row order.
+$worksheet6->write('A1', \@array2d);
+
+# 7. Write a 2D array in row-col order.
+$worksheet7->write_col('A1', \@array2d);
+
+# 8. Write a row of data with formatting. The blank cell is also formatted.
+$worksheet8->write('A1', \@array, $format);
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/write_handler1.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/write_handler1.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/write_handler1.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,64 +1,64 @@
-#!/usr/bin/perl -w
-
-###############################################################################
-#
-# Example of how to add a user defined data handler to the Spreadsheet::
-# WriteExcel write() method.
-#
-# The following example shows how to add a handler for a 7 digit ID number.
-#
-#
-# reverse('©'), September 2004, John McNamara, jmcnamara at cpan.org
-#
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-
-my $workbook    = Spreadsheet::WriteExcel->new("write_handler1.xls");
-my $worksheet   = $workbook->add_worksheet();
-
-
-###############################################################################
-#
-# Add a handler for 7 digit id numbers. This is useful when you want a string
-# such as 0000001 written as a string instead of a number and thus preserve
-# the leading zeroes.
-#
-# Note: you can get the same effect using the keep_leading_zeros() method but
-# this serves as a simple example.
-#
-$worksheet->add_write_handler(qr[^\d{7}$], \&write_my_id);
-
-
-###############################################################################
-#
-# The following function processes the data when a match is found.
-#
-sub write_my_id {
-
-    my $worksheet = shift;
-
-    return $worksheet->write_string(@_);
-}
-
-
-# This format maintains the cell as text even if it is edited.
-my $id_format   = $workbook->add_format(num_format => '@');
-
-
-# Write some numbers in the user defined format
-$worksheet->write('A1', '0000000', $id_format);
-$worksheet->write('A2', '0000001', $id_format);
-$worksheet->write('A3', '0004000', $id_format);
-$worksheet->write('A4', '1234567', $id_format);
-
-# Write some numbers that don't match the defined format
-$worksheet->write('A6', '000000',  $id_format);
-$worksheet->write('A7', '000001',  $id_format);
-$worksheet->write('A8', '004000',  $id_format);
-$worksheet->write('A9', '123456',  $id_format);
-
-
-__END__
-
+#!/usr/bin/perl -w
+
+###############################################################################
+#
+# Example of how to add a user defined data handler to the Spreadsheet::
+# WriteExcel write() method.
+#
+# The following example shows how to add a handler for a 7 digit ID number.
+#
+#
+# reverse('©'), September 2004, John McNamara, jmcnamara at cpan.org
+#
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+
+my $workbook    = Spreadsheet::WriteExcel->new("write_handler1.xls");
+my $worksheet   = $workbook->add_worksheet();
+
+
+###############################################################################
+#
+# Add a handler for 7 digit id numbers. This is useful when you want a string
+# such as 0000001 written as a string instead of a number and thus preserve
+# the leading zeroes.
+#
+# Note: you can get the same effect using the keep_leading_zeros() method but
+# this serves as a simple example.
+#
+$worksheet->add_write_handler(qr[^\d{7}$], \&write_my_id);
+
+
+###############################################################################
+#
+# The following function processes the data when a match is found.
+#
+sub write_my_id {
+
+    my $worksheet = shift;
+
+    return $worksheet->write_string(@_);
+}
+
+
+# This format maintains the cell as text even if it is edited.
+my $id_format   = $workbook->add_format(num_format => '@');
+
+
+# Write some numbers in the user defined format
+$worksheet->write('A1', '0000000', $id_format);
+$worksheet->write('A2', '0000001', $id_format);
+$worksheet->write('A3', '0004000', $id_format);
+$worksheet->write('A4', '1234567', $id_format);
+
+# Write some numbers that don't match the defined format
+$worksheet->write('A6', '000000',  $id_format);
+$worksheet->write('A7', '000001',  $id_format);
+$worksheet->write('A8', '004000',  $id_format);
+$worksheet->write('A9', '123456',  $id_format);
+
+
+__END__
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/write_handler2.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/write_handler2.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/write_handler2.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,71 +1,71 @@
-#!/usr/bin/perl -w
-
-###############################################################################
-#
-# Example of how to add a user defined data handler to the Spreadsheet::
-# WriteExcel write() method.
-#
-# The following example shows how to add a handler for a 7 digit ID number.
-# It adds an additional constraint to the write_handler1.pl in that it only
-# filters data if it isn't in the third column.
-#
-#
-# reverse('©'), September 2004, John McNamara, jmcnamara at cpan.org
-#
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-
-my $workbook    = Spreadsheet::WriteExcel->new("write_handler2.xls");
-my $worksheet   = $workbook->add_worksheet();
-
-
-###############################################################################
-#
-# Add a handler for 7 digit id numbers. This is useful when you want a string
-# such as 0000001 written as a string instead of a number and thus preserve
-# the leading zeroes.
-#
-# Note: you can get the same effect using the keep_leading_zeros() method but
-# this serves as a simple example.
-#
-$worksheet->add_write_handler(qr[^\d{7}$], \&write_my_id);
-
-
-###############################################################################
-#
-# The following function processes the data when a match is found. The handler
-# is set up so that it only filters data if it is in the third column.
-#
-sub write_my_id {
-
-    my $worksheet = shift;
-    my $col       = $_[1];
-
-    # col is zero based
-    if ($col != 2) {
-        return $worksheet->write_string(@_);
-    }
-    else {
-        # Reject the match and return control to write()
-        return undef;
-    }
-
-}
-
-
-# This format maintains the cell as text even if it is edited.
-my $id_format   = $workbook->add_format(num_format => '@');
-
-
-# Write some numbers in the user defined format
-$worksheet->write('A1', '0000000', $id_format);
-$worksheet->write('B1', '0000001', $id_format);
-$worksheet->write('C1', '0000002', $id_format);
-$worksheet->write('D1', '0000003', $id_format);
-
-
-
-__END__
-
+#!/usr/bin/perl -w
+
+###############################################################################
+#
+# Example of how to add a user defined data handler to the Spreadsheet::
+# WriteExcel write() method.
+#
+# The following example shows how to add a handler for a 7 digit ID number.
+# It adds an additional constraint to the write_handler1.pl in that it only
+# filters data if it isn't in the third column.
+#
+#
+# reverse('©'), September 2004, John McNamara, jmcnamara at cpan.org
+#
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+
+my $workbook    = Spreadsheet::WriteExcel->new("write_handler2.xls");
+my $worksheet   = $workbook->add_worksheet();
+
+
+###############################################################################
+#
+# Add a handler for 7 digit id numbers. This is useful when you want a string
+# such as 0000001 written as a string instead of a number and thus preserve
+# the leading zeroes.
+#
+# Note: you can get the same effect using the keep_leading_zeros() method but
+# this serves as a simple example.
+#
+$worksheet->add_write_handler(qr[^\d{7}$], \&write_my_id);
+
+
+###############################################################################
+#
+# The following function processes the data when a match is found. The handler
+# is set up so that it only filters data if it is in the third column.
+#
+sub write_my_id {
+
+    my $worksheet = shift;
+    my $col       = $_[1];
+
+    # col is zero based
+    if ($col != 2) {
+        return $worksheet->write_string(@_);
+    }
+    else {
+        # Reject the match and return control to write()
+        return undef;
+    }
+
+}
+
+
+# This format maintains the cell as text even if it is edited.
+my $id_format   = $workbook->add_format(num_format => '@');
+
+
+# Write some numbers in the user defined format
+$worksheet->write('A1', '0000000', $id_format);
+$worksheet->write('B1', '0000001', $id_format);
+$worksheet->write('C1', '0000002', $id_format);
+$worksheet->write('D1', '0000003', $id_format);
+
+
+
+__END__
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/write_handler3.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/write_handler3.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/write_handler3.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,63 +1,63 @@
-#!/usr/bin/perl -w
-
-###############################################################################
-#
-# Example of how to add a user defined data handler to the Spreadsheet::
-# WriteExcel write() method.
-#
-# The following example shows how to add a handler for dates in a specific
-# format.
-#
-#
-# reverse('©'), September 2004, John McNamara, jmcnamara at cpan.org
-#
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-
-my $workbook    = Spreadsheet::WriteExcel->new("write_handler3.xls");
-my $worksheet   = $workbook->add_worksheet();
-my $date_format = $workbook->add_format(num_format => 'dd/mm/yy');
-
-
-###############################################################################
-#
-# Add a handler to match dates in the following format: d/m/yyyy
-#
-# The day and month can be single or double digits.
-#
-$worksheet->add_write_handler(qr[^\d{1,2}/\d{1,2}/\d{4}$], \&write_my_date);
-
-
-###############################################################################
-#
-# The following function processes the data when a match is found.
-# See write_handler4.pl for a more rigorous example with error handling.
-#
-sub write_my_date {
-
-    my $worksheet = shift;
-    my @args      = @_;
-
-    my $token     = $args[2];
-       $token     =~ qr[^(\d{1,2})/(\d{1,2})/(\d{4})$];
-
-    # Change to the date format required by write_date_time().
-    my $date = sprintf "%4d-%02d-%02dT", $3, $2, $1;
-
-    $args[2] = $date;
-
-    return $worksheet->write_date_time(@args);
-}
-
-
-# Write some dates in the user defined format
-$worksheet->write('A1', '22/12/2004', $date_format);
-$worksheet->write('A2', '1/1/1995',   $date_format);
-$worksheet->write('A3', '01/01/1995', $date_format);
-
-
-
-__END__
-
+#!/usr/bin/perl -w
+
+###############################################################################
+#
+# Example of how to add a user defined data handler to the Spreadsheet::
+# WriteExcel write() method.
+#
+# The following example shows how to add a handler for dates in a specific
+# format.
+#
+#
+# reverse('©'), September 2004, John McNamara, jmcnamara at cpan.org
+#
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+
+my $workbook    = Spreadsheet::WriteExcel->new("write_handler3.xls");
+my $worksheet   = $workbook->add_worksheet();
+my $date_format = $workbook->add_format(num_format => 'dd/mm/yy');
+
+
+###############################################################################
+#
+# Add a handler to match dates in the following format: d/m/yyyy
+#
+# The day and month can be single or double digits.
+#
+$worksheet->add_write_handler(qr[^\d{1,2}/\d{1,2}/\d{4}$], \&write_my_date);
+
+
+###############################################################################
+#
+# The following function processes the data when a match is found.
+# See write_handler4.pl for a more rigorous example with error handling.
+#
+sub write_my_date {
+
+    my $worksheet = shift;
+    my @args      = @_;
+
+    my $token     = $args[2];
+       $token     =~ qr[^(\d{1,2})/(\d{1,2})/(\d{4})$];
+
+    # Change to the date format required by write_date_time().
+    my $date = sprintf "%4d-%02d-%02dT", $3, $2, $1;
+
+    $args[2] = $date;
+
+    return $worksheet->write_date_time(@args);
+}
+
+
+# Write some dates in the user defined format
+$worksheet->write('A1', '22/12/2004', $date_format);
+$worksheet->write('A2', '1/1/1995',   $date_format);
+$worksheet->write('A3', '01/01/1995', $date_format);
+
+
+
+__END__
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/write_handler4.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/write_handler4.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/write_handler4.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,99 +1,99 @@
-#!/usr/bin/perl -w
-
-###############################################################################
-#
-# Example of how to add a user defined data handler to the Spreadsheet::
-# WriteExcel write() method.
-#
-# The following example shows how to add a handler for dates in a specific
-# format.
-#
-#
-# reverse('©'), September 2004, John McNamara, jmcnamara at cpan.org
-#
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-
-my $workbook    = Spreadsheet::WriteExcel->new("write_handler4.xls");
-my $worksheet   = $workbook->add_worksheet();
-my $date_format = $workbook->add_format(num_format => 'dd/mm/yy');
-
-
-###############################################################################
-#
-# Add a handler to match dates in the following formats: d/m/yy, d/m/yyyy
-#
-# The day and month can be single or double digits and the year can be  2 or 4
-# digits.
-#
-$worksheet->add_write_handler(qr[^\d{1,2}/\d{1,2}/\d{2,4}$], \&write_my_date);
-
-
-###############################################################################
-#
-# The following function processes the data when a match is found.
-#
-sub write_my_date {
-
-    my $worksheet = shift;
-    my @args      = @_;
-
-    my $token     = $args[2];
-
-    if ($token =~  qr[^(\d{1,2})/(\d{1,2})/(\d{2,4})$]) {
-
-        my $day  = $1;
-        my $mon  = $2;
-        my $year = $3;
-
-        # Use a window for 2 digit dates. This will keep some ragged Perl
-        # programmer employed in thirty years time. :-)
-        if (length $year == 2) {
-            if ($year < 50) {
-                $year += 2000;
-            }
-            else {
-                $year += 1900;
-            }
-        }
-
-        my $date = sprintf "%4d-%02d-%02dT", $year, $mon, $day;
-
-        # Convert the ISO ISO8601 style string to an Excel date
-        $date = $worksheet->convert_date_time($date);
-
-        if (defined $date) {
-            # Date was valid
-            $args[2] = $date;
-            return $worksheet->write_number(@args);
-        }
-        else {
-            # Not a valid date therefore write as a string
-            return $worksheet->write_string(@args);
-        }
-    }
-    else {
-        # Shouldn't happen if the same match is used in the re and sub.
-        return undef;
-    }
-}
-
-
-# Write some dates in the user defined format
-$worksheet->write('A1', '22/12/2004', $date_format);
-$worksheet->write('A2', '22/12/04',   $date_format);
-$worksheet->write('A3', '2/12/04',    $date_format);
-$worksheet->write('A4', '2/5/04',     $date_format);
-$worksheet->write('A5', '2/5/95',     $date_format);
-$worksheet->write('A6', '2/5/1995',   $date_format);
-
-# Some erroneous dates
-$worksheet->write('A8', '2/5/1895',   $date_format); # Date out of Excel range
-$worksheet->write('A9', '29/2/2003',  $date_format); # Invalid leap day
-$worksheet->write('A10','50/50/50',   $date_format); # Matches but isn't a date
-
-
-__END__
-
+#!/usr/bin/perl -w
+
+###############################################################################
+#
+# Example of how to add a user defined data handler to the Spreadsheet::
+# WriteExcel write() method.
+#
+# The following example shows how to add a handler for dates in a specific
+# format.
+#
+#
+# reverse('©'), September 2004, John McNamara, jmcnamara at cpan.org
+#
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+
+my $workbook    = Spreadsheet::WriteExcel->new("write_handler4.xls");
+my $worksheet   = $workbook->add_worksheet();
+my $date_format = $workbook->add_format(num_format => 'dd/mm/yy');
+
+
+###############################################################################
+#
+# Add a handler to match dates in the following formats: d/m/yy, d/m/yyyy
+#
+# The day and month can be single or double digits and the year can be  2 or 4
+# digits.
+#
+$worksheet->add_write_handler(qr[^\d{1,2}/\d{1,2}/\d{2,4}$], \&write_my_date);
+
+
+###############################################################################
+#
+# The following function processes the data when a match is found.
+#
+sub write_my_date {
+
+    my $worksheet = shift;
+    my @args      = @_;
+
+    my $token     = $args[2];
+
+    if ($token =~  qr[^(\d{1,2})/(\d{1,2})/(\d{2,4})$]) {
+
+        my $day  = $1;
+        my $mon  = $2;
+        my $year = $3;
+
+        # Use a window for 2 digit dates. This will keep some ragged Perl
+        # programmer employed in thirty years time. :-)
+        if (length $year == 2) {
+            if ($year < 50) {
+                $year += 2000;
+            }
+            else {
+                $year += 1900;
+            }
+        }
+
+        my $date = sprintf "%4d-%02d-%02dT", $year, $mon, $day;
+
+        # Convert the ISO ISO8601 style string to an Excel date
+        $date = $worksheet->convert_date_time($date);
+
+        if (defined $date) {
+            # Date was valid
+            $args[2] = $date;
+            return $worksheet->write_number(@args);
+        }
+        else {
+            # Not a valid date therefore write as a string
+            return $worksheet->write_string(@args);
+        }
+    }
+    else {
+        # Shouldn't happen if the same match is used in the re and sub.
+        return undef;
+    }
+}
+
+
+# Write some dates in the user defined format
+$worksheet->write('A1', '22/12/2004', $date_format);
+$worksheet->write('A2', '22/12/04',   $date_format);
+$worksheet->write('A3', '2/12/04',    $date_format);
+$worksheet->write('A4', '2/5/04',     $date_format);
+$worksheet->write('A5', '2/5/95',     $date_format);
+$worksheet->write('A6', '2/5/1995',   $date_format);
+
+# Some erroneous dates
+$worksheet->write('A8', '2/5/1895',   $date_format); # Date out of Excel range
+$worksheet->write('A9', '29/2/2003',  $date_format); # Invalid leap day
+$worksheet->write('A10','50/50/50',   $date_format); # Matches but isn't a date
+
+
+__END__
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/examples/write_to_scalar.pl
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/examples/write_to_scalar.pl	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/examples/write_to_scalar.pl	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,46 +1,46 @@
-#!/usr/bin/perl -w
-
-##############################################################################
-#
-# An example of writing an Excel file to a Perl scalar using Spreadsheet::
-# WriteExcel and the new features of perl 5.8.
-#
-# For an examples of how to write to a scalar in versions prior to perl 5.8
-# see the filehandle.pl program and IO:Scalar.
-#
-# reverse('©'), September 2004, John McNamara, jmcnamara at cpan.org
-#
-
-use strict;
-use Spreadsheet::WriteExcel;
-
-require 5.008;
-
-
-# Use perl 5.8's feature of using a scalar as a filehandle.
-my   $fh;
-my   $str = '';
-open $fh, '>', \$str or die "Failed to open filehandle: $!";;
-
-
-# Or replace the previous three lines with this:
-# open my $fh, '>', \my $str or die "Failed to open filehandle: $!";
-
-
-# Spreadsheet::WriteExce accepts filehandle as well as file names.
-my $workbook  = Spreadsheet::WriteExcel->new($fh);
-my $worksheet = $workbook->add_worksheet();
-
-$worksheet->write(0, 0,  "Hi Excel!");
-
-$workbook->close();
-
-
-# The Excel file in now in $str. Remember to binmode() the output
-# filehandle before printing it.
-binmode STDOUT;
-print $str;
-
-
-__END__
-
+#!/usr/bin/perl -w
+
+##############################################################################
+#
+# An example of writing an Excel file to a Perl scalar using Spreadsheet::
+# WriteExcel and the new features of perl 5.8.
+#
+# For an examples of how to write to a scalar in versions prior to perl 5.8
+# see the filehandle.pl program and IO:Scalar.
+#
+# reverse('©'), September 2004, John McNamara, jmcnamara at cpan.org
+#
+
+use strict;
+use Spreadsheet::WriteExcel;
+
+require 5.008;
+
+
+# Use perl 5.8's feature of using a scalar as a filehandle.
+my   $fh;
+my   $str = '';
+open $fh, '>', \$str or die "Failed to open filehandle: $!";;
+
+
+# Or replace the previous three lines with this:
+# open my $fh, '>', \my $str or die "Failed to open filehandle: $!";
+
+
+# Spreadsheet::WriteExce accepts filehandle as well as file names.
+my $workbook  = Spreadsheet::WriteExcel->new($fh);
+my $worksheet = $workbook->add_worksheet();
+
+$worksheet->write(0, 0,  "Hi Excel!");
+
+$workbook->close();
+
+
+# The Excel file in now in $str. Remember to binmode() the output
+# filehandle before printing it.
+binmode STDOUT;
+print $str;
+
+
+__END__
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/lib/Spreadsheet/WriteExcel/BIFFwriter.pm
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/lib/Spreadsheet/WriteExcel/BIFFwriter.pm	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/lib/Spreadsheet/WriteExcel/BIFFwriter.pm	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,275 +1,309 @@
-package Spreadsheet::WriteExcel::BIFFwriter;
-
-###############################################################################
-#
-# BIFFwriter - An abstract base class for Excel workbooks and worksheets.
-#
-#
-# Used in conjunction with Spreadsheet::WriteExcel
-#
-# Copyright 2000-2005, John McNamara, jmcnamara at cpan.org
-#
-# Documentation after __END__
-#
-
-use Exporter;
-use strict;
-
-
-
-
-
-
-
-use vars qw($VERSION @ISA);
- at ISA = qw(Exporter);
-
-$VERSION = '2.01';
-
-###############################################################################
-#
-# Class data.
-#
-my $byte_order   = '';
-my $BIFF_version = 0x0600;
-
-
-###############################################################################
-#
-# new()
-#
-# Constructor
-#
-sub new {
-
-    my $class  = $_[0];
-
-    my $self   = {
-                    _byte_order    => '',
-                    _data          => '',
-                    _datasize      => 0,
-                    _limit         => 8224,
-                 };
-
-    bless $self, $class;
-    $self->_set_byte_order();
-    return $self;
-}
-
-
-###############################################################################
-#
-# _set_byte_order()
-#
-# Determine the byte order and store it as class data to avoid
-# recalculating it for each call to new().
-#
-sub _set_byte_order {
-
-    my $self    = shift;
-
-    if ($byte_order eq ''){
-        # Check if "pack" gives the required IEEE 64bit float
-        my $teststr = pack "d", 1.2345;
-        my @hexdata =(0x8D, 0x97, 0x6E, 0x12, 0x83, 0xC0, 0xF3, 0x3F);
-        my $number  = pack "C8", @hexdata;
-
-        if ($number eq $teststr) {
-            $byte_order = 0;    # Little Endian
-        }
-        elsif ($number eq reverse($teststr)){
-            $byte_order = 1;    # Big Endian
-        }
-        else {
-            # Give up. I'll fix this in a later version.
-            croak ( "Required floating point format not supported "  .
-                    "on this platform. See the portability section " .
-                    "of the documentation."
-            );
-        }
-    }
-    $self->{_byte_order} = $byte_order;
-}
-
-
-###############################################################################
-#
-# _prepend($data)
-#
-# General storage function
-#
-sub _prepend {
-
-    my $self    = shift;
-    my $data    = join('', @_);
-
-    $data = $self->_add_continue($data) if length($data) > $self->{_limit};
-
-    $self->{_data}      = $data . $self->{_data};
-    $self->{_datasize} += length($data);
-}
-
-
-###############################################################################
-#
-# _append($data)
-#
-# General storage function
-#
-sub _append {
-
-    my $self    = shift;
-    my $data    = join('', @_);
-
-    $data = $self->_add_continue($data) if length($data) > $self->{_limit};
-
-    $self->{_data}      = $self->{_data} . $data;
-    $self->{_datasize} += length($data);
-}
-
-
-###############################################################################
-#
-# _store_bof($type)
-#
-# $type = 0x0005, Workbook
-# $type = 0x0010, Worksheet
-#
-# Writes Excel BOF record to indicate the beginning of a stream or
-# sub-stream in the BIFF file.
-#
-sub _store_bof {
-
-    my $self    = shift;
-    my $record  = 0x0809;        # Record identifier
-    my $length  = 0x0010;        # Number of bytes to follow
-
-    my $version = $BIFF_version;
-    my $type    = $_[0];
-
-    # According to the SDK $build and $year should be set to zero.
-    # However, this throws a warning in Excel 5. So, use these
-    # magic numbers.
-    my $build   = 0x0DBB;
-    my $year    = 0x07CC;
-
-    my $bfh     = 0x00000041;
-    my $sfo     = 0x00000006;
-
-    my $header  = pack("vv",   $record, $length);
-    my $data    = pack("vvvvVV", $version, $type, $build, $year, $bfh, $sfo);
-
-    $self->_prepend($header, $data);
-}
-
-
-###############################################################################
-#
-# _store_eof()
-#
-# Writes Excel EOF record to indicate the end of a BIFF stream.
-#
-sub _store_eof {
-
-    my $self      = shift;
-    my $record    = 0x000A; # Record identifier
-    my $length    = 0x0000; # Number of bytes to follow
-
-    my $header    = pack("vv", $record, $length);
-
-    $self->_append($header);
-}
-
-
-###############################################################################
-#
-# _add_continue()
-#
-# Excel limits the size of BIFF records. In Excel 5 the limit is 2084 bytes. In
-# Excel 97 the limit is 8228 bytes. Records that are longer than these limits
-# must be split up into CONTINUE blocks.
-#
-# This function take a long BIFF record and inserts CONTINUE records as
-# necessary.
-#
-sub _add_continue {
-
-    my $self        = shift;
-    my $data        = $_[0];
-    my $limit       = $self->{_limit};
-    my $record      = 0x003C; # Record identifier
-    my $length;               # Number of bytes to follow
-    my $header;
-    my $tmp;
-
-    # The first 2080/8224 bytes remain intact. However, we have to change
-    # the length field of the record.
-    #
-    $tmp = substr($data, 0, $limit, "");
-    substr($tmp, 2, 2, pack("v", $limit-4));
-
-    # Strip out chunks of 2080/8224 bytes +4 for the header.
-    while (length($data) > $limit) {
-        $header  = pack("vv", $record, $limit);
-        $tmp    .= $header;
-        $tmp    .= substr($data, 0, $limit, "");
-    }
-
-    # Mop up the last of the data
-    $header  = pack("vv", $record, length($data));
-    $tmp    .= $header;
-    $tmp    .= $data;
-
-    return $tmp ;
-}
-
-###############################################################################
-#
-# For debugging
-#
-sub _hexout {
-
-    my $self = shift;
-
-    print +(caller(1))[3], "\n";
-
-    my $data = join '', @_;
-
-    my @bytes = unpack("H*", $data) =~ /../g;
-
-    while (@bytes > 16) {
-        print join " ", splice @bytes, 0, 16;
-        print "\n";
-    }
-    print join " ", @bytes, "\n\n";
-}
-
-
-
-1;
-
-
-__END__
-
-
-=head1 NAME
-
-BIFFwriter - An abstract base class for Excel workbooks and worksheets.
-
-=head1 SYNOPSIS
-
-See the documentation for Spreadsheet::WriteExcel
-
-=head1 DESCRIPTION
-
-This module is used in conjunction with Spreadsheet::WriteExcel.
-
-=head1 AUTHOR
-
-John McNamara jmcnamara at cpan.org
-
-=head1 COPYRIGHT
-
-© MM-MMV, John McNamara.
-
-All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.
+package Spreadsheet::WriteExcel::BIFFwriter;
+
+###############################################################################
+#
+# BIFFwriter - An abstract base class for Excel workbooks and worksheets.
+#
+#
+# Used in conjunction with Spreadsheet::WriteExcel
+#
+# Copyright 2000-2006, John McNamara, jmcnamara at cpan.org
+#
+# Documentation after __END__
+#
+
+use Exporter;
+use strict;
+
+
+
+
+
+
+
+use vars qw($VERSION @ISA);
+ at ISA = qw(Exporter);
+
+$VERSION = '2.01';
+
+###############################################################################
+#
+# Class data.
+#
+my $byte_order   = '';
+my $BIFF_version = 0x0600;
+
+
+###############################################################################
+#
+# new()
+#
+# Constructor
+#
+sub new {
+
+    my $class  = $_[0];
+
+    my $self   = {
+                    _byte_order    => '',
+                    _data          => '',
+                    _datasize      => 0,
+                    _limit         => 8224,
+                 };
+
+    bless $self, $class;
+    $self->_set_byte_order();
+    return $self;
+}
+
+
+###############################################################################
+#
+# _set_byte_order()
+#
+# Determine the byte order and store it as class data to avoid
+# recalculating it for each call to new().
+#
+sub _set_byte_order {
+
+    my $self    = shift;
+
+    if ($byte_order eq ''){
+        # Check if "pack" gives the required IEEE 64bit float
+        my $teststr = pack "d", 1.2345;
+        my @hexdata =(0x8D, 0x97, 0x6E, 0x12, 0x83, 0xC0, 0xF3, 0x3F);
+        my $number  = pack "C8", @hexdata;
+
+        if ($number eq $teststr) {
+            $byte_order = 0;    # Little Endian
+        }
+        elsif ($number eq reverse($teststr)){
+            $byte_order = 1;    # Big Endian
+        }
+        else {
+            # Give up. I'll fix this in a later version.
+            croak ( "Required floating point format not supported "  .
+                    "on this platform. See the portability section " .
+                    "of the documentation."
+            );
+        }
+    }
+    $self->{_byte_order} = $byte_order;
+}
+
+
+###############################################################################
+#
+# _prepend($data)
+#
+# General storage function
+#
+sub _prepend {
+
+    my $self    = shift;
+    my $data    = join('', @_);
+
+    $data = $self->_add_continue($data) if length($data) > $self->{_limit};
+
+    $self->{_data}      = $data . $self->{_data};
+    $self->{_datasize} += length($data);
+
+    return $data;
+}
+
+
+###############################################################################
+#
+# _append($data)
+#
+# General storage function
+#
+sub _append {
+
+    my $self    = shift;
+    my $data    = join('', @_);
+
+    $data = $self->_add_continue($data) if length($data) > $self->{_limit};
+
+    $self->{_data}      = $self->{_data} . $data;
+    $self->{_datasize} += length($data);
+
+    return $data;
+}
+
+
+###############################################################################
+#
+# _store_bof($type)
+#
+# $type = 0x0005, Workbook
+# $type = 0x0010, Worksheet
+#
+# Writes Excel BOF record to indicate the beginning of a stream or
+# sub-stream in the BIFF file.
+#
+sub _store_bof {
+
+    my $self    = shift;
+    my $record  = 0x0809;        # Record identifier
+    my $length  = 0x0010;        # Number of bytes to follow
+
+    my $version = $BIFF_version;
+    my $type    = $_[0];
+
+    # According to the SDK $build and $year should be set to zero.
+    # However, this throws a warning in Excel 5. So, use these
+    # magic numbers.
+    my $build   = 0x0DBB;
+    my $year    = 0x07CC;
+
+    my $bfh     = 0x00000041;
+    my $sfo     = 0x00000006;
+
+    my $header  = pack("vv",   $record, $length);
+    my $data    = pack("vvvvVV", $version, $type, $build, $year, $bfh, $sfo);
+
+    $self->_prepend($header, $data);
+}
+
+
+###############################################################################
+#
+# _store_eof()
+#
+# Writes Excel EOF record to indicate the end of a BIFF stream.
+#
+sub _store_eof {
+
+    my $self      = shift;
+    my $record    = 0x000A; # Record identifier
+    my $length    = 0x0000; # Number of bytes to follow
+
+    my $header    = pack("vv", $record, $length);
+
+    $self->_append($header);
+}
+
+
+###############################################################################
+#
+# _add_continue()
+#
+# Excel limits the size of BIFF records. In Excel 5 the limit is 2084 bytes. In
+# Excel 97 the limit is 8228 bytes. Records that are longer than these limits
+# must be split up into CONTINUE blocks.
+#
+# This function take a long BIFF record and inserts CONTINUE records as
+# necessary.
+#
+sub _add_continue {
+
+    my $self        = shift;
+    my $data        = $_[0];
+    my $limit       = $self->{_limit};
+    my $record      = 0x003C; # Record identifier
+    my $length;               # Number of bytes to follow
+    my $header;
+    my $tmp;
+
+    # The first 2080/8224 bytes remain intact. However, we have to change
+    # the length field of the record.
+    #
+    $tmp = substr($data, 0, $limit, "");
+    substr($tmp, 2, 2, pack("v", $limit-4));
+
+    # Strip out chunks of 2080/8224 bytes +4 for the header.
+    while (length($data) > $limit) {
+        $header  = pack("vv", $record, $limit);
+        $tmp    .= $header;
+        $tmp    .= substr($data, 0, $limit, "");
+    }
+
+    # Mop up the last of the data
+    $header  = pack("vv", $record, length($data));
+    $tmp    .= $header;
+    $tmp    .= $data;
+
+    return $tmp ;
+}
+
+
+###############################################################################
+#
+# _add_mso_generic()
+#
+# Create a mso structure that is part of an Escher drawing object. These are
+# are used for images, comments and filters. This generic method is used by
+# other methods to create specific mso records.
+#
+# Returns the packed record.
+#
+sub _add_mso_generic {
+
+    my $self        = shift;
+    my $type        = $_[0];
+    my $version     = $_[1];
+    my $instance    = $_[2];
+    my $data        = $_[3];
+    my $length      = defined $_[4] ? $_[4] : length($data);
+
+    # The header contains version and instance info packed into 2 bytes.
+    my $header      = $version | ($instance << 4);
+
+    my $record      = pack "vvV", $header, $type, $length;
+       $record     .= $data;
+
+    return $record;
+}
+
+
+###############################################################################
+#
+# For debugging
+#
+sub _hexout {
+
+    my $self = shift;
+
+    print +(caller(1))[3], "\n";
+
+    my $data = join '', @_;
+
+    my @bytes = unpack("H*", $data) =~ /../g;
+
+    while (@bytes > 16) {
+        print join " ", splice @bytes, 0, 16;
+        print "\n";
+    }
+    print join " ", @bytes, "\n\n";
+}
+
+
+
+1;
+
+
+__END__
+
+
+=head1 NAME
+
+BIFFwriter - An abstract base class for Excel workbooks and worksheets.
+
+=head1 SYNOPSIS
+
+See the documentation for Spreadsheet::WriteExcel
+
+=head1 DESCRIPTION
+
+This module is used in conjunction with Spreadsheet::WriteExcel.
+
+=head1 AUTHOR
+
+John McNamara jmcnamara at cpan.org
+
+=head1 COPYRIGHT
+
+© MM-MMVI, John McNamara.
+
+All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.

Modified: packages/libspreadsheet-writeexcel-perl/trunk/lib/Spreadsheet/WriteExcel/Big.pm
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/lib/Spreadsheet/WriteExcel/Big.pm	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/lib/Spreadsheet/WriteExcel/Big.pm	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,99 +1,99 @@
-package Spreadsheet::WriteExcel::Big;
-
-###############################################################################
-#
-# WriteExcel::Big
-#
-# Spreadsheet::WriteExcel - Write formatted text and numbers to a
-# cross-platform Excel binary file.
-#
-# Copyright 2000-2005, John McNamara.
-#
-#
-
-require Exporter;
-
-use strict;
-use Spreadsheet::WriteExcel::WorkbookBig;
-
-
-
-
-use vars qw($VERSION @ISA);
- at ISA = qw(Spreadsheet::WriteExcel::WorkbookBig Exporter);
-
-$VERSION = '2.01'; # May 2000
-
-###############################################################################
-#
-# new()
-#
-# Constructor. Wrapper for a Workbook object.
-# uses: Spreadsheet::WriteExcel::BIFFwriter
-#       Spreadsheet::WriteExcel::OLEwriter
-#       Spreadsheet::WriteExcel::WorkbookBig
-#       Spreadsheet::WriteExcel::Worksheet
-#       Spreadsheet::WriteExcel::Format
-#
-sub new {
-
-    my $class = shift;
-    my $self  = Spreadsheet::WriteExcel::WorkbookBig->new($_[0]);
-
-    bless  $self, $class;
-    return $self;
-}
-
-
-1;
-
-
-__END__
-
-
-
-=head1 NAME
-
-
-Big - A class for creating Excel files > 7MB.
-
-
-=head1 SYNOPSIS
-
-
-See the documentation for Spreadsheet::WriteExcel.
-
-
-=head1 DESCRIPTION
-
-
-This module is used in conjunction with Spreadsheet::WriteExcel.
-
-    use Spreadsheet::WriteExcel::Big;
-
-    my $workbook  = Spreadsheet::WriteExcel::Big->new("file.xls");
-    my $worksheet = $workbook->add_worksheet();
-
-    # Same as Spreadsheet::WriteExcel
-    ...
-    ...
-
-
-=head1 REQUIREMENTS
-
-IO::Stringy and OLE::Storage_Lite
-
-
-=head1 AUTHOR
-
-
-John McNamara jmcnamara at cpan.org
-
-
-=head1 COPYRIGHT
-
-
-© MM-MMV, John McNamara.
-
-
-All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.
+package Spreadsheet::WriteExcel::Big;
+
+###############################################################################
+#
+# WriteExcel::Big
+#
+# Spreadsheet::WriteExcel - Write formatted text and numbers to a
+# cross-platform Excel binary file.
+#
+# Copyright 2000-2006, John McNamara.
+#
+#
+
+require Exporter;
+
+use strict;
+use Spreadsheet::WriteExcel::WorkbookBig;
+
+
+
+
+use vars qw($VERSION @ISA);
+ at ISA = qw(Spreadsheet::WriteExcel::WorkbookBig Exporter);
+
+$VERSION = '2.01'; # May 2000
+
+###############################################################################
+#
+# new()
+#
+# Constructor. Wrapper for a Workbook object.
+# uses: Spreadsheet::WriteExcel::BIFFwriter
+#       Spreadsheet::WriteExcel::OLEwriter
+#       Spreadsheet::WriteExcel::WorkbookBig
+#       Spreadsheet::WriteExcel::Worksheet
+#       Spreadsheet::WriteExcel::Format
+#
+sub new {
+
+    my $class = shift;
+    my $self  = Spreadsheet::WriteExcel::WorkbookBig->new($_[0]);
+
+    bless  $self, $class;
+    return $self;
+}
+
+
+1;
+
+
+__END__
+
+
+
+=head1 NAME
+
+
+Big - A class for creating Excel files > 7MB.
+
+
+=head1 SYNOPSIS
+
+
+See the documentation for Spreadsheet::WriteExcel.
+
+
+=head1 DESCRIPTION
+
+
+This module is used in conjunction with Spreadsheet::WriteExcel.
+
+    use Spreadsheet::WriteExcel::Big;
+
+    my $workbook  = Spreadsheet::WriteExcel::Big->new("file.xls");
+    my $worksheet = $workbook->add_worksheet();
+
+    # Same as Spreadsheet::WriteExcel
+    ...
+    ...
+
+
+=head1 REQUIREMENTS
+
+IO::Stringy and OLE::Storage_Lite
+
+
+=head1 AUTHOR
+
+
+John McNamara jmcnamara at cpan.org
+
+
+=head1 COPYRIGHT
+
+
+© MM-MMVI, John McNamara.
+
+
+All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.

Modified: packages/libspreadsheet-writeexcel-perl/trunk/lib/Spreadsheet/WriteExcel/Chart.pm
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/lib/Spreadsheet/WriteExcel/Chart.pm	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/lib/Spreadsheet/WriteExcel/Chart.pm	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,292 +1,292 @@
-package Spreadsheet::WriteExcel::Chart;
-
-###############################################################################
-#
-# Chart - A writer class for Excel Charts.
-#
-#
-# Used in conjunction with Spreadsheet::WriteExcel
-#
-# Copyright 2000-2005, John McNamara, jmcnamara at cpan.org
-#
-# Documentation after __END__
-#
-
-use Exporter;
-use strict;
-use Carp;
-use FileHandle;
-use Spreadsheet::WriteExcel::BIFFwriter;
-
-
-
-
-use vars qw($VERSION @ISA);
- at ISA = qw(Spreadsheet::WriteExcel::BIFFwriter);
-
-$VERSION = '2.13';
-
-###############################################################################
-#
-# new()
-#
-# Constructor. Creates a new Chart object from a BIFFwriter object
-#
-sub new {
-
-    my $class                   = shift;
-    my $self                    = Spreadsheet::WriteExcel::BIFFwriter->new();
-
-    $self->{_filename}          = $_[0];
-    $self->{_name}              = $_[1];
-    $self->{_index}             = $_[2];
-    $self->{_encoding}          = $_[3];
-    $self->{_activesheet}       = $_[4];
-    $self->{_firstsheet}        = $_[5];
-
-    $self->{_type}              = 0x0200;
-    $self->{_ext_sheets}        = [];
-    $self->{_using_tmpfile}     = 1;
-    $self->{_filehandle}        = "";
-    $self->{_fileclosed}        = 0;
-    $self->{_offset}            = 0;
-    $self->{_xls_rowmax}        = 0;
-    $self->{_xls_colmax}        = 0;
-    $self->{_xls_strmax}        = 0;
-    $self->{_dim_rowmin}        = 0;
-    $self->{_dim_rowmax}        = 0;
-    $self->{_dim_colmin}        = 0;
-    $self->{_dim_colmax}        = 0;
-    $self->{_dim_changed}       = 0;
-    $self->{_colinfo}           = [];
-    $self->{_selection}         = [0, 0];
-    $self->{_panes}             = [];
-    $self->{_active_pane}       = 3;
-    $self->{_frozen}            = 0;
-    $self->{_selected}          = 0;
-    $self->{_hidden}            = 0;
-
-    $self->{_paper_size}        = 0x0;
-    $self->{_orientation}       = 0x1;
-    $self->{_header}            = '';
-    $self->{_footer}            = '';
-    $self->{_hcenter}           = 0;
-    $self->{_vcenter}           = 0;
-    $self->{_margin_head}       = 0.50;
-    $self->{_margin_foot}       = 0.50;
-    $self->{_margin_left}       = 0.75;
-    $self->{_margin_right}      = 0.75;
-    $self->{_margin_top}        = 1.00;
-    $self->{_margin_bottom}     = 1.00;
-
-    $self->{_title_rowmin}      = undef;
-    $self->{_title_rowmax}      = undef;
-    $self->{_title_colmin}      = undef;
-    $self->{_title_colmax}      = undef;
-    $self->{_print_rowmin}      = undef;
-    $self->{_print_rowmax}      = undef;
-    $self->{_print_colmin}      = undef;
-    $self->{_print_colmax}      = undef;
-
-    $self->{_print_gridlines}   = 1;
-    $self->{_screen_gridlines}  = 1;
-    $self->{_print_headers}     = 0;
-
-    $self->{_fit_page}          = 0;
-    $self->{_fit_width}         = 0;
-    $self->{_fit_height}        = 0;
-
-    $self->{_hbreaks}           = [];
-    $self->{_vbreaks}           = [];
-
-    $self->{_protect}           = 0;
-    $self->{_password}          = undef;
-
-    $self->{_col_sizes}         = {};
-    $self->{_row_sizes}         = {};
-
-    $self->{_col_formats}       = {};
-    $self->{_row_formats}       = {};
-
-    $self->{_zoom}              = 100;
-    $self->{_print_scale}       = 100;
-
-    $self->{_leading_zeros}     = 0;
-
-    $self->{_outline_row_level} = 0;
-    $self->{_outline_style}     = 0;
-    $self->{_outline_below}     = 1;
-    $self->{_outline_right}     = 1;
-    $self->{_outline_on}        = 1;
-
-    bless $self, $class;
-    $self->_initialize();
-    return $self;
-}
-
-
-###############################################################################
-#
-# _initialize()
-#
-sub _initialize {
-
-    my $self       = shift;
-    my $filename   = $self->{_filename};
-    my $filehandle = FileHandle->new($filename) or
-                     die "Couldn't open $filename in add_chart_ext(): $!.\n";
-
-    binmode($filehandle);
-
-    $self->{_filehandle} = $filehandle;
-    $self->{_datasize}   = -s $filehandle;
-
-}
-
-
-###############################################################################
-#
-# _close()
-#
-# Add data to the beginning of the workbook (note the reverse order)
-# and to the end of the workbook.
-#
-sub _close {
-
-    my $self = shift;
-}
-
-
-###############################################################################
-#
-# get_name().
-#
-# Retrieve the worksheet name.
-#
-sub get_name {
-
-    my $self    = shift;
-
-    return $self->{_name};
-}
-
-
-###############################################################################
-#
-# get_data().
-#
-# Retrieves data from memory in one chunk, or from disk in $buffer
-# sized chunks.
-#
-sub get_data {
-
-    my $self   = shift;
-    my $buffer = 4096;
-    my $tmp;
-
-    return $tmp if read($self->{_filehandle}, $tmp, $buffer);
-
-    # No data to return
-    return undef;
-}
-
-
-###############################################################################
-#
-# select()
-#
-# Set this worksheet as a selected worksheet, i.e. the worksheet has its tab
-# highlighted.
-#
-sub select {
-
-    my $self = shift;
-
-    $self->{_hidden}         = 0; # Selected worksheet can't be hidden.
-    $self->{_selected}       = 1;
-}
-
-
-###############################################################################
-#
-# activate()
-#
-# Set this worksheet as the active worksheet, i.e. the worksheet that is
-# displayed when the workbook is opened. Also set it as selected.
-#
-sub activate {
-
-    my $self = shift;
-
-    $self->{_hidden}         = 0; # Active worksheet can't be hidden.
-    $self->{_selected}       = 1;
-    ${$self->{_activesheet}} = $self->{_index};
-}
-
-
-###############################################################################
-#
-# hide()
-#
-# Hide this worksheet.
-#
-sub hide {
-
-    my $self = shift;
-
-    $self->{_hidden}         = 1;
-
-    # A hidden worksheet shouldn't be active or selected.
-    $self->{_selected}       = 0;
-    ${$self->{_activesheet}} = 0;
-    ${$self->{_firstsheet}}  = 0;
-}
-
-
-###############################################################################
-#
-# set_first_sheet()
-#
-# Set this worksheet as the first visible sheet. This is necessary
-# when there are a large number of worksheets and the activated
-# worksheet is not visible on the screen.
-#
-sub set_first_sheet {
-
-    my $self = shift;
-
-    $self->{_hidden}         = 0; # Active worksheet can't be hidden.
-    ${$self->{_firstsheet}}  = $self->{_index};
-}
-
-
-
-
-1;
-
-
-__END__
-
-
-=head1 NAME
-
-Chart - A writer class for Excel Charts.
-
-=head1 SYNOPSIS
-
-See the documentation for Spreadsheet::WriteExcel
-
-=head1 DESCRIPTION
-
-This module is used in conjunction with Spreadsheet::WriteExcel.
-
-=head1 AUTHOR
-
-John McNamara jmcnamara at cpan.org
-
-=head1 COPYRIGHT
-
-© MM-MMV, John McNamara.
-
-All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.
-
+package Spreadsheet::WriteExcel::Chart;
+
+###############################################################################
+#
+# Chart - A writer class for Excel Charts.
+#
+#
+# Used in conjunction with Spreadsheet::WriteExcel
+#
+# Copyright 2000-2006, John McNamara, jmcnamara at cpan.org
+#
+# Documentation after __END__
+#
+
+use Exporter;
+use strict;
+use Carp;
+use FileHandle;
+use Spreadsheet::WriteExcel::BIFFwriter;
+
+
+
+
+use vars qw($VERSION @ISA);
+ at ISA = qw(Spreadsheet::WriteExcel::BIFFwriter);
+
+$VERSION = '2.13';
+
+###############################################################################
+#
+# new()
+#
+# Constructor. Creates a new Chart object from a BIFFwriter object
+#
+sub new {
+
+    my $class                   = shift;
+    my $self                    = Spreadsheet::WriteExcel::BIFFwriter->new();
+
+    $self->{_filename}          = $_[0];
+    $self->{_name}              = $_[1];
+    $self->{_index}             = $_[2];
+    $self->{_encoding}          = $_[3];
+    $self->{_activesheet}       = $_[4];
+    $self->{_firstsheet}        = $_[5];
+
+    $self->{_type}              = 0x0200;
+    $self->{_ext_sheets}        = [];
+    $self->{_using_tmpfile}     = 1;
+    $self->{_filehandle}        = "";
+    $self->{_fileclosed}        = 0;
+    $self->{_offset}            = 0;
+    $self->{_xls_rowmax}        = 0;
+    $self->{_xls_colmax}        = 0;
+    $self->{_xls_strmax}        = 0;
+    $self->{_dim_rowmin}        = 0;
+    $self->{_dim_rowmax}        = 0;
+    $self->{_dim_colmin}        = 0;
+    $self->{_dim_colmax}        = 0;
+    $self->{_dim_changed}       = 0;
+    $self->{_colinfo}           = [];
+    $self->{_selection}         = [0, 0];
+    $self->{_panes}             = [];
+    $self->{_active_pane}       = 3;
+    $self->{_frozen}            = 0;
+    $self->{_selected}          = 0;
+    $self->{_hidden}            = 0;
+
+    $self->{_paper_size}        = 0x0;
+    $self->{_orientation}       = 0x1;
+    $self->{_header}            = '';
+    $self->{_footer}            = '';
+    $self->{_hcenter}           = 0;
+    $self->{_vcenter}           = 0;
+    $self->{_margin_head}       = 0.50;
+    $self->{_margin_foot}       = 0.50;
+    $self->{_margin_left}       = 0.75;
+    $self->{_margin_right}      = 0.75;
+    $self->{_margin_top}        = 1.00;
+    $self->{_margin_bottom}     = 1.00;
+
+    $self->{_title_rowmin}      = undef;
+    $self->{_title_rowmax}      = undef;
+    $self->{_title_colmin}      = undef;
+    $self->{_title_colmax}      = undef;
+    $self->{_print_rowmin}      = undef;
+    $self->{_print_rowmax}      = undef;
+    $self->{_print_colmin}      = undef;
+    $self->{_print_colmax}      = undef;
+
+    $self->{_print_gridlines}   = 1;
+    $self->{_screen_gridlines}  = 1;
+    $self->{_print_headers}     = 0;
+
+    $self->{_fit_page}          = 0;
+    $self->{_fit_width}         = 0;
+    $self->{_fit_height}        = 0;
+
+    $self->{_hbreaks}           = [];
+    $self->{_vbreaks}           = [];
+
+    $self->{_protect}           = 0;
+    $self->{_password}          = undef;
+
+    $self->{_col_sizes}         = {};
+    $self->{_row_sizes}         = {};
+
+    $self->{_col_formats}       = {};
+    $self->{_row_formats}       = {};
+
+    $self->{_zoom}              = 100;
+    $self->{_print_scale}       = 100;
+
+    $self->{_leading_zeros}     = 0;
+
+    $self->{_outline_row_level} = 0;
+    $self->{_outline_style}     = 0;
+    $self->{_outline_below}     = 1;
+    $self->{_outline_right}     = 1;
+    $self->{_outline_on}        = 1;
+
+    bless $self, $class;
+    $self->_initialize();
+    return $self;
+}
+
+
+###############################################################################
+#
+# _initialize()
+#
+sub _initialize {
+
+    my $self       = shift;
+    my $filename   = $self->{_filename};
+    my $filehandle = FileHandle->new($filename) or
+                     die "Couldn't open $filename in add_chart_ext(): $!.\n";
+
+    binmode($filehandle);
+
+    $self->{_filehandle} = $filehandle;
+    $self->{_datasize}   = -s $filehandle;
+
+}
+
+
+###############################################################################
+#
+# _close()
+#
+# Add data to the beginning of the workbook (note the reverse order)
+# and to the end of the workbook.
+#
+sub _close {
+
+    my $self = shift;
+}
+
+
+###############################################################################
+#
+# get_name().
+#
+# Retrieve the worksheet name.
+#
+sub get_name {
+
+    my $self    = shift;
+
+    return $self->{_name};
+}
+
+
+###############################################################################
+#
+# get_data().
+#
+# Retrieves data from memory in one chunk, or from disk in $buffer
+# sized chunks.
+#
+sub get_data {
+
+    my $self   = shift;
+    my $buffer = 4096;
+    my $tmp;
+
+    return $tmp if read($self->{_filehandle}, $tmp, $buffer);
+
+    # No data to return
+    return undef;
+}
+
+
+###############################################################################
+#
+# select()
+#
+# Set this worksheet as a selected worksheet, i.e. the worksheet has its tab
+# highlighted.
+#
+sub select {
+
+    my $self = shift;
+
+    $self->{_hidden}         = 0; # Selected worksheet can't be hidden.
+    $self->{_selected}       = 1;
+}
+
+
+###############################################################################
+#
+# activate()
+#
+# Set this worksheet as the active worksheet, i.e. the worksheet that is
+# displayed when the workbook is opened. Also set it as selected.
+#
+sub activate {
+
+    my $self = shift;
+
+    $self->{_hidden}         = 0; # Active worksheet can't be hidden.
+    $self->{_selected}       = 1;
+    ${$self->{_activesheet}} = $self->{_index};
+}
+
+
+###############################################################################
+#
+# hide()
+#
+# Hide this worksheet.
+#
+sub hide {
+
+    my $self = shift;
+
+    $self->{_hidden}         = 1;
+
+    # A hidden worksheet shouldn't be active or selected.
+    $self->{_selected}       = 0;
+    ${$self->{_activesheet}} = 0;
+    ${$self->{_firstsheet}}  = 0;
+}
+
+
+###############################################################################
+#
+# set_first_sheet()
+#
+# Set this worksheet as the first visible sheet. This is necessary
+# when there are a large number of worksheets and the activated
+# worksheet is not visible on the screen.
+#
+sub set_first_sheet {
+
+    my $self = shift;
+
+    $self->{_hidden}         = 0; # Active worksheet can't be hidden.
+    ${$self->{_firstsheet}}  = $self->{_index};
+}
+
+
+
+
+1;
+
+
+__END__
+
+
+=head1 NAME
+
+Chart - A writer class for Excel Charts.
+
+=head1 SYNOPSIS
+
+See the documentation for Spreadsheet::WriteExcel
+
+=head1 DESCRIPTION
+
+This module is used in conjunction with Spreadsheet::WriteExcel.
+
+=head1 AUTHOR
+
+John McNamara jmcnamara at cpan.org
+
+=head1 COPYRIGHT
+
+© MM-MMVI, John McNamara.
+
+All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/lib/Spreadsheet/WriteExcel/Format.pm
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/lib/Spreadsheet/WriteExcel/Format.pm	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/lib/Spreadsheet/WriteExcel/Format.pm	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,773 +1,814 @@
-package Spreadsheet::WriteExcel::Format;
-
-###############################################################################
-#
-# Format - A class for defining Excel formatting.
-#
-#
-# Used in conjunction with Spreadsheet::WriteExcel
-#
-# Copyright 2000-2005, John McNamara, jmcnamara at cpan.org
-#
-# Documentation after __END__
-#
-
-use Exporter;
-use strict;
-use Carp; # TODO required?
-
-
-
-
-
-
-use vars qw($AUTOLOAD $VERSION @ISA);
- at ISA = qw(Exporter);
-
-$VERSION = '2.14';
-
-###############################################################################
-#
-# new()
-#
-# Constructor
-#
-sub new {
-
-    my $class  = shift;
-
-    my $self   = {
-                    _xf_index       => shift || 0,
-
-                    _font_index     => 0,
-                    _font           => 'Arial',
-                    _size           => 10,
-                    _bold           => 0x0190,
-                    _italic         => 0,
-                    _color          => 0x7FFF,
-                    _underline      => 0,
-                    _font_strikeout => 0,
-                    _font_outline   => 0,
-                    _font_shadow    => 0,
-                    _font_script    => 0,
-                    _font_family    => 0,
-                    _font_charset   => 0,
-                    _font_encoding  => 0,
-
-                    _num_format     => 0,
-                    _num_format_enc => 0,
-
-                    _hidden         => 0,
-                    _locked         => 1,
-
-                    _text_h_align   => 0,
-                    _text_wrap      => 0,
-                    _text_v_align   => 2,
-                    _text_justlast  => 0,
-                    _rotation       => 0,
-
-                    _fg_color       => 0x40,
-                    _bg_color       => 0x41,
-
-                    _pattern        => 0,
-
-                    _bottom         => 0,
-                    _top            => 0,
-                    _left           => 0,
-                    _right          => 0,
-
-                    _bottom_color   => 0x40,
-                    _top_color      => 0x40,
-                    _left_color     => 0x40,
-                    _right_color    => 0x40,
-
-                    _indent         => 0,
-                    _shrink         => 0,
-                    _merge_range    => 0,
-                    _reading_order  => 0,
-
-                    _diag_type      => 0,
-                    _diag_color     => 0x40,
-                    _diag_border    => 0,
-
-                    # Temp code to prevent merged formats in non-merged cells.
-                    _used_merge     => 0,
-
-                 };
-
-    bless  $self, $class;
-
-    # Set properties passed to Workbook::add_format()
-    $self->set_properties(@_) if @_;
-
-    return $self;
-}
-
-
-###############################################################################
-#
-# copy($format)
-#
-# Copy the attributes of another Spreadsheet::WriteExcel::Format object.
-#
-sub copy {
-    my $self  = shift;
-    my $other = $_[0];
-
-    return unless defined $other;
-    return unless (ref($self) eq ref($other));
-
-    my $xf = $self->{_xf_index};    # Store XF index assigned by Workbook.pm
-    %$self = %$other;               # Copy properties
-    $self->{_xf_index} = $xf;       # Restore XF index
-}
-
-
-###############################################################################
-#
-# get_xf($style)
-#
-# Generate an Excel BIFF XF record.
-#
-sub get_xf {
-
-    use integer;    # Avoid << shift bug in Perl 5.6.0 on HP-UX
-
-    my $self = shift;
-
-    my $record;     # Record identifier
-    my $length;     # Number of bytes to follow
-
-    my $ifnt;       # Index to FONT record
-    my $ifmt;       # Index to FORMAT record
-    my $style;      # Style and other options
-    my $align;      # Alignment
-    my $indent;     #
-    my $icv;        # fg and bg pattern colors
-    my $border1;    # Border line style and color
-    my $border2;    # Border TODO
-    my $border3;    # Border TODO
-
-
-    # Set the type of the XF record and some of the attributes.
-    if ($_[0] eq "style") {
-        $style = 0xFFF5;
-    }
-    else {
-        $style   = $self->{_locked};
-        $style  |= $self->{_hidden} << 1;
-    }
-
-
-    # Flags to indicate if attributes have been set.
-    my $atr_num     = ($self->{_num_format}     != 0);
-
-    my $atr_fnt     = ($self->{_font_index}     != 0);
-
-    my $atr_alc     = ($self->{_text_h_align}   != 0  ||
-                       $self->{_text_v_align}   != 2  ||
-                       $self->{_shrink}         != 0  ||
-                       $self->{_merge_range}    != 0  ||
-                       $self->{_text_wrap}      != 0  ||
-                       $self->{_indent}         != 0) ? 1 : 0;
-
-    my $atr_bdr     = ($self->{_bottom}         != 0  ||
-                       $self->{_top}            != 0  ||
-                       $self->{_left}           != 0  ||
-                       $self->{_right}          != 0  ||
-                       $self->{_diag_type}      != 0) ? 1: 0;
-
-    my $atr_pat     = ($self->{_fg_color}       != 0x40  ||
-                       $self->{_bg_color}       != 0x41  ||
-                       $self->{_pattern}        != 0x00) ? 1 : 0;
-
-    my $atr_prot    = ($self->{_hidden}         != 0  ||
-                       $self->{_locked}         != 1) ? 1 : 0;
-
-
-    # Set a default diagonal border style if none was specified.
-    $self->{_diag_border} = 1 if !$self->{_diag_border} and $self->{_diag_type};
-
-
-    # Reset the default colours for the non-font properties
-    $self->{_fg_color}     = 0x40 if $self->{_fg_color}     == 0x7FFF;
-    $self->{_bg_color}     = 0x41 if $self->{_bg_color}     == 0x7FFF;
-    $self->{_bottom_color} = 0x40 if $self->{_bottom_color} == 0x7FFF;
-    $self->{_top_color}    = 0x40 if $self->{_top_color}    == 0x7FFF;
-    $self->{_left_color}   = 0x40 if $self->{_left_color}   == 0x7FFF;
-    $self->{_right_color}  = 0x40 if $self->{_right_color}  == 0x7FFF;
-    $self->{_diag_color}   = 0x40 if $self->{_diag_color}   == 0x7FFF;
-
-
-    # Zero the default border colour if the border has not been set.
-    $self->{_bottom_color} = 0 if $self->{_bottom}    == 0;
-    $self->{_top_color}    = 0 if $self->{_top}       == 0;
-    $self->{_right_color}  = 0 if $self->{_right}     == 0;
-    $self->{_left_color}   = 0 if $self->{_left}      == 0;
-    $self->{_diag_color}   = 0 if $self->{_diag_type} == 0;
-
-
-    # The following 2 logical statements take care of special cases in relation
-    # to cell colours and patterns:
-    # 1. For a solid fill (_pattern == 1) Excel reverses the role of foreground
-    #    and background colours.
-    # 2. If the user specifies a foreground or background colour without a
-    #    pattern they probably wanted a solid fill, so we fill in the defaults.
-    #
-    if ($self->{_pattern}  <= 0x01 and
-        $self->{_bg_color} != 0x41 and
-        $self->{_fg_color} == 0x40    )
-    {
-        $self->{_fg_color} = $self->{_bg_color};
-        $self->{_bg_color} = 0x40;
-        $self->{_pattern}  = 1;
-    }
-
-    if ($self->{_pattern}  <= 0x01 and
-        $self->{_bg_color} == 0x41 and
-        $self->{_fg_color} != 0x40    )
-    {
-        $self->{_bg_color} = 0x40;
-        $self->{_pattern}  = 1;
-    }
-
-
-    # Set default alignment if indent is set.
-    $self->{_text_h_align} = 1 if $self->{_indent} and
-                                  $self->{_text_h_align} == 0;
-
-
-    $record         = 0x00E0;
-    $length         = 0x0014;
-
-    $ifnt           = $self->{_font_index};
-    $ifmt           = $self->{_num_format};
-
-
-    $align          = $self->{_text_h_align};
-    $align         |= $self->{_text_wrap}     << 3;
-    $align         |= $self->{_text_v_align}  << 4;
-    $align         |= $self->{_text_justlast} << 7;
-    $align         |= $self->{_rotation}      << 8;
-
-
-
-    $indent         = $self->{_indent};
-    $indent        |= $self->{_shrink}        << 4;
-    $indent        |= $self->{_merge_range}   << 5;
-    $indent        |= $self->{_reading_order} << 6;
-    $indent        |= $atr_num                << 10;
-    $indent        |= $atr_fnt                << 11;
-    $indent        |= $atr_alc                << 12;
-    $indent        |= $atr_bdr                << 13;
-    $indent        |= $atr_pat                << 14;
-    $indent        |= $atr_prot               << 15;
-
-
-    $border1        = $self->{_left};
-    $border1       |= $self->{_right}         << 4;
-    $border1       |= $self->{_top}           << 8;
-    $border1       |= $self->{_bottom}        << 12;
-
-    $border2        = $self->{_left_color};
-    $border2       |= $self->{_right_color}   << 7;
-    $border2       |= $self->{_diag_type}     << 14;
-
-
-    $border3       |= $self->{_top_color};
-    $border3       |= $self->{_bottom_color}  << 7;
-    $border3       |= $self->{_diag_color}    << 14;
-    $border3       |= $self->{_diag_border}   << 21;
-    $border3       |= $self->{_pattern}       << 26;
-
-    $icv            = $self->{_fg_color};
-    $icv           |= $self->{_bg_color}      << 7;
-
-
-
-    my $header      = pack("vv",        $record, $length);
-    my $data        = pack("vvvvvvvVv", $ifnt, $ifmt, $style,
-                                        $align, $indent,
-                                        $border1, $border2, $border3,
-                                        $icv);
-
-    return($header . $data);
-}
-
-
-###############################################################################
-#
-# Note to porters. The majority of the set_property() methods are created
-# dynamically via Perl' AUTOLOAD sub, see below. You may prefer/have to specify
-# them explicitly in other implementation languages.
-#
-
-
-###############################################################################
-#
-# get_font()
-#
-# Generate an Excel BIFF FONT record.
-#
-sub get_font {
-
-    my $self      = shift;
-
-    my $record;     # Record identifier
-    my $length;     # Record length
-
-    my $dyHeight;   # Height of font (1/20 of a point)
-    my $grbit;      # Font attributes
-    my $icv;        # Index to color palette
-    my $bls;        # Bold style
-    my $sss;        # Superscript/subscript
-    my $uls;        # Underline
-    my $bFamily;    # Font family
-    my $bCharSet;   # Character set
-    my $reserved;   # Reserved
-    my $cch;        # Length of font name
-    my $rgch;       # Font name
-    my $encoding;   # Font name character encoding
-
-
-    $dyHeight   = $self->{_size} * 20;
-    $icv        = $self->{_color};
-    $bls        = $self->{_bold};
-    $sss        = $self->{_font_script};
-    $uls        = $self->{_underline};
-    $bFamily    = $self->{_font_family};
-    $bCharSet   = $self->{_font_charset};
-    $rgch       = $self->{_font};
-    $encoding   = $self->{_font_encoding};
-
-    # Handle utf8 strings in newer perls.
-    if ($] >= 5.008) {
-        require Encode;
-
-        if (Encode::is_utf8($rgch)) {
-            $rgch = Encode::encode("UTF-16BE", $rgch);
-            $encoding = 1;
-        }
-    }
-
-    $cch = length $rgch;
-
-    # Handle Unicode font names.
-    if ($encoding == 1) {
-        croak "Uneven number of bytes in Unicode font name" if $cch % 2;
-        $cch  /= 2 if $encoding;
-        $rgch  = pack 'v*', unpack 'n*', $rgch;
-    }
-
-    $record     = 0x31;
-    $length     = 0x10 + length $rgch;
-    $reserved   = 0x00;
-
-    $grbit      = 0x00;
-    $grbit     |= 0x02 if $self->{_italic};
-    $grbit     |= 0x08 if $self->{_font_strikeout};
-    $grbit     |= 0x10 if $self->{_font_outline};
-    $grbit     |= 0x20 if $self->{_font_shadow};
-
-
-    my $header  = pack("vv",          $record, $length);
-    my $data    = pack("vvvvvCCCCCC", $dyHeight, $grbit, $icv, $bls,
-                                      $sss, $uls, $bFamily,
-                                      $bCharSet, $reserved, $cch, $encoding);
-
-    return($header . $data . $rgch);
-}
-
-###############################################################################
-#
-# get_font_key()
-#
-# Returns a unique hash key for a font. Used by Workbook->_store_all_fonts()
-#
-sub get_font_key {
-
-    my $self    = shift;
-
-    # The following elements are arranged to increase the probability of
-    # generating a unique key. Elements that hold a large range of numbers
-    # e.g. _color are placed between two binary elements such as _italic
-    #
-    my $key = "$self->{_font}$self->{_size}";
-    $key   .= "$self->{_font_script}$self->{_underline}";
-    $key   .= "$self->{_font_strikeout}$self->{_bold}$self->{_font_outline}";
-    $key   .= "$self->{_font_family}$self->{_font_charset}";
-    $key   .= "$self->{_font_shadow}$self->{_color}$self->{_italic}";
-    $key   .= "$self->{_font_encoding}";
-    $key    =~ s/ /_/g; # Convert the key to a single word
-
-    return $key;
-}
-
-
-###############################################################################
-#
-# get_xf_index()
-#
-# Returns the used by Worksheet->_XF()
-#
-sub get_xf_index {
-    my $self   = shift;
-
-    return $self->{_xf_index};
-}
-
-
-###############################################################################
-#
-# _get_color()
-#
-# Used in conjunction with the set_xxx_color methods to convert a color
-# string into a number. Color range is 0..63 but we will restrict it
-# to 8..63 to comply with Gnumeric. Colors 0..7 are repeated in 8..15.
-#
-sub _get_color {
-
-    my %colors = (
-                    aqua    => 0x0F,
-                    cyan    => 0x0F,
-                    black   => 0x08,
-                    blue    => 0x0C,
-                    brown   => 0x10,
-                    magenta => 0x0E,
-                    fuchsia => 0x0E,
-                    gray    => 0x17,
-                    grey    => 0x17,
-                    green   => 0x11,
-                    lime    => 0x0B,
-                    navy    => 0x12,
-                    orange  => 0x35,
-                    purple  => 0x14,
-                    red     => 0x0A,
-                    silver  => 0x16,
-                    white   => 0x09,
-                    yellow  => 0x0D,
-                 );
-
-    # Return the default color, 0x7FFF, if undef,
-    return 0x7FFF unless defined $_[0];
-
-    # or the color string converted to an integer,
-    return $colors{lc($_[0])} if exists $colors{lc($_[0])};
-
-    # or the default color if string is unrecognised,
-    return 0x7FFF if ($_[0] =~ m/\D/);
-
-    # or an index < 8 mapped into the correct range,
-    return $_[0] + 8 if $_[0] < 8;
-
-    # or the default color if arg is outside range,
-    return 0x7FFF if $_[0] > 63;
-
-    # or an integer in the valid range
-    return $_[0];
-}
-
-
-###############################################################################
-#
-# set_align()
-#
-# Set cell alignment.
-#
-sub set_align {
-
-    my $self     = shift;
-    my $location = $_[0];
-
-    return if not defined $location;  # No default
-    return if $location =~ m/\d/;     # Ignore numbers
-
-    $location = lc($location);
-
-    $self->set_text_h_align(1) if ($location eq 'left');
-    $self->set_text_h_align(2) if ($location eq 'centre');
-    $self->set_text_h_align(2) if ($location eq 'center');
-    $self->set_text_h_align(3) if ($location eq 'right');
-    $self->set_text_h_align(4) if ($location eq 'fill');
-    $self->set_text_h_align(5) if ($location eq 'justify');
-    $self->set_text_h_align(6) if ($location eq 'center_across');
-    $self->set_text_h_align(6) if ($location eq 'centre_across');
-    $self->set_text_h_align(6) if ($location eq 'merge');        # S:WE name
-    $self->set_text_h_align(7) if ($location eq 'distributed');
-    $self->set_text_h_align(7) if ($location eq 'equal_space');  # ParseExcel
-
-
-    $self->set_text_v_align(0) if ($location eq 'top');
-    $self->set_text_v_align(1) if ($location eq 'vcentre');
-    $self->set_text_v_align(1) if ($location eq 'vcenter');
-    $self->set_text_v_align(2) if ($location eq 'bottom');
-    $self->set_text_v_align(3) if ($location eq 'vjustify');
-    $self->set_text_v_align(4) if ($location eq 'vdistributed');
-    $self->set_text_v_align(4) if ($location eq 'vequal_space'); # ParseExcel
-}
-
-
-###############################################################################
-#
-# set_valign()
-#
-# Set vertical cell alignment. This is required by the set_properties() method
-# to differentiate between the vertical and horizontal properties.
-#
-sub set_valign {
-
-    my $self = shift;
-    $self->set_align(@_);
-}
-
-
-###############################################################################
-#
-# set_center_across()
-#
-# Implements the Excel5 style "merge".
-#
-sub set_center_across {
-
-    my $self     = shift;
-
-    $self->set_text_h_align(6);
-}
-
-
-###############################################################################
-#
-# set_merge()
-#
-# This was the way to implement a merge in Excel5. However it should have been
-# called "center_across" and not "merge".
-# This is now deprecated. Use set_center_across() or better merge_range().
-#
-#
-sub set_merge {
-
-    my $self     = shift;
-
-    $self->set_text_h_align(6);
-}
-
-
-###############################################################################
-#
-# set_bold()
-#
-# Bold has a range 0x64..0x3E8.
-# 0x190 is normal. 0x2BC is bold. So is an excessive use of AUTOLOAD.
-#
-sub set_bold {
-
-    my $self   = shift;
-    my $weight = $_[0];
-
-    $weight = 0x2BC if not defined $weight; # Bold text
-    $weight = 0x2BC if $weight == 1;        # Bold text
-    $weight = 0x190 if $weight == 0;        # Normal text
-    $weight = 0x190 if $weight <  0x064;    # Lower bound
-    $weight = 0x190 if $weight >  0x3E8;    # Upper bound
-
-    $self->{_bold} = $weight;
-}
-
-
-###############################################################################
-#
-# set_border($style)
-#
-# Set cells borders to the same style
-#
-sub set_border {
-
-    my $self  = shift;
-    my $style = $_[0];
-
-    $self->set_bottom($style);
-    $self->set_top($style);
-    $self->set_left($style);
-    $self->set_right($style);
-}
-
-
-###############################################################################
-#
-# set_border_color($color)
-#
-# Set cells border to the same color
-#
-sub set_border_color {
-
-    my $self  = shift;
-    my $color = $_[0];
-
-    $self->set_bottom_color($color);
-    $self->set_top_color($color);
-    $self->set_left_color($color);
-    $self->set_right_color($color);
-}
-
-
-###############################################################################
-#
-# set_rotation($angle)
-#
-# Set the rotation angle of the text. An alignment property.
-#
-sub set_rotation {
-
-    my $self     = shift;
-    my $rotation = $_[0];
-
-    # Argument should be a number
-    return if $rotation !~ /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/;
-
-    # The arg type can be a double but the Excel dialog only allows integers.
-    $rotation = int $rotation;
-
-    if ($rotation == 270) {
-        $rotation = 255;
-    }
-    elsif ($rotation >= -90 or $rotation <= 90) {
-        $rotation = -$rotation +90 if $rotation < 0;
-    }
-    else {
-        carp "Rotation $rotation outside range: -90 <= angle <= 90";
-        $rotation = 0;
-    }
-
-    $self->{_rotation} = $rotation;
-}
-
-
-###############################################################################
-#
-# set_properties()
-#
-# Convert hashes of properties to method calls.
-#
-sub set_properties {
-
-    my $self = shift;
-
-    my %properties = @_; # Merge multiple hashes into one
-
-    while (my($key, $value) = each(%properties)) {
-
-        # Strip leading "-" from Tk style properties e.g. -color => 'red'.
-        $key =~ s/^-//;
-
-
-        # Make sure method names are alphanumeric characters only, in case
-        # tainted data is passed to the eval().
-        #
-        die "Unknown method: \$self->set_$key\n" if $key =~ /\W/;
-
-
-        # Evaling all $values as a strings gets around the problem of some
-        # numerical format strings being evaluated as numbers, for example
-        # "00000" for a zip code.
-        #
-        if (defined $value) {
-            eval "\$self->set_$key('$value')";
-        }
-        else {
-            eval "\$self->set_$key(undef)";
-        }
-
-        die $@ if $@; # Rethrow the eval error.
-    }
-}
-
-
-###############################################################################
-#
-# AUTOLOAD. Deus ex machina.
-#
-# Dynamically create set methods that aren't already defined.
-#
-sub AUTOLOAD {
-
-    my $self = shift;
-
-    # Ignore calls to DESTROY
-    return if $AUTOLOAD =~ /::DESTROY$/;
-
-    # Check for a valid method names, i.e. "set_xxx_yyy".
-    $AUTOLOAD =~ /.*::set(\w+)/ or die "Unknown method: $AUTOLOAD\n";
-
-    # Match the attribute, i.e. "_xxx_yyy".
-    my $attribute = $1;
-
-    # Check that the attribute exists
-    exists $self->{$attribute}  or die "Unknown method: $AUTOLOAD\n";
-
-    # The attribute value
-    my $value;
-
-
-    # There are two types of set methods: set_property() and
-    # set_property_color(). When a method is AUTOLOADED we store a new anonymous
-    # sub in the appropriate slot in the symbol table. The speeds up subsequent
-    # calls to the same method.
-    #
-    no strict 'refs'; # To allow symbol table hackery
-
-    if ($AUTOLOAD =~ /.*::set\w+color$/) {
-        # For "set_property_color" methods
-        $value =  _get_color($_[0]);
-
-        *{$AUTOLOAD} = sub {
-                             my $self  = shift;
-
-                             $self->{$attribute} = _get_color($_[0]);
-                           };
-    }
-    else {
-
-        $value = $_[0];
-        $value = 1 if not defined $value; # The default value is always 1
-
-        *{$AUTOLOAD} = sub {
-                             my $self  = shift;
-                             my $value = shift;
-
-                             $value = 1 if not defined $value;
-    $self->{$attribute} = $value;
-                           };
-}
-
-
-    $self->{$attribute} = $value;
-}
-
-
-1;
-
-
-__END__
-
-
-=head1 NAME
-
-Format - A class for defining Excel formatting.
-
-=head1 SYNOPSIS
-
-See the documentation for Spreadsheet::WriteExcel
-
-=head1 DESCRIPTION
-
-This module is used in conjunction with Spreadsheet::WriteExcel.
-
-=head1 AUTHOR
-
-John McNamara jmcnamara at cpan.org
-
-=head1 COPYRIGHT
-
-© MM-MMV, John McNamara.
-
-All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.
+package Spreadsheet::WriteExcel::Format;
+
+###############################################################################
+#
+# Format - A class for defining Excel formatting.
+#
+#
+# Used in conjunction with Spreadsheet::WriteExcel
+#
+# Copyright 2000-2006, John McNamara, jmcnamara at cpan.org
+#
+# Documentation after __END__
+#
+
+use Exporter;
+use strict;
+use Carp;
+
+
+
+
+
+
+use vars qw($AUTOLOAD $VERSION @ISA);
+ at ISA = qw(Exporter);
+
+$VERSION = '2.16';
+
+###############################################################################
+#
+# new()
+#
+# Constructor
+#
+sub new {
+
+    my $class  = shift;
+
+    my $self   = {
+                    _xf_index       => shift || 0,
+
+                    _type           => 0,
+                    _font_index     => 0,
+                    _font           => 'Arial',
+                    _size           => 10,
+                    _bold           => 0x0190,
+                    _italic         => 0,
+                    _color          => 0x7FFF,
+                    _underline      => 0,
+                    _font_strikeout => 0,
+                    _font_outline   => 0,
+                    _font_shadow    => 0,
+                    _font_script    => 0,
+                    _font_family    => 0,
+                    _font_charset   => 0,
+                    _font_encoding  => 0,
+
+                    _num_format     => 0,
+                    _num_format_enc => 0,
+
+                    _hidden         => 0,
+                    _locked         => 1,
+
+                    _text_h_align   => 0,
+                    _text_wrap      => 0,
+                    _text_v_align   => 2,
+                    _text_justlast  => 0,
+                    _rotation       => 0,
+
+                    _fg_color       => 0x40,
+                    _bg_color       => 0x41,
+
+                    _pattern        => 0,
+
+                    _bottom         => 0,
+                    _top            => 0,
+                    _left           => 0,
+                    _right          => 0,
+
+                    _bottom_color   => 0x40,
+                    _top_color      => 0x40,
+                    _left_color     => 0x40,
+                    _right_color    => 0x40,
+
+                    _indent         => 0,
+                    _shrink         => 0,
+                    _merge_range    => 0,
+                    _reading_order  => 0,
+
+                    _diag_type      => 0,
+                    _diag_color     => 0x40,
+                    _diag_border    => 0,
+
+                    # Temp code to prevent merged formats in non-merged cells.
+                    _used_merge     => 0,
+
+                 };
+
+    bless  $self, $class;
+
+    # Set properties passed to Workbook::add_format()
+    $self->set_properties(@_) if @_;
+
+    return $self;
+}
+
+
+###############################################################################
+#
+# copy($format)
+#
+# Copy the attributes of another Spreadsheet::WriteExcel::Format object.
+#
+sub copy {
+    my $self  = shift;
+    my $other = $_[0];
+
+    return unless defined $other;
+    return unless (ref($self) eq ref($other));
+
+    my $xf = $self->{_xf_index};    # Store XF index assigned by Workbook.pm
+    %$self = %$other;               # Copy properties
+    $self->{_xf_index} = $xf;       # Restore XF index
+}
+
+
+###############################################################################
+#
+# get_xf($style)
+#
+# Generate an Excel BIFF XF record.
+#
+sub get_xf {
+
+    use integer;    # Avoid << shift bug in Perl 5.6.0 on HP-UX
+
+    my $self = shift;
+
+    my $record;     # Record identifier
+    my $length;     # Number of bytes to follow
+
+    my $ifnt;       # Index to FONT record
+    my $ifmt;       # Index to FORMAT record
+    my $style;      # Style and other options
+    my $align;      # Alignment
+    my $indent;     #
+    my $icv;        # fg and bg pattern colors
+    my $border1;    # Border line options
+    my $border2;    # Border line options
+    my $border3;    # Border line options
+
+
+    # Set the type of the XF record and some of the attributes.
+    if ($self->{_type} == 0xFFF5) {
+        $style = 0xFFF5;
+    }
+    else {
+        $style   = $self->{_locked};
+        $style  |= $self->{_hidden} << 1;
+    }
+
+
+    # Flags to indicate if attributes have been set.
+    my $atr_num     = ($self->{_num_format}     != 0);
+
+    my $atr_fnt     = ($self->{_font_index}     != 0);
+
+    my $atr_alc     = ($self->{_text_h_align}   != 0  ||
+                       $self->{_text_v_align}   != 2  ||
+                       $self->{_shrink}         != 0  ||
+                       $self->{_merge_range}    != 0  ||
+                       $self->{_text_wrap}      != 0  ||
+                       $self->{_indent}         != 0) ? 1 : 0;
+
+    my $atr_bdr     = ($self->{_bottom}         != 0  ||
+                       $self->{_top}            != 0  ||
+                       $self->{_left}           != 0  ||
+                       $self->{_right}          != 0  ||
+                       $self->{_diag_type}      != 0) ? 1: 0;
+
+    my $atr_pat     = ($self->{_fg_color}       != 0x40  ||
+                       $self->{_bg_color}       != 0x41  ||
+                       $self->{_pattern}        != 0x00) ? 1 : 0;
+
+    my $atr_prot    = ($self->{_hidden}         != 0  ||
+                       $self->{_locked}         != 1) ? 1 : 0;
+
+
+    # Set attribute changed flags for the style formats.
+    if ($self->{_xf_index} != 0 and $self->{_type} == 0xFFF5) {
+
+        if ($self->{_xf_index} >= 16) {
+            $atr_num    = 0;
+            $atr_fnt    = 1;
+        }
+        else {
+            $atr_num    = 1;
+            $atr_fnt    = 0;
+        }
+
+        $atr_alc    = 1;
+        $atr_bdr    = 1;
+        $atr_pat    = 1;
+        $atr_prot   = 1;
+    }
+
+
+    # Set a default diagonal border style if none was specified.
+    $self->{_diag_border} = 1 if !$self->{_diag_border} and $self->{_diag_type};
+
+
+    # Reset the default colours for the non-font properties
+    $self->{_fg_color}     = 0x40 if $self->{_fg_color}     == 0x7FFF;
+    $self->{_bg_color}     = 0x41 if $self->{_bg_color}     == 0x7FFF;
+    $self->{_bottom_color} = 0x40 if $self->{_bottom_color} == 0x7FFF;
+    $self->{_top_color}    = 0x40 if $self->{_top_color}    == 0x7FFF;
+    $self->{_left_color}   = 0x40 if $self->{_left_color}   == 0x7FFF;
+    $self->{_right_color}  = 0x40 if $self->{_right_color}  == 0x7FFF;
+    $self->{_diag_color}   = 0x40 if $self->{_diag_color}   == 0x7FFF;
+
+
+    # Zero the default border colour if the border has not been set.
+    $self->{_bottom_color} = 0 if $self->{_bottom}    == 0;
+    $self->{_top_color}    = 0 if $self->{_top}       == 0;
+    $self->{_right_color}  = 0 if $self->{_right}     == 0;
+    $self->{_left_color}   = 0 if $self->{_left}      == 0;
+    $self->{_diag_color}   = 0 if $self->{_diag_type} == 0;
+
+
+    # The following 2 logical statements take care of special cases in relation
+    # to cell colours and patterns:
+    # 1. For a solid fill (_pattern == 1) Excel reverses the role of foreground
+    #    and background colours.
+    # 2. If the user specifies a foreground or background colour without a
+    #    pattern they probably wanted a solid fill, so we fill in the defaults.
+    #
+    if ($self->{_pattern}  <= 0x01 and
+        $self->{_bg_color} != 0x41 and
+        $self->{_fg_color} == 0x40    )
+    {
+        $self->{_fg_color} = $self->{_bg_color};
+        $self->{_bg_color} = 0x40;
+        $self->{_pattern}  = 1;
+    }
+
+    if ($self->{_pattern}  <= 0x01 and
+        $self->{_bg_color} == 0x41 and
+        $self->{_fg_color} != 0x40    )
+    {
+        $self->{_bg_color} = 0x40;
+        $self->{_pattern}  = 1;
+    }
+
+
+    # Set default alignment if indent is set.
+    $self->{_text_h_align} = 1 if $self->{_indent} and
+                                  $self->{_text_h_align} == 0;
+
+
+    $record         = 0x00E0;
+    $length         = 0x0014;
+
+    $ifnt           = $self->{_font_index};
+    $ifmt           = $self->{_num_format};
+
+
+    $align          = $self->{_text_h_align};
+    $align         |= $self->{_text_wrap}     << 3;
+    $align         |= $self->{_text_v_align}  << 4;
+    $align         |= $self->{_text_justlast} << 7;
+    $align         |= $self->{_rotation}      << 8;
+
+
+
+    $indent         = $self->{_indent};
+    $indent        |= $self->{_shrink}        << 4;
+    $indent        |= $self->{_merge_range}   << 5;
+    $indent        |= $self->{_reading_order} << 6;
+    $indent        |= $atr_num                << 10;
+    $indent        |= $atr_fnt                << 11;
+    $indent        |= $atr_alc                << 12;
+    $indent        |= $atr_bdr                << 13;
+    $indent        |= $atr_pat                << 14;
+    $indent        |= $atr_prot               << 15;
+
+
+    $border1        = $self->{_left};
+    $border1       |= $self->{_right}         << 4;
+    $border1       |= $self->{_top}           << 8;
+    $border1       |= $self->{_bottom}        << 12;
+
+    $border2        = $self->{_left_color};
+    $border2       |= $self->{_right_color}   << 7;
+    $border2       |= $self->{_diag_type}     << 14;
+
+
+    $border3       |= $self->{_top_color};
+    $border3       |= $self->{_bottom_color}  << 7;
+    $border3       |= $self->{_diag_color}    << 14;
+    $border3       |= $self->{_diag_border}   << 21;
+    $border3       |= $self->{_pattern}       << 26;
+
+    $icv            = $self->{_fg_color};
+    $icv           |= $self->{_bg_color}      << 7;
+
+
+
+    my $header      = pack("vv",        $record, $length);
+    my $data        = pack("vvvvvvvVv", $ifnt, $ifmt, $style,
+                                        $align, $indent,
+                                        $border1, $border2, $border3,
+                                        $icv);
+
+    return($header . $data);
+}
+
+
+###############################################################################
+#
+# Note to porters. The majority of the set_property() methods are created
+# dynamically via Perl' AUTOLOAD sub, see below. You may prefer/have to specify
+# them explicitly in other implementation languages.
+#
+
+
+###############################################################################
+#
+# get_font()
+#
+# Generate an Excel BIFF FONT record.
+#
+sub get_font {
+
+    my $self      = shift;
+
+    my $record;     # Record identifier
+    my $length;     # Record length
+
+    my $dyHeight;   # Height of font (1/20 of a point)
+    my $grbit;      # Font attributes
+    my $icv;        # Index to color palette
+    my $bls;        # Bold style
+    my $sss;        # Superscript/subscript
+    my $uls;        # Underline
+    my $bFamily;    # Font family
+    my $bCharSet;   # Character set
+    my $reserved;   # Reserved
+    my $cch;        # Length of font name
+    my $rgch;       # Font name
+    my $encoding;   # Font name character encoding
+
+
+    $dyHeight   = $self->{_size} * 20;
+    $icv        = $self->{_color};
+    $bls        = $self->{_bold};
+    $sss        = $self->{_font_script};
+    $uls        = $self->{_underline};
+    $bFamily    = $self->{_font_family};
+    $bCharSet   = $self->{_font_charset};
+    $rgch       = $self->{_font};
+    $encoding   = $self->{_font_encoding};
+
+    # Handle utf8 strings in perl 5.8.
+    if ($] >= 5.008) {
+        require Encode;
+
+        if (Encode::is_utf8($rgch)) {
+            $rgch = Encode::encode("UTF-16BE", $rgch);
+            $encoding = 1;
+        }
+    }
+
+    $cch = length $rgch;
+
+    # Handle Unicode font names.
+    if ($encoding == 1) {
+        croak "Uneven number of bytes in Unicode font name" if $cch % 2;
+        $cch  /= 2 if $encoding;
+        $rgch  = pack 'v*', unpack 'n*', $rgch;
+    }
+
+    $record     = 0x31;
+    $length     = 0x10 + length $rgch;
+    $reserved   = 0x00;
+
+    $grbit      = 0x00;
+    $grbit     |= 0x02 if $self->{_italic};
+    $grbit     |= 0x08 if $self->{_font_strikeout};
+    $grbit     |= 0x10 if $self->{_font_outline};
+    $grbit     |= 0x20 if $self->{_font_shadow};
+
+
+    my $header  = pack("vv",          $record, $length);
+    my $data    = pack("vvvvvCCCCCC", $dyHeight, $grbit, $icv, $bls,
+                                      $sss, $uls, $bFamily,
+                                      $bCharSet, $reserved, $cch, $encoding);
+
+    return($header . $data . $rgch);
+}
+
+###############################################################################
+#
+# get_font_key()
+#
+# Returns a unique hash key for a font. Used by Workbook->_store_all_fonts()
+#
+sub get_font_key {
+
+    my $self    = shift;
+
+    # The following elements are arranged to increase the probability of
+    # generating a unique key. Elements that hold a large range of numbers
+    # e.g. _color are placed between two binary elements such as _italic
+    #
+    my $key = "$self->{_font}$self->{_size}";
+    $key   .= "$self->{_font_script}$self->{_underline}";
+    $key   .= "$self->{_font_strikeout}$self->{_bold}$self->{_font_outline}";
+    $key   .= "$self->{_font_family}$self->{_font_charset}";
+    $key   .= "$self->{_font_shadow}$self->{_color}$self->{_italic}";
+    $key   .= "$self->{_font_encoding}";
+    $key    =~ s/ /_/g; # Convert the key to a single word
+
+    return $key;
+}
+
+
+###############################################################################
+#
+# get_xf_index()
+#
+# Returns the used by Worksheet->_XF()
+#
+sub get_xf_index {
+    my $self   = shift;
+
+    return $self->{_xf_index};
+}
+
+
+###############################################################################
+#
+# _get_color()
+#
+# Used in conjunction with the set_xxx_color methods to convert a color
+# string into a number. Color range is 0..63 but we will restrict it
+# to 8..63 to comply with Gnumeric. Colors 0..7 are repeated in 8..15.
+#
+sub _get_color {
+
+    my %colors = (
+                    aqua    => 0x0F,
+                    cyan    => 0x0F,
+                    black   => 0x08,
+                    blue    => 0x0C,
+                    brown   => 0x10,
+                    magenta => 0x0E,
+                    fuchsia => 0x0E,
+                    gray    => 0x17,
+                    grey    => 0x17,
+                    green   => 0x11,
+                    lime    => 0x0B,
+                    navy    => 0x12,
+                    orange  => 0x35,
+                    pink    => 0x21,
+                    purple  => 0x14,
+                    red     => 0x0A,
+                    silver  => 0x16,
+                    white   => 0x09,
+                    yellow  => 0x0D,
+                 );
+
+    # Return the default color, 0x7FFF, if undef,
+    return 0x7FFF unless defined $_[0];
+
+    # or the color string converted to an integer,
+    return $colors{lc($_[0])} if exists $colors{lc($_[0])};
+
+    # or the default color if string is unrecognised,
+    return 0x7FFF if ($_[0] =~ m/\D/);
+
+    # or an index < 8 mapped into the correct range,
+    return $_[0] + 8 if $_[0] < 8;
+
+    # or the default color if arg is outside range,
+    return 0x7FFF if $_[0] > 63;
+
+    # or an integer in the valid range
+    return $_[0];
+}
+
+
+###############################################################################
+#
+# set_type()
+#
+# Set the XF object type as 0 = cell XF or 0xFFF5 = style XF.
+#
+sub set_type {
+
+    my $self = shift;
+    my $type = $_[0];
+
+    if (defined $_[0] and $_[0] eq 0) {
+        $self->{_type} = 0x0000;
+    }
+    else {
+        $self->{_type} = 0xFFF5;
+    }
+}
+
+
+###############################################################################
+#
+# set_align()
+#
+# Set cell alignment.
+#
+sub set_align {
+
+    my $self     = shift;
+    my $location = $_[0];
+
+    return if not defined $location;  # No default
+    return if $location =~ m/\d/;     # Ignore numbers
+
+    $location = lc($location);
+
+    $self->set_text_h_align(1) if ($location eq 'left');
+    $self->set_text_h_align(2) if ($location eq 'centre');
+    $self->set_text_h_align(2) if ($location eq 'center');
+    $self->set_text_h_align(3) if ($location eq 'right');
+    $self->set_text_h_align(4) if ($location eq 'fill');
+    $self->set_text_h_align(5) if ($location eq 'justify');
+    $self->set_text_h_align(6) if ($location eq 'center_across');
+    $self->set_text_h_align(6) if ($location eq 'centre_across');
+    $self->set_text_h_align(6) if ($location eq 'merge');        # S:WE name
+    $self->set_text_h_align(7) if ($location eq 'distributed');
+    $self->set_text_h_align(7) if ($location eq 'equal_space');  # ParseExcel
+
+
+    $self->set_text_v_align(0) if ($location eq 'top');
+    $self->set_text_v_align(1) if ($location eq 'vcentre');
+    $self->set_text_v_align(1) if ($location eq 'vcenter');
+    $self->set_text_v_align(2) if ($location eq 'bottom');
+    $self->set_text_v_align(3) if ($location eq 'vjustify');
+    $self->set_text_v_align(4) if ($location eq 'vdistributed');
+    $self->set_text_v_align(4) if ($location eq 'vequal_space'); # ParseExcel
+}
+
+
+###############################################################################
+#
+# set_valign()
+#
+# Set vertical cell alignment. This is required by the set_properties() method
+# to differentiate between the vertical and horizontal properties.
+#
+sub set_valign {
+
+    my $self = shift;
+    $self->set_align(@_);
+}
+
+
+###############################################################################
+#
+# set_center_across()
+#
+# Implements the Excel5 style "merge".
+#
+sub set_center_across {
+
+    my $self     = shift;
+
+    $self->set_text_h_align(6);
+}
+
+
+###############################################################################
+#
+# set_merge()
+#
+# This was the way to implement a merge in Excel5. However it should have been
+# called "center_across" and not "merge".
+# This is now deprecated. Use set_center_across() or better merge_range().
+#
+#
+sub set_merge {
+
+    my $self     = shift;
+
+    $self->set_text_h_align(6);
+}
+
+
+###############################################################################
+#
+# set_bold()
+#
+# Bold has a range 0x64..0x3E8.
+# 0x190 is normal. 0x2BC is bold. So is an excessive use of AUTOLOAD.
+#
+sub set_bold {
+
+    my $self   = shift;
+    my $weight = $_[0];
+
+    $weight = 0x2BC if not defined $weight; # Bold text
+    $weight = 0x2BC if $weight == 1;        # Bold text
+    $weight = 0x190 if $weight == 0;        # Normal text
+    $weight = 0x190 if $weight <  0x064;    # Lower bound
+    $weight = 0x190 if $weight >  0x3E8;    # Upper bound
+
+    $self->{_bold} = $weight;
+}
+
+
+###############################################################################
+#
+# set_border($style)
+#
+# Set cells borders to the same style
+#
+sub set_border {
+
+    my $self  = shift;
+    my $style = $_[0];
+
+    $self->set_bottom($style);
+    $self->set_top($style);
+    $self->set_left($style);
+    $self->set_right($style);
+}
+
+
+###############################################################################
+#
+# set_border_color($color)
+#
+# Set cells border to the same color
+#
+sub set_border_color {
+
+    my $self  = shift;
+    my $color = $_[0];
+
+    $self->set_bottom_color($color);
+    $self->set_top_color($color);
+    $self->set_left_color($color);
+    $self->set_right_color($color);
+}
+
+
+###############################################################################
+#
+# set_rotation($angle)
+#
+# Set the rotation angle of the text. An alignment property.
+#
+sub set_rotation {
+
+    my $self     = shift;
+    my $rotation = $_[0];
+
+    # Argument should be a number
+    return if $rotation !~ /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/;
+
+    # The arg type can be a double but the Excel dialog only allows integers.
+    $rotation = int $rotation;
+
+    if ($rotation == 270) {
+        $rotation = 255;
+    }
+    elsif ($rotation >= -90 or $rotation <= 90) {
+        $rotation = -$rotation +90 if $rotation < 0;
+    }
+    else {
+        carp "Rotation $rotation outside range: -90 <= angle <= 90";
+        $rotation = 0;
+    }
+
+    $self->{_rotation} = $rotation;
+}
+
+
+###############################################################################
+#
+# set_properties()
+#
+# Convert hashes of properties to method calls.
+#
+sub set_properties {
+
+    my $self = shift;
+
+    my %properties = @_; # Merge multiple hashes into one
+
+    while (my($key, $value) = each(%properties)) {
+
+        # Strip leading "-" from Tk style properties e.g. -color => 'red'.
+        $key =~ s/^-//;
+
+
+        # Make sure method names are alphanumeric characters only, in case
+        # tainted data is passed to the eval().
+        #
+        die "Unknown method: \$self->set_$key\n" if $key =~ /\W/;
+
+
+        # Evaling all $values as a strings gets around the problem of some
+        # numerical format strings being evaluated as numbers, for example
+        # "00000" for a zip code.
+        #
+        if (defined $value) {
+            eval "\$self->set_$key('$value')";
+        }
+        else {
+            eval "\$self->set_$key(undef)";
+        }
+
+        die $@ if $@; # Rethrow the eval error.
+    }
+}
+
+
+###############################################################################
+#
+# AUTOLOAD. Deus ex machina.
+#
+# Dynamically create set methods that aren't already defined.
+#
+sub AUTOLOAD {
+
+    my $self = shift;
+
+    # Ignore calls to DESTROY
+    return if $AUTOLOAD =~ /::DESTROY$/;
+
+    # Check for a valid method names, i.e. "set_xxx_yyy".
+    $AUTOLOAD =~ /.*::set(\w+)/ or die "Unknown method: $AUTOLOAD\n";
+
+    # Match the attribute, i.e. "_xxx_yyy".
+    my $attribute = $1;
+
+    # Check that the attribute exists
+    exists $self->{$attribute}  or die "Unknown method: $AUTOLOAD\n";
+
+    # The attribute value
+    my $value;
+
+
+    # There are two types of set methods: set_property() and
+    # set_property_color(). When a method is AUTOLOADED we store a new anonymous
+    # sub in the appropriate slot in the symbol table. The speeds up subsequent
+    # calls to the same method.
+    #
+    no strict 'refs'; # To allow symbol table hackery
+
+    if ($AUTOLOAD =~ /.*::set\w+color$/) {
+        # For "set_property_color" methods
+        $value =  _get_color($_[0]);
+
+        *{$AUTOLOAD} = sub {
+                                my $self  = shift;
+
+                                $self->{$attribute} = _get_color($_[0]);
+                           };
+    }
+    else {
+
+        $value = $_[0];
+        $value = 1 if not defined $value; # The default value is always 1
+
+        *{$AUTOLOAD} = sub {
+                                my $self  = shift;
+                                my $value = shift;
+
+                                $value = 1 if not defined $value;
+                                $self->{$attribute} = $value;
+                            };
+    }
+
+
+    $self->{$attribute} = $value;
+}
+
+
+1;
+
+
+__END__
+
+
+=head1 NAME
+
+Format - A class for defining Excel formatting.
+
+=head1 SYNOPSIS
+
+See the documentation for Spreadsheet::WriteExcel
+
+=head1 DESCRIPTION
+
+This module is used in conjunction with Spreadsheet::WriteExcel.
+
+=head1 AUTHOR
+
+John McNamara jmcnamara at cpan.org
+
+=head1 COPYRIGHT
+
+© MM-MMVI, John McNamara.
+
+All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.

Modified: packages/libspreadsheet-writeexcel-perl/trunk/lib/Spreadsheet/WriteExcel/Formula.pm
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/lib/Spreadsheet/WriteExcel/Formula.pm	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/lib/Spreadsheet/WriteExcel/Formula.pm	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,1410 +1,1410 @@
-package Spreadsheet::WriteExcel::Formula;
-
-###############################################################################
-#
-# Formula - A class for generating Excel formulas.
-#
-#
-# Used in conjunction with Spreadsheet::WriteExcel
-#
-# Copyright 2000-2005, John McNamara, jmcnamara at cpan.org
-#
-# Documentation after __END__
-#
-
-use Exporter;
-use strict;
-use Carp;
-
-
-
-
-
-
-use vars qw($VERSION @ISA);
- at ISA = qw(Exporter);
-
-$VERSION = '2.04';
-
-###############################################################################
-#
-# Class data.
-#
-my $parser;
-my %ptg;
-my %functions;
-
-
-###############################################################################
-#
-# For debugging.
-#
-my $_debug = 0;
-
-
-###############################################################################
-#
-# new()
-#
-# Constructor
-#
-sub new {
-
-    my $class  = $_[0];
-
-    my $self   = {
-                    _byte_order     => $_[1],
-                    _workbook       => "",
-                    _ext_sheets     => {},
-                    _ext_refs       => {},
-                    _ext_ref_count  => 0,
-                 };
-
-    bless $self, $class;
-    return $self;
-}
-
-
-###############################################################################
-#
-# _init_parser()
-#
-# There is a small overhead involved in generating the parser. Therefore, the
-# initialisation is delayed until a formula is required.
-# TODO: use a pre-compiled grammar.
-#
-# Porters take note, a recursive descent parser isn't mandatory. A future
-# version of this module may use a YACC based parser instead.
-#
-sub _init_parser {
-
-    my $self = shift;
-
-    # Delay loading Parse::RecDescent to reduce the module dependencies.
-    eval { require Parse::RecDescent };
-    die  "The Parse::RecDescent module must be installed in order ".
-         "to write an Excel formula\n" if $@;
-
-    $self->_initialize_hashes();
-
-    # The parsing grammar.
-    #
-    # TODO: Add support for international versions of Excel
-    #
-    $parser = Parse::RecDescent->new(<<'EndGrammar');
-
-        expr:           list
-
-        # Match arg lists such as SUM(1,2, 3)
-        list:           <leftop: addition ',' addition>
-                        { [ $item[1], '_arg', scalar @{$item[1]} ] }
-
-        addition:       <leftop: multiplication add_op multiplication>
-
-        # TODO: The add_op operators don't have equal precedence.
-        add_op:         add |  sub | concat
-                        | eq | ne | le | ge | lt | gt   # Order is important
-
-        add:            '+'  { 'ptgAdd'    }
-        sub:            '-'  { 'ptgSub'    }
-        concat:         '&'  { 'ptgConcat' }
-        eq:             '='  { 'ptgEQ'     }
-        ne:             '<>' { 'ptgNE'     }
-        le:             '<=' { 'ptgLE'     }
-        ge:             '>=' { 'ptgGE'     }
-        lt:             '<'  { 'ptgLT'     }
-        gt:             '>'  { 'ptgGT'     }
-
-
-        multiplication: <leftop: exponention mult_op exponention>
-
-        mult_op:        mult  | div
-        mult:           '*' { 'ptgMul' }
-        div:            '/' { 'ptgDiv' }
-
-        # Left associative (apparently)
-        exponention:    <leftop: factor exp_op factor>
-
-        exp_op:         '^' { 'ptgPower' }
-
-        factor:         number       # Order is important
-                        | string
-                        | range2d
-                        | range3d
-                        | true
-                        | false
-                        | ref2d
-                        | ref3d
-                        | function
-                        | '(' expr ')'  { [$item[2], 'ptgParen'] }
-
-        # Match a string.
-        # Regex by merlyn. See http://www.perlmonks.org/index.pl?node_id=330280
-        #
-        string:           /"([^"]|"")*"/     #" For editors
-                        { [ '_str', $item[1]] }
-
-        # Match float or integer
-        number:           /([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?/
-                        { ['_num', $item[1]] }
-
-        # Note: The highest column values is IV. The following regexes match
-        # up to IZ. Out of range values are caught in the code.
-        #
-        # Note: sheetnames with whitespace, commas, or parentheses must be in
-        # single quotes. Applies to ref3d and range3d
-        #
-
-        # Match A1, $A1, A$1 or $A$1.
-        ref2d:            /\$?[A-I]?[A-Z]\$?\d+/
-                        { ['_ref2d', $item[1]] }
-
-        # Match an external sheet reference: Sheet1!A1 or 'Sheet (1)'!A1
-        ref3d:            /[^!(,]+!\$?[A-I]?[A-Z]\$?\d+/
-                        { ['_ref3d', $item[1]] }
-                        | /'[^']+'!\$?[A-I]?[A-Z]\$?\d+/
-                        { ['_ref3d', $item[1]] }
-
-        # Match A1:C5, $A1:$C5 or A:C etc.
-        range2d:          /\$?[A-I]?[A-Z]\$?(\d+)?:\$?[A-I]?[A-Z]\$?(\d+)?/
-                        { ['_range2d', $item[1]] }
-
-        # Match an external sheet range. 'Sheet 1:Sheet 2'!B2:C5
-        range3d:          /[^!(,]+!\$?[A-I]?[A-Z]\$?(\d+)?:\$?[A-I]?[A-Z]\$?(\d+)?/
-                        { ['_range3d', $item[1]] }
-                        | /'[^']+'!\$?[A-I]?[A-Z]\$?(\d+)?:\$?[A-I]?[A-Z]\$?(\d+)?/
-                        { ['_range3d', $item[1]] }
-
-        # Match a function name.
-        function:         /[A-Z0-9À-Ü_.]+/ '()'
-                        { ['_func', $item[1]] }
-                        | /[A-Z0-9À-Ü_.]+/ '(' expr ')'
-                        { ['_class', $item[1], $item[3], '_func', $item[1]] }
-                        | /[A-Z0-9À-Ü_.]+/ '(' list ')'
-                        { ['_class', $item[1], $item[3], '_func', $item[1]] }
-
-        # Boolean values.
-        true:           'TRUE'  { [ 'ptgBool', 1 ] }
-
-        false:          'FALSE' { [ 'ptgBool', 0 ] }
-
-EndGrammar
-
-print "Init_parser.\n\n" if $_debug;
-}
-
-
-
-###############################################################################
-#
-# parse_formula()
-#
-# Takes a textual description of a formula and returns a RPN encoded byte
-# string.
-#
-sub parse_formula {
-
-    my $self= shift;
-
-    # Initialise the parser if this is the first call
-    $self->_init_parser() if not defined $parser;
-
-    my $formula = shift @_;
-    my $tokens;
-
-    print $formula, "\n" if $_debug;
-
-    # Build the parse tree for the formula
-    my $parsetree =$parser->expr($formula);
-
-    # Check if parsing worked.
-    if (defined $parsetree) {
-        my @tokens = $self->_reverse_tree(@$parsetree);
-
-        # Add a volatile token if the formula contains a volatile function.
-        # This must be the first token in the list
-        #
-        unshift @tokens, '_vol' if $self->_check_volatile(@tokens);
-
-        # The return value depends on which Worksheet.pm method is the caller
-        if (wantarray) {
-            # Parse formula to see if it throws any errors and then
-            # return raw tokens to Worksheet::store_formula()
-            #
-            $self->parse_tokens(@tokens);
-            return @tokens;
-        }
-        else{
-            # Return byte stream to Worksheet::write_formula()
-            return $self->parse_tokens(@tokens);
-        }
-    }
-    else {
-        die "Couldn't parse formula: =$formula\n";
-    }
-}
-
-
-###############################################################################
-#
-# parse_tokens()
-#
-# Convert each token or token pair to its Excel 'ptg' equivalent.
-#
-sub parse_tokens {
-
-    my $self        = shift;
-    my $parse_str   = '';
-    my $last_type   = '';
-    my $modifier    = '';
-    my $num_args    = 0;
-    my $class       = 0;
-    my @class       = 1;
-    my @tokens      = @_;
-
-
-    # A note about the class modifiers used below. In general the class,
-    # "reference" or "value", of a function is applied to all of its operands.
-    # However, in certain circumstances the operands can have mixed classes,
-    # e.g. =VLOOKUP with external references. These will eventually be dealt
-    # with by the parser. However, as a workaround the class type of a token
-    # can be changed via the repeat_formula interface. Thus, a _ref2d token can
-    # be changed by the user to _ref2dA or _ref2dR to change its token class.
-    #
-    while (@_) {
-        my $token = shift @_;
-
-        if ($token eq '_arg') {
-            $num_args = shift @_;
-        }
-        elsif ($token eq '_class') {
-            $token = shift @_;
-            $class = $functions{$token}[2];
-            # If $class is undef then it means that the function isn't valid.
-            die "Unknown function $token() in formula\n" unless defined $class;
-            push @class, $class;
-        }
-        elsif ($token eq '_vol') {
-            $parse_str  .= $self->_convert_volatile();
-        }
-        elsif ($token eq 'ptgBool') {
-            $token = shift @_;
-            $parse_str .= $self->_convert_bool($token);
-        }
-        elsif ($token eq '_num') {
-            $token = shift @_;
-            $parse_str .= $self->_convert_number($token);
-        }
-        elsif ($token eq '_str') {
-            $token = shift @_;
-            $parse_str .= $self->_convert_string($token);
-        }
-        elsif ($token =~ /^_ref2d/) {
-            ($modifier  = $token) =~ s/_ref2d//;
-            $class      = $class[-1];
-            $class      = 0 if $modifier eq 'R';
-            $class      = 1 if $modifier eq 'V';
-            $token      = shift @_;
-            $parse_str .= $self->_convert_ref2d($token, $class);
-        }
-        elsif ($token =~ /^_ref3d/) {
-            ($modifier  = $token) =~ s/_ref3d//;
-            $class      = $class[-1];
-            $class      = 0 if $modifier eq 'R';
-            $class      = 1 if $modifier eq 'V';
-            $token      = shift @_;
-            $parse_str .= $self->_convert_ref3d($token, $class);
-        }
-        elsif ($token =~ /^_range2d/) {
-            ($modifier  = $token) =~ s/_range2d//;
-            $class      = $class[-1];
-            $class      = 0 if $modifier eq 'R';
-            $class      = 1 if $modifier eq 'V';
-            $token      = shift @_;
-            $parse_str .= $self->_convert_range2d($token, $class);
-        }
-        elsif ($token =~ /^_range3d/) {
-            ($modifier  = $token) =~ s/_range3d//;
-            $class      = $class[-1];
-            $class      = 0 if $modifier eq 'R';
-            $class      = 1 if $modifier eq 'V';
-            $token      = shift @_;
-            $parse_str .= $self->_convert_range3d($token, $class);
-        }
-        elsif ($token eq '_func') {
-            $token = shift @_;
-            $parse_str .= $self->_convert_function($token, $num_args);
-            pop @class;
-            $num_args = 0; # Reset after use
-        }
-        elsif (exists $ptg{$token}) {
-            $parse_str .= pack("C", $ptg{$token});
-        }
-        else {
-            # Unrecognised token
-            return undef;
-        }
-    }
-
-
-    if ($_debug) {
-        print join(" ", map { sprintf "%02X", $_ } unpack("C*",$parse_str));
-        print "\n\n";
-        print join(" ", @tokens), "\n\n";
-    }
-
-    return $parse_str;
-}
-
-
-###############################################################################
-#
-#  _reverse_tree()
-#
-# This function descends recursively through the parse tree. At each level it
-# swaps the order of an operator followed by an operand.
-# For example, 1+2*3 would be converted in the following sequence:
-#               1 + 2 * 3
-#               1 + (2 * 3)
-#               1 + (2 3 *)
-#               1 (2 3 *) +
-#               1 2 3 * +
-#
-sub _reverse_tree
-{
-    my $self = shift;
-
-    my @tokens;
-    my @expression = @_;
-    my @stack;
-
-    while (@expression) {
-        my $token = shift @expression;
-
-        # If the token is an operator swap it with the following operand
-        if (    $token eq 'ptgAdd'      ||
-                $token eq 'ptgSub'      ||
-                $token eq 'ptgConcat'   ||
-                $token eq 'ptgMul'      ||
-                $token eq 'ptgDiv'      ||
-                $token eq 'ptgPower'    ||
-                $token eq 'ptgEQ'       ||
-                $token eq 'ptgNE'       ||
-                $token eq 'ptgLE'       ||
-                $token eq 'ptgGE'       ||
-                $token eq 'ptgLT'       ||
-                $token eq 'ptgGT')
-        {
-            my $operand = shift @expression;
-            push @stack, $operand;
-        }
-
-        push @stack, $token;
-    }
-
-    # Recurse through the parse tree
-    foreach my $token (@stack) {
-        if (ref($token)) {
-            push @tokens, $self->_reverse_tree(@$token);
-        }
-        else {
-            push @tokens, $token;
-        }
-    }
-
-    return  @tokens;
-}
-
-
-###############################################################################
-#
-#  _check_volatile()
-#
-# Check if the formula contains a volatile function, i.e. a function that must
-# be recalculated each time a cell is updated. These formulas require a ptgAttr
-# with the volatile flag set as the first token in the parsed expression.
-#
-# Examples of volatile functions: RAND(), NOW(), TODAY()
-#
-sub _check_volatile {
-
-    my $self     = shift;
-    my @tokens   = @_;
-    my $volatile = 0;
-
-    for my $i (0.. at tokens-1) {
-        # If the next token is a function check if it is volatile.
-        if ($tokens[$i] eq '_func' and $functions{$tokens[$i+1]}[3]) {
-            $volatile = 1;
-            last;
-        }
-    }
-
-    return $volatile;
-}
-
-
-###############################################################################
-#
-# _convert_volatile()
-#
-# Convert _vol to a ptgAttr tag formatted to indicate that the formula contains
-# a volatile function. See _check_volatile()
-#
-sub _convert_volatile {
-
-    my $self = shift;
-
-    # Set bitFattrSemi flag to indicate volatile function, "w" is set to zero.
-    return pack("CCv", $ptg{ptgAttr}, 0x1, 0x0);
-}
-
-
-###############################################################################
-#
-# _convert_bool()
-#
-# Convert a boolean token to ptgBool
-#
-sub _convert_bool {
-
-    my $self = shift;
-    my $bool = shift;
-
-    return pack("CC", $ptg{ptgBool}, $bool);
-}
-
-
-###############################################################################
-#
-# _convert_number()
-#
-# Convert a number token to ptgInt or ptgNum
-#
-sub _convert_number {
-
-    my $self = shift;
-    my $num  = shift;
-
-    # Integer in the range 0..2**16-1
-    if (($num =~ /^\d+$/) && ($num <= 65535)) {
-        return pack("Cv", $ptg{ptgInt}, $num);
-    }
-    else { # A float
-        $num = pack("d", $num);
-        $num = reverse $num if $self->{_byte_order};
-        return pack("C", $ptg{ptgNum}) . $num;
-    }
-}
-
-
-###############################################################################
-#
-# _convert_string()
-#
-# Convert a string to a ptg Str.
-#
-sub _convert_string {
-
-    my $self     = shift;
-    my $str      = shift;
-    my $encoding = 0;
-
-    $str =~ s/^"//;   # Remove leading  "
-    $str =~ s/"$//;   # Remove trailing "
-    $str =~ s/""/"/g; # Substitute Excel's escaped double quote "" for "
-
-    my $length = length($str);
-
-    # TODO string length
-    die "String in formula has more than 255 chars\n" if $length > 255;
-
-    return pack("CCC", $ptg{ptgStr}, $length, $encoding) . $str;
-}
-
-
-###############################################################################
-#
-# _convert_ref2d()
-#
-# Convert an Excel reference such as A1, $B2, C$3 or $D$4 to a ptgRefV.
-#
-sub _convert_ref2d {
-
-    my $self  = shift;
-    my $cell  = shift;
-    my $class = shift;
-    my $ptgRef;
-
-    # Convert the cell reference
-    my ($row, $col) = $self->_cell_to_packed_rowcol($cell);
-
-    # The ptg value depends on the class of the ptg.
-    if    ($class == 0) {
-        $ptgRef = pack("C", $ptg{ptgRef});
-    }
-    elsif ($class == 1) {
-        $ptgRef = pack("C", $ptg{ptgRefV});
-    }
-    elsif ($class == 2) {
-        $ptgRef = pack("C", $ptg{ptgRefA});
-    }
-    else{
-        die "Unknown function class in formula\n";
-    }
-
-    return $ptgRef . $row . $col;
-}
-
-
-###############################################################################
-#
-# _convert_ref3d
-#
-# Convert an Excel 3d reference such as "Sheet1!A1" or "Sheet1:Sheet2!A1" to a
-# ptgRef3dV.
-#
-sub _convert_ref3d {
-
-    my $self  = shift;
-    my $token = shift;
-    my $class = shift;
-    my $ptgRef;
-
-    # Split the ref at the ! symbol
-    my ($ext_ref, $cell) = split '!', $token;
-
-    # Convert the external reference part
-    $ext_ref = $self->_pack_ext_ref($ext_ref);
-
-    # Convert the cell reference part
-    my ($row, $col) = $self->_cell_to_packed_rowcol($cell);
-
-    # The ptg value depends on the class of the ptg.
-    if    ($class == 0) {
-        $ptgRef = pack("C", $ptg{ptgRef3d});
-    }
-    elsif ($class == 1) {
-        $ptgRef = pack("C", $ptg{ptgRef3dV});
-    }
-    elsif ($class == 2) {
-        $ptgRef = pack("C", $ptg{ptgRef3dA});
-    }
-    else{
-        die "Unknown function class in formula\n";
-    }
-
-    return $ptgRef . $ext_ref. $row . $col;
-}
-
-
-###############################################################################
-#
-# _convert_range2d()
-#
-# Convert an Excel range such as A1:D4 or A:D to a ptgRefV.
-#
-sub _convert_range2d {
-
-    my $self  = shift;
-    my $range = shift;
-    my $class = shift;
-    my $ptgArea;
-
-    # Split the range into 2 cell refs
-    my ($cell1, $cell2) = split ':', $range;
-
-    # A range such as A:D is equivalent to A1:D65536, so add rows as required
-    $cell1 .= '1'     if $cell1 !~ /\d/;
-    $cell2 .= '65536' if $cell2 !~ /\d/;
-
-    # Convert the cell references
-    my ($row1, $col1) = $self->_cell_to_packed_rowcol($cell1);
-    my ($row2, $col2) = $self->_cell_to_packed_rowcol($cell2);
-
-    # The ptg value depends on the class of the ptg.
-    if    ($class == 0) {
-        $ptgArea = pack("C", $ptg{ptgArea});
-    }
-    elsif ($class == 1) {
-        $ptgArea = pack("C", $ptg{ptgAreaV});
-    }
-    elsif ($class == 2) {
-        $ptgArea = pack("C", $ptg{ptgAreaA});
-    }
-    else{
-        die "Unknown function class in formula\n";
-    }
-
-    return $ptgArea . $row1 . $row2 . $col1. $col2;
-}
-
-
-###############################################################################
-#
-# _convert_range3d
-#
-# Convert an Excel 3d range such as "Sheet1!A1:D4" or "Sheet1:Sheet2!A1:D4" to
-# a ptgArea3dV.
-#
-sub _convert_range3d {
-
-    my $self      = shift;
-    my $token     = shift;
-    my $class = shift;
-    my $ptgArea;
-
-    # Split the ref at the ! symbol
-    my ($ext_ref, $range) = split '!', $token;
-
-    # Convert the external reference part
-    $ext_ref = $self->_pack_ext_ref($ext_ref);
-
-    # Split the range into 2 cell refs
-    my ($cell1, $cell2) = split ':', $range;
-
-    # A range such as A:D is equivalent to A1:D65536, so add rows as required
-    $cell1 .= '1'     if $cell1 !~ /\d/;
-    $cell2 .= '65536' if $cell2 !~ /\d/;
-
-    # Convert the cell references
-    my ($row1, $col1) = $self->_cell_to_packed_rowcol($cell1);
-    my ($row2, $col2) = $self->_cell_to_packed_rowcol($cell2);
-
-    # The ptg value depends on the class of the ptg.
-    if    ($class == 0) {
-        $ptgArea = pack("C", $ptg{ptgArea3d});
-    }
-    elsif ($class == 1) {
-        $ptgArea = pack("C", $ptg{ptgArea3dV});
-    }
-    elsif ($class == 2) {
-        $ptgArea = pack("C", $ptg{ptgArea3dA});
-    }
-    else{
-        die "Unknown function class in formula\n";
-    }
-
-    return $ptgArea . $ext_ref . $row1 . $row2 . $col1. $col2;
-}
-
-
-###############################################################################
-#
-# _pack_ext_ref()
-#
-# Convert the sheet name part of an external reference, for example "Sheet1" or
-# "Sheet1:Sheet2", to a packed structure.
-#
-sub _pack_ext_ref {
-
-    my $self    = shift;
-    my $ext_ref = shift;
-    my $sheet1;
-    my $sheet2;
-
-    $ext_ref =~ s/^'//;   # Remove leading  ' if any.
-    $ext_ref =~ s/'$//;   # Remove trailing ' if any.
-
-    # Check if there is a sheet range eg., Sheet1:Sheet2.
-    if ($ext_ref =~ /:/) {
-        ($sheet1, $sheet2) = split ':', $ext_ref;
-
-        $sheet1 = $self->_get_sheet_index($sheet1);
-        $sheet2 = $self->_get_sheet_index($sheet2);
-
-        # Reverse max and min sheet numbers if necessary
-        if ($sheet1 > $sheet2) {
-            ($sheet1, $sheet2) = ($sheet2, $sheet1);
-        }
-    }
-    else {
-        # Single sheet name only.
-        ($sheet1, $sheet2) = ($ext_ref, $ext_ref);
-
-        $sheet1 = $self->_get_sheet_index($sheet1);
-        $sheet2 = $sheet1;
-    }
-
-    my $key = "$sheet1:$sheet2";
-    my $index;
-
-    if (exists $self->{_ext_refs}->{$key}) {
-        $index = $self->{_ext_refs}->{$key};
-    }
-    else {
-        $index = $self->{_ext_ref_count};
-        $self->{_ext_refs}->{$key} = $index;
-        $self->{_ext_ref_count}++;
-    }
-
-    return pack("v",$index);
-}
-
-
-###############################################################################
-#
-# _get_sheet_index()
-#
-# Look up the index that corresponds to an external sheet name. The hash of
-# sheet names is updated by the add_worksheet() method of the Workbook class.
-#
-sub _get_sheet_index {
-
-    my $self        = shift;
-    my $sheet_name  = shift;
-
-    if (not exists $self->{_ext_sheets}->{$sheet_name}) {
-        die "Unknown sheet name $sheet_name in formula\n";
-    }
-    else {
-        return $self->{_ext_sheets}->{$sheet_name};
-    }
-}
-
-
-###############################################################################
-#
-# set_ext_sheets()
-#
-# This semi-public method is used to update the hash of sheet names. It is
-# updated by the add_worksheet() method of the Workbook class.
-#
-sub set_ext_sheets {
-
-    my $self        = shift;
-    my $worksheet   = shift;
-    my $index       = shift;
-
-    #my $ref         = "$index:$index";
-
-    # The _ext_sheets hash is used to translate between worksheet names
-    # and their index
-    $self->{_ext_sheets}->{$worksheet} = $index;
-
-
-    # 2D sheet refs such as '=Sheet1:Sheet2!A1' can only be added after all
-    # worksheets have been added.
-    #return 0 if $index < $self->{_ext_ref_count}; TODO
-
-
-    # The _ext_refs hash is used to correlate the external references used in
-    # formulas with the index stored in the Workbook EXTERNSHEET record.
-    #$self->{_ext_refs}->{$ref} = $index;
-    #$self->{_ext_ref_count}++;
-
-    # No errors
-    #return 1;
-}
-
-
-###############################################################################
-#
-# get_ext_sheets()
-#
-# This semi-public method is used to update the hash of sheet names. It is
-# updated by the add_worksheet() method of the Workbook class.
-#
-# TODO
-#
-sub get_ext_sheets {
-
-    my $self  = shift;
-
-    # TODO
-    my %refs = %{$self->{_ext_refs}};
-    return %refs;
-
-    #my @refs = sort {$refs{$a} <=> $refs{$b}} keys %refs;
-
-    #foreach my $ref (@refs) {
-    #    $ref = [split /:/, $ref];
-    #}
-
-    #return @refs;
-}
-
-
-###############################################################################
-#
-# get_ext_ref_count()
-#
-# TODO This semi-public method is used to update the hash of sheet names. It is
-# updated by the add_worksheet() method of the Workbook class.
-#
-sub get_ext_ref_count {
-
-    my $self  = shift;
-
-    return $self->{_ext_ref_count};
-}
-
-
-###############################################################################
-#
-# _convert_function()
-#
-# Convert a function to a ptgFunc or ptgFuncVarV depending on the number of
-# args that it takes.
-#
-sub _convert_function {
-
-    my $self     = shift;
-    my $token    = shift;
-    my $num_args = shift;
-
-    die "Unknown function $token() in formula\n"
-        unless defined $functions{$token}[0];
-
-    my $args = $functions{$token}[1];
-
-    # Fixed number of args eg. TIME($i,$j,$k).
-    if ($args >= 0) {
-        # Check that the number of args is valid.
-        if ($args != $num_args) {
-            die "Incorrect number of arguments for $token() in formula\n";
-        }
-        else {
-            return pack("Cv", $ptg{ptgFuncV}, $functions{$token}[0]);
-        }
-    }
-
-    # Variable number of args eg. SUM($i,$j,$k, ..).
-    if ($args == -1) {
-        return pack "CCv", $ptg{ptgFuncVarV}, $num_args, $functions{$token}[0];
-    }
-}
-
-
-###############################################################################
-#
-# _cell_to_rowcol($cell_ref)
-#
-# Convert an Excel cell reference such as A1 or $B2 or C$3 or $D$4 to a zero
-# indexed row and column number. Also returns two boolean values to indicate
-# whether the row or column are relative references.
-# TODO use function in Utility.pm
-#
-sub _cell_to_rowcol {
-
-    my $self = shift;
-    my $cell = shift;
-
-    $cell =~ /(\$?)([A-I]?[A-Z])(\$?)(\d+)/;
-
-    my $col_rel = $1 eq "" ? 1 : 0;
-    my $col     = $2;
-    my $row_rel = $3 eq "" ? 1 : 0;
-    my $row     = $4;
-
-    # Convert base26 column string to a number.
-    # All your Base are belong to us.
-    my @chars  = split //, $col;
-    my $expn   = 0;
-    $col       = 0;
-
-    while (@chars) {
-        my $char = pop(@chars); # LS char first
-        $col += (ord($char) - ord('A') + 1) * (26**$expn);
-        $expn++;
-    }
-
-    # Convert 1-index to zero-index
-    $row--;
-    $col--;
-
-    return $row, $col, $row_rel, $col_rel;
-}
-
-
-###############################################################################
-#
-# _cell_to_packed_rowcol($row, $col, $row_rel, $col_rel)
-#
-# pack() row and column into the required 3 byte format.
-#
-sub _cell_to_packed_rowcol {
-
-    use integer;    # Avoid << shift bug in Perl 5.6.0 on HP-UX
-
-    my $self = shift;
-    my $cell = shift;
-
-    my ($row, $col, $row_rel, $col_rel) = $self->_cell_to_rowcol($cell);
-
-    die "Column $cell greater than IV in formula\n" if $col >= 256;
-    die "Row $cell greater than 65536 in formula\n" if $row >= 65536;
-
-    # Set the high bits to indicate if row or col are relative.
-    $col    |= $col_rel << 14;
-    $col    |= $row_rel << 15;
-
-    $row     = pack('v', $row);
-    $col     = pack('v', $col);
-
-    return ($row, $col);
-}
-
-
-###############################################################################
-#
-# _initialize_hashes()
-#
-sub _initialize_hashes {
-
-    # The Excel ptg indices
-    %ptg = (
-        'ptgExp'            => 0x01,
-        'ptgTbl'            => 0x02,
-        'ptgAdd'            => 0x03,
-        'ptgSub'            => 0x04,
-        'ptgMul'            => 0x05,
-        'ptgDiv'            => 0x06,
-        'ptgPower'          => 0x07,
-        'ptgConcat'         => 0x08,
-        'ptgLT'             => 0x09,
-        'ptgLE'             => 0x0A,
-        'ptgEQ'             => 0x0B,
-        'ptgGE'             => 0x0C,
-        'ptgGT'             => 0x0D,
-        'ptgNE'             => 0x0E,
-        'ptgIsect'          => 0x0F,
-        'ptgUnion'          => 0x10,
-        'ptgRange'          => 0x11,
-        'ptgUplus'          => 0x12,
-        'ptgUminus'         => 0x13,
-        'ptgPercent'        => 0x14,
-        'ptgParen'          => 0x15,
-        'ptgMissArg'        => 0x16,
-        'ptgStr'            => 0x17,
-        'ptgAttr'           => 0x19,
-        'ptgSheet'          => 0x1A,
-        'ptgEndSheet'       => 0x1B,
-        'ptgErr'            => 0x1C,
-        'ptgBool'           => 0x1D,
-        'ptgInt'            => 0x1E,
-        'ptgNum'            => 0x1F,
-        'ptgArray'          => 0x20,
-        'ptgFunc'           => 0x21,
-        'ptgFuncVar'        => 0x22,
-        'ptgName'           => 0x23,
-        'ptgRef'            => 0x24,
-        'ptgArea'           => 0x25,
-        'ptgMemArea'        => 0x26,
-        'ptgMemErr'         => 0x27,
-        'ptgMemNoMem'       => 0x28,
-        'ptgMemFunc'        => 0x29,
-        'ptgRefErr'         => 0x2A,
-        'ptgAreaErr'        => 0x2B,
-        'ptgRefN'           => 0x2C,
-        'ptgAreaN'          => 0x2D,
-        'ptgMemAreaN'       => 0x2E,
-        'ptgMemNoMemN'      => 0x2F,
-        'ptgNameX'          => 0x39,
-        'ptgRef3d'          => 0x3A,
-        'ptgArea3d'         => 0x3B,
-        'ptgRefErr3d'       => 0x3C,
-        'ptgAreaErr3d'      => 0x3D,
-        'ptgArrayV'         => 0x40,
-        'ptgFuncV'          => 0x41,
-        'ptgFuncVarV'       => 0x42,
-        'ptgNameV'          => 0x43,
-        'ptgRefV'           => 0x44,
-        'ptgAreaV'          => 0x45,
-        'ptgMemAreaV'       => 0x46,
-        'ptgMemErrV'        => 0x47,
-        'ptgMemNoMemV'      => 0x48,
-        'ptgMemFuncV'       => 0x49,
-        'ptgRefErrV'        => 0x4A,
-        'ptgAreaErrV'       => 0x4B,
-        'ptgRefNV'          => 0x4C,
-        'ptgAreaNV'         => 0x4D,
-        'ptgMemAreaNV'      => 0x4E,
-        'ptgMemNoMemN'      => 0x4F,
-        'ptgFuncCEV'        => 0x58,
-        'ptgNameXV'         => 0x59,
-        'ptgRef3dV'         => 0x5A,
-        'ptgArea3dV'        => 0x5B,
-        'ptgRefErr3dV'      => 0x5C,
-        'ptgAreaErr3d'      => 0x5D,
-        'ptgArrayA'         => 0x60,
-        'ptgFuncA'          => 0x61,
-        'ptgFuncVarA'       => 0x62,
-        'ptgNameA'          => 0x63,
-        'ptgRefA'           => 0x64,
-        'ptgAreaA'          => 0x65,
-        'ptgMemAreaA'       => 0x66,
-        'ptgMemErrA'        => 0x67,
-        'ptgMemNoMemA'      => 0x68,
-        'ptgMemFuncA'       => 0x69,
-        'ptgRefErrA'        => 0x6A,
-        'ptgAreaErrA'       => 0x6B,
-        'ptgRefNA'          => 0x6C,
-        'ptgAreaNA'         => 0x6D,
-        'ptgMemAreaNA'      => 0x6E,
-        'ptgMemNoMemN'      => 0x6F,
-        'ptgFuncCEA'        => 0x78,
-        'ptgNameXA'         => 0x79,
-        'ptgRef3dA'         => 0x7A,
-        'ptgArea3dA'        => 0x7B,
-        'ptgRefErr3dA'      => 0x7C,
-        'ptgAreaErr3d'      => 0x7D,
-    );
-
-    # Thanks to Michael Meeks and Gnumeric for the initial arg values.
-    #
-    # The following hash was generated by "function_locale.pl" in the distro.
-    # Refer to function_locale.pl for non-English function names.
-    #
-    # The array elements are as follow:
-    # ptg:   The Excel function ptg code.
-    # args:  The number of arguments that the function takes:
-    #           >=0 is a fixed number of arguments.
-    #           -1  is a variable  number of arguments.
-    # class: The reference, value or array class of the function args.
-    # vol:   The function is volatile.
-    #
-    %functions  = (
-        #                                     ptg  args  class  vol
-        'COUNT'                         => [   0,   -1,    0,    0 ],
-        'IF'                            => [   1,   -1,    1,    0 ],
-        'ISNA'                          => [   2,    1,    1,    0 ],
-        'ISERROR'                       => [   3,    1,    1,    0 ],
-        'SUM'                           => [   4,   -1,    0,    0 ],
-        'AVERAGE'                       => [   5,   -1,    0,    0 ],
-        'MIN'                           => [   6,   -1,    0,    0 ],
-        'MAX'                           => [   7,   -1,    0,    0 ],
-        'ROW'                           => [   8,   -1,    0,    0 ],
-        'COLUMN'                        => [   9,   -1,    0,    0 ],
-        'NA'                            => [  10,    0,    0,    0 ],
-        'NPV'                           => [  11,   -1,    1,    0 ],
-        'STDEV'                         => [  12,   -1,    0,    0 ],
-        'DOLLAR'                        => [  13,   -1,    1,    0 ],
-        'FIXED'                         => [  14,   -1,    1,    0 ],
-        'SIN'                           => [  15,    1,    1,    0 ],
-        'COS'                           => [  16,    1,    1,    0 ],
-        'TAN'                           => [  17,    1,    1,    0 ],
-        'ATAN'                          => [  18,    1,    1,    0 ],
-        'PI'                            => [  19,    0,    1,    0 ],
-        'SQRT'                          => [  20,    1,    1,    0 ],
-        'EXP'                           => [  21,    1,    1,    0 ],
-        'LN'                            => [  22,    1,    1,    0 ],
-        'LOG10'                         => [  23,    1,    1,    0 ],
-        'ABS'                           => [  24,    1,    1,    0 ],
-        'INT'                           => [  25,    1,    1,    0 ],
-        'SIGN'                          => [  26,    1,    1,    0 ],
-        'ROUND'                         => [  27,    2,    1,    0 ],
-        'LOOKUP'                        => [  28,   -1,    0,    0 ],
-        'INDEX'                         => [  29,   -1,    0,    1 ],
-        'REPT'                          => [  30,    2,    1,    0 ],
-        'MID'                           => [  31,    3,    1,    0 ],
-        'LEN'                           => [  32,    1,    1,    0 ],
-        'VALUE'                         => [  33,    1,    1,    0 ],
-        'TRUE'                          => [  34,    0,    1,    0 ],
-        'FALSE'                         => [  35,    0,    1,    0 ],
-        'AND'                           => [  36,   -1,    1,    0 ],
-        'OR'                            => [  37,   -1,    1,    0 ],
-        'NOT'                           => [  38,    1,    1,    0 ],
-        'MOD'                           => [  39,    2,    1,    0 ],
-        'DCOUNT'                        => [  40,    3,    0,    0 ],
-        'DSUM'                          => [  41,    3,    0,    0 ],
-        'DAVERAGE'                      => [  42,    3,    0,    0 ],
-        'DMIN'                          => [  43,    3,    0,    0 ],
-        'DMAX'                          => [  44,    3,    0,    0 ],
-        'DSTDEV'                        => [  45,    3,    0,    0 ],
-        'VAR'                           => [  46,   -1,    0,    0 ],
-        'DVAR'                          => [  47,    3,    0,    0 ],
-        'TEXT'                          => [  48,    2,    1,    0 ],
-        'LINEST'                        => [  49,   -1,    0,    0 ],
-        'TREND'                         => [  50,   -1,    0,    0 ],
-        'LOGEST'                        => [  51,   -1,    0,    0 ],
-        'GROWTH'                        => [  52,   -1,    0,    0 ],
-        'PV'                            => [  56,   -1,    1,    0 ],
-        'FV'                            => [  57,   -1,    1,    0 ],
-        'NPER'                          => [  58,   -1,    1,    0 ],
-        'PMT'                           => [  59,   -1,    1,    0 ],
-        'RATE'                          => [  60,   -1,    1,    0 ],
-        'MIRR'                          => [  61,    3,    0,    0 ],
-        'IRR'                           => [  62,   -1,    0,    0 ],
-        'RAND'                          => [  63,    0,    1,    1 ],
-        'MATCH'                         => [  64,   -1,    0,    0 ],
-        'DATE'                          => [  65,    3,    1,    0 ],
-        'TIME'                          => [  66,    3,    1,    0 ],
-        'DAY'                           => [  67,    1,    1,    0 ],
-        'MONTH'                         => [  68,    1,    1,    0 ],
-        'YEAR'                          => [  69,    1,    1,    0 ],
-        'WEEKDAY'                       => [  70,   -1,    1,    0 ],
-        'HOUR'                          => [  71,    1,    1,    0 ],
-        'MINUTE'                        => [  72,    1,    1,    0 ],
-        'SECOND'                        => [  73,    1,    1,    0 ],
-        'NOW'                           => [  74,    0,    1,    1 ],
-        'AREAS'                         => [  75,    1,    0,    1 ],
-        'ROWS'                          => [  76,    1,    0,    1 ],
-        'COLUMNS'                       => [  77,    1,    0,    1 ],
-        'OFFSET'                        => [  78,   -1,    0,    1 ],
-        'SEARCH'                        => [  82,   -1,    1,    0 ],
-        'TRANSPOSE'                     => [  83,    1,    1,    0 ],
-        'TYPE'                          => [  86,    1,    1,    0 ],
-        'ATAN2'                         => [  97,    2,    1,    0 ],
-        'ASIN'                          => [  98,    1,    1,    0 ],
-        'ACOS'                          => [  99,    1,    1,    0 ],
-        'CHOOSE'                        => [ 100,   -1,    1,    0 ],
-        'HLOOKUP'                       => [ 101,   -1,    0,    0 ],
-        'VLOOKUP'                       => [ 102,   -1,    0,    0 ],
-        'ISREF'                         => [ 105,    1,    0,    0 ],
-        'LOG'                           => [ 109,   -1,    1,    0 ],
-        'CHAR'                          => [ 111,    1,    1,    0 ],
-        'LOWER'                         => [ 112,    1,    1,    0 ],
-        'UPPER'                         => [ 113,    1,    1,    0 ],
-        'PROPER'                        => [ 114,    1,    1,    0 ],
-        'LEFT'                          => [ 115,   -1,    1,    0 ],
-        'RIGHT'                         => [ 116,   -1,    1,    0 ],
-        'EXACT'                         => [ 117,    2,    1,    0 ],
-        'TRIM'                          => [ 118,    1,    1,    0 ],
-        'REPLACE'                       => [ 119,    4,    1,    0 ],
-        'SUBSTITUTE'                    => [ 120,   -1,    1,    0 ],
-        'CODE'                          => [ 121,    1,    1,    0 ],
-        'FIND'                          => [ 124,   -1,    1,    0 ],
-        'CELL'                          => [ 125,   -1,    0,    1 ],
-        'ISERR'                         => [ 126,    1,    1,    0 ],
-        'ISTEXT'                        => [ 127,    1,    1,    0 ],
-        'ISNUMBER'                      => [ 128,    1,    1,    0 ],
-        'ISBLANK'                       => [ 129,    1,    1,    0 ],
-        'T'                             => [ 130,    1,    0,    0 ],
-        'N'                             => [ 131,    1,    0,    0 ],
-        'DATEVALUE'                     => [ 140,    1,    1,    0 ],
-        'TIMEVALUE'                     => [ 141,    1,    1,    0 ],
-        'SLN'                           => [ 142,    3,    1,    0 ],
-        'SYD'                           => [ 143,    4,    1,    0 ],
-        'DDB'                           => [ 144,   -1,    1,    0 ],
-        'INDIRECT'                      => [ 148,   -1,    1,    1 ],
-        'CALL'                          => [ 150,   -1,    1,    0 ],
-        'CLEAN'                         => [ 162,    1,    1,    0 ],
-        'MDETERM'                       => [ 163,    1,    2,    0 ],
-        'MINVERSE'                      => [ 164,    1,    2,    0 ],
-        'MMULT'                         => [ 165,    2,    2,    0 ],
-        'IPMT'                          => [ 167,   -1,    1,    0 ],
-        'PPMT'                          => [ 168,   -1,    1,    0 ],
-        'COUNTA'                        => [ 169,   -1,    0,    0 ],
-        'PRODUCT'                       => [ 183,   -1,    0,    0 ],
-        'FACT'                          => [ 184,    1,    1,    0 ],
-        'DPRODUCT'                      => [ 189,    3,    0,    0 ],
-        'ISNONTEXT'                     => [ 190,    1,    1,    0 ],
-        'STDEVP'                        => [ 193,   -1,    0,    0 ],
-        'VARP'                          => [ 194,   -1,    0,    0 ],
-        'DSTDEVP'                       => [ 195,    3,    0,    0 ],
-        'DVARP'                         => [ 196,    3,    0,    0 ],
-        'TRUNC'                         => [ 197,   -1,    1,    0 ],
-        'ISLOGICAL'                     => [ 198,    1,    1,    0 ],
-        'DCOUNTA'                       => [ 199,    3,    0,    0 ],
-        'ROUNDUP'                       => [ 212,    2,    1,    0 ],
-        'ROUNDDOWN'                     => [ 213,    2,    1,    0 ],
-        'RANK'                          => [ 216,   -1,    0,    0 ],
-        'ADDRESS'                       => [ 219,   -1,    1,    0 ],
-        'DAYS360'                       => [ 220,   -1,    1,    0 ],
-        'TODAY'                         => [ 221,    0,    1,    1 ],
-        'VDB'                           => [ 222,   -1,    1,    0 ],
-        'MEDIAN'                        => [ 227,   -1,    0,    0 ],
-        'SUMPRODUCT'                    => [ 228,   -1,    2,    0 ],
-        'SINH'                          => [ 229,    1,    1,    0 ],
-        'COSH'                          => [ 230,    1,    1,    0 ],
-        'TANH'                          => [ 231,    1,    1,    0 ],
-        'ASINH'                         => [ 232,    1,    1,    0 ],
-        'ACOSH'                         => [ 233,    1,    1,    0 ],
-        'ATANH'                         => [ 234,    1,    1,    0 ],
-        'DGET'                          => [ 235,    3,    0,    0 ],
-        'INFO'                          => [ 244,    1,    1,    1 ],
-        'DB'                            => [ 247,   -1,    1,    0 ],
-        'FREQUENCY'                     => [ 252,    2,    0,    0 ],
-        'ERROR.TYPE'                    => [ 261,    1,    1,    0 ],
-        'REGISTER.ID'                   => [ 267,   -1,    1,    0 ],
-        'AVEDEV'                        => [ 269,   -1,    0,    0 ],
-        'BETADIST'                      => [ 270,   -1,    1,    0 ],
-        'GAMMALN'                       => [ 271,    1,    1,    0 ],
-        'BETAINV'                       => [ 272,   -1,    1,    0 ],
-        'BINOMDIST'                     => [ 273,    4,    1,    0 ],
-        'CHIDIST'                       => [ 274,    2,    1,    0 ],
-        'CHIINV'                        => [ 275,    2,    1,    0 ],
-        'COMBIN'                        => [ 276,    2,    1,    0 ],
-        'CONFIDENCE'                    => [ 277,    3,    1,    0 ],
-        'CRITBINOM'                     => [ 278,    3,    1,    0 ],
-        'EVEN'                          => [ 279,    1,    1,    0 ],
-        'EXPONDIST'                     => [ 280,    3,    1,    0 ],
-        'FDIST'                         => [ 281,    3,    1,    0 ],
-        'FINV'                          => [ 282,    3,    1,    0 ],
-        'FISHER'                        => [ 283,    1,    1,    0 ],
-        'FISHERINV'                     => [ 284,    1,    1,    0 ],
-        'FLOOR'                         => [ 285,    2,    1,    0 ],
-        'GAMMADIST'                     => [ 286,    4,    1,    0 ],
-        'GAMMAINV'                      => [ 287,    3,    1,    0 ],
-        'CEILING'                       => [ 288,    2,    1,    0 ],
-        'HYPGEOMDIST'                   => [ 289,    4,    1,    0 ],
-        'LOGNORMDIST'                   => [ 290,    3,    1,    0 ],
-        'LOGINV'                        => [ 291,    3,    1,    0 ],
-        'NEGBINOMDIST'                  => [ 292,    3,    1,    0 ],
-        'NORMDIST'                      => [ 293,    4,    1,    0 ],
-        'NORMSDIST'                     => [ 294,    1,    1,    0 ],
-        'NORMINV'                       => [ 295,    3,    1,    0 ],
-        'NORMSINV'                      => [ 296,    1,    1,    0 ],
-        'STANDARDIZE'                   => [ 297,    3,    1,    0 ],
-        'ODD'                           => [ 298,    1,    1,    0 ],
-        'PERMUT'                        => [ 299,    2,    1,    0 ],
-        'POISSON'                       => [ 300,    3,    1,    0 ],
-        'TDIST'                         => [ 301,    3,    1,    0 ],
-        'WEIBULL'                       => [ 302,    4,    1,    0 ],
-        'SUMXMY2'                       => [ 303,    2,    2,    0 ],
-        'SUMX2MY2'                      => [ 304,    2,    2,    0 ],
-        'SUMX2PY2'                      => [ 305,    2,    2,    0 ],
-        'CHITEST'                       => [ 306,    2,    2,    0 ],
-        'CORREL'                        => [ 307,    2,    2,    0 ],
-        'COVAR'                         => [ 308,    2,    2,    0 ],
-        'FORECAST'                      => [ 309,    3,    2,    0 ],
-        'FTEST'                         => [ 310,    2,    2,    0 ],
-        'INTERCEPT'                     => [ 311,    2,    2,    0 ],
-        'PEARSON'                       => [ 312,    2,    2,    0 ],
-        'RSQ'                           => [ 313,    2,    2,    0 ],
-        'STEYX'                         => [ 314,    2,    2,    0 ],
-        'SLOPE'                         => [ 315,    2,    2,    0 ],
-        'TTEST'                         => [ 316,    4,    2,    0 ],
-        'PROB'                          => [ 317,   -1,    2,    0 ],
-        'DEVSQ'                         => [ 318,   -1,    0,    0 ],
-        'GEOMEAN'                       => [ 319,   -1,    0,    0 ],
-        'HARMEAN'                       => [ 320,   -1,    0,    0 ],
-        'SUMSQ'                         => [ 321,   -1,    0,    0 ],
-        'KURT'                          => [ 322,   -1,    0,    0 ],
-        'SKEW'                          => [ 323,   -1,    0,    0 ],
-        'ZTEST'                         => [ 324,   -1,    0,    0 ],
-        'LARGE'                         => [ 325,    2,    0,    0 ],
-        'SMALL'                         => [ 326,    2,    0,    0 ],
-        'QUARTILE'                      => [ 327,    2,    0,    0 ],
-        'PERCENTILE'                    => [ 328,    2,    0,    0 ],
-        'PERCENTRANK'                   => [ 329,   -1,    0,    0 ],
-        'MODE'                          => [ 330,   -1,    2,    0 ],
-        'TRIMMEAN'                      => [ 331,    2,    0,    0 ],
-        'TINV'                          => [ 332,    2,    1,    0 ],
-        'CONCATENATE'                   => [ 336,   -1,    1,    0 ],
-        'POWER'                         => [ 337,    2,    1,    0 ],
-        'RADIANS'                       => [ 342,    1,    1,    0 ],
-        'DEGREES'                       => [ 343,    1,    1,    0 ],
-        'SUBTOTAL'                      => [ 344,   -1,    0,    0 ],
-        'SUMIF'                         => [ 345,   -1,    0,    0 ],
-        'COUNTIF'                       => [ 346,    2,    0,    0 ],
-        'COUNTBLANK'                    => [ 347,    1,    0,    0 ],
-        'ROMAN'                         => [ 354,   -1,    1,    0 ],
-    );
-
-}
-
-
-
-
-1;
-
-
-__END__
-
-
-=head1 NAME
-
-Formula - A class for generating Excel formulas
-
-=head1 SYNOPSIS
-
-See the documentation for Spreadsheet::WriteExcel
-
-=head1 DESCRIPTION
-
-This module is used by Spreadsheet::WriteExcel. You do not need to use it directly.
-
-
-=head1 NOTES
-
-The following notes are to help developers and maintainers understand the sequence of operation. They are also intended as a pro-memoria for the author. ;-)
-
-Spreadsheet::WriteExcel::Formula converts a textual representation of a formula into the pre-parsed binary format that Excel uses to store formulas. For example C<1+2*3> is stored as follows: C<1E 01 00 1E 02 00 1E 03 00 05 03>.
-
-This string is comprised of operators and operands arranged in a reverse-Polish format. The meaning of the tokens in the above example is shown in the following table:
-
-    Token   Name        Value
-    1E      ptgInt      0001   (stored as 01 00)
-    1E      ptgInt      0002   (stored as 02 00)
-    1E      ptgInt      0003   (stored as 03 00)
-    05      ptgMul
-    03      ptgAdd
-
-The tokens and token names are defined in the "Excel Developer's Kit" from Microsoft Press. C<ptg> stands for Parse ThinG (as in "That lexer can't grok it, it's a parse thang.")
-
-In general the tokens fall into two categories: operators such as C<ptgMul> and operands such as C<ptgInt>. When the formula is evaluated by Excel the operand tokens push values onto a stack. The operator tokens then pop the required number of operands off of the stack, perform an operation and push the resulting value back onto the stack. This methodology is similar to the basic operation of a reverse-Polish (RPN) calculator.
-
-Spreadsheet::WriteExcel::Formula parses a formula using a C<Parse::RecDescent> parser (at a later stage it may use a C<Parse::Yapp> parser or C<Parse::FastDescent>).
-
-The parser converts the textual representation of a formula into a parse tree. Thus, C<1+2*3> is converted into something like the following, C<e> stands for expression:
-
-             e
-           / | \
-         1   +   e
-               / | \
-             2   *   3
-
-
-The function C<_reverse_tree()> recurses down through this structure swapping the order of operators followed by operands to produce a reverse-Polish tree. In other words the formula is converted from in-fix notation to post-fix. Following the above example the resulting tree would look like this:
-
-
-             e
-           / | \
-         1   e   +
-           / | \
-         2   3   *
-
-The result of the recursion is a single array of tokens. In our example the simplified form would look like the following:
-
-    (1, 2, 3, *, +)
-
-The actual return value contains some additional information to help in the secondary parsing stage:
-
-    (_num, 1, _num, 2, _num, 3, ptgMul, ptgAdd, _arg, 1)
-
-The additional tokens are:
-
-    Token       Meaning
-    _num        The next token is a number
-    _str        The next token is a string
-    _ref2d      The next token is a 2d cell reference
-    _ref3d      The next token is a 3d cell reference
-    _range2d    The next token is a 2d range
-    _range3d    The next token is a 3d range
-    _func       The next token is a function
-    _arg        The next token is the number of args for a function
-    _class      The next token is a function name
-    _vol        The formula contains a voltile function
-
-The C<_arg> token is generated for all lists but is only used for functions that take a variable number of arguments.
-
-The C<_class> token indicates the start of the arguments to a function. This allows the post-processor to decide the "class" of the ref and range arguments that the function takes. The class can be reference, value or array. Since function calls can be nested, the class variable is stored on a stack in the C<@class> array. The class of the ref or range is then read as the top element of the stack C<$class[-1]>. When a C<_func> is read it pops the class value.
-
-Certain Excel functions such as RAND() and NOW() are designated as volatile and must be recalculated by Excel every time that a cell is updated. Any formulas that contain one of these functions has a specially formatted C<ptgAttr> tag prepended to it to indicate that it is volatile.
-
-A secondary parsing stage is carried out by C<parse_tokens()> which converts these tokens into a binary string. For the C<1+2*3> example this would give:
-
-    1E 01 00 1E 02 00 1E 03 00 05 03
-
-This two-pass method could probably have been reduced to a single pass through the C<Parse::RecDescent> parser. However, it was easier to develop and debug this way.
-
-The token values and formula values are stored in the C<%ptg> and C<%functions> hashes. These hashes and the parser object C<$parser> are exposed as global data. This breaks the OO encapsulation, but means that they can be shared by several instances of Spreadsheet::WriteExcel called from the same program.
-
-Non-English function names can be added to the C<%functions> hash using the C<function_locale.pl> program in the C<examples> directory of the distro. The supported languages are: German, French, Spanish, Portuguese, Dutch, Finnish, Italian and Swedish. These languages are not added by default because there are conflicts between functions names in different languages.
-
-The parser is initialised by C<_init_parser()>. The initialisation is delayed until the first formula is parsed. This eliminates the overhead of generating the parser in programs that are not processing formulas. (The parser should really be pre-compiled, this is to-do when the grammar stabilises).
-
-
-
-
-=head1 AUTHOR
-
-John McNamara jmcnamara at cpan.org
-
-=head1 COPYRIGHT
-
-© MM-MMV, John McNamara.
-
-All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.
+package Spreadsheet::WriteExcel::Formula;
+
+###############################################################################
+#
+# Formula - A class for generating Excel formulas.
+#
+#
+# Used in conjunction with Spreadsheet::WriteExcel
+#
+# Copyright 2000-2006, John McNamara, jmcnamara at cpan.org
+#
+# Documentation after __END__
+#
+
+use Exporter;
+use strict;
+use Carp;
+
+
+
+
+
+
+use vars qw($VERSION @ISA);
+ at ISA = qw(Exporter);
+
+$VERSION = '2.04';
+
+###############################################################################
+#
+# Class data.
+#
+my $parser;
+my %ptg;
+my %functions;
+
+
+###############################################################################
+#
+# For debugging.
+#
+my $_debug = 0;
+
+
+###############################################################################
+#
+# new()
+#
+# Constructor
+#
+sub new {
+
+    my $class  = $_[0];
+
+    my $self   = {
+                    _byte_order     => $_[1],
+                    _workbook       => "",
+                    _ext_sheets     => {},
+                    _ext_refs       => {},
+                    _ext_ref_count  => 0,
+                 };
+
+    bless $self, $class;
+    return $self;
+}
+
+
+###############################################################################
+#
+# _init_parser()
+#
+# There is a small overhead involved in generating the parser. Therefore, the
+# initialisation is delayed until a formula is required.
+# TODO: use a pre-compiled grammar.
+#
+# Porters take note, a recursive descent parser isn't mandatory. A future
+# version of this module may use a YACC based parser instead.
+#
+sub _init_parser {
+
+    my $self = shift;
+
+    # Delay loading Parse::RecDescent to reduce the module dependencies.
+    eval { require Parse::RecDescent };
+    die  "The Parse::RecDescent module must be installed in order ".
+         "to write an Excel formula\n" if $@;
+
+    $self->_initialize_hashes();
+
+    # The parsing grammar.
+    #
+    # TODO: Add support for international versions of Excel
+    #
+    $parser = Parse::RecDescent->new(<<'EndGrammar');
+
+        expr:           list
+
+        # Match arg lists such as SUM(1,2, 3)
+        list:           <leftop: addition ',' addition>
+                        { [ $item[1], '_arg', scalar @{$item[1]} ] }
+
+        addition:       <leftop: multiplication add_op multiplication>
+
+        # TODO: The add_op operators don't have equal precedence.
+        add_op:         add |  sub | concat
+                        | eq | ne | le | ge | lt | gt   # Order is important
+
+        add:            '+'  { 'ptgAdd'    }
+        sub:            '-'  { 'ptgSub'    }
+        concat:         '&'  { 'ptgConcat' }
+        eq:             '='  { 'ptgEQ'     }
+        ne:             '<>' { 'ptgNE'     }
+        le:             '<=' { 'ptgLE'     }
+        ge:             '>=' { 'ptgGE'     }
+        lt:             '<'  { 'ptgLT'     }
+        gt:             '>'  { 'ptgGT'     }
+
+
+        multiplication: <leftop: exponention mult_op exponention>
+
+        mult_op:        mult  | div
+        mult:           '*' { 'ptgMul' }
+        div:            '/' { 'ptgDiv' }
+
+        # Left associative (apparently)
+        exponention:    <leftop: factor exp_op factor>
+
+        exp_op:         '^' { 'ptgPower' }
+
+        factor:         number       # Order is important
+                        | string
+                        | range2d
+                        | range3d
+                        | true
+                        | false
+                        | ref2d
+                        | ref3d
+                        | function
+                        | '(' expr ')'  { [$item[2], 'ptgParen'] }
+
+        # Match a string.
+        # Regex by merlyn. See http://www.perlmonks.org/index.pl?node_id=330280
+        #
+        string:           /"([^"]|"")*"/     #" For editors
+                        { [ '_str', $item[1]] }
+
+        # Match float or integer
+        number:           /([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?/
+                        { ['_num', $item[1]] }
+
+        # Note: The highest column values is IV. The following regexes match
+        # up to IZ. Out of range values are caught in the code.
+        #
+        # Note: sheetnames with whitespace, commas, or parentheses must be in
+        # single quotes. Applies to ref3d and range3d
+        #
+
+        # Match A1, $A1, A$1 or $A$1.
+        ref2d:            /\$?[A-I]?[A-Z]\$?\d+/
+                        { ['_ref2d', $item[1]] }
+
+        # Match an external sheet reference: Sheet1!A1 or 'Sheet (1)'!A1
+        ref3d:            /[^!(,]+!\$?[A-I]?[A-Z]\$?\d+/
+                        { ['_ref3d', $item[1]] }
+                        | /'[^']+'!\$?[A-I]?[A-Z]\$?\d+/
+                        { ['_ref3d', $item[1]] }
+
+        # Match A1:C5, $A1:$C5 or A:C etc.
+        range2d:          /\$?[A-I]?[A-Z]\$?(\d+)?:\$?[A-I]?[A-Z]\$?(\d+)?/
+                        { ['_range2d', $item[1]] }
+
+        # Match an external sheet range. 'Sheet 1:Sheet 2'!B2:C5
+        range3d:          /[^!(,]+!\$?[A-I]?[A-Z]\$?(\d+)?:\$?[A-I]?[A-Z]\$?(\d+)?/
+                        { ['_range3d', $item[1]] }
+                        | /'[^']+'!\$?[A-I]?[A-Z]\$?(\d+)?:\$?[A-I]?[A-Z]\$?(\d+)?/
+                        { ['_range3d', $item[1]] }
+
+        # Match a function name.
+        function:         /[A-Z0-9À-Ü_.]+/ '()'
+                        { ['_func', $item[1]] }
+                        | /[A-Z0-9À-Ü_.]+/ '(' expr ')'
+                        { ['_class', $item[1], $item[3], '_func', $item[1]] }
+                        | /[A-Z0-9À-Ü_.]+/ '(' list ')'
+                        { ['_class', $item[1], $item[3], '_func', $item[1]] }
+
+        # Boolean values.
+        true:           'TRUE'  { [ 'ptgBool', 1 ] }
+
+        false:          'FALSE' { [ 'ptgBool', 0 ] }
+
+EndGrammar
+
+print "Init_parser.\n\n" if $_debug;
+}
+
+
+
+###############################################################################
+#
+# parse_formula()
+#
+# Takes a textual description of a formula and returns a RPN encoded byte
+# string.
+#
+sub parse_formula {
+
+    my $self= shift;
+
+    # Initialise the parser if this is the first call
+    $self->_init_parser() if not defined $parser;
+
+    my $formula = shift @_;
+    my $tokens;
+
+    print $formula, "\n" if $_debug;
+
+    # Build the parse tree for the formula
+    my $parsetree =$parser->expr($formula);
+
+    # Check if parsing worked.
+    if (defined $parsetree) {
+        my @tokens = $self->_reverse_tree(@$parsetree);
+
+        # Add a volatile token if the formula contains a volatile function.
+        # This must be the first token in the list
+        #
+        unshift @tokens, '_vol' if $self->_check_volatile(@tokens);
+
+        # The return value depends on which Worksheet.pm method is the caller
+        if (wantarray) {
+            # Parse formula to see if it throws any errors and then
+            # return raw tokens to Worksheet::store_formula()
+            #
+            $self->parse_tokens(@tokens);
+            return @tokens;
+        }
+        else{
+            # Return byte stream to Worksheet::write_formula()
+            return $self->parse_tokens(@tokens);
+        }
+    }
+    else {
+        die "Couldn't parse formula: =$formula\n";
+    }
+}
+
+
+###############################################################################
+#
+# parse_tokens()
+#
+# Convert each token or token pair to its Excel 'ptg' equivalent.
+#
+sub parse_tokens {
+
+    my $self        = shift;
+    my $parse_str   = '';
+    my $last_type   = '';
+    my $modifier    = '';
+    my $num_args    = 0;
+    my $class       = 0;
+    my @class       = 1;
+    my @tokens      = @_;
+
+
+    # A note about the class modifiers used below. In general the class,
+    # "reference" or "value", of a function is applied to all of its operands.
+    # However, in certain circumstances the operands can have mixed classes,
+    # e.g. =VLOOKUP with external references. These will eventually be dealt
+    # with by the parser. However, as a workaround the class type of a token
+    # can be changed via the repeat_formula interface. Thus, a _ref2d token can
+    # be changed by the user to _ref2dA or _ref2dR to change its token class.
+    #
+    while (@_) {
+        my $token = shift @_;
+
+        if ($token eq '_arg') {
+            $num_args = shift @_;
+        }
+        elsif ($token eq '_class') {
+            $token = shift @_;
+            $class = $functions{$token}[2];
+            # If $class is undef then it means that the function isn't valid.
+            die "Unknown function $token() in formula\n" unless defined $class;
+            push @class, $class;
+        }
+        elsif ($token eq '_vol') {
+            $parse_str  .= $self->_convert_volatile();
+        }
+        elsif ($token eq 'ptgBool') {
+            $token = shift @_;
+            $parse_str .= $self->_convert_bool($token);
+        }
+        elsif ($token eq '_num') {
+            $token = shift @_;
+            $parse_str .= $self->_convert_number($token);
+        }
+        elsif ($token eq '_str') {
+            $token = shift @_;
+            $parse_str .= $self->_convert_string($token);
+        }
+        elsif ($token =~ /^_ref2d/) {
+            ($modifier  = $token) =~ s/_ref2d//;
+            $class      = $class[-1];
+            $class      = 0 if $modifier eq 'R';
+            $class      = 1 if $modifier eq 'V';
+            $token      = shift @_;
+            $parse_str .= $self->_convert_ref2d($token, $class);
+        }
+        elsif ($token =~ /^_ref3d/) {
+            ($modifier  = $token) =~ s/_ref3d//;
+            $class      = $class[-1];
+            $class      = 0 if $modifier eq 'R';
+            $class      = 1 if $modifier eq 'V';
+            $token      = shift @_;
+            $parse_str .= $self->_convert_ref3d($token, $class);
+        }
+        elsif ($token =~ /^_range2d/) {
+            ($modifier  = $token) =~ s/_range2d//;
+            $class      = $class[-1];
+            $class      = 0 if $modifier eq 'R';
+            $class      = 1 if $modifier eq 'V';
+            $token      = shift @_;
+            $parse_str .= $self->_convert_range2d($token, $class);
+        }
+        elsif ($token =~ /^_range3d/) {
+            ($modifier  = $token) =~ s/_range3d//;
+            $class      = $class[-1];
+            $class      = 0 if $modifier eq 'R';
+            $class      = 1 if $modifier eq 'V';
+            $token      = shift @_;
+            $parse_str .= $self->_convert_range3d($token, $class);
+        }
+        elsif ($token eq '_func') {
+            $token = shift @_;
+            $parse_str .= $self->_convert_function($token, $num_args);
+            pop @class;
+            $num_args = 0; # Reset after use
+        }
+        elsif (exists $ptg{$token}) {
+            $parse_str .= pack("C", $ptg{$token});
+        }
+        else {
+            # Unrecognised token
+            return undef;
+        }
+    }
+
+
+    if ($_debug) {
+        print join(" ", map { sprintf "%02X", $_ } unpack("C*",$parse_str));
+        print "\n\n";
+        print join(" ", @tokens), "\n\n";
+    }
+
+    return $parse_str;
+}
+
+
+###############################################################################
+#
+#  _reverse_tree()
+#
+# This function descends recursively through the parse tree. At each level it
+# swaps the order of an operator followed by an operand.
+# For example, 1+2*3 would be converted in the following sequence:
+#               1 + 2 * 3
+#               1 + (2 * 3)
+#               1 + (2 3 *)
+#               1 (2 3 *) +
+#               1 2 3 * +
+#
+sub _reverse_tree
+{
+    my $self = shift;
+
+    my @tokens;
+    my @expression = @_;
+    my @stack;
+
+    while (@expression) {
+        my $token = shift @expression;
+
+        # If the token is an operator swap it with the following operand
+        if (    $token eq 'ptgAdd'      ||
+                $token eq 'ptgSub'      ||
+                $token eq 'ptgConcat'   ||
+                $token eq 'ptgMul'      ||
+                $token eq 'ptgDiv'      ||
+                $token eq 'ptgPower'    ||
+                $token eq 'ptgEQ'       ||
+                $token eq 'ptgNE'       ||
+                $token eq 'ptgLE'       ||
+                $token eq 'ptgGE'       ||
+                $token eq 'ptgLT'       ||
+                $token eq 'ptgGT')
+        {
+            my $operand = shift @expression;
+            push @stack, $operand;
+        }
+
+        push @stack, $token;
+    }
+
+    # Recurse through the parse tree
+    foreach my $token (@stack) {
+        if (ref($token)) {
+            push @tokens, $self->_reverse_tree(@$token);
+        }
+        else {
+            push @tokens, $token;
+        }
+    }
+
+    return  @tokens;
+}
+
+
+###############################################################################
+#
+#  _check_volatile()
+#
+# Check if the formula contains a volatile function, i.e. a function that must
+# be recalculated each time a cell is updated. These formulas require a ptgAttr
+# with the volatile flag set as the first token in the parsed expression.
+#
+# Examples of volatile functions: RAND(), NOW(), TODAY()
+#
+sub _check_volatile {
+
+    my $self     = shift;
+    my @tokens   = @_;
+    my $volatile = 0;
+
+    for my $i (0.. at tokens-1) {
+        # If the next token is a function check if it is volatile.
+        if ($tokens[$i] eq '_func' and $functions{$tokens[$i+1]}[3]) {
+            $volatile = 1;
+            last;
+        }
+    }
+
+    return $volatile;
+}
+
+
+###############################################################################
+#
+# _convert_volatile()
+#
+# Convert _vol to a ptgAttr tag formatted to indicate that the formula contains
+# a volatile function. See _check_volatile()
+#
+sub _convert_volatile {
+
+    my $self = shift;
+
+    # Set bitFattrSemi flag to indicate volatile function, "w" is set to zero.
+    return pack("CCv", $ptg{ptgAttr}, 0x1, 0x0);
+}
+
+
+###############################################################################
+#
+# _convert_bool()
+#
+# Convert a boolean token to ptgBool
+#
+sub _convert_bool {
+
+    my $self = shift;
+    my $bool = shift;
+
+    return pack("CC", $ptg{ptgBool}, $bool);
+}
+
+
+###############################################################################
+#
+# _convert_number()
+#
+# Convert a number token to ptgInt or ptgNum
+#
+sub _convert_number {
+
+    my $self = shift;
+    my $num  = shift;
+
+    # Integer in the range 0..2**16-1
+    if (($num =~ /^\d+$/) && ($num <= 65535)) {
+        return pack("Cv", $ptg{ptgInt}, $num);
+    }
+    else { # A float
+        $num = pack("d", $num);
+        $num = reverse $num if $self->{_byte_order};
+        return pack("C", $ptg{ptgNum}) . $num;
+    }
+}
+
+
+###############################################################################
+#
+# _convert_string()
+#
+# Convert a string to a ptg Str.
+#
+sub _convert_string {
+
+    my $self     = shift;
+    my $str      = shift;
+    my $encoding = 0;
+
+    $str =~ s/^"//;   # Remove leading  "
+    $str =~ s/"$//;   # Remove trailing "
+    $str =~ s/""/"/g; # Substitute Excel's escaped double quote "" for "
+
+    my $length = length($str);
+
+    # TODO string length
+    die "String in formula has more than 255 chars\n" if $length > 255;
+
+    return pack("CCC", $ptg{ptgStr}, $length, $encoding) . $str;
+}
+
+
+###############################################################################
+#
+# _convert_ref2d()
+#
+# Convert an Excel reference such as A1, $B2, C$3 or $D$4 to a ptgRefV.
+#
+sub _convert_ref2d {
+
+    my $self  = shift;
+    my $cell  = shift;
+    my $class = shift;
+    my $ptgRef;
+
+    # Convert the cell reference
+    my ($row, $col) = $self->_cell_to_packed_rowcol($cell);
+
+    # The ptg value depends on the class of the ptg.
+    if    ($class == 0) {
+        $ptgRef = pack("C", $ptg{ptgRef});
+    }
+    elsif ($class == 1) {
+        $ptgRef = pack("C", $ptg{ptgRefV});
+    }
+    elsif ($class == 2) {
+        $ptgRef = pack("C", $ptg{ptgRefA});
+    }
+    else{
+        die "Unknown function class in formula\n";
+    }
+
+    return $ptgRef . $row . $col;
+}
+
+
+###############################################################################
+#
+# _convert_ref3d
+#
+# Convert an Excel 3d reference such as "Sheet1!A1" or "Sheet1:Sheet2!A1" to a
+# ptgRef3dV.
+#
+sub _convert_ref3d {
+
+    my $self  = shift;
+    my $token = shift;
+    my $class = shift;
+    my $ptgRef;
+
+    # Split the ref at the ! symbol
+    my ($ext_ref, $cell) = split '!', $token;
+
+    # Convert the external reference part
+    $ext_ref = $self->_pack_ext_ref($ext_ref);
+
+    # Convert the cell reference part
+    my ($row, $col) = $self->_cell_to_packed_rowcol($cell);
+
+    # The ptg value depends on the class of the ptg.
+    if    ($class == 0) {
+        $ptgRef = pack("C", $ptg{ptgRef3d});
+    }
+    elsif ($class == 1) {
+        $ptgRef = pack("C", $ptg{ptgRef3dV});
+    }
+    elsif ($class == 2) {
+        $ptgRef = pack("C", $ptg{ptgRef3dA});
+    }
+    else{
+        die "Unknown function class in formula\n";
+    }
+
+    return $ptgRef . $ext_ref. $row . $col;
+}
+
+
+###############################################################################
+#
+# _convert_range2d()
+#
+# Convert an Excel range such as A1:D4 or A:D to a ptgRefV.
+#
+sub _convert_range2d {
+
+    my $self  = shift;
+    my $range = shift;
+    my $class = shift;
+    my $ptgArea;
+
+    # Split the range into 2 cell refs
+    my ($cell1, $cell2) = split ':', $range;
+
+    # A range such as A:D is equivalent to A1:D65536, so add rows as required
+    $cell1 .= '1'     if $cell1 !~ /\d/;
+    $cell2 .= '65536' if $cell2 !~ /\d/;
+
+    # Convert the cell references
+    my ($row1, $col1) = $self->_cell_to_packed_rowcol($cell1);
+    my ($row2, $col2) = $self->_cell_to_packed_rowcol($cell2);
+
+    # The ptg value depends on the class of the ptg.
+    if    ($class == 0) {
+        $ptgArea = pack("C", $ptg{ptgArea});
+    }
+    elsif ($class == 1) {
+        $ptgArea = pack("C", $ptg{ptgAreaV});
+    }
+    elsif ($class == 2) {
+        $ptgArea = pack("C", $ptg{ptgAreaA});
+    }
+    else{
+        die "Unknown function class in formula\n";
+    }
+
+    return $ptgArea . $row1 . $row2 . $col1. $col2;
+}
+
+
+###############################################################################
+#
+# _convert_range3d
+#
+# Convert an Excel 3d range such as "Sheet1!A1:D4" or "Sheet1:Sheet2!A1:D4" to
+# a ptgArea3dV.
+#
+sub _convert_range3d {
+
+    my $self      = shift;
+    my $token     = shift;
+    my $class = shift;
+    my $ptgArea;
+
+    # Split the ref at the ! symbol
+    my ($ext_ref, $range) = split '!', $token;
+
+    # Convert the external reference part
+    $ext_ref = $self->_pack_ext_ref($ext_ref);
+
+    # Split the range into 2 cell refs
+    my ($cell1, $cell2) = split ':', $range;
+
+    # A range such as A:D is equivalent to A1:D65536, so add rows as required
+    $cell1 .= '1'     if $cell1 !~ /\d/;
+    $cell2 .= '65536' if $cell2 !~ /\d/;
+
+    # Convert the cell references
+    my ($row1, $col1) = $self->_cell_to_packed_rowcol($cell1);
+    my ($row2, $col2) = $self->_cell_to_packed_rowcol($cell2);
+
+    # The ptg value depends on the class of the ptg.
+    if    ($class == 0) {
+        $ptgArea = pack("C", $ptg{ptgArea3d});
+    }
+    elsif ($class == 1) {
+        $ptgArea = pack("C", $ptg{ptgArea3dV});
+    }
+    elsif ($class == 2) {
+        $ptgArea = pack("C", $ptg{ptgArea3dA});
+    }
+    else{
+        die "Unknown function class in formula\n";
+    }
+
+    return $ptgArea . $ext_ref . $row1 . $row2 . $col1. $col2;
+}
+
+
+###############################################################################
+#
+# _pack_ext_ref()
+#
+# Convert the sheet name part of an external reference, for example "Sheet1" or
+# "Sheet1:Sheet2", to a packed structure.
+#
+sub _pack_ext_ref {
+
+    my $self    = shift;
+    my $ext_ref = shift;
+    my $sheet1;
+    my $sheet2;
+
+    $ext_ref =~ s/^'//;   # Remove leading  ' if any.
+    $ext_ref =~ s/'$//;   # Remove trailing ' if any.
+
+    # Check if there is a sheet range eg., Sheet1:Sheet2.
+    if ($ext_ref =~ /:/) {
+        ($sheet1, $sheet2) = split ':', $ext_ref;
+
+        $sheet1 = $self->_get_sheet_index($sheet1);
+        $sheet2 = $self->_get_sheet_index($sheet2);
+
+        # Reverse max and min sheet numbers if necessary
+        if ($sheet1 > $sheet2) {
+            ($sheet1, $sheet2) = ($sheet2, $sheet1);
+        }
+    }
+    else {
+        # Single sheet name only.
+        ($sheet1, $sheet2) = ($ext_ref, $ext_ref);
+
+        $sheet1 = $self->_get_sheet_index($sheet1);
+        $sheet2 = $sheet1;
+    }
+
+    my $key = "$sheet1:$sheet2";
+    my $index;
+
+    if (exists $self->{_ext_refs}->{$key}) {
+        $index = $self->{_ext_refs}->{$key};
+    }
+    else {
+        $index = $self->{_ext_ref_count};
+        $self->{_ext_refs}->{$key} = $index;
+        $self->{_ext_ref_count}++;
+    }
+
+    return pack("v",$index);
+}
+
+
+###############################################################################
+#
+# _get_sheet_index()
+#
+# Look up the index that corresponds to an external sheet name. The hash of
+# sheet names is updated by the add_worksheet() method of the Workbook class.
+#
+sub _get_sheet_index {
+
+    my $self        = shift;
+    my $sheet_name  = shift;
+
+    if (not exists $self->{_ext_sheets}->{$sheet_name}) {
+        die "Unknown sheet name $sheet_name in formula\n";
+    }
+    else {
+        return $self->{_ext_sheets}->{$sheet_name};
+    }
+}
+
+
+###############################################################################
+#
+# set_ext_sheets()
+#
+# This semi-public method is used to update the hash of sheet names. It is
+# updated by the add_worksheet() method of the Workbook class.
+#
+sub set_ext_sheets {
+
+    my $self        = shift;
+    my $worksheet   = shift;
+    my $index       = shift;
+
+    #my $ref         = "$index:$index";
+
+    # The _ext_sheets hash is used to translate between worksheet names
+    # and their index
+    $self->{_ext_sheets}->{$worksheet} = $index;
+
+
+    # 2D sheet refs such as '=Sheet1:Sheet2!A1' can only be added after all
+    # worksheets have been added.
+    #return 0 if $index < $self->{_ext_ref_count}; TODO
+
+
+    # The _ext_refs hash is used to correlate the external references used in
+    # formulas with the index stored in the Workbook EXTERNSHEET record.
+    #$self->{_ext_refs}->{$ref} = $index;
+    #$self->{_ext_ref_count}++;
+
+    # No errors
+    #return 1;
+}
+
+
+###############################################################################
+#
+# get_ext_sheets()
+#
+# This semi-public method is used to update the hash of sheet names. It is
+# updated by the add_worksheet() method of the Workbook class.
+#
+# TODO
+#
+sub get_ext_sheets {
+
+    my $self  = shift;
+
+    # TODO
+    my %refs = %{$self->{_ext_refs}};
+    return %refs;
+
+    #my @refs = sort {$refs{$a} <=> $refs{$b}} keys %refs;
+
+    #foreach my $ref (@refs) {
+    #    $ref = [split /:/, $ref];
+    #}
+
+    #return @refs;
+}
+
+
+###############################################################################
+#
+# get_ext_ref_count()
+#
+# TODO This semi-public method is used to update the hash of sheet names. It is
+# updated by the add_worksheet() method of the Workbook class.
+#
+sub get_ext_ref_count {
+
+    my $self  = shift;
+
+    return $self->{_ext_ref_count};
+}
+
+
+###############################################################################
+#
+# _convert_function()
+#
+# Convert a function to a ptgFunc or ptgFuncVarV depending on the number of
+# args that it takes.
+#
+sub _convert_function {
+
+    my $self     = shift;
+    my $token    = shift;
+    my $num_args = shift;
+
+    die "Unknown function $token() in formula\n"
+        unless defined $functions{$token}[0];
+
+    my $args = $functions{$token}[1];
+
+    # Fixed number of args eg. TIME($i,$j,$k).
+    if ($args >= 0) {
+        # Check that the number of args is valid.
+        if ($args != $num_args) {
+            die "Incorrect number of arguments for $token() in formula\n";
+        }
+        else {
+            return pack("Cv", $ptg{ptgFuncV}, $functions{$token}[0]);
+        }
+    }
+
+    # Variable number of args eg. SUM($i,$j,$k, ..).
+    if ($args == -1) {
+        return pack "CCv", $ptg{ptgFuncVarV}, $num_args, $functions{$token}[0];
+    }
+}
+
+
+###############################################################################
+#
+# _cell_to_rowcol($cell_ref)
+#
+# Convert an Excel cell reference such as A1 or $B2 or C$3 or $D$4 to a zero
+# indexed row and column number. Also returns two boolean values to indicate
+# whether the row or column are relative references.
+# TODO use function in Utility.pm
+#
+sub _cell_to_rowcol {
+
+    my $self = shift;
+    my $cell = shift;
+
+    $cell =~ /(\$?)([A-I]?[A-Z])(\$?)(\d+)/;
+
+    my $col_rel = $1 eq "" ? 1 : 0;
+    my $col     = $2;
+    my $row_rel = $3 eq "" ? 1 : 0;
+    my $row     = $4;
+
+    # Convert base26 column string to a number.
+    # All your Base are belong to us.
+    my @chars  = split //, $col;
+    my $expn   = 0;
+    $col       = 0;
+
+    while (@chars) {
+        my $char = pop(@chars); # LS char first
+        $col += (ord($char) - ord('A') + 1) * (26**$expn);
+        $expn++;
+    }
+
+    # Convert 1-index to zero-index
+    $row--;
+    $col--;
+
+    return $row, $col, $row_rel, $col_rel;
+}
+
+
+###############################################################################
+#
+# _cell_to_packed_rowcol($row, $col, $row_rel, $col_rel)
+#
+# pack() row and column into the required 3 byte format.
+#
+sub _cell_to_packed_rowcol {
+
+    use integer;    # Avoid << shift bug in Perl 5.6.0 on HP-UX
+
+    my $self = shift;
+    my $cell = shift;
+
+    my ($row, $col, $row_rel, $col_rel) = $self->_cell_to_rowcol($cell);
+
+    die "Column $cell greater than IV in formula\n" if $col >= 256;
+    die "Row $cell greater than 65536 in formula\n" if $row >= 65536;
+
+    # Set the high bits to indicate if row or col are relative.
+    $col    |= $col_rel << 14;
+    $col    |= $row_rel << 15;
+
+    $row     = pack('v', $row);
+    $col     = pack('v', $col);
+
+    return ($row, $col);
+}
+
+
+###############################################################################
+#
+# _initialize_hashes()
+#
+sub _initialize_hashes {
+
+    # The Excel ptg indices
+    %ptg = (
+        'ptgExp'            => 0x01,
+        'ptgTbl'            => 0x02,
+        'ptgAdd'            => 0x03,
+        'ptgSub'            => 0x04,
+        'ptgMul'            => 0x05,
+        'ptgDiv'            => 0x06,
+        'ptgPower'          => 0x07,
+        'ptgConcat'         => 0x08,
+        'ptgLT'             => 0x09,
+        'ptgLE'             => 0x0A,
+        'ptgEQ'             => 0x0B,
+        'ptgGE'             => 0x0C,
+        'ptgGT'             => 0x0D,
+        'ptgNE'             => 0x0E,
+        'ptgIsect'          => 0x0F,
+        'ptgUnion'          => 0x10,
+        'ptgRange'          => 0x11,
+        'ptgUplus'          => 0x12,
+        'ptgUminus'         => 0x13,
+        'ptgPercent'        => 0x14,
+        'ptgParen'          => 0x15,
+        'ptgMissArg'        => 0x16,
+        'ptgStr'            => 0x17,
+        'ptgAttr'           => 0x19,
+        'ptgSheet'          => 0x1A,
+        'ptgEndSheet'       => 0x1B,
+        'ptgErr'            => 0x1C,
+        'ptgBool'           => 0x1D,
+        'ptgInt'            => 0x1E,
+        'ptgNum'            => 0x1F,
+        'ptgArray'          => 0x20,
+        'ptgFunc'           => 0x21,
+        'ptgFuncVar'        => 0x22,
+        'ptgName'           => 0x23,
+        'ptgRef'            => 0x24,
+        'ptgArea'           => 0x25,
+        'ptgMemArea'        => 0x26,
+        'ptgMemErr'         => 0x27,
+        'ptgMemNoMem'       => 0x28,
+        'ptgMemFunc'        => 0x29,
+        'ptgRefErr'         => 0x2A,
+        'ptgAreaErr'        => 0x2B,
+        'ptgRefN'           => 0x2C,
+        'ptgAreaN'          => 0x2D,
+        'ptgMemAreaN'       => 0x2E,
+        'ptgMemNoMemN'      => 0x2F,
+        'ptgNameX'          => 0x39,
+        'ptgRef3d'          => 0x3A,
+        'ptgArea3d'         => 0x3B,
+        'ptgRefErr3d'       => 0x3C,
+        'ptgAreaErr3d'      => 0x3D,
+        'ptgArrayV'         => 0x40,
+        'ptgFuncV'          => 0x41,
+        'ptgFuncVarV'       => 0x42,
+        'ptgNameV'          => 0x43,
+        'ptgRefV'           => 0x44,
+        'ptgAreaV'          => 0x45,
+        'ptgMemAreaV'       => 0x46,
+        'ptgMemErrV'        => 0x47,
+        'ptgMemNoMemV'      => 0x48,
+        'ptgMemFuncV'       => 0x49,
+        'ptgRefErrV'        => 0x4A,
+        'ptgAreaErrV'       => 0x4B,
+        'ptgRefNV'          => 0x4C,
+        'ptgAreaNV'         => 0x4D,
+        'ptgMemAreaNV'      => 0x4E,
+        'ptgMemNoMemN'      => 0x4F,
+        'ptgFuncCEV'        => 0x58,
+        'ptgNameXV'         => 0x59,
+        'ptgRef3dV'         => 0x5A,
+        'ptgArea3dV'        => 0x5B,
+        'ptgRefErr3dV'      => 0x5C,
+        'ptgAreaErr3d'      => 0x5D,
+        'ptgArrayA'         => 0x60,
+        'ptgFuncA'          => 0x61,
+        'ptgFuncVarA'       => 0x62,
+        'ptgNameA'          => 0x63,
+        'ptgRefA'           => 0x64,
+        'ptgAreaA'          => 0x65,
+        'ptgMemAreaA'       => 0x66,
+        'ptgMemErrA'        => 0x67,
+        'ptgMemNoMemA'      => 0x68,
+        'ptgMemFuncA'       => 0x69,
+        'ptgRefErrA'        => 0x6A,
+        'ptgAreaErrA'       => 0x6B,
+        'ptgRefNA'          => 0x6C,
+        'ptgAreaNA'         => 0x6D,
+        'ptgMemAreaNA'      => 0x6E,
+        'ptgMemNoMemN'      => 0x6F,
+        'ptgFuncCEA'        => 0x78,
+        'ptgNameXA'         => 0x79,
+        'ptgRef3dA'         => 0x7A,
+        'ptgArea3dA'        => 0x7B,
+        'ptgRefErr3dA'      => 0x7C,
+        'ptgAreaErr3d'      => 0x7D,
+    );
+
+    # Thanks to Michael Meeks and Gnumeric for the initial arg values.
+    #
+    # The following hash was generated by "function_locale.pl" in the distro.
+    # Refer to function_locale.pl for non-English function names.
+    #
+    # The array elements are as follow:
+    # ptg:   The Excel function ptg code.
+    # args:  The number of arguments that the function takes:
+    #           >=0 is a fixed number of arguments.
+    #           -1  is a variable  number of arguments.
+    # class: The reference, value or array class of the function args.
+    # vol:   The function is volatile.
+    #
+    %functions  = (
+        #                                     ptg  args  class  vol
+        'COUNT'                         => [   0,   -1,    0,    0 ],
+        'IF'                            => [   1,   -1,    1,    0 ],
+        'ISNA'                          => [   2,    1,    1,    0 ],
+        'ISERROR'                       => [   3,    1,    1,    0 ],
+        'SUM'                           => [   4,   -1,    0,    0 ],
+        'AVERAGE'                       => [   5,   -1,    0,    0 ],
+        'MIN'                           => [   6,   -1,    0,    0 ],
+        'MAX'                           => [   7,   -1,    0,    0 ],
+        'ROW'                           => [   8,   -1,    0,    0 ],
+        'COLUMN'                        => [   9,   -1,    0,    0 ],
+        'NA'                            => [  10,    0,    0,    0 ],
+        'NPV'                           => [  11,   -1,    1,    0 ],
+        'STDEV'                         => [  12,   -1,    0,    0 ],
+        'DOLLAR'                        => [  13,   -1,    1,    0 ],
+        'FIXED'                         => [  14,   -1,    1,    0 ],
+        'SIN'                           => [  15,    1,    1,    0 ],
+        'COS'                           => [  16,    1,    1,    0 ],
+        'TAN'                           => [  17,    1,    1,    0 ],
+        'ATAN'                          => [  18,    1,    1,    0 ],
+        'PI'                            => [  19,    0,    1,    0 ],
+        'SQRT'                          => [  20,    1,    1,    0 ],
+        'EXP'                           => [  21,    1,    1,    0 ],
+        'LN'                            => [  22,    1,    1,    0 ],
+        'LOG10'                         => [  23,    1,    1,    0 ],
+        'ABS'                           => [  24,    1,    1,    0 ],
+        'INT'                           => [  25,    1,    1,    0 ],
+        'SIGN'                          => [  26,    1,    1,    0 ],
+        'ROUND'                         => [  27,    2,    1,    0 ],
+        'LOOKUP'                        => [  28,   -1,    0,    0 ],
+        'INDEX'                         => [  29,   -1,    0,    1 ],
+        'REPT'                          => [  30,    2,    1,    0 ],
+        'MID'                           => [  31,    3,    1,    0 ],
+        'LEN'                           => [  32,    1,    1,    0 ],
+        'VALUE'                         => [  33,    1,    1,    0 ],
+        'TRUE'                          => [  34,    0,    1,    0 ],
+        'FALSE'                         => [  35,    0,    1,    0 ],
+        'AND'                           => [  36,   -1,    1,    0 ],
+        'OR'                            => [  37,   -1,    1,    0 ],
+        'NOT'                           => [  38,    1,    1,    0 ],
+        'MOD'                           => [  39,    2,    1,    0 ],
+        'DCOUNT'                        => [  40,    3,    0,    0 ],
+        'DSUM'                          => [  41,    3,    0,    0 ],
+        'DAVERAGE'                      => [  42,    3,    0,    0 ],
+        'DMIN'                          => [  43,    3,    0,    0 ],
+        'DMAX'                          => [  44,    3,    0,    0 ],
+        'DSTDEV'                        => [  45,    3,    0,    0 ],
+        'VAR'                           => [  46,   -1,    0,    0 ],
+        'DVAR'                          => [  47,    3,    0,    0 ],
+        'TEXT'                          => [  48,    2,    1,    0 ],
+        'LINEST'                        => [  49,   -1,    0,    0 ],
+        'TREND'                         => [  50,   -1,    0,    0 ],
+        'LOGEST'                        => [  51,   -1,    0,    0 ],
+        'GROWTH'                        => [  52,   -1,    0,    0 ],
+        'PV'                            => [  56,   -1,    1,    0 ],
+        'FV'                            => [  57,   -1,    1,    0 ],
+        'NPER'                          => [  58,   -1,    1,    0 ],
+        'PMT'                           => [  59,   -1,    1,    0 ],
+        'RATE'                          => [  60,   -1,    1,    0 ],
+        'MIRR'                          => [  61,    3,    0,    0 ],
+        'IRR'                           => [  62,   -1,    0,    0 ],
+        'RAND'                          => [  63,    0,    1,    1 ],
+        'MATCH'                         => [  64,   -1,    0,    0 ],
+        'DATE'                          => [  65,    3,    1,    0 ],
+        'TIME'                          => [  66,    3,    1,    0 ],
+        'DAY'                           => [  67,    1,    1,    0 ],
+        'MONTH'                         => [  68,    1,    1,    0 ],
+        'YEAR'                          => [  69,    1,    1,    0 ],
+        'WEEKDAY'                       => [  70,   -1,    1,    0 ],
+        'HOUR'                          => [  71,    1,    1,    0 ],
+        'MINUTE'                        => [  72,    1,    1,    0 ],
+        'SECOND'                        => [  73,    1,    1,    0 ],
+        'NOW'                           => [  74,    0,    1,    1 ],
+        'AREAS'                         => [  75,    1,    0,    1 ],
+        'ROWS'                          => [  76,    1,    0,    1 ],
+        'COLUMNS'                       => [  77,    1,    0,    1 ],
+        'OFFSET'                        => [  78,   -1,    0,    1 ],
+        'SEARCH'                        => [  82,   -1,    1,    0 ],
+        'TRANSPOSE'                     => [  83,    1,    1,    0 ],
+        'TYPE'                          => [  86,    1,    1,    0 ],
+        'ATAN2'                         => [  97,    2,    1,    0 ],
+        'ASIN'                          => [  98,    1,    1,    0 ],
+        'ACOS'                          => [  99,    1,    1,    0 ],
+        'CHOOSE'                        => [ 100,   -1,    1,    0 ],
+        'HLOOKUP'                       => [ 101,   -1,    0,    0 ],
+        'VLOOKUP'                       => [ 102,   -1,    0,    0 ],
+        'ISREF'                         => [ 105,    1,    0,    0 ],
+        'LOG'                           => [ 109,   -1,    1,    0 ],
+        'CHAR'                          => [ 111,    1,    1,    0 ],
+        'LOWER'                         => [ 112,    1,    1,    0 ],
+        'UPPER'                         => [ 113,    1,    1,    0 ],
+        'PROPER'                        => [ 114,    1,    1,    0 ],
+        'LEFT'                          => [ 115,   -1,    1,    0 ],
+        'RIGHT'                         => [ 116,   -1,    1,    0 ],
+        'EXACT'                         => [ 117,    2,    1,    0 ],
+        'TRIM'                          => [ 118,    1,    1,    0 ],
+        'REPLACE'                       => [ 119,    4,    1,    0 ],
+        'SUBSTITUTE'                    => [ 120,   -1,    1,    0 ],
+        'CODE'                          => [ 121,    1,    1,    0 ],
+        'FIND'                          => [ 124,   -1,    1,    0 ],
+        'CELL'                          => [ 125,   -1,    0,    1 ],
+        'ISERR'                         => [ 126,    1,    1,    0 ],
+        'ISTEXT'                        => [ 127,    1,    1,    0 ],
+        'ISNUMBER'                      => [ 128,    1,    1,    0 ],
+        'ISBLANK'                       => [ 129,    1,    1,    0 ],
+        'T'                             => [ 130,    1,    0,    0 ],
+        'N'                             => [ 131,    1,    0,    0 ],
+        'DATEVALUE'                     => [ 140,    1,    1,    0 ],
+        'TIMEVALUE'                     => [ 141,    1,    1,    0 ],
+        'SLN'                           => [ 142,    3,    1,    0 ],
+        'SYD'                           => [ 143,    4,    1,    0 ],
+        'DDB'                           => [ 144,   -1,    1,    0 ],
+        'INDIRECT'                      => [ 148,   -1,    1,    1 ],
+        'CALL'                          => [ 150,   -1,    1,    0 ],
+        'CLEAN'                         => [ 162,    1,    1,    0 ],
+        'MDETERM'                       => [ 163,    1,    2,    0 ],
+        'MINVERSE'                      => [ 164,    1,    2,    0 ],
+        'MMULT'                         => [ 165,    2,    2,    0 ],
+        'IPMT'                          => [ 167,   -1,    1,    0 ],
+        'PPMT'                          => [ 168,   -1,    1,    0 ],
+        'COUNTA'                        => [ 169,   -1,    0,    0 ],
+        'PRODUCT'                       => [ 183,   -1,    0,    0 ],
+        'FACT'                          => [ 184,    1,    1,    0 ],
+        'DPRODUCT'                      => [ 189,    3,    0,    0 ],
+        'ISNONTEXT'                     => [ 190,    1,    1,    0 ],
+        'STDEVP'                        => [ 193,   -1,    0,    0 ],
+        'VARP'                          => [ 194,   -1,    0,    0 ],
+        'DSTDEVP'                       => [ 195,    3,    0,    0 ],
+        'DVARP'                         => [ 196,    3,    0,    0 ],
+        'TRUNC'                         => [ 197,   -1,    1,    0 ],
+        'ISLOGICAL'                     => [ 198,    1,    1,    0 ],
+        'DCOUNTA'                       => [ 199,    3,    0,    0 ],
+        'ROUNDUP'                       => [ 212,    2,    1,    0 ],
+        'ROUNDDOWN'                     => [ 213,    2,    1,    0 ],
+        'RANK'                          => [ 216,   -1,    0,    0 ],
+        'ADDRESS'                       => [ 219,   -1,    1,    0 ],
+        'DAYS360'                       => [ 220,   -1,    1,    0 ],
+        'TODAY'                         => [ 221,    0,    1,    1 ],
+        'VDB'                           => [ 222,   -1,    1,    0 ],
+        'MEDIAN'                        => [ 227,   -1,    0,    0 ],
+        'SUMPRODUCT'                    => [ 228,   -1,    2,    0 ],
+        'SINH'                          => [ 229,    1,    1,    0 ],
+        'COSH'                          => [ 230,    1,    1,    0 ],
+        'TANH'                          => [ 231,    1,    1,    0 ],
+        'ASINH'                         => [ 232,    1,    1,    0 ],
+        'ACOSH'                         => [ 233,    1,    1,    0 ],
+        'ATANH'                         => [ 234,    1,    1,    0 ],
+        'DGET'                          => [ 235,    3,    0,    0 ],
+        'INFO'                          => [ 244,    1,    1,    1 ],
+        'DB'                            => [ 247,   -1,    1,    0 ],
+        'FREQUENCY'                     => [ 252,    2,    0,    0 ],
+        'ERROR.TYPE'                    => [ 261,    1,    1,    0 ],
+        'REGISTER.ID'                   => [ 267,   -1,    1,    0 ],
+        'AVEDEV'                        => [ 269,   -1,    0,    0 ],
+        'BETADIST'                      => [ 270,   -1,    1,    0 ],
+        'GAMMALN'                       => [ 271,    1,    1,    0 ],
+        'BETAINV'                       => [ 272,   -1,    1,    0 ],
+        'BINOMDIST'                     => [ 273,    4,    1,    0 ],
+        'CHIDIST'                       => [ 274,    2,    1,    0 ],
+        'CHIINV'                        => [ 275,    2,    1,    0 ],
+        'COMBIN'                        => [ 276,    2,    1,    0 ],
+        'CONFIDENCE'                    => [ 277,    3,    1,    0 ],
+        'CRITBINOM'                     => [ 278,    3,    1,    0 ],
+        'EVEN'                          => [ 279,    1,    1,    0 ],
+        'EXPONDIST'                     => [ 280,    3,    1,    0 ],
+        'FDIST'                         => [ 281,    3,    1,    0 ],
+        'FINV'                          => [ 282,    3,    1,    0 ],
+        'FISHER'                        => [ 283,    1,    1,    0 ],
+        'FISHERINV'                     => [ 284,    1,    1,    0 ],
+        'FLOOR'                         => [ 285,    2,    1,    0 ],
+        'GAMMADIST'                     => [ 286,    4,    1,    0 ],
+        'GAMMAINV'                      => [ 287,    3,    1,    0 ],
+        'CEILING'                       => [ 288,    2,    1,    0 ],
+        'HYPGEOMDIST'                   => [ 289,    4,    1,    0 ],
+        'LOGNORMDIST'                   => [ 290,    3,    1,    0 ],
+        'LOGINV'                        => [ 291,    3,    1,    0 ],
+        'NEGBINOMDIST'                  => [ 292,    3,    1,    0 ],
+        'NORMDIST'                      => [ 293,    4,    1,    0 ],
+        'NORMSDIST'                     => [ 294,    1,    1,    0 ],
+        'NORMINV'                       => [ 295,    3,    1,    0 ],
+        'NORMSINV'                      => [ 296,    1,    1,    0 ],
+        'STANDARDIZE'                   => [ 297,    3,    1,    0 ],
+        'ODD'                           => [ 298,    1,    1,    0 ],
+        'PERMUT'                        => [ 299,    2,    1,    0 ],
+        'POISSON'                       => [ 300,    3,    1,    0 ],
+        'TDIST'                         => [ 301,    3,    1,    0 ],
+        'WEIBULL'                       => [ 302,    4,    1,    0 ],
+        'SUMXMY2'                       => [ 303,    2,    2,    0 ],
+        'SUMX2MY2'                      => [ 304,    2,    2,    0 ],
+        'SUMX2PY2'                      => [ 305,    2,    2,    0 ],
+        'CHITEST'                       => [ 306,    2,    2,    0 ],
+        'CORREL'                        => [ 307,    2,    2,    0 ],
+        'COVAR'                         => [ 308,    2,    2,    0 ],
+        'FORECAST'                      => [ 309,    3,    2,    0 ],
+        'FTEST'                         => [ 310,    2,    2,    0 ],
+        'INTERCEPT'                     => [ 311,    2,    2,    0 ],
+        'PEARSON'                       => [ 312,    2,    2,    0 ],
+        'RSQ'                           => [ 313,    2,    2,    0 ],
+        'STEYX'                         => [ 314,    2,    2,    0 ],
+        'SLOPE'                         => [ 315,    2,    2,    0 ],
+        'TTEST'                         => [ 316,    4,    2,    0 ],
+        'PROB'                          => [ 317,   -1,    2,    0 ],
+        'DEVSQ'                         => [ 318,   -1,    0,    0 ],
+        'GEOMEAN'                       => [ 319,   -1,    0,    0 ],
+        'HARMEAN'                       => [ 320,   -1,    0,    0 ],
+        'SUMSQ'                         => [ 321,   -1,    0,    0 ],
+        'KURT'                          => [ 322,   -1,    0,    0 ],
+        'SKEW'                          => [ 323,   -1,    0,    0 ],
+        'ZTEST'                         => [ 324,   -1,    0,    0 ],
+        'LARGE'                         => [ 325,    2,    0,    0 ],
+        'SMALL'                         => [ 326,    2,    0,    0 ],
+        'QUARTILE'                      => [ 327,    2,    0,    0 ],
+        'PERCENTILE'                    => [ 328,    2,    0,    0 ],
+        'PERCENTRANK'                   => [ 329,   -1,    0,    0 ],
+        'MODE'                          => [ 330,   -1,    2,    0 ],
+        'TRIMMEAN'                      => [ 331,    2,    0,    0 ],
+        'TINV'                          => [ 332,    2,    1,    0 ],
+        'CONCATENATE'                   => [ 336,   -1,    1,    0 ],
+        'POWER'                         => [ 337,    2,    1,    0 ],
+        'RADIANS'                       => [ 342,    1,    1,    0 ],
+        'DEGREES'                       => [ 343,    1,    1,    0 ],
+        'SUBTOTAL'                      => [ 344,   -1,    0,    0 ],
+        'SUMIF'                         => [ 345,   -1,    0,    0 ],
+        'COUNTIF'                       => [ 346,    2,    0,    0 ],
+        'COUNTBLANK'                    => [ 347,    1,    0,    0 ],
+        'ROMAN'                         => [ 354,   -1,    1,    0 ],
+    );
+
+}
+
+
+
+
+1;
+
+
+__END__
+
+
+=head1 NAME
+
+Formula - A class for generating Excel formulas
+
+=head1 SYNOPSIS
+
+See the documentation for Spreadsheet::WriteExcel
+
+=head1 DESCRIPTION
+
+This module is used by Spreadsheet::WriteExcel. You do not need to use it directly.
+
+
+=head1 NOTES
+
+The following notes are to help developers and maintainers understand the sequence of operation. They are also intended as a pro-memoria for the author. ;-)
+
+Spreadsheet::WriteExcel::Formula converts a textual representation of a formula into the pre-parsed binary format that Excel uses to store formulas. For example C<1+2*3> is stored as follows: C<1E 01 00 1E 02 00 1E 03 00 05 03>.
+
+This string is comprised of operators and operands arranged in a reverse-Polish format. The meaning of the tokens in the above example is shown in the following table:
+
+    Token   Name        Value
+    1E      ptgInt      0001   (stored as 01 00)
+    1E      ptgInt      0002   (stored as 02 00)
+    1E      ptgInt      0003   (stored as 03 00)
+    05      ptgMul
+    03      ptgAdd
+
+The tokens and token names are defined in the "Excel Developer's Kit" from Microsoft Press. C<ptg> stands for Parse ThinG (as in "That lexer can't grok it, it's a parse thang.")
+
+In general the tokens fall into two categories: operators such as C<ptgMul> and operands such as C<ptgInt>. When the formula is evaluated by Excel the operand tokens push values onto a stack. The operator tokens then pop the required number of operands off of the stack, perform an operation and push the resulting value back onto the stack. This methodology is similar to the basic operation of a reverse-Polish (RPN) calculator.
+
+Spreadsheet::WriteExcel::Formula parses a formula using a C<Parse::RecDescent> parser (at a later stage it may use a C<Parse::Yapp> parser or C<Parse::FastDescent>).
+
+The parser converts the textual representation of a formula into a parse tree. Thus, C<1+2*3> is converted into something like the following, C<e> stands for expression:
+
+             e
+           / | \
+         1   +   e
+               / | \
+             2   *   3
+
+
+The function C<_reverse_tree()> recurses down through this structure swapping the order of operators followed by operands to produce a reverse-Polish tree. In other words the formula is converted from in-fix notation to post-fix. Following the above example the resulting tree would look like this:
+
+
+             e
+           / | \
+         1   e   +
+           / | \
+         2   3   *
+
+The result of the recursion is a single array of tokens. In our example the simplified form would look like the following:
+
+    (1, 2, 3, *, +)
+
+The actual return value contains some additional information to help in the secondary parsing stage:
+
+    (_num, 1, _num, 2, _num, 3, ptgMul, ptgAdd, _arg, 1)
+
+The additional tokens are:
+
+    Token       Meaning
+    _num        The next token is a number
+    _str        The next token is a string
+    _ref2d      The next token is a 2d cell reference
+    _ref3d      The next token is a 3d cell reference
+    _range2d    The next token is a 2d range
+    _range3d    The next token is a 3d range
+    _func       The next token is a function
+    _arg        The next token is the number of args for a function
+    _class      The next token is a function name
+    _vol        The formula contains a voltile function
+
+The C<_arg> token is generated for all lists but is only used for functions that take a variable number of arguments.
+
+The C<_class> token indicates the start of the arguments to a function. This allows the post-processor to decide the "class" of the ref and range arguments that the function takes. The class can be reference, value or array. Since function calls can be nested, the class variable is stored on a stack in the C<@class> array. The class of the ref or range is then read as the top element of the stack C<$class[-1]>. When a C<_func> is read it pops the class value.
+
+Certain Excel functions such as RAND() and NOW() are designated as volatile and must be recalculated by Excel every time that a cell is updated. Any formulas that contain one of these functions has a specially formatted C<ptgAttr> tag prepended to it to indicate that it is volatile.
+
+A secondary parsing stage is carried out by C<parse_tokens()> which converts these tokens into a binary string. For the C<1+2*3> example this would give:
+
+    1E 01 00 1E 02 00 1E 03 00 05 03
+
+This two-pass method could probably have been reduced to a single pass through the C<Parse::RecDescent> parser. However, it was easier to develop and debug this way.
+
+The token values and formula values are stored in the C<%ptg> and C<%functions> hashes. These hashes and the parser object C<$parser> are exposed as global data. This breaks the OO encapsulation, but means that they can be shared by several instances of Spreadsheet::WriteExcel called from the same program.
+
+Non-English function names can be added to the C<%functions> hash using the C<function_locale.pl> program in the C<examples> directory of the distro. The supported languages are: German, French, Spanish, Portuguese, Dutch, Finnish, Italian and Swedish. These languages are not added by default because there are conflicts between functions names in different languages.
+
+The parser is initialised by C<_init_parser()>. The initialisation is delayed until the first formula is parsed. This eliminates the overhead of generating the parser in programs that are not processing formulas. (The parser should really be pre-compiled, this is to-do when the grammar stabilises).
+
+
+
+
+=head1 AUTHOR
+
+John McNamara jmcnamara at cpan.org
+
+=head1 COPYRIGHT
+
+© MM-MMVI, John McNamara.
+
+All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.

Modified: packages/libspreadsheet-writeexcel-perl/trunk/lib/Spreadsheet/WriteExcel/OLEwriter.pm
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/lib/Spreadsheet/WriteExcel/OLEwriter.pm	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/lib/Spreadsheet/WriteExcel/OLEwriter.pm	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,447 +1,447 @@
-package Spreadsheet::WriteExcel::OLEwriter;
-
-###############################################################################
-#
-# OLEwriter - A writer class to store BIFF data in a OLE compound storage file.
-#
-#
-# Used in conjunction with Spreadsheet::WriteExcel
-#
-# Copyright 2000-2005, John McNamara, jmcnamara at cpan.org
-#
-# Documentation after __END__
-#
-
-use Exporter;
-use strict;
-use Carp;
-use FileHandle;
-
-
-
-
-
-use vars qw($VERSION @ISA);
- at ISA = qw(Exporter);
-
-$VERSION = '2.15';
-
-###############################################################################
-#
-# new()
-#
-# Constructor
-#
-sub new {
-
-    my $class  = shift;
-    my $self   = {
-                    _olefilename   => $_[0],
-                    _filehandle    => "",
-                    _fileclosed    => 0,
-                    _internal_fh   => 0,
-                    _biff_only     => 0,
-                    _size_allowed  => 0,
-                    _biffsize      => 0,
-                    _booksize      => 0,
-                    _big_blocks    => 0,
-                    _list_blocks   => 0,
-                    _root_start    => 0,
-                    _block_count   => 4,
-                 };
-
-    bless $self, $class;
-    $self->_initialize();
-    return $self;
-}
-
-
-###############################################################################
-#
-# _initialize()
-#
-# Create a new filehandle or use the provided filehandle.
-#
-sub _initialize {
-
-    my $self    = shift;
-    my $olefile = $self->{_olefilename};
-    my $fh;
-
-    # If the filename is a reference it is assumed that it is a valid
-    # filehandle, if not we create a filehandle.
-    #
-    if (ref($olefile)) {
-        $fh = $olefile;
-    }
-    else{
-
-        # Create a new file, open for writing
-        $fh = FileHandle->new("> $olefile");
-
-        # Workbook.pm also checks this but something may have happened since
-        # then.
-        if (not defined $fh) {
-            croak "Can't open $olefile. It may be in use or protected.\n";
-        }
-
-        # binmode file whether platform requires it or not
-        binmode($fh);
-
-        $self->{_internal_fh} = 1;
-    }
-
-    # Store filehandle
-    $self->{_filehandle} = $fh;
-}
-
-
-###############################################################################
-#
-# set_size($biffsize)
-#
-# Set the size of the data to be written to the OLE stream
-#
-#   $big_blocks = (109 depot block x (128 -1 marker word)
-#                 - (1 x end words)) = 13842
-#   $maxsize    = $big_blocks * 512 bytes = 7087104
-#
-sub set_size {
-
-    my $self    = shift;
-    my $maxsize = 7_087_104; # Use Spreadsheet::WriteExcel::Big to exceed this
-
-    if ($_[0] > $maxsize) {
-        return $self->{_size_allowed} = 0;
-    }
-
-    $self->{_biffsize} = $_[0];
-
-    # Set the min file size to 4k to avoid having to use small blocks
-    if ($_[0] > 4096) {
-        $self->{_booksize} = $_[0];
-    }
-    else {
-        $self->{_booksize} = 4096;
-    }
-
-    return $self->{_size_allowed} = 1;
-
-}
-
-
-###############################################################################
-#
-# _calculate_sizes()
-#
-# Calculate various sizes needed for the OLE stream
-#
-sub _calculate_sizes {
-
-    my $self     = shift;
-    my $datasize = $self->{_booksize};
-
-    if ($datasize % 512 == 0) {
-        $self->{_big_blocks} = $datasize/512;
-    }
-    else {
-        $self->{_big_blocks} = int($datasize/512) +1;
-    }
-    # There are 127 list blocks and 1 marker blocks for each big block
-    # depot + 1 end of chain block
-    $self->{_list_blocks} = int(($self->{_big_blocks})/127) +1;
-    $self->{_root_start}  = $self->{_big_blocks};
-}
-
-
-###############################################################################
-#
-# close()
-#
-# Write root entry, big block list and close the filehandle.
-# This routine is used to explicitly close the open filehandle without
-# having to wait for DESTROY.
-#
-sub close {
-
-    my $self = shift;
-
-    return if not $self->{_size_allowed};
-
-    $self->_write_padding()          if not $self->{_biff_only};
-    $self->_write_property_storage() if not $self->{_biff_only};
-    $self->_write_big_block_depot()  if not $self->{_biff_only};
-
-    my $close;
-
-    # Close the filehandle if it was created internally.
-    $close = CORE::close($self->{_filehandle}) if $self->{_internal_fh};
-
-    $self->{_fileclosed} = 1;
-
-    return $close;
-}
-
-
-###############################################################################
-#
-# DESTROY()
-#
-# Close the filehandle if it hasn't already been explicitly closed.
-#
-sub DESTROY {
-
-    my $self = shift;
-
-    $self->close() unless $self->{_fileclosed};
-}
-
-
-###############################################################################
-#
-# write($data)
-#
-# Write BIFF data to OLE file.
-#
-sub write {
-
-    my $self = shift;
-
-    # Protect print() from -l on the command line.
-    local $\ = undef;
-    print {$self->{_filehandle}} $_[0];
-}
-
-
-###############################################################################
-#
-# write_header()
-#
-# Write OLE header block.
-#
-sub write_header {
-
-    my $self            = shift;
-
-    return if $self->{_biff_only};
-    $self->_calculate_sizes();
-
-    my $root_start      = $self->{_root_start};
-    my $num_lists       = $self->{_list_blocks};
-
-    my $id              = pack("NN",   0xD0CF11E0, 0xA1B11AE1);
-    my $unknown1        = pack("VVVV", 0x00, 0x00, 0x00, 0x00);
-    my $unknown2        = pack("vv",   0x3E, 0x03);
-    my $unknown3        = pack("v",    -2);
-    my $unknown4        = pack("v",    0x09);
-    my $unknown5        = pack("VVV",  0x06, 0x00, 0x00);
-    my $num_bbd_blocks  = pack("V",    $num_lists);
-    my $root_startblock = pack("V",    $root_start);
-    my $unknown6        = pack("VV",   0x00, 0x1000);
-    my $sbd_startblock  = pack("V",    -2);
-    my $unknown7        = pack("VVV",  0x00, -2 ,0x00);
-    my $unused          = pack("V",    -1);
-
-    # Protect print() from -l on the command line.
-    local $\ = undef;
-
-    print {$self->{_filehandle}}  $id;
-    print {$self->{_filehandle}}  $unknown1;
-    print {$self->{_filehandle}}  $unknown2;
-    print {$self->{_filehandle}}  $unknown3;
-    print {$self->{_filehandle}}  $unknown4;
-    print {$self->{_filehandle}}  $unknown5;
-    print {$self->{_filehandle}}  $num_bbd_blocks;
-    print {$self->{_filehandle}}  $root_startblock;
-    print {$self->{_filehandle}}  $unknown6;
-    print {$self->{_filehandle}}  $sbd_startblock;
-    print {$self->{_filehandle}}  $unknown7;
-
-    for (1..$num_lists) {
-        $root_start++;
-        print {$self->{_filehandle}}  pack("V", $root_start);
-    }
-
-    for ($num_lists..108) {
-        print {$self->{_filehandle}}  $unused;
-    }
-}
-
-
-###############################################################################
-#
-# _write_big_block_depot()
-#
-# Write big block depot.
-#
-sub _write_big_block_depot {
-
-    my $self         = shift;
-    my $num_blocks   = $self->{_big_blocks};
-    my $num_lists    = $self->{_list_blocks};
-    my $total_blocks = $num_lists *128;
-    my $used_blocks  = $num_blocks + $num_lists +2;
-
-    my $marker       = pack("V", -3);
-    my $end_of_chain = pack("V", -2);
-    my $unused       = pack("V", -1);
-
-
-    # Protect print() from -l on the command line.
-    local $\ = undef;
-
-    for my $i (1..$num_blocks-1) {
-        print {$self->{_filehandle}}  pack("V",$i);
-    }
-
-    print {$self->{_filehandle}}  $end_of_chain;
-    print {$self->{_filehandle}}  $end_of_chain;
-
-    for (1..$num_lists) {
-        print {$self->{_filehandle}}  $marker;
-    }
-
-    for ($used_blocks..$total_blocks) {
-        print {$self->{_filehandle}}  $unused;
-    }
-}
-
-
-###############################################################################
-#
-# _write_property_storage()
-#
-# Write property storage. TODO: add summary sheets
-#
-sub _write_property_storage {
-
-    my $self     = shift;
-
-    my $rootsize = -2;
-    my $booksize = $self->{_booksize};
-
-    #################  name         type   dir start size
-    $self->_write_pps('Root Entry', 0x05,   1,   -2, 0x00);
-    $self->_write_pps('Workbook',   0x02,  -1, 0x00, $booksize);
-    $self->_write_pps('',           0x00,  -1, 0x00, 0x0000);
-    $self->_write_pps('',           0x00,  -1, 0x00, 0x0000);
-}
-
-
-###############################################################################
-#
-# _write_pps()
-#
-# Write property sheet in property storage
-#
-sub _write_pps {
-
-    my $self            = shift;
-
-    my $name            = $_[0];
-    my @name            = ();
-    my $length          = 0;
-
-    if ($name ne '') {
-        $name   = $_[0] . "\0";
-        # Simulate a Unicode string
-        @name   = map(ord, split('', $name));
-        $length = length($name) * 2;
-    }
-
-    my $rawname         = pack("v*", @name);
-    my $zero            = pack("C",  0);
-
-    my $pps_sizeofname  = pack("v",  $length);    #0x40
-    my $pps_type        = pack("v",  $_[1]);      #0x42
-    my $pps_prev        = pack("V",  -1);         #0x44
-    my $pps_next        = pack("V",  -1);         #0x48
-    my $pps_dir         = pack("V",  $_[2]);      #0x4c
-
-    my $unknown1        = pack("V",  0);
-
-    my $pps_ts1s        = pack("V",  0);          #0x64
-    my $pps_ts1d        = pack("V",  0);          #0x68
-    my $pps_ts2s        = pack("V",  0);          #0x6c
-    my $pps_ts2d        = pack("V",  0);          #0x70
-    my $pps_sb          = pack("V",  $_[3]);      #0x74
-    my $pps_size        = pack("V",  $_[4]);      #0x78
-
-
-    # Protect print() from -l on the command line.
-    local $\ = undef;
-
-    print {$self->{_filehandle}}  $rawname;
-    print {$self->{_filehandle}}  $zero x (64 -$length);
-    print {$self->{_filehandle}}  $pps_sizeofname;
-    print {$self->{_filehandle}}  $pps_type;
-    print {$self->{_filehandle}}  $pps_prev;
-    print {$self->{_filehandle}}  $pps_next;
-    print {$self->{_filehandle}}  $pps_dir;
-    print {$self->{_filehandle}}  $unknown1 x 5;
-    print {$self->{_filehandle}}  $pps_ts1s;
-    print {$self->{_filehandle}}  $pps_ts1d;
-    print {$self->{_filehandle}}  $pps_ts2d;
-    print {$self->{_filehandle}}  $pps_ts2d;
-    print {$self->{_filehandle}}  $pps_sb;
-    print {$self->{_filehandle}}  $pps_size;
-    print {$self->{_filehandle}}  $unknown1;
-}
-
-
-###############################################################################
-#
-# _write_padding()
-#
-# Pad the end of the file
-#
-sub _write_padding {
-
-    my $self     = shift;
-    my $biffsize = $self->{_biffsize};
-    my $min_size;
-
-    if ($biffsize < 4096) {
-        $min_size = 4096;
-    }
-    else {
-        $min_size = 512;
-    }
-
-    # Protect print() from -l on the command line.
-    local $\ = undef;
-
-    if ($biffsize % $min_size != 0) {
-        my $padding  = $min_size - ($biffsize % $min_size);
-        print {$self->{_filehandle}}  "\0" x $padding;
-    }
-}
-
-
-1;
-
-
-__END__
-
-
-=head1 NAME
-
-OLEwriter - A writer class to store BIFF data in a OLE compound storage file.
-
-=head1 SYNOPSIS
-
-See the documentation for Spreadsheet::WriteExcel
-
-=head1 DESCRIPTION
-
-This module is used in conjunction with Spreadsheet::WriteExcel.
-
-=head1 AUTHOR
-
-John McNamara jmcnamara at cpan.org
-
-=head1 COPYRIGHT
-
-© MM-MMV, John McNamara.
-
-All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.
+package Spreadsheet::WriteExcel::OLEwriter;
+
+###############################################################################
+#
+# OLEwriter - A writer class to store BIFF data in a OLE compound storage file.
+#
+#
+# Used in conjunction with Spreadsheet::WriteExcel
+#
+# Copyright 2000-2006, John McNamara, jmcnamara at cpan.org
+#
+# Documentation after __END__
+#
+
+use Exporter;
+use strict;
+use Carp;
+use FileHandle;
+
+
+
+
+
+use vars qw($VERSION @ISA);
+ at ISA = qw(Exporter);
+
+$VERSION = '2.15';
+
+###############################################################################
+#
+# new()
+#
+# Constructor
+#
+sub new {
+
+    my $class  = shift;
+    my $self   = {
+                    _olefilename   => $_[0],
+                    _filehandle    => "",
+                    _fileclosed    => 0,
+                    _internal_fh   => 0,
+                    _biff_only     => 0,
+                    _size_allowed  => 0,
+                    _biffsize      => 0,
+                    _booksize      => 0,
+                    _big_blocks    => 0,
+                    _list_blocks   => 0,
+                    _root_start    => 0,
+                    _block_count   => 4,
+                 };
+
+    bless $self, $class;
+    $self->_initialize();
+    return $self;
+}
+
+
+###############################################################################
+#
+# _initialize()
+#
+# Create a new filehandle or use the provided filehandle.
+#
+sub _initialize {
+
+    my $self    = shift;
+    my $olefile = $self->{_olefilename};
+    my $fh;
+
+    # If the filename is a reference it is assumed that it is a valid
+    # filehandle, if not we create a filehandle.
+    #
+    if (ref($olefile)) {
+        $fh = $olefile;
+    }
+    else{
+
+        # Create a new file, open for writing
+        $fh = FileHandle->new("> $olefile");
+
+        # Workbook.pm also checks this but something may have happened since
+        # then.
+        if (not defined $fh) {
+            croak "Can't open $olefile. It may be in use or protected.\n";
+        }
+
+        # binmode file whether platform requires it or not
+        binmode($fh);
+
+        $self->{_internal_fh} = 1;
+    }
+
+    # Store filehandle
+    $self->{_filehandle} = $fh;
+}
+
+
+###############################################################################
+#
+# set_size($biffsize)
+#
+# Set the size of the data to be written to the OLE stream
+#
+#   $big_blocks = (109 depot block x (128 -1 marker word)
+#                 - (1 x end words)) = 13842
+#   $maxsize    = $big_blocks * 512 bytes = 7087104
+#
+sub set_size {
+
+    my $self    = shift;
+    my $maxsize = 7_087_104; # Use Spreadsheet::WriteExcel::Big to exceed this
+
+    if ($_[0] > $maxsize) {
+        return $self->{_size_allowed} = 0;
+    }
+
+    $self->{_biffsize} = $_[0];
+
+    # Set the min file size to 4k to avoid having to use small blocks
+    if ($_[0] > 4096) {
+        $self->{_booksize} = $_[0];
+    }
+    else {
+        $self->{_booksize} = 4096;
+    }
+
+    return $self->{_size_allowed} = 1;
+
+}
+
+
+###############################################################################
+#
+# _calculate_sizes()
+#
+# Calculate various sizes needed for the OLE stream
+#
+sub _calculate_sizes {
+
+    my $self     = shift;
+    my $datasize = $self->{_booksize};
+
+    if ($datasize % 512 == 0) {
+        $self->{_big_blocks} = $datasize/512;
+    }
+    else {
+        $self->{_big_blocks} = int($datasize/512) +1;
+    }
+    # There are 127 list blocks and 1 marker blocks for each big block
+    # depot + 1 end of chain block
+    $self->{_list_blocks} = int(($self->{_big_blocks})/127) +1;
+    $self->{_root_start}  = $self->{_big_blocks};
+}
+
+
+###############################################################################
+#
+# close()
+#
+# Write root entry, big block list and close the filehandle.
+# This routine is used to explicitly close the open filehandle without
+# having to wait for DESTROY.
+#
+sub close {
+
+    my $self = shift;
+
+    return if not $self->{_size_allowed};
+
+    $self->_write_padding()          if not $self->{_biff_only};
+    $self->_write_property_storage() if not $self->{_biff_only};
+    $self->_write_big_block_depot()  if not $self->{_biff_only};
+
+    my $close;
+
+    # Close the filehandle if it was created internally.
+    $close = CORE::close($self->{_filehandle}) if $self->{_internal_fh};
+
+    $self->{_fileclosed} = 1;
+
+    return $close;
+}
+
+
+###############################################################################
+#
+# DESTROY()
+#
+# Close the filehandle if it hasn't already been explicitly closed.
+#
+sub DESTROY {
+
+    my $self = shift;
+
+    $self->close() unless $self->{_fileclosed};
+}
+
+
+###############################################################################
+#
+# write($data)
+#
+# Write BIFF data to OLE file.
+#
+sub write {
+
+    my $self = shift;
+
+    # Protect print() from -l on the command line.
+    local $\ = undef;
+    print {$self->{_filehandle}} $_[0];
+}
+
+
+###############################################################################
+#
+# write_header()
+#
+# Write OLE header block.
+#
+sub write_header {
+
+    my $self            = shift;
+
+    return if $self->{_biff_only};
+    $self->_calculate_sizes();
+
+    my $root_start      = $self->{_root_start};
+    my $num_lists       = $self->{_list_blocks};
+
+    my $id              = pack("NN",   0xD0CF11E0, 0xA1B11AE1);
+    my $unknown1        = pack("VVVV", 0x00, 0x00, 0x00, 0x00);
+    my $unknown2        = pack("vv",   0x3E, 0x03);
+    my $unknown3        = pack("v",    -2);
+    my $unknown4        = pack("v",    0x09);
+    my $unknown5        = pack("VVV",  0x06, 0x00, 0x00);
+    my $num_bbd_blocks  = pack("V",    $num_lists);
+    my $root_startblock = pack("V",    $root_start);
+    my $unknown6        = pack("VV",   0x00, 0x1000);
+    my $sbd_startblock  = pack("V",    -2);
+    my $unknown7        = pack("VVV",  0x00, -2 ,0x00);
+    my $unused          = pack("V",    -1);
+
+    # Protect print() from -l on the command line.
+    local $\ = undef;
+
+    print {$self->{_filehandle}}  $id;
+    print {$self->{_filehandle}}  $unknown1;
+    print {$self->{_filehandle}}  $unknown2;
+    print {$self->{_filehandle}}  $unknown3;
+    print {$self->{_filehandle}}  $unknown4;
+    print {$self->{_filehandle}}  $unknown5;
+    print {$self->{_filehandle}}  $num_bbd_blocks;
+    print {$self->{_filehandle}}  $root_startblock;
+    print {$self->{_filehandle}}  $unknown6;
+    print {$self->{_filehandle}}  $sbd_startblock;
+    print {$self->{_filehandle}}  $unknown7;
+
+    for (1..$num_lists) {
+        $root_start++;
+        print {$self->{_filehandle}}  pack("V", $root_start);
+    }
+
+    for ($num_lists..108) {
+        print {$self->{_filehandle}}  $unused;
+    }
+}
+
+
+###############################################################################
+#
+# _write_big_block_depot()
+#
+# Write big block depot.
+#
+sub _write_big_block_depot {
+
+    my $self         = shift;
+    my $num_blocks   = $self->{_big_blocks};
+    my $num_lists    = $self->{_list_blocks};
+    my $total_blocks = $num_lists *128;
+    my $used_blocks  = $num_blocks + $num_lists +2;
+
+    my $marker       = pack("V", -3);
+    my $end_of_chain = pack("V", -2);
+    my $unused       = pack("V", -1);
+
+
+    # Protect print() from -l on the command line.
+    local $\ = undef;
+
+    for my $i (1..$num_blocks-1) {
+        print {$self->{_filehandle}}  pack("V",$i);
+    }
+
+    print {$self->{_filehandle}}  $end_of_chain;
+    print {$self->{_filehandle}}  $end_of_chain;
+
+    for (1..$num_lists) {
+        print {$self->{_filehandle}}  $marker;
+    }
+
+    for ($used_blocks..$total_blocks) {
+        print {$self->{_filehandle}}  $unused;
+    }
+}
+
+
+###############################################################################
+#
+# _write_property_storage()
+#
+# Write property storage. TODO: add summary sheets
+#
+sub _write_property_storage {
+
+    my $self     = shift;
+
+    my $rootsize = -2;
+    my $booksize = $self->{_booksize};
+
+    #################  name         type   dir start size
+    $self->_write_pps('Root Entry', 0x05,   1,   -2, 0x00);
+    $self->_write_pps('Workbook',   0x02,  -1, 0x00, $booksize);
+    $self->_write_pps('',           0x00,  -1, 0x00, 0x0000);
+    $self->_write_pps('',           0x00,  -1, 0x00, 0x0000);
+}
+
+
+###############################################################################
+#
+# _write_pps()
+#
+# Write property sheet in property storage
+#
+sub _write_pps {
+
+    my $self            = shift;
+
+    my $name            = $_[0];
+    my @name            = ();
+    my $length          = 0;
+
+    if ($name ne '') {
+        $name   = $_[0] . "\0";
+        # Simulate a Unicode string
+        @name   = map(ord, split('', $name));
+        $length = length($name) * 2;
+    }
+
+    my $rawname         = pack("v*", @name);
+    my $zero            = pack("C",  0);
+
+    my $pps_sizeofname  = pack("v",  $length);    #0x40
+    my $pps_type        = pack("v",  $_[1]);      #0x42
+    my $pps_prev        = pack("V",  -1);         #0x44
+    my $pps_next        = pack("V",  -1);         #0x48
+    my $pps_dir         = pack("V",  $_[2]);      #0x4c
+
+    my $unknown1        = pack("V",  0);
+
+    my $pps_ts1s        = pack("V",  0);          #0x64
+    my $pps_ts1d        = pack("V",  0);          #0x68
+    my $pps_ts2s        = pack("V",  0);          #0x6c
+    my $pps_ts2d        = pack("V",  0);          #0x70
+    my $pps_sb          = pack("V",  $_[3]);      #0x74
+    my $pps_size        = pack("V",  $_[4]);      #0x78
+
+
+    # Protect print() from -l on the command line.
+    local $\ = undef;
+
+    print {$self->{_filehandle}}  $rawname;
+    print {$self->{_filehandle}}  $zero x (64 -$length);
+    print {$self->{_filehandle}}  $pps_sizeofname;
+    print {$self->{_filehandle}}  $pps_type;
+    print {$self->{_filehandle}}  $pps_prev;
+    print {$self->{_filehandle}}  $pps_next;
+    print {$self->{_filehandle}}  $pps_dir;
+    print {$self->{_filehandle}}  $unknown1 x 5;
+    print {$self->{_filehandle}}  $pps_ts1s;
+    print {$self->{_filehandle}}  $pps_ts1d;
+    print {$self->{_filehandle}}  $pps_ts2d;
+    print {$self->{_filehandle}}  $pps_ts2d;
+    print {$self->{_filehandle}}  $pps_sb;
+    print {$self->{_filehandle}}  $pps_size;
+    print {$self->{_filehandle}}  $unknown1;
+}
+
+
+###############################################################################
+#
+# _write_padding()
+#
+# Pad the end of the file
+#
+sub _write_padding {
+
+    my $self     = shift;
+    my $biffsize = $self->{_biffsize};
+    my $min_size;
+
+    if ($biffsize < 4096) {
+        $min_size = 4096;
+    }
+    else {
+        $min_size = 512;
+    }
+
+    # Protect print() from -l on the command line.
+    local $\ = undef;
+
+    if ($biffsize % $min_size != 0) {
+        my $padding  = $min_size - ($biffsize % $min_size);
+        print {$self->{_filehandle}}  "\0" x $padding;
+    }
+}
+
+
+1;
+
+
+__END__
+
+
+=head1 NAME
+
+OLEwriter - A writer class to store BIFF data in a OLE compound storage file.
+
+=head1 SYNOPSIS
+
+See the documentation for Spreadsheet::WriteExcel
+
+=head1 DESCRIPTION
+
+This module is used in conjunction with Spreadsheet::WriteExcel.
+
+=head1 AUTHOR
+
+John McNamara jmcnamara at cpan.org
+
+=head1 COPYRIGHT
+
+© MM-MMVI, John McNamara.
+
+All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.

Modified: packages/libspreadsheet-writeexcel-perl/trunk/lib/Spreadsheet/WriteExcel/Utility.pm
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/lib/Spreadsheet/WriteExcel/Utility.pm	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/lib/Spreadsheet/WriteExcel/Utility.pm	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,884 +1,884 @@
-package Spreadsheet::WriteExcel::Utility;
-
-###############################################################################
-#
-# Utility - Helper functions for Spreadsheet::WriteExcel.
-#
-# Copyright 2000-2005, John McNamara, jmcnamara at cpan.org
-#
-#
-
-use Exporter;
-use strict;
-use autouse 'Date::Calc'  => qw(Delta_DHMS Decode_Date_EU Decode_Date_US);
-use autouse 'Date::Manip' => qw(ParseDate Date_Init);
-
-
-# Do all of the export preparation
-use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
-
-# Row and column functions
-my @rowcol      = qw(
-                        xl_rowcol_to_cell
-                        xl_cell_to_rowcol
-                        xl_inc_row
-                        xl_dec_row
-                        xl_inc_col
-                        xl_dec_col
-                    );
-
-# Date and Time functions
-my @dates       = qw(
-                        xl_date_list
-                        xl_date_1904
-                        xl_parse_time
-                        xl_parse_date
-                        xl_parse_date_init
-                        xl_decode_date_EU
-                        xl_decode_date_US
-                    );
-
-
- at ISA            = qw(Exporter);
- at EXPORT_OK      =   ();
- at EXPORT         =   (@rowcol, @dates);
-%EXPORT_TAGS    =   (
-                        rowcol  => \@rowcol,
-                        dates   => \@dates
-                    );
-
-$VERSION        = '2.01';
-
-
-
-
-=head1 NAME
-
-Utility - Helper functions for Spreadsheet::WriteExcel.
-
-
-
-
-=head1 VERSION
-
-This document refers to version 0.03 of Spreadsheet::WriteExcel::Utility, released March, 2002.
-
-
-
-=head1 SYNOPSIS
-
-Functions to help with some common tasks when using Spreadsheet::WriteExcel.
-
-These functions mainly relate to dealing with rows and columns in A1 notation and to handling dates and times.
-
-    use Spreadsheet::WriteExcel::Utility;               # Import everything
-
-    ($row, $col)    = xl_cell_to_rowcol('C2');          # (1, 2)
-    $str            = xl_rowcol_to_cell(1, 2);          # C2
-    $str            = xl_inc_col('Z1'  );               # AA1
-    $str            = xl_dec_col('AA1' );               # Z1
-
-    $date           = xl_date_list(2002, 1, 1);         # 37257
-    $date           = xl_parse_date("11 July 1997");    # 35622
-    $time           = xl_parse_time('3:21:36 PM');      # 0.64
-    $date           = xl_decode_date_EU("13 May 2002"); # 37389
-
-
-
-
-=head1 DESCRIPTION
-
-This module provides a set of functions to help with some common tasks encountered when using the Spreadsheet::WriteExcel module. The two main categories of function are:
-
-Row and column functions: these are used to deal with Excel's A1 representation of cells. The functions in this category are:
-
-    xl_rowcol_to_cell
-    xl_cell_to_rowcol
-    xl_inc_row
-    xl_dec_row
-    xl_inc_col
-    xl_dec_col
-
-Date and Time functions: these are used to convert dates and times to the numeric format used by Excel. The functions in this category are:
-
-    xl_date_list
-    xl_date_1904
-    xl_parse_time
-    xl_parse_date
-    xl_parse_date_init
-    xl_decode_date_EU
-    xl_decode_date_US
-
-All of these functions are exported by default. However, you can use import lists if you wish to limit the functions that are imported:
-
-    use Spreadsheet::WriteExcel::Utility;                  # Import everything
-    use Spreadsheet::WriteExcel::Utility qw(xl_date_list); # xl_date_list only
-    use Spreadsheet::WriteExcel::Utility qw(:rowcol);      # Row/col functions
-    use Spreadsheet::WriteExcel::Utility qw(:dates);       # Date functions
-
-
-
-=head1 ROW AND COLUMN FUNCTIONS
-
-
-Spreadsheet::WriteExcel supports two forms of notation to designate the position of cells: Row-column notation and A1 notation.
-
-Row-column notation uses a zero based index for both row and column while A1 notation uses the standard Excel alphanumeric sequence of column letter and 1-based row. Columns range from A to IV i.e. 0 to 255, rows range from 1 to 16384 in Excel 5 and 65536 in Excel 97. For example:
-
-    (0, 0)      # The top left cell in row-column notation.
-    ('A1')      # The top left cell in A1 notation.
-
-    (1999, 29)  # Row-column notation.
-    ('AD2000')  # The same cell in A1 notation.
-
-Row-column notation is useful if you are referring to cells programmatically:
-
-    for my $i (0 .. 9) {
-        $worksheet->write($i, 0, 'Hello'); # Cells A1 to A10
-    }
-
-A1 notation is useful for setting up a worksheet manually and for working with formulas:
-
-    $worksheet->write('H1', 200);
-    $worksheet->write('H2', '=H7+1');
-
-The functions in the following sections can be used for dealing with A1 notation, for example:
-
-    ($row, $col)    = xl_cell_to_rowcol('C2');  # (1, 2)
-    $str            = xl_rowcol_to_cell(1, 2);  # C2
-
-
-Cell references in Excel can be either relative or absolute. Absolute references are prefixed by the dollar symbol as shown below:
-
-    A1      # Column and row are relative
-    $A1     # Column is absolute and row is relative
-    A$1     # Column is relative and row is absolute
-    $A$1    # Column and row are absolute
-
-An absolute reference only has an effect if the cell is copied. Refer to the Excel documentation for further details. All of the following functions support absolute references.
-
-=cut
-
-
-
-
-###############################################################################
-###############################################################################
-
-=head2 xl_rowcol_to_cell($row, $col, $row_absolute, $col_absolute)
-
-    Parameters: $row:           Integer
-                $col:           Integer
-                $row_absolute:  Boolean (1/0) [optional, default is 0]
-                $col_absolute:  Boolean (1/0) [optional, default is 0]
-
-    Returns:    A string in A1 cell notation
-
-
-This function converts a zero based row and column cell reference to a A1 style string:
-
-    $str = xl_rowcol_to_cell(0, 0); # A1
-    $str = xl_rowcol_to_cell(0, 1); # B1
-    $str = xl_rowcol_to_cell(1, 0); # A2
-
-
-The optional parameters C<$row_absolute> and C<$col_absolute> can be used to indicate if the row or column is absolute:
-
-    $str = xl_rowcol_to_cell(0, 0, 0, 1); # $A1
-    $str = xl_rowcol_to_cell(0, 0, 1, 0); # A$1
-    $str = xl_rowcol_to_cell(0, 0, 1, 1); # $A$1
-
-See L<ROW AND COLUMN FUNCTIONS> for an explanation of absolute cell references.
-
-
-=cut
-###############################################################################
-#
-# xl_rowcol_to_cell($row, $col, $row_absolute, $col_absolute)
-#
-sub xl_rowcol_to_cell {
-
-    my $row     = $_[0];
-    my $col     = $_[1];
-    my $row_abs = $_[2] ? '$' : '';
-    my $col_abs = $_[3] ? '$' : '';
-
-
-    my $int  = int ($col / 26);
-    my $frac = $col % 26;
-
-    my $chr1 =''; # Most significant character in AA1
-
-    if ($int > 0) {
-        $chr1 = chr( ord('A') + $int  -1 );
-    }
-
-    my $chr2 = chr( ord('A') + $frac );
-
-    # Zero index to 1-index
-    $row++;
-
-    return $col_abs . $chr1 . $chr2 . $row_abs. $row;
-}
-
-
-
-
-###############################################################################
-###############################################################################
-
-=head2 xl_cell_to_rowcol($string)
-
-
-    Parameters: $string         String in A1 format
-
-    Returns:    List            ($row, $col)
-
-This function converts an Excel cell reference in A1 notation to a zero based row and column. The function will also handle Excel's absolute, C<$>, cell notation.
-
-    my ($row, $col) = xl_cell_to_rowcol('A1');     # (0, 0)
-    my ($row, $col) = xl_cell_to_rowcol('B1');     # (0, 1)
-    my ($row, $col) = xl_cell_to_rowcol('C2');     # (1, 2)
-    my ($row, $col) = xl_cell_to_rowcol('$C2' );   # (1, 2)
-    my ($row, $col) = xl_cell_to_rowcol('C$2' );   # (1, 2)
-    my ($row, $col) = xl_cell_to_rowcol('$C$2');   # (1, 2)
-
-=cut
-###############################################################################
-#
-# xl_cell_to_rowcol($string)
-#
-# Returns: ($row, $col, $row_absolute, $col_absolute)
-#
-# The $row_absolute and $col_absolute parameters aren't documented because they
-# mainly used internally and aren't very useful to the user.
-#
-sub xl_cell_to_rowcol {
-
-    my $cell = shift;
-
-    $cell =~ /(\$?)([A-I]?[A-Z])(\$?)(\d+)/;
-
-    my $col_abs = $1 eq "" ? 0 : 1;
-    my $col     = $2;
-    my $row_abs = $3 eq "" ? 0 : 1;
-    my $row     = $4;
-
-    # Convert base26 column string to number
-    # All your Base are belong to us.
-    my @chars  = split //, $col;
-    my $expn   = 0;
-    $col       = 0;
-
-    while (@chars) {
-        my $char = pop(@chars); # LS char first
-        $col += (ord($char) -ord('A') +1) * (26**$expn);
-        $expn++;
-    }
-
-    # Convert 1-index to zero-index
-    $row--;
-    $col--;
-
-    return $row, $col, $row_abs, $col_abs;
-}
-
-
-
-
-###############################################################################
-###############################################################################
-
-=head2 xl_inc_row($string)
-
-
-    Parameters: $string, a string in A1 format
-
-    Returns:    Incremented string in A1 format
-
-This functions takes a cell reference string in A1 notation and increments the row. The function will also handle Excel's absolute, C<$>, cell notation:
-
-    my $str = xl_inc_row('A1'  ); # A2
-    my $str = xl_inc_row('B$2' ); # B$3
-    my $str = xl_inc_row('$C3' ); # $C4
-    my $str = xl_inc_row('$D$4'); # $D$5
-
-
-=cut
-###############################################################################
-#
-# xl_inc_row($string)
-#
-sub xl_inc_row {
-
-    my $cell = shift;
-    my ($row, $col, $row_abs, $col_abs) = xl_cell_to_rowcol($cell);
-
-    return xl_rowcol_to_cell(++$row, $col, $row_abs, $col_abs);
-}
-
-
-
-
-###############################################################################
-###############################################################################
-
-=head2 xl_dec_row($string)
-
-
-    Parameters: $string, a string in A1 format
-
-    Returns:    Decremented string in A1 format
-
-This functions takes a cell reference string in A1 notation and decrements the row. The function will also handle Excel's absolute, C<$>, cell notation:
-
-    my $str = xl_dec_row('A2'  ); # A1
-    my $str = xl_dec_row('B$3' ); # B$2
-    my $str = xl_dec_row('$C4' ); # $C3
-    my $str = xl_dec_row('$D$5'); # $D$4
-
-
-=cut
-###############################################################################
-#
-# xl_dec_row($string)
-#
-# Decrements the row number of an Excel cell reference in A1 notation.
-# For example C4 to C3
-#
-# Returns: a cell reference string.
-#
-sub xl_dec_row {
-
-    my $cell = shift;
-    my ($row, $col, $row_abs, $col_abs) = xl_cell_to_rowcol($cell);
-
-    return xl_rowcol_to_cell(--$row, $col, $row_abs, $col_abs);
-}
-
-
-
-
-###############################################################################
-###############################################################################
-
-=head2 xl_inc_col($string)
-
-
-    Parameters: $string, a string in A1 format
-
-    Returns:    Incremented string in A1 format
-
-This functions takes a cell reference string in A1 notation and increments the column. The function will also handle Excel's absolute, C<$>, cell notation:
-
-    my $str = xl_inc_col('A1'  ); # B1
-    my $str = xl_inc_col('Z1'  ); # AA1
-    my $str = xl_inc_col('$B1' ); # $C1
-    my $str = xl_inc_col('$D$5'); # $E$5
-
-
-=cut
-###############################################################################
-#
-# xl_inc_col($string)
-#
-# Increments the column number of an Excel cell reference in A1 notation.
-# For example C3 to D3
-#
-# Returns: a cell reference string.
-#
-sub xl_inc_col {
-
-    my $cell = shift;
-    my ($row, $col, $row_abs, $col_abs) = xl_cell_to_rowcol($cell);
-
-    return xl_rowcol_to_cell($row, ++$col, $row_abs, $col_abs);
-}
-
-
-
-
-###############################################################################
-###############################################################################
-
-=head2 xl_dec_col($string)
-
-    Parameters: $string, a string in A1 format
-
-    Returns:    Decremented string in A1 format
-
-This functions takes a cell reference string in A1 notation and decrements the column. The function will also handle Excel's absolute, C<$>, cell notation:
-
-    my $str = xl_dec_col('B1'  ); # A1
-    my $str = xl_dec_col('AA1' ); # Z1
-    my $str = xl_dec_col('$C1' ); # $B1
-    my $str = xl_dec_col('$E$5'); # $D$5
-
-
-=cut
-###############################################################################
-#
-# xl_dec_col($string)
-#
-sub xl_dec_col {
-
-    my $cell = shift;
-    my ($row, $col, $row_abs, $col_abs) = xl_cell_to_rowcol($cell);
-
-    return xl_rowcol_to_cell($row, --$col, $row_abs, $col_abs);
-}
-
-
-
-
-=head1 TIME AND DATE FUNCTIONS
-
-
-Dates and times in Excel are represented by real numbers, for example "Jan 1 2001 12:30 AM" is represented by the number 36892.521.
-
-The integer part of the number stores the number of days since the epoch and the fractional part stores the percentage of the day in seconds.
-
-The epoch can be either 1900 or 1904. Excel for Windows uses 1900 and Excel for Macintosh uses 1904. The epochs are:
-
-    1900: 0 January 1900 i.e. 31 December 1899
-    1904: 1 January 1904
-
-Excel on Windows and the Macintosh will convert automatically between one system and the other. By default Spreadsheet::WriteExcel uses the 1900 format. To use the 1904 epoch you must use the C<set_1904()> workbook method, see the Spreadsheet::WriteExcel documentation.
-
-There are two things to note about the 1900 date format. The first is that the epoch starts on 0 January 1900. The second is that the year 1900 is erroneously but deliberately treated as a leap year. Therefore you must add an extra day to dates after 28 February 1900. The functions in the following section will deal with these issues automatically. The reason for this anomaly is explained at http://support.microsoft.com/support/kb/articles/Q181/3/70.asp
-
-Note, a date or time in Excel is like any other number. To display the number as a date you must apply a number format to it: Refer to the C<set_num_format()> method in the Spreadsheet::WriteExcel documentation:
-
-    $date = xl_date_list(2001, 1, 1, 12, 30);
-    $format->set_num_format('mmm d yyyy hh:mm AM/PM');
-    $worksheet->write('A1', $date , $format); # Jan 1 2001 12:30 AM
-
-To use these functions you must install the C<Date::Manip> and C<Date::Calc> modules. See L<REQUIREMENTS> and the individual requirements of each functions.
-
-See also the DateTime::Format::Excel module,http://search.cpan.org/search?dist=DateTime-Format-Excel which is part of the DateTime project and which deals specifically with converting dates and times to and from Excel's format.
-
-
-=cut
-
-
-###############################################################################
-###############################################################################
-
-=head2 xl_date_list($years, $months, $days, $hours, $minutes, $seconds)
-
-
-    Parameters: $years:         Integer
-                $months:        Integer [optional, default is 1]
-                $days:          Integer [optional, default is 1]
-                $hours:         Integer [optional, default is 0]
-                $minutes:       Integer [optional, default is 0]
-                $seconds:       Float   [optional, default is 0]
-
-    Returns:    A number that represents an Excel date
-                or undef for an invalid date.
-
-    Requires:   Date::Calc
-
-This function converts an array of data into a number that represents an Excel date. All of the parameters are optional except for C<$years>.
-
-    $date1 = xl_date_list(2002, 1, 2);              # 2 Jan 2002
-    $date2 = xl_date_list(2002, 1, 2, 12);          # 2 Jan 2002 12:00 pm
-    $date3 = xl_date_list(2002, 1, 2, 12, 30);      # 2 Jan 2002 12:30 pm
-    $date4 = xl_date_list(2002, 1, 2, 12, 30, 45);  # 2 Jan 2002 12:30:45 pm
-
-This function can be used in conjunction with functions that parse date and time strings. In fact it is used in most of the following functions.
-
-
-=cut
-###############################################################################
-#
-# xl_date_list($years, $months, $days, $hours, $minutes, $seconds)
-#
-sub xl_date_list {
-
-    return undef unless @_;
-
-    my $years   = $_[0];
-    my $months  = $_[1] || 1;
-    my $days    = $_[2] || 1;
-    my $hours   = $_[3] || 0;
-    my $minutes = $_[4] || 0;
-    my $seconds = $_[5] || 0;
-
-    my @date = ($years, $months, $days, $hours, $minutes, $seconds);
-    my @epoch = (1899, 12, 31, 0, 0, 0);
-
-    ($days, $hours, $minutes, $seconds) = Delta_DHMS(@epoch, @date);
-
-    my $date = $days + ($hours*3600 +$minutes*60 +$seconds)/(24*60*60);
-
-    # Add a day for Excel's missing leap day in 1900
-    $date++ if ($date > 59);
-
-    return $date;
-}
-
-
-###############################################################################
-###############################################################################
-
-=head2 xl_parse_time($string)
-
-
-    Parameters: $string, a textual representation of a time
-
-    Returns:    A number that represents an Excel time
-                or undef for an invalid time.
-
-This function converts a time string into a number that represents an Excel time. The following time formats are valid:
-
-    hh:mm       [AM|PM]
-    hh:mm       [AM|PM]
-    hh:mm:ss    [AM|PM]
-    hh:mm:ss.ss [AM|PM]
-
-
-The meridian, AM or PM, is optional and case insensitive. A 24 hour time is assumed if the meridian is omitted
-
-    $time1 = xl_parse_time('12:18');
-    $time2 = xl_parse_time('12:18:14');
-    $time3 = xl_parse_time('12:18:14 AM');
-    $time4 = xl_parse_time('1:18:14 AM');
-
-Time in Excel is expressed as a fraction of the day in seconds. Therefore you can calculate an Excel time as follows:
-
-    $time = ($hours*3600 +$minutes*60 +$seconds)/(24*60*60);
-
-
-=cut
-###############################################################################
-#
-# xl_parse_time($string)
-#
-sub xl_parse_time {
-
-    my $time = shift;
-
-    if ($time =~ /(\d{1,2}):(\d\d):?((?:\d\d)(?:\.\d+)?)?(?:\s+)?(am|pm)?/i) {
-
-        my $hours       = $1;
-        my $minutes     = $2;
-        my $seconds     = $3     || 0;
-        my $meridian    = lc($4) || '';
-
-        # Normalise midnight and midday
-        $hours = 0 if ($hours == 12 && $meridian ne '');
-
-        # Add 12 hours to the pm times. Note: 12.00 pm has been set to 0.00.
-        $hours += 12 if $meridian eq 'pm';
-
-        # Calculate the time as a fraction of 24 hours in seconds
-        return ($hours*3600 +$minutes*60 +$seconds)/(24*60*60);
-
-    }
-    else {
-        return undef; # Not a valid time string
-    }
-}
-
-
-###############################################################################
-###############################################################################
-
-=head2 xl_parse_date($string)
-
-
-    Parameters: $string, a textual representation of a date and time
-
-    Returns:    A number that represents an Excel date
-                or undef for an invalid date.
-
-    Requires:   Date::Manip and Date::Calc
-
-This function converts a date and time string into a number that represents an Excel date.
-
-The parsing is performed using the C<ParseDate()> function of the Date::Manip module. Refer to the Date::Manip documentation for further information about the date and time formats that can be parsed. In order to use this function you will probably have to initialise some Date::Manip variables via the C<xl_parse_date_init()> function, see below.
-
-    xl_parse_date_init("TZ=GMT","DateFormat=non-US");
-
-    $date1 = xl_parse_date("11/7/97");
-    $date2 = xl_parse_date("Friday 11 July 1997");
-    $date3 = xl_parse_date("10:30 AM Friday 11 July 1997");
-    $date4 = xl_parse_date("Today");
-    $date5 = xl_parse_date("Yesterday");
-
-Note, if you parse a string that represents a time but not a date this function will add the current date. If you want the time without the date you can do something like the following:
-
-    $time  = xl_parse_date("10:30 AM");
-    $time -= int($time);
-
-
-=cut
-###############################################################################
-#
-# xl_parse_date($string)
-#
-sub xl_parse_date {
-
-    my $date = ParseDate($_[0]);
-
-    return undef unless defined $date;
-
-    # Unpack the return value from ParseDate()
-    my    ($years, $months, $days, $hours, undef, $minutes, undef, $seconds) =
-    unpack("A4     A2       A2     A2      C      A2        C      A2", $date);
-
-    # Convert to Excel date
-    return xl_date_list($years, $months, $days, $hours, $minutes, $seconds);
-}
-
-
-
-
-###############################################################################
-###############################################################################
-
-=head2 xl_parse_date_init("variable=value", ...)
-
-
-    Parameters: A list of Date::Manip variable strings
-
-    Returns:    A list of all the Date::Manip strings
-
-    Requires:   Date::Manip
-
-This function is used to initialise variables required by the Date::Manip module. You should call this function before calling C<xl_parse_date()>. It need only be called once.
-
-This function is a thin wrapper for the C<Date::Manip::Date_Init()> function. You can use C<Date_Init()>  directly if you wish. Refer to the Date::Manip documentation for further information.
-
-    xl_parse_date_init("TZ=MST","DateFormat=US");
-    $date1 = xl_parse_date("11/7/97");  # November 7th 1997
-
-    xl_parse_date_init("TZ=GMT","DateFormat=non-US");
-    $date1 = xl_parse_date("11/7/97");  # July 11th 1997
-
-
-=cut
-###############################################################################
-#
-# xl_parse_date_init("variable=value", ...)
-#
-sub xl_parse_date_init {
-
-    Date_Init(@_); # How lazy is that.
-}
-
-
-
-
-###############################################################################
-###############################################################################
-
-=head2 xl_decode_date_EU($string)
-
-
-    Parameters: $string, a textual representation of a date and time
-
-    Returns:    A number that represents an Excel date
-                or undef for an invalid date.
-
-    Requires:   Date::Calc
-
-This function converts a date and time string into a number that represents an Excel date.
-
-The date parsing is performed using the C<Decode_Date_EU()> function of the Date::Calc module. Refer to the Date::Calc for further information about the date formats that can be parsed. Also note the following from the Date::Calc documentation:
-
-"If the year is given as one or two digits only (i.e., if the year is less than 100), it is mapped to the window 1970 -2069 as follows":
-
-     0 E<lt>= $year E<lt>  70  ==>  $year += 2000;
-    70 E<lt>= $year E<lt> 100  ==>  $year += 1900;
-
-The time portion of the string is parsed using the C<xl_parse_time()> function described above.
-
-Note: the EU in the function name means that a European date format is assumed if it is not clear from the string. See the first example below.
-
-    $date1 = xl_decode_date_EU("11/7/97"); #11 July 1997
-    $date2 = xl_decode_date_EU("Sat 12 Sept 1998");
-    $date3 = xl_decode_date_EU("4:30 AM Sat 12 Sept 1998");
-
-
-=cut
-###############################################################################
-#
-# xl_decode_date_EU($string)
-#
-sub xl_decode_date_EU {
-
-    return undef unless @_;
-
-    my $date = shift;
-    my @date;
-    my $time = 0;
-
-    # Remove and decode the time portion of the string
-    if ($date =~ s/(\d{1,2}:\d\d:?(\d\d(\.\d+)?)?(\s+)?(am|pm)?)//i) {
-        $time = xl_parse_time($1);
-        return undef unless defined $time;
-    }
-
-    # Return if the string is now blank, i.e. it contained a time only.
-    return $time if $date =~ /^\s*$/;
-
-    # Decode the date portion of the string
-    @date = Decode_Date_EU($date);
-    return undef unless @date;
-
-    return xl_date_list(@date) + $time;
-}
-
-
-
-###############################################################################
-###############################################################################
-
-=head2 xl_decode_date_US($string)
-
-
-    Parameters: $string, a textual representation of a date and time
-
-    Returns:    A number that represents an Excel date
-                or undef for an invalid date.
-
-    Requires:   Date::Calc
-
-This function converts a date and time string into a number that represents an Excel date.
-
-The date parsing is performed using the C<Decode_Date_US()> function of the Date::Calc module. Refer to the Date::Calc for further information about the date formats that can be parsed. Also note the following from the Date::Calc documentation:
-
-"If the year is given as one or two digits only (i.e., if the year is less than 100), it is mapped to the window 1970 -2069 as follows":
-
-     0 <= $year <  70  ==>  $year += 2000;
-    70 <= $year < 100  ==>  $year += 1900;
-
-The time portion of the string is parsed using the C<xl_parse_time()> function described above.
-
-Note: the US in the function name means that an American date format is assumed if it is not clear from the string. See the first example below.
-
-    $date1 = xl_decode_date_US("11/7/97"); # 7 November 1997
-    $date2 = xl_decode_date_US("12 Sept Saturday 1998");
-    $date3 = xl_decode_date_US("4:30 AM 12 Sept Sat 1998");
-
-
-=cut
-###############################################################################
-#
-# xl_decode_date_US($string)
-#
-sub xl_decode_date_US {
-
-    return undef unless @_;
-
-    my $date = shift;
-    my @date;
-    my $time = 0;
-
-    # Remove and decode the time portion of the string
-    if ($date =~ s/(\d{1,2}:\d\d:?(\d\d(\.\d+)?)?(\s+)?(am|pm)?)//i) {
-        $time = xl_parse_time($1);
-        return undef unless defined $time;
-    }
-
-    # Return if the string is now blank, i.e. it contained a time only.
-    return $time if $date =~ /^\s*$/;
-
-    # Decode the date portion of the string
-    @date = Decode_Date_US($date);
-    return undef unless @date;
-
-    return xl_date_list(@date) + $time;
-}
-
-
-
-
-###############################################################################
-###############################################################################
-
-=head2 xl_date_1904($date)
-
-
-    Parameters: $date, an Excel date with a 1900 epoch
-
-    Returns:    an Excel date with a 1904 epoch or zero if
-                the $date is before 1904
-
-
-This function converts an Excel date based on the 1900 epoch into a date based on the 1904 epoch.
-
-
-    $date1 = xl_date_list(2002, 1, 13); # 13 Jan 2002, 1900 epoch
-    $date2 = xl_date_1904($date1);      # 13 Jan 2002, 1904 epoch
-
-
-See also the C<set_1904()> workbook method in the Spreadsheet::WriteExcel documentation.
-
-=cut
-###############################################################################
-#
-# xl_decode_date_US($string)
-#
-sub xl_date_1904 {
-
-    my $date = $_[0] || 0;
-
-    if ($date < 1462) {
-        # before 1904
-        $date = 0;
-    }
-    else {
-        $date -= 1462;
-    }
-
-    return $date;
-}
-
-
-
-
-=cut
-
-=head1 REQUIREMENTS
-
-The date and time functions require functions from the C<Date::Manip> and C<Date::Calc> modules. The required functions are "autoused" from these modules so that you do not have to install them unless you wish to use the date and time routines. Therefore it is possible to use the row and column functions without having C<Date::Manip> and C<Date::Calc> installed.
-
-For more information about "autousing" refer to the documentation on the C<autouse> pragma.
-
-
-
-=head1 BUGS
-
-When using the autoused functions from C<Date::Manip> and C<Date::Calc> on Perl 5.6.0 with C<-w> you will get a warning like this:
-
-    "Subroutine xxx redefined ..."
-
-The current workaround for this is to put C<use warnings;> near the beginning of your program.
-
-
-
-=head1 AUTHOR
-
-John McNamara jmcnamara at cpan.org
-
-
-
-
-=head1 COPYRIGHT
-
-© MM-MMV, John McNamara.
-
-All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.
-
-=cut
-
-
-
-1;
-
-
-__END__
-
+package Spreadsheet::WriteExcel::Utility;
+
+###############################################################################
+#
+# Utility - Helper functions for Spreadsheet::WriteExcel.
+#
+# Copyright 2000-2006, John McNamara, jmcnamara at cpan.org
+#
+#
+
+use Exporter;
+use strict;
+use autouse 'Date::Calc'  => qw(Delta_DHMS Decode_Date_EU Decode_Date_US);
+use autouse 'Date::Manip' => qw(ParseDate Date_Init);
+
+
+# Do all of the export preparation
+use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
+
+# Row and column functions
+my @rowcol      = qw(
+                        xl_rowcol_to_cell
+                        xl_cell_to_rowcol
+                        xl_inc_row
+                        xl_dec_row
+                        xl_inc_col
+                        xl_dec_col
+                    );
+
+# Date and Time functions
+my @dates       = qw(
+                        xl_date_list
+                        xl_date_1904
+                        xl_parse_time
+                        xl_parse_date
+                        xl_parse_date_init
+                        xl_decode_date_EU
+                        xl_decode_date_US
+                    );
+
+
+ at ISA            = qw(Exporter);
+ at EXPORT_OK      =   ();
+ at EXPORT         =   (@rowcol, @dates);
+%EXPORT_TAGS    =   (
+                        rowcol  => \@rowcol,
+                        dates   => \@dates
+                    );
+
+$VERSION        = '2.01';
+
+
+
+
+=head1 NAME
+
+Utility - Helper functions for Spreadsheet::WriteExcel.
+
+
+
+
+=head1 VERSION
+
+This document refers to version 0.03 of Spreadsheet::WriteExcel::Utility, released March, 2002.
+
+
+
+=head1 SYNOPSIS
+
+Functions to help with some common tasks when using Spreadsheet::WriteExcel.
+
+These functions mainly relate to dealing with rows and columns in A1 notation and to handling dates and times.
+
+    use Spreadsheet::WriteExcel::Utility;               # Import everything
+
+    ($row, $col)    = xl_cell_to_rowcol('C2');          # (1, 2)
+    $str            = xl_rowcol_to_cell(1, 2);          # C2
+    $str            = xl_inc_col('Z1'  );               # AA1
+    $str            = xl_dec_col('AA1' );               # Z1
+
+    $date           = xl_date_list(2002, 1, 1);         # 37257
+    $date           = xl_parse_date("11 July 1997");    # 35622
+    $time           = xl_parse_time('3:21:36 PM');      # 0.64
+    $date           = xl_decode_date_EU("13 May 2002"); # 37389
+
+
+
+
+=head1 DESCRIPTION
+
+This module provides a set of functions to help with some common tasks encountered when using the Spreadsheet::WriteExcel module. The two main categories of function are:
+
+Row and column functions: these are used to deal with Excel's A1 representation of cells. The functions in this category are:
+
+    xl_rowcol_to_cell
+    xl_cell_to_rowcol
+    xl_inc_row
+    xl_dec_row
+    xl_inc_col
+    xl_dec_col
+
+Date and Time functions: these are used to convert dates and times to the numeric format used by Excel. The functions in this category are:
+
+    xl_date_list
+    xl_date_1904
+    xl_parse_time
+    xl_parse_date
+    xl_parse_date_init
+    xl_decode_date_EU
+    xl_decode_date_US
+
+All of these functions are exported by default. However, you can use import lists if you wish to limit the functions that are imported:
+
+    use Spreadsheet::WriteExcel::Utility;                  # Import everything
+    use Spreadsheet::WriteExcel::Utility qw(xl_date_list); # xl_date_list only
+    use Spreadsheet::WriteExcel::Utility qw(:rowcol);      # Row/col functions
+    use Spreadsheet::WriteExcel::Utility qw(:dates);       # Date functions
+
+
+
+=head1 ROW AND COLUMN FUNCTIONS
+
+
+Spreadsheet::WriteExcel supports two forms of notation to designate the position of cells: Row-column notation and A1 notation.
+
+Row-column notation uses a zero based index for both row and column while A1 notation uses the standard Excel alphanumeric sequence of column letter and 1-based row. Columns range from A to IV i.e. 0 to 255, rows range from 1 to 16384 in Excel 5 and 65536 in Excel 97. For example:
+
+    (0, 0)      # The top left cell in row-column notation.
+    ('A1')      # The top left cell in A1 notation.
+
+    (1999, 29)  # Row-column notation.
+    ('AD2000')  # The same cell in A1 notation.
+
+Row-column notation is useful if you are referring to cells programmatically:
+
+    for my $i (0 .. 9) {
+        $worksheet->write($i, 0, 'Hello'); # Cells A1 to A10
+    }
+
+A1 notation is useful for setting up a worksheet manually and for working with formulas:
+
+    $worksheet->write('H1', 200);
+    $worksheet->write('H2', '=H7+1');
+
+The functions in the following sections can be used for dealing with A1 notation, for example:
+
+    ($row, $col)    = xl_cell_to_rowcol('C2');  # (1, 2)
+    $str            = xl_rowcol_to_cell(1, 2);  # C2
+
+
+Cell references in Excel can be either relative or absolute. Absolute references are prefixed by the dollar symbol as shown below:
+
+    A1      # Column and row are relative
+    $A1     # Column is absolute and row is relative
+    A$1     # Column is relative and row is absolute
+    $A$1    # Column and row are absolute
+
+An absolute reference only has an effect if the cell is copied. Refer to the Excel documentation for further details. All of the following functions support absolute references.
+
+=cut
+
+
+
+
+###############################################################################
+###############################################################################
+
+=head2 xl_rowcol_to_cell($row, $col, $row_absolute, $col_absolute)
+
+    Parameters: $row:           Integer
+                $col:           Integer
+                $row_absolute:  Boolean (1/0) [optional, default is 0]
+                $col_absolute:  Boolean (1/0) [optional, default is 0]
+
+    Returns:    A string in A1 cell notation
+
+
+This function converts a zero based row and column cell reference to a A1 style string:
+
+    $str = xl_rowcol_to_cell(0, 0); # A1
+    $str = xl_rowcol_to_cell(0, 1); # B1
+    $str = xl_rowcol_to_cell(1, 0); # A2
+
+
+The optional parameters C<$row_absolute> and C<$col_absolute> can be used to indicate if the row or column is absolute:
+
+    $str = xl_rowcol_to_cell(0, 0, 0, 1); # $A1
+    $str = xl_rowcol_to_cell(0, 0, 1, 0); # A$1
+    $str = xl_rowcol_to_cell(0, 0, 1, 1); # $A$1
+
+See L<ROW AND COLUMN FUNCTIONS> for an explanation of absolute cell references.
+
+
+=cut
+###############################################################################
+#
+# xl_rowcol_to_cell($row, $col, $row_absolute, $col_absolute)
+#
+sub xl_rowcol_to_cell {
+
+    my $row     = $_[0];
+    my $col     = $_[1];
+    my $row_abs = $_[2] ? '$' : '';
+    my $col_abs = $_[3] ? '$' : '';
+
+
+    my $int  = int ($col / 26);
+    my $frac = $col % 26;
+
+    my $chr1 =''; # Most significant character in AA1
+
+    if ($int > 0) {
+        $chr1 = chr( ord('A') + $int  -1 );
+    }
+
+    my $chr2 = chr( ord('A') + $frac );
+
+    # Zero index to 1-index
+    $row++;
+
+    return $col_abs . $chr1 . $chr2 . $row_abs. $row;
+}
+
+
+
+
+###############################################################################
+###############################################################################
+
+=head2 xl_cell_to_rowcol($string)
+
+
+    Parameters: $string         String in A1 format
+
+    Returns:    List            ($row, $col)
+
+This function converts an Excel cell reference in A1 notation to a zero based row and column. The function will also handle Excel's absolute, C<$>, cell notation.
+
+    my ($row, $col) = xl_cell_to_rowcol('A1');     # (0, 0)
+    my ($row, $col) = xl_cell_to_rowcol('B1');     # (0, 1)
+    my ($row, $col) = xl_cell_to_rowcol('C2');     # (1, 2)
+    my ($row, $col) = xl_cell_to_rowcol('$C2' );   # (1, 2)
+    my ($row, $col) = xl_cell_to_rowcol('C$2' );   # (1, 2)
+    my ($row, $col) = xl_cell_to_rowcol('$C$2');   # (1, 2)
+
+=cut
+###############################################################################
+#
+# xl_cell_to_rowcol($string)
+#
+# Returns: ($row, $col, $row_absolute, $col_absolute)
+#
+# The $row_absolute and $col_absolute parameters aren't documented because they
+# mainly used internally and aren't very useful to the user.
+#
+sub xl_cell_to_rowcol {
+
+    my $cell = shift;
+
+    $cell =~ /(\$?)([A-I]?[A-Z])(\$?)(\d+)/;
+
+    my $col_abs = $1 eq "" ? 0 : 1;
+    my $col     = $2;
+    my $row_abs = $3 eq "" ? 0 : 1;
+    my $row     = $4;
+
+    # Convert base26 column string to number
+    # All your Base are belong to us.
+    my @chars  = split //, $col;
+    my $expn   = 0;
+    $col       = 0;
+
+    while (@chars) {
+        my $char = pop(@chars); # LS char first
+        $col += (ord($char) -ord('A') +1) * (26**$expn);
+        $expn++;
+    }
+
+    # Convert 1-index to zero-index
+    $row--;
+    $col--;
+
+    return $row, $col, $row_abs, $col_abs;
+}
+
+
+
+
+###############################################################################
+###############################################################################
+
+=head2 xl_inc_row($string)
+
+
+    Parameters: $string, a string in A1 format
+
+    Returns:    Incremented string in A1 format
+
+This functions takes a cell reference string in A1 notation and increments the row. The function will also handle Excel's absolute, C<$>, cell notation:
+
+    my $str = xl_inc_row('A1'  ); # A2
+    my $str = xl_inc_row('B$2' ); # B$3
+    my $str = xl_inc_row('$C3' ); # $C4
+    my $str = xl_inc_row('$D$4'); # $D$5
+
+
+=cut
+###############################################################################
+#
+# xl_inc_row($string)
+#
+sub xl_inc_row {
+
+    my $cell = shift;
+    my ($row, $col, $row_abs, $col_abs) = xl_cell_to_rowcol($cell);
+
+    return xl_rowcol_to_cell(++$row, $col, $row_abs, $col_abs);
+}
+
+
+
+
+###############################################################################
+###############################################################################
+
+=head2 xl_dec_row($string)
+
+
+    Parameters: $string, a string in A1 format
+
+    Returns:    Decremented string in A1 format
+
+This functions takes a cell reference string in A1 notation and decrements the row. The function will also handle Excel's absolute, C<$>, cell notation:
+
+    my $str = xl_dec_row('A2'  ); # A1
+    my $str = xl_dec_row('B$3' ); # B$2
+    my $str = xl_dec_row('$C4' ); # $C3
+    my $str = xl_dec_row('$D$5'); # $D$4
+
+
+=cut
+###############################################################################
+#
+# xl_dec_row($string)
+#
+# Decrements the row number of an Excel cell reference in A1 notation.
+# For example C4 to C3
+#
+# Returns: a cell reference string.
+#
+sub xl_dec_row {
+
+    my $cell = shift;
+    my ($row, $col, $row_abs, $col_abs) = xl_cell_to_rowcol($cell);
+
+    return xl_rowcol_to_cell(--$row, $col, $row_abs, $col_abs);
+}
+
+
+
+
+###############################################################################
+###############################################################################
+
+=head2 xl_inc_col($string)
+
+
+    Parameters: $string, a string in A1 format
+
+    Returns:    Incremented string in A1 format
+
+This functions takes a cell reference string in A1 notation and increments the column. The function will also handle Excel's absolute, C<$>, cell notation:
+
+    my $str = xl_inc_col('A1'  ); # B1
+    my $str = xl_inc_col('Z1'  ); # AA1
+    my $str = xl_inc_col('$B1' ); # $C1
+    my $str = xl_inc_col('$D$5'); # $E$5
+
+
+=cut
+###############################################################################
+#
+# xl_inc_col($string)
+#
+# Increments the column number of an Excel cell reference in A1 notation.
+# For example C3 to D3
+#
+# Returns: a cell reference string.
+#
+sub xl_inc_col {
+
+    my $cell = shift;
+    my ($row, $col, $row_abs, $col_abs) = xl_cell_to_rowcol($cell);
+
+    return xl_rowcol_to_cell($row, ++$col, $row_abs, $col_abs);
+}
+
+
+
+
+###############################################################################
+###############################################################################
+
+=head2 xl_dec_col($string)
+
+    Parameters: $string, a string in A1 format
+
+    Returns:    Decremented string in A1 format
+
+This functions takes a cell reference string in A1 notation and decrements the column. The function will also handle Excel's absolute, C<$>, cell notation:
+
+    my $str = xl_dec_col('B1'  ); # A1
+    my $str = xl_dec_col('AA1' ); # Z1
+    my $str = xl_dec_col('$C1' ); # $B1
+    my $str = xl_dec_col('$E$5'); # $D$5
+
+
+=cut
+###############################################################################
+#
+# xl_dec_col($string)
+#
+sub xl_dec_col {
+
+    my $cell = shift;
+    my ($row, $col, $row_abs, $col_abs) = xl_cell_to_rowcol($cell);
+
+    return xl_rowcol_to_cell($row, --$col, $row_abs, $col_abs);
+}
+
+
+
+
+=head1 TIME AND DATE FUNCTIONS
+
+
+Dates and times in Excel are represented by real numbers, for example "Jan 1 2001 12:30 AM" is represented by the number 36892.521.
+
+The integer part of the number stores the number of days since the epoch and the fractional part stores the percentage of the day in seconds.
+
+The epoch can be either 1900 or 1904. Excel for Windows uses 1900 and Excel for Macintosh uses 1904. The epochs are:
+
+    1900: 0 January 1900 i.e. 31 December 1899
+    1904: 1 January 1904
+
+Excel on Windows and the Macintosh will convert automatically between one system and the other. By default Spreadsheet::WriteExcel uses the 1900 format. To use the 1904 epoch you must use the C<set_1904()> workbook method, see the Spreadsheet::WriteExcel documentation.
+
+There are two things to note about the 1900 date format. The first is that the epoch starts on 0 January 1900. The second is that the year 1900 is erroneously but deliberately treated as a leap year. Therefore you must add an extra day to dates after 28 February 1900. The functions in the following section will deal with these issues automatically. The reason for this anomaly is explained at http://support.microsoft.com/support/kb/articles/Q181/3/70.asp
+
+Note, a date or time in Excel is like any other number. To display the number as a date you must apply a number format to it: Refer to the C<set_num_format()> method in the Spreadsheet::WriteExcel documentation:
+
+    $date = xl_date_list(2001, 1, 1, 12, 30);
+    $format->set_num_format('mmm d yyyy hh:mm AM/PM');
+    $worksheet->write('A1', $date , $format); # Jan 1 2001 12:30 AM
+
+To use these functions you must install the C<Date::Manip> and C<Date::Calc> modules. See L<REQUIREMENTS> and the individual requirements of each functions.
+
+See also the DateTime::Format::Excel module,http://search.cpan.org/search?dist=DateTime-Format-Excel which is part of the DateTime project and which deals specifically with converting dates and times to and from Excel's format.
+
+
+=cut
+
+
+###############################################################################
+###############################################################################
+
+=head2 xl_date_list($years, $months, $days, $hours, $minutes, $seconds)
+
+
+    Parameters: $years:         Integer
+                $months:        Integer [optional, default is 1]
+                $days:          Integer [optional, default is 1]
+                $hours:         Integer [optional, default is 0]
+                $minutes:       Integer [optional, default is 0]
+                $seconds:       Float   [optional, default is 0]
+
+    Returns:    A number that represents an Excel date
+                or undef for an invalid date.
+
+    Requires:   Date::Calc
+
+This function converts an array of data into a number that represents an Excel date. All of the parameters are optional except for C<$years>.
+
+    $date1 = xl_date_list(2002, 1, 2);              # 2 Jan 2002
+    $date2 = xl_date_list(2002, 1, 2, 12);          # 2 Jan 2002 12:00 pm
+    $date3 = xl_date_list(2002, 1, 2, 12, 30);      # 2 Jan 2002 12:30 pm
+    $date4 = xl_date_list(2002, 1, 2, 12, 30, 45);  # 2 Jan 2002 12:30:45 pm
+
+This function can be used in conjunction with functions that parse date and time strings. In fact it is used in most of the following functions.
+
+
+=cut
+###############################################################################
+#
+# xl_date_list($years, $months, $days, $hours, $minutes, $seconds)
+#
+sub xl_date_list {
+
+    return undef unless @_;
+
+    my $years   = $_[0];
+    my $months  = $_[1] || 1;
+    my $days    = $_[2] || 1;
+    my $hours   = $_[3] || 0;
+    my $minutes = $_[4] || 0;
+    my $seconds = $_[5] || 0;
+
+    my @date = ($years, $months, $days, $hours, $minutes, $seconds);
+    my @epoch = (1899, 12, 31, 0, 0, 0);
+
+    ($days, $hours, $minutes, $seconds) = Delta_DHMS(@epoch, @date);
+
+    my $date = $days + ($hours*3600 +$minutes*60 +$seconds)/(24*60*60);
+
+    # Add a day for Excel's missing leap day in 1900
+    $date++ if ($date > 59);
+
+    return $date;
+}
+
+
+###############################################################################
+###############################################################################
+
+=head2 xl_parse_time($string)
+
+
+    Parameters: $string, a textual representation of a time
+
+    Returns:    A number that represents an Excel time
+                or undef for an invalid time.
+
+This function converts a time string into a number that represents an Excel time. The following time formats are valid:
+
+    hh:mm       [AM|PM]
+    hh:mm       [AM|PM]
+    hh:mm:ss    [AM|PM]
+    hh:mm:ss.ss [AM|PM]
+
+
+The meridian, AM or PM, is optional and case insensitive. A 24 hour time is assumed if the meridian is omitted
+
+    $time1 = xl_parse_time('12:18');
+    $time2 = xl_parse_time('12:18:14');
+    $time3 = xl_parse_time('12:18:14 AM');
+    $time4 = xl_parse_time('1:18:14 AM');
+
+Time in Excel is expressed as a fraction of the day in seconds. Therefore you can calculate an Excel time as follows:
+
+    $time = ($hours*3600 +$minutes*60 +$seconds)/(24*60*60);
+
+
+=cut
+###############################################################################
+#
+# xl_parse_time($string)
+#
+sub xl_parse_time {
+
+    my $time = shift;
+
+    if ($time =~ /(\d{1,2}):(\d\d):?((?:\d\d)(?:\.\d+)?)?(?:\s+)?(am|pm)?/i) {
+
+        my $hours       = $1;
+        my $minutes     = $2;
+        my $seconds     = $3     || 0;
+        my $meridian    = lc($4) || '';
+
+        # Normalise midnight and midday
+        $hours = 0 if ($hours == 12 && $meridian ne '');
+
+        # Add 12 hours to the pm times. Note: 12.00 pm has been set to 0.00.
+        $hours += 12 if $meridian eq 'pm';
+
+        # Calculate the time as a fraction of 24 hours in seconds
+        return ($hours*3600 +$minutes*60 +$seconds)/(24*60*60);
+
+    }
+    else {
+        return undef; # Not a valid time string
+    }
+}
+
+
+###############################################################################
+###############################################################################
+
+=head2 xl_parse_date($string)
+
+
+    Parameters: $string, a textual representation of a date and time
+
+    Returns:    A number that represents an Excel date
+                or undef for an invalid date.
+
+    Requires:   Date::Manip and Date::Calc
+
+This function converts a date and time string into a number that represents an Excel date.
+
+The parsing is performed using the C<ParseDate()> function of the Date::Manip module. Refer to the Date::Manip documentation for further information about the date and time formats that can be parsed. In order to use this function you will probably have to initialise some Date::Manip variables via the C<xl_parse_date_init()> function, see below.
+
+    xl_parse_date_init("TZ=GMT","DateFormat=non-US");
+
+    $date1 = xl_parse_date("11/7/97");
+    $date2 = xl_parse_date("Friday 11 July 1997");
+    $date3 = xl_parse_date("10:30 AM Friday 11 July 1997");
+    $date4 = xl_parse_date("Today");
+    $date5 = xl_parse_date("Yesterday");
+
+Note, if you parse a string that represents a time but not a date this function will add the current date. If you want the time without the date you can do something like the following:
+
+    $time  = xl_parse_date("10:30 AM");
+    $time -= int($time);
+
+
+=cut
+###############################################################################
+#
+# xl_parse_date($string)
+#
+sub xl_parse_date {
+
+    my $date = ParseDate($_[0]);
+
+    return undef unless defined $date;
+
+    # Unpack the return value from ParseDate()
+    my    ($years, $months, $days, $hours, undef, $minutes, undef, $seconds) =
+    unpack("A4     A2       A2     A2      C      A2        C      A2", $date);
+
+    # Convert to Excel date
+    return xl_date_list($years, $months, $days, $hours, $minutes, $seconds);
+}
+
+
+
+
+###############################################################################
+###############################################################################
+
+=head2 xl_parse_date_init("variable=value", ...)
+
+
+    Parameters: A list of Date::Manip variable strings
+
+    Returns:    A list of all the Date::Manip strings
+
+    Requires:   Date::Manip
+
+This function is used to initialise variables required by the Date::Manip module. You should call this function before calling C<xl_parse_date()>. It need only be called once.
+
+This function is a thin wrapper for the C<Date::Manip::Date_Init()> function. You can use C<Date_Init()>  directly if you wish. Refer to the Date::Manip documentation for further information.
+
+    xl_parse_date_init("TZ=MST","DateFormat=US");
+    $date1 = xl_parse_date("11/7/97");  # November 7th 1997
+
+    xl_parse_date_init("TZ=GMT","DateFormat=non-US");
+    $date1 = xl_parse_date("11/7/97");  # July 11th 1997
+
+
+=cut
+###############################################################################
+#
+# xl_parse_date_init("variable=value", ...)
+#
+sub xl_parse_date_init {
+
+    Date_Init(@_); # How lazy is that.
+}
+
+
+
+
+###############################################################################
+###############################################################################
+
+=head2 xl_decode_date_EU($string)
+
+
+    Parameters: $string, a textual representation of a date and time
+
+    Returns:    A number that represents an Excel date
+                or undef for an invalid date.
+
+    Requires:   Date::Calc
+
+This function converts a date and time string into a number that represents an Excel date.
+
+The date parsing is performed using the C<Decode_Date_EU()> function of the Date::Calc module. Refer to the Date::Calc for further information about the date formats that can be parsed. Also note the following from the Date::Calc documentation:
+
+"If the year is given as one or two digits only (i.e., if the year is less than 100), it is mapped to the window 1970 -2069 as follows":
+
+     0 E<lt>= $year E<lt>  70  ==>  $year += 2000;
+    70 E<lt>= $year E<lt> 100  ==>  $year += 1900;
+
+The time portion of the string is parsed using the C<xl_parse_time()> function described above.
+
+Note: the EU in the function name means that a European date format is assumed if it is not clear from the string. See the first example below.
+
+    $date1 = xl_decode_date_EU("11/7/97"); #11 July 1997
+    $date2 = xl_decode_date_EU("Sat 12 Sept 1998");
+    $date3 = xl_decode_date_EU("4:30 AM Sat 12 Sept 1998");
+
+
+=cut
+###############################################################################
+#
+# xl_decode_date_EU($string)
+#
+sub xl_decode_date_EU {
+
+    return undef unless @_;
+
+    my $date = shift;
+    my @date;
+    my $time = 0;
+
+    # Remove and decode the time portion of the string
+    if ($date =~ s/(\d{1,2}:\d\d:?(\d\d(\.\d+)?)?(\s+)?(am|pm)?)//i) {
+        $time = xl_parse_time($1);
+        return undef unless defined $time;
+    }
+
+    # Return if the string is now blank, i.e. it contained a time only.
+    return $time if $date =~ /^\s*$/;
+
+    # Decode the date portion of the string
+    @date = Decode_Date_EU($date);
+    return undef unless @date;
+
+    return xl_date_list(@date) + $time;
+}
+
+
+
+###############################################################################
+###############################################################################
+
+=head2 xl_decode_date_US($string)
+
+
+    Parameters: $string, a textual representation of a date and time
+
+    Returns:    A number that represents an Excel date
+                or undef for an invalid date.
+
+    Requires:   Date::Calc
+
+This function converts a date and time string into a number that represents an Excel date.
+
+The date parsing is performed using the C<Decode_Date_US()> function of the Date::Calc module. Refer to the Date::Calc for further information about the date formats that can be parsed. Also note the following from the Date::Calc documentation:
+
+"If the year is given as one or two digits only (i.e., if the year is less than 100), it is mapped to the window 1970 -2069 as follows":
+
+     0 <= $year <  70  ==>  $year += 2000;
+    70 <= $year < 100  ==>  $year += 1900;
+
+The time portion of the string is parsed using the C<xl_parse_time()> function described above.
+
+Note: the US in the function name means that an American date format is assumed if it is not clear from the string. See the first example below.
+
+    $date1 = xl_decode_date_US("11/7/97"); # 7 November 1997
+    $date2 = xl_decode_date_US("12 Sept Saturday 1998");
+    $date3 = xl_decode_date_US("4:30 AM 12 Sept Sat 1998");
+
+
+=cut
+###############################################################################
+#
+# xl_decode_date_US($string)
+#
+sub xl_decode_date_US {
+
+    return undef unless @_;
+
+    my $date = shift;
+    my @date;
+    my $time = 0;
+
+    # Remove and decode the time portion of the string
+    if ($date =~ s/(\d{1,2}:\d\d:?(\d\d(\.\d+)?)?(\s+)?(am|pm)?)//i) {
+        $time = xl_parse_time($1);
+        return undef unless defined $time;
+    }
+
+    # Return if the string is now blank, i.e. it contained a time only.
+    return $time if $date =~ /^\s*$/;
+
+    # Decode the date portion of the string
+    @date = Decode_Date_US($date);
+    return undef unless @date;
+
+    return xl_date_list(@date) + $time;
+}
+
+
+
+
+###############################################################################
+###############################################################################
+
+=head2 xl_date_1904($date)
+
+
+    Parameters: $date, an Excel date with a 1900 epoch
+
+    Returns:    an Excel date with a 1904 epoch or zero if
+                the $date is before 1904
+
+
+This function converts an Excel date based on the 1900 epoch into a date based on the 1904 epoch.
+
+
+    $date1 = xl_date_list(2002, 1, 13); # 13 Jan 2002, 1900 epoch
+    $date2 = xl_date_1904($date1);      # 13 Jan 2002, 1904 epoch
+
+
+See also the C<set_1904()> workbook method in the Spreadsheet::WriteExcel documentation.
+
+=cut
+###############################################################################
+#
+# xl_decode_date_US($string)
+#
+sub xl_date_1904 {
+
+    my $date = $_[0] || 0;
+
+    if ($date < 1462) {
+        # before 1904
+        $date = 0;
+    }
+    else {
+        $date -= 1462;
+    }
+
+    return $date;
+}
+
+
+
+
+=cut
+
+=head1 REQUIREMENTS
+
+The date and time functions require functions from the C<Date::Manip> and C<Date::Calc> modules. The required functions are "autoused" from these modules so that you do not have to install them unless you wish to use the date and time routines. Therefore it is possible to use the row and column functions without having C<Date::Manip> and C<Date::Calc> installed.
+
+For more information about "autousing" refer to the documentation on the C<autouse> pragma.
+
+
+
+=head1 BUGS
+
+When using the autoused functions from C<Date::Manip> and C<Date::Calc> on Perl 5.6.0 with C<-w> you will get a warning like this:
+
+    "Subroutine xxx redefined ..."
+
+The current workaround for this is to put C<use warnings;> near the beginning of your program.
+
+
+
+=head1 AUTHOR
+
+John McNamara jmcnamara at cpan.org
+
+
+
+
+=head1 COPYRIGHT
+
+© MM-MMVI, John McNamara.
+
+All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.
+
+=cut
+
+
+
+1;
+
+
+__END__
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/lib/Spreadsheet/WriteExcel/Workbook.pm
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/lib/Spreadsheet/WriteExcel/Workbook.pm	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/lib/Spreadsheet/WriteExcel/Workbook.pm	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,2053 +1,2338 @@
-package Spreadsheet::WriteExcel::Workbook;
-
-###############################################################################
-#
-# Workbook - A writer class for Excel Workbooks.
-#
-#
-# Used in conjunction with Spreadsheet::WriteExcel
-#
-# Copyright 2000-2005, John McNamara, jmcnamara at cpan.org
-#
-# Documentation after __END__
-#
-
-use Exporter;
-use strict;
-use Carp;
-use Spreadsheet::WriteExcel::BIFFwriter;
-use Spreadsheet::WriteExcel::OLEwriter;
-use Spreadsheet::WriteExcel::Worksheet;
-use Spreadsheet::WriteExcel::Format;
-use Spreadsheet::WriteExcel::Chart;
-
-use vars qw($VERSION @ISA);
- at ISA = qw(Spreadsheet::WriteExcel::BIFFwriter Exporter);
-
-$VERSION = '2.15';
-
-###############################################################################
-#
-# new()
-#
-# Constructor. Creates a new Workbook object from a BIFFwriter object.
-#
-sub new {
-
-    my $class       = shift;
-    my $self        = Spreadsheet::WriteExcel::BIFFwriter->new();
-    my $tmp_format  = Spreadsheet::WriteExcel::Format->new();
-    my $byte_order  = $self->{_byte_order};
-    my $parser      = Spreadsheet::WriteExcel::Formula->new($byte_order);
-
-    $self->{_filename}          = $_[0] || '';
-    $self->{_parser}            = $parser;
-    $self->{_tempdir}           = undef;
-    $self->{_1904}              = 0;
-    $self->{_activesheet}       = 0;
-    $self->{_firstsheet}        = 0;
-    $self->{_selected}          = 0;
-    $self->{_xf_index}          = 16; # 15 style XF's and 1 cell XF.
-    $self->{_fileclosed}        = 0;
-    $self->{_biffsize}          = 0;
-    $self->{_sheetname}         = "Sheet";
-    $self->{_tmp_format}        = $tmp_format;
-    $self->{_url_format}        = '';
-    $self->{_codepage}          = 0x04E4;
-    $self->{_worksheets}        = [];
-    $self->{_sheetnames}        = [];
-    $self->{_formats}           = [];
-    $self->{_palette}           = [];
-
-    $self->{_using_tmpfile}     = 1;
-    $self->{_filehandle}        = "";
-    $self->{_temp_file}         = "";
-    $self->{_internal_fh}       = 0;
-    $self->{_fh_out}            = "";
-
-    $self->{_str_total}         = 0;
-    $self->{_str_unique}        = 0;
-    $self->{_str_table}         = {};
-    $self->{_str_array}         = [];
-    $self->{_str_block_sizes}   = [];
-
-    $self->{_ext_ref_count}     = 0;
-    $self->{_ext_refs}          = {};
-
-    bless $self, $class;
-
-    # Add the default format for hyperlinks
-    $self->{_url_format} = $self->add_format(color => 'blue', underline => 1);
-
-
-    # Check for a filename unless it is an existing filehandle
-    if (not ref $self->{_filename} and $self->{_filename} eq '') {
-        carp 'Filename required by Spreadsheet::WriteExcel->new()';
-        return undef;
-    }
-
-
-    # Convert the filename to a filehandle to pass to the OLE writer when the
-    # file is closed. If the filename is a reference it is assumed that it is
-    # a valid filehandle.
-    #
-    if (not ref $self->{_filename}) {
-        my $fh = FileHandle->new('>'. $self->{_filename});
-        if (not defined $fh) {
-            carp "Can't open " .
-                  $self->{_filename} .
-                  ". It may be in use or protected";
-            return undef;
-    }
-
-        # binmode file whether platform requires it or not
-        binmode($fh);
-        $self->{_internal_fh} = 1;
-        $self->{_fh_out}      = $fh;
-    }
-    else {
-        $self->{_internal_fh} = 0;
-        $self->{_fh_out}      = $self->{_filename};
-
-    }
-
-
-    # Set colour palette.
-    $self->set_palette_xl97();
-
-    $self->_initialize();
-    return $self;
-}
-
-
-###############################################################################
-#
-# _initialize()
-#
-# Open a tmp file to store the majority of the Worksheet data. If this fails,
-# for example due to write permissions, store the data in memory. This can be
-# slow for large files.
-#
-# TODO: Move this and other methods shared with Worksheet up into BIFFWriter.
-#
-sub _initialize {
-
-    my $self = shift;
-    my $fh;
-    my $tmp_dir;
-
-    # The following code is complicated by Windows limitations. Porters can
-    # choose a more direct method.
-
-
-
-    # In the default case we use IO::File->new_tmpfile(). This may fail, in
-    # particular with IIS on Windows, so we allow the user to specify a temp
-    # directory via File::Temp.
-    #
-    if (defined $self->{_tempdir}) {
-
-        # Delay loading File:Temp to reduce the module dependencies.
-        eval { require File::Temp };
-        die "The File::Temp module must be installed in order ".
-            "to call set_tempdir().\n" if $@;
-
-
-        # Trap but ignore File::Temp errors.
-        eval { $fh = File::Temp::tempfile(DIR => $self->{_tempdir}) };
-
-        # Store the failed tmp dir in case of errors.
-        $tmp_dir = $self->{_tempdir} || File::Spec->tmpdir if not $fh;
-    }
-    else {
-
-        $fh = IO::File->new_tmpfile();
-
-        # Store the failed tmp dir in case of errors.
-        $tmp_dir = "POSIX::tmpnam() directory" if not $fh;
-    }
-
-
-    # Check if the temp file creation was successful. Else store data in memory.
-    if ($fh) {
-
-        # binmode file whether platform requires it or not.
-        binmode($fh);
-
-        # Store filehandle
-        $self->{_filehandle} = $fh;
-    }
-    else {
-
-        # Set flag to store data in memory if XX::tempfile() failed.
-        $self->{_using_tmpfile} = 0;
-
-        if ($^W) {
-            my $dir = $self->{_tempdir} || File::Spec->tmpdir();
-
-            warn "Unable to create temp files in $tmp_dir. Data will be ".
-                 "stored in memory. Refer to set_tempdir() in the ".
-                 "Spreadsheet::WriteExcel documentation.\n" ;
-        }
-    }
-}
-
-
-###############################################################################
-#
-# _append(), overloaded.
-#
-# Store Worksheet data in memory using the base class _append() or to a
-# temporary file, the default.
-#
-sub _append {
-
-    my $self = shift;
-
-    if ($self->{_using_tmpfile}) {
-        my $data = join('', @_);
-
-        # Add CONTINUE records if necessary
-        $data = $self->_add_continue($data) if length($data) > $self->{_limit};
-
-        # Protect print() from -l on the command line.
-        local $\ = undef;
-
-        print {$self->{_filehandle}} $data;
-        $self->{_datasize} += length($data);
-    }
-    else {
-        $self->SUPER::_append(@_);
-    }
-}
-
-
-###############################################################################
-#
-# get_data().
-#
-# Retrieves data from memory in one chunk, or from disk in $buffer
-# sized chunks.
-#
-sub get_data {
-
-    my $self   = shift;
-    my $buffer = 4096;
-    my $tmp;
-
-    # Return data stored in memory
-    if (defined $self->{_data}) {
-        $tmp           = $self->{_data};
-        $self->{_data} = undef;
-        my $fh         = $self->{_filehandle};
-        seek($fh, 0, 0) if $self->{_using_tmpfile};
-        return $tmp;
-    }
-
-    # Return data stored on disk
-    if ($self->{_using_tmpfile}) {
-        return $tmp if read($self->{_filehandle}, $tmp, $buffer);
-    }
-
-    # No data to return
-    return undef;
-}
-
-
-###############################################################################
-#
-# close()
-#
-# Calls finalization methods and explicitly close the OLEwriter file
-# handle.
-#
-sub close {
-
-    my $self = shift;
-
-    return if $self->{_fileclosed}; # Prevent close() from being called twice.
-
-    $self->{_fileclosed} = 1;
-
-    return $self->_store_workbook();
-}
-
-
-###############################################################################
-#
-# DESTROY()
-#
-# Close the workbook if it hasn't already been explicitly closed.
-#
-sub DESTROY {
-
-    my $self = shift;
-
-    $self->close() if not $self->{_fileclosed};
-}
-
-
-###############################################################################
-#
-# sheets(slice,...)
-#
-# An accessor for the _worksheets[] array
-#
-# Returns: an optionally sliced list of the worksheet objects in a workbook.
-#
-sub sheets {
-
-    my $self = shift;
-
-    if (@_) {
-        # Return a slice of the array
-        return @{$self->{_worksheets}}[@_];
-    }
-    else {
-        # Return the entire list
-        return @{$self->{_worksheets}};
-    }
-}
-
-
-###############################################################################
-#
-# worksheets()
-#
-# An accessor for the _worksheets[] array.
-# This method is now deprecated. Use the sheets() method instead.
-#
-# Returns: an array reference
-#
-sub worksheets {
-
-    my $self = shift;
-
-    return $self->{_worksheets};
-}
-
-
-###############################################################################
-#
-# add_worksheet($name, $encoding)
-#
-# Add a new worksheet to the Excel workbook.
-#
-# Returns: reference to a worksheet object
-#
-sub add_worksheet {
-
-    my $self     = shift;
-    my $index    = @{$self->{_worksheets}};
-
-    my ($name, $encoding) = $self->_check_sheetname($_[0], $_[1]);
-
-
-    # Porters take note, the following scheme of passing references to Workbook
-    # data (in the \$self->{_foo} cases) instead of a reference to the Workbook
-    # itself is a workaround to avoid circular references between Workbook and
-    # Worksheet objects. Feel free to implement this in any way the suits your
-    # language.
-    #
-    my @init_data = (
-                         $name,
-                         $index,
-                         $encoding,
-                        \$self->{_activesheet},
-                        \$self->{_firstsheet},
-                         $self->{_url_format},
-                         $self->{_parser},
-                         $self->{_tempdir},
-                        \$self->{_str_total},
-                        \$self->{_str_unique},
-                        \$self->{_str_table},
-                         $self->{_1904},
-                    );
-
-    my $worksheet = Spreadsheet::WriteExcel::Worksheet->new(@init_data);
-    $self->{_worksheets}->[$index] = $worksheet;     # Store ref for iterator
-    $self->{_sheetnames}->[$index] = $name;          # Store EXTERNSHEET names
-    $self->{_parser}->set_ext_sheets($name, $index); # Store names in Formula.pm
-    return $worksheet;
-}
-
-
-###############################################################################
-#
-# add_chart_ext($name, $filename)
-#
-# Add an externally created chart.
-#
-#
-sub add_chart_ext {
-
-    my $self     = shift;
-    my $filename = $_[0];
-    my $index    = @{$self->{_worksheets}};
-
-    my ($name, $encoding) = $self->_check_sheetname($_[1], $_[2]);
-
-
-    my @init_data = (
-                         $filename,
-                         $name,
-                         $index,
-                         $encoding,
-                        \$self->{_activesheet},
-                        \$self->{_firstsheet},
-                    );
-
-    my $worksheet = Spreadsheet::WriteExcel::Chart->new(@init_data);
-    $self->{_worksheets}->[$index] = $worksheet;     # Store ref for iterator
-    $self->{_sheetnames}->[$index] = $name;          # Store EXTERNSHEET names
-    $self->{_parser}->set_ext_sheets($name, $index); # Store names in Formula.pm
-    return $worksheet;
-}
-
-
-###############################################################################
-#
-# _check_sheetname($name, $encoding)
-#
-# Check for valid worksheet names. We check the length, if it contains any
-# invalid characters and if the name is unique in the workbook.
-#
-sub _check_sheetname {
-
-    my $self            = shift;
-    my $name            = $_[0] || "";
-    my $encoding        = $_[1] || 0;
-    my $limit           = $encoding ? 62 : 31;
-    my $invalid_char    = qr([\[\]:*?/\\]);
-
-    # Supply default "Sheet" name if none has been defined.
-    my $index     = @{$self->{_worksheets}};
-    my $sheetname = $self->{_sheetname};
-
-    if ($name eq "" ) {
-        $name     = $sheetname . ($index+1);
-        $encoding = 0;
-    }
-
-
-    # Check that sheetname is <= 31 (1 or 2 byte chars). Excel limit.
-    croak "Sheetname $name must be <= 31 chars" if length $name > $limit;
-
-    # Check that Unicode sheetname has an even number of bytes
-    croak 'Odd number of bytes in Unicode worksheet name:' . $name
-          if $encoding == 1 and length($name) % 2;
-
-
-    # Check that sheetname doesn't contain any invalid characters
-    if ($encoding != 1 and $name =~ $invalid_char) {
-        # Check ASCII names
-        croak 'Invalid character []:*?/\\ in worksheet name: ' . $name;
-    }
-    else {
-        # Extract any 8bit clean chars from the UTF16 name and validate them.
-        for my $wchar ($name =~ /../sg) {
-            my ($hi, $lo) = unpack "aa", $wchar;
-            if ($hi eq "\0" and $lo =~ $invalid_char) {
-                croak 'Invalid character []:*?/\\ in worksheet name: ' . $name;
-            }
-        }
-    }
-
-
-    # Handle utf8 strings in newer perls.
-    if ($] >= 5.008) {
-        require Encode;
-
-        if (Encode::is_utf8($name)) {
-            $name = Encode::encode("UTF-16BE", $name);
-            $encoding = 1;
-        }
-    }
-
-
-    # Check that the worksheet name doesn't already exist since this is a fatal
-    # error in Excel 97. The check must also exclude case insensitive matches
-    # since the names 'Sheet1' and 'sheet1' are equivalent. The tests also have
-    # to take the encoding into account.
-    #
-    foreach my $worksheet (@{$self->{_worksheets}}) {
-        my $name_a  = $name;
-        my $encd_a  = $encoding;
-        my $name_b  = $worksheet->{_name};
-        my $encd_b  = $worksheet->{_encoding};
-        my $error   = 0;
-
-        if    ($encd_a == 0 and $encd_b == 0) {
-            $error  = 1 if lc($name_a) eq lc($name_b);
-        }
-        elsif ($encd_a == 0 and $encd_b == 1) {
-            $name_a = pack "n*", unpack "C*", $name_a;
-            $error  = 1 if lc($name_a) eq lc($name_b);
-        }
-        elsif ($encd_a == 1 and $encd_b == 0) {
-            $name_b = pack "n*", unpack "C*", $name_b;
-            $error  = 1 if lc($name_a) eq lc($name_b);
-        }
-        elsif ($encd_a == 1 and $encd_b == 1) {
-            # We can do a true case insensitive test with Perl 5.8 and utf8.
-            if ($] >= 5.008) {
-                $name_a = Encode::decode("UTF-16BE", $name_a);
-                $name_b = Encode::decode("UTF-16BE", $name_b);
-                $error  = 1 if lc($name_a) eq lc($name_b);
-            }
-            else {
-            # We can't easily do a case insensite test of the UTF16 names.
-            # As a special case we check if all of the high bytes are nulls and
-            # then do an ASCII style case insensitive test.
-
-                # Strip out the high bytes (funkily).
-                my $hi_a = grep {ord} $name_a =~ /(.)./sg;
-                my $hi_b = grep {ord} $name_b =~ /(.)./sg;
-
-                if ($hi_a or $hi_b) {
-                    $error  = 1 if    $name_a  eq    $name_b;
-                }
-                else {
-                    $error  = 1 if lc($name_a) eq lc($name_b);
-                }
-            }
-        }
-
-        # If any of the cases failed we throw the error here.
-        if ($error) {
-            croak "Worksheet name '$name', with case ignored, " .
-                  "is already in use";
-        }
-    }
-
-    return ($name,  $encoding);
-}
-
-
-###############################################################################
-#
-# addworksheet($name)
-#
-# This method is now deprecated. Use the add_worksheet() method instead.
-#
-sub addworksheet {
-
-    my $self = shift;
-
-    $self->add_worksheet(@_);
-}
-
-
-###############################################################################
-#
-# add_format(%properties)
-#
-# Add a new format to the Excel workbook. This adds an XF record and
-# a FONT record. Also, pass any properties to the Format::new().
-#
-sub add_format {
-
-    my $self = shift;
-
-    my $format = Spreadsheet::WriteExcel::Format->new($self->{_xf_index}, @_);
-
-    $self->{_xf_index} += 1;
-    push @{$self->{_formats}}, $format; # Store format reference
-
-    return $format;
-}
-
-
-###############################################################################
-#
-# addformat()
-#
-# This method is now deprecated. Use the add_format() method instead.
-#
-sub addformat {
-
-    my $self = shift;
-
-    $self->add_format(@_);
-}
-
-
-###############################################################################
-#
-# set_1904()
-#
-# Set the date system: 0 = 1900 (the default), 1 = 1904
-#
-sub set_1904 {
-
-    my $self      = shift;
-
-    croak "set_1904() must be called before add_worksheet" if $self->sheets();
-
-
-    if (defined($_[0])) {
-        $self->{_1904} = $_[0];
-    }
-    else {
-        $self->{_1904} = 1;
-    }
-}
-
-
-###############################################################################
-#
-# get_1904()
-#
-# Return the date system: 0 = 1900, 1 = 1904
-#
-sub get_1904 {
-
-    my $self = shift;
-
-    return $self->{_1904};
-}
-
-
-###############################################################################
-#
-# set_custom_color()
-#
-# Change the RGB components of the elements in the colour palette.
-#
-sub set_custom_color {
-
-    my $self    = shift;
-
-
-    # Match a HTML #xxyyzz style parameter
-    if (defined $_[1] and $_[1] =~ /^#(\w\w)(\w\w)(\w\w)/ ) {
-        @_ = ($_[0], hex $1, hex $2, hex $3);
-    }
-
-
-    my $index   = $_[0] || 0;
-    my $red     = $_[1] || 0;
-    my $green   = $_[2] || 0;
-    my $blue    = $_[3] || 0;
-
-    my $aref    = $self->{_palette};
-
-    # Check that the colour index is the right range
-    if ($index < 8 or $index > 64) {
-        carp "Color index $index outside range: 8 <= index <= 64";
-        return 0;
-    }
-
-    # Check that the colour components are in the right range
-    if ( ($red   < 0 or $red   > 255) ||
-         ($green < 0 or $green > 255) ||
-         ($blue  < 0 or $blue  > 255) )
-    {
-        carp "Color component outside range: 0 <= color <= 255";
-        return 0;
-    }
-
-    $index -=8; # Adjust colour index (wingless dragonfly)
-
-    # Set the RGB value
-    $$aref[$index] = [$red, $green, $blue, 0];
-
-    return $index +8;
-}
-
-
-###############################################################################
-#
-# set_palette_xl97()
-#
-# Sets the colour palette to the Excel 97+ default.
-#
-sub set_palette_xl97 {
-
-    my $self = shift;
-
-    $self->{_palette} = [
-                            [0x00, 0x00, 0x00, 0x00],   # 8
-                            [0xff, 0xff, 0xff, 0x00],   # 9
-                            [0xff, 0x00, 0x00, 0x00],   # 10
-                            [0x00, 0xff, 0x00, 0x00],   # 11
-                            [0x00, 0x00, 0xff, 0x00],   # 12
-                            [0xff, 0xff, 0x00, 0x00],   # 13
-                            [0xff, 0x00, 0xff, 0x00],   # 14
-                            [0x00, 0xff, 0xff, 0x00],   # 15
-                            [0x80, 0x00, 0x00, 0x00],   # 16
-                            [0x00, 0x80, 0x00, 0x00],   # 17
-                            [0x00, 0x00, 0x80, 0x00],   # 18
-                            [0x80, 0x80, 0x00, 0x00],   # 19
-                            [0x80, 0x00, 0x80, 0x00],   # 20
-                            [0x00, 0x80, 0x80, 0x00],   # 21
-                            [0xc0, 0xc0, 0xc0, 0x00],   # 22
-                            [0x80, 0x80, 0x80, 0x00],   # 23
-                            [0x99, 0x99, 0xff, 0x00],   # 24
-                            [0x99, 0x33, 0x66, 0x00],   # 25
-                            [0xff, 0xff, 0xcc, 0x00],   # 26
-                            [0xcc, 0xff, 0xff, 0x00],   # 27
-                            [0x66, 0x00, 0x66, 0x00],   # 28
-                            [0xff, 0x80, 0x80, 0x00],   # 29
-                            [0x00, 0x66, 0xcc, 0x00],   # 30
-                            [0xcc, 0xcc, 0xff, 0x00],   # 31
-                            [0x00, 0x00, 0x80, 0x00],   # 32
-                            [0xff, 0x00, 0xff, 0x00],   # 33
-                            [0xff, 0xff, 0x00, 0x00],   # 34
-                            [0x00, 0xff, 0xff, 0x00],   # 35
-                            [0x80, 0x00, 0x80, 0x00],   # 36
-                            [0x80, 0x00, 0x00, 0x00],   # 37
-                            [0x00, 0x80, 0x80, 0x00],   # 38
-                            [0x00, 0x00, 0xff, 0x00],   # 39
-                            [0x00, 0xcc, 0xff, 0x00],   # 40
-                            [0xcc, 0xff, 0xff, 0x00],   # 41
-                            [0xcc, 0xff, 0xcc, 0x00],   # 42
-                            [0xff, 0xff, 0x99, 0x00],   # 43
-                            [0x99, 0xcc, 0xff, 0x00],   # 44
-                            [0xff, 0x99, 0xcc, 0x00],   # 45
-                            [0xcc, 0x99, 0xff, 0x00],   # 46
-                            [0xff, 0xcc, 0x99, 0x00],   # 47
-                            [0x33, 0x66, 0xff, 0x00],   # 48
-                            [0x33, 0xcc, 0xcc, 0x00],   # 49
-                            [0x99, 0xcc, 0x00, 0x00],   # 50
-                            [0xff, 0xcc, 0x00, 0x00],   # 51
-                            [0xff, 0x99, 0x00, 0x00],   # 52
-                            [0xff, 0x66, 0x00, 0x00],   # 53
-                            [0x66, 0x66, 0x99, 0x00],   # 54
-                            [0x96, 0x96, 0x96, 0x00],   # 55
-                            [0x00, 0x33, 0x66, 0x00],   # 56
-                            [0x33, 0x99, 0x66, 0x00],   # 57
-                            [0x00, 0x33, 0x00, 0x00],   # 58
-                            [0x33, 0x33, 0x00, 0x00],   # 59
-                            [0x99, 0x33, 0x00, 0x00],   # 60
-                            [0x99, 0x33, 0x66, 0x00],   # 61
-                            [0x33, 0x33, 0x99, 0x00],   # 62
-                            [0x33, 0x33, 0x33, 0x00],   # 63
-                        ];
-
-    return 0;
-}
-
-
-###############################################################################
-#
-# set_tempdir()
-#
-# Change the default temp directory used by _initialize() in Worksheet.pm.
-#
-sub set_tempdir {
-
-    my $self = shift;
-
-    # Windows workaround. See Worksheet::_initialize()
-    my $dir  = shift || '';
-
-    croak "$dir is not a valid directory"       if $dir ne '' and not -d $dir;
-    croak "set_tempdir must be called before add_worksheet" if $self->sheets();
-
-    $self->{_tempdir} = $dir ;
-}
-
-
-###############################################################################
-#
-# set_codepage()
-#
-# See also the _store_codepage method. This is used to store the code page, i.e.
-# the character set used in the workbook.
-#
-sub set_codepage {
-
-    my $self        = shift;
-    my $codepage    = $_[0] || 1;
-    $codepage   = 0x04E4 if $codepage == 1;
-    $codepage   = 0x8000 if $codepage == 2;
-    $self->{_codepage} = $codepage;
-}
-
-
-###############################################################################
-#
-# _store_workbook()
-#
-# Assemble worksheets into a workbook and send the BIFF data to an OLE
-# storage.
-#
-sub _store_workbook {
-
-    my $self = shift;
-
-    # Add a default worksheet if non have been added. 
-    $self->add_worksheet() if not @{$self->{_worksheets}};
-
-
-    # Ensure that at least one worksheet has been selected.
-    if ($self->{_activesheet} == 0) {
-        @{$self->{_worksheets}}[0]->{_selected} = 1;
-        @{$self->{_worksheets}}[0]->{_hidden}   = 0;
-    }
-
-    # Calculate the number of selected worksheet tabs and call the finalization
-    # methods for each worksheet
-    foreach my $sheet (@{$self->{_worksheets}}) {
-        $self->{_selected}++ if $sheet->{_selected};
-        $sheet->{_active} = 1 if $sheet->{_index} == $self->{_activesheet};
-        $sheet->_close($self->{_sheetnames});
-    }
-
-    # Add Workbook globals
-    $self->_store_bof(0x0005);
-    $self->_store_codepage();
-    $self->_store_window1();
-    $self->_store_1904();
-    $self->_store_all_fonts();
-    $self->_store_all_num_formats();
-    $self->_store_all_xfs();
-    $self->_store_all_styles();
-    $self->_store_palette();
-
-    # Calculate the offsets required by the BOUNDSHEET records
-    $self->_calc_sheet_offsets();
-
-    # Add BOUNDSHEET records. For BIFF 7+ TODO ....
-    foreach my $sheet (@{$self->{_worksheets}}) {
-        $self->_store_boundsheet($sheet->{_name},
-                                 $sheet->{_offset},
-                                 $sheet->{_type},
-                                 $sheet->{_hidden},
-                                 $sheet->{_encoding});
-    }
-
-    # NOTE: If any records are added between here and EOF the
-    # _calc_sheet_offsets() should be updated to include the new length.
-    if ($self->{_ext_ref_count}) {
-        $self->_store_supbook();
-        $self->_store_externsheet();
-        $self->_store_names();
-    }
-    $self->_store_shared_strings();
-
-    # End Workbook globals
-    $self->_store_eof();
-
-    # Store the workbook in an OLE container
-    return $self->_store_OLE_file();
-}
-
-
-###############################################################################
-#
-# _store_OLE_file()
-#
-# Store the workbook in an OLE container if the total size of the workbook data
-# is less than ~ 7MB.
-#
-sub _store_OLE_file {
-
-    my $self = shift;
-
-    my $OLE  = Spreadsheet::WriteExcel::OLEwriter->new($self->{_fh_out});
-
-    # Indicate that we created the filehandle and want to close it.
-    $OLE->{_internal_fh} = $self->{_internal_fh};
-
-    # Write Worksheet data if data <~ 7MB
-    if ($OLE->set_size($self->{_biffsize})) {
-        $OLE->write_header();
-
-        while (my $tmp = $self->get_data()) {
-            $OLE->write($tmp);
-        }
-
-        foreach my $sheet (@{$self->{_worksheets}}) {
-            while (my $tmp = $sheet->get_data()) {
-                $OLE->write($tmp);
-            }
-        }
-
-        return $OLE->close();
-    }
-    else {
-        # File in greater than limit, set $! to "File too large"
-        $! = 27; # Perl error code "File too large"
-        my $maxsize = 7_087_104;
-
-        croak "Maximum Spreadsheet::WriteExcel filesize, $maxsize bytes, "    .
-              "exceeded. To create files bigger than this limit please refer ".
-              "to the \"Spreadsheet::WriteExcel::Big\" documentation.\n"      ;
-
-        # return 0;
-    }
-}
-
-
-###############################################################################
-#
-# _calc_sheet_offsets()
-#
-# Calculate Worksheet BOF offsets records for use in the BOUNDSHEET records.
-#
-sub _calc_sheet_offsets {
-
-    my $self    = shift;
-    my $BOF     = 12;
-    my $EOF     = 4;
-    my $offset  = $self->{_datasize};
-
-    # Add the length of the SST and associated CONTINUEs
-    $offset += $self->_calculate_shared_string_sizes();
-
-    # Add the length of the SUPBOOK, EXTERNSHEET and NAME records
-    $offset += $self->_calculate_extern_sizes();
-
-    foreach my $sheet (@{$self->{_worksheets}}) {
-        $offset += $BOF + length($sheet->{_name});
-    }
-
-    $offset += $EOF;
-
-    foreach my $sheet (@{$self->{_worksheets}}) {
-        $sheet->{_offset} = $offset;
-        $offset += $sheet->{_datasize};
-    }
-
-    $self->{_biffsize} = $offset;
-}
-
-
-###############################################################################
-#
-# _store_all_fonts()
-#
-# Store the Excel FONT records.
-#
-sub _store_all_fonts {
-
-    my $self = shift;
-
-    # _tmp_format is added by new(). We use this to write the default XF's
-    my $format = $self->{_tmp_format};
-    my $font   = $format->get_font();
-
-    # Note: Fonts are 0-indexed. According to the SDK there is no index 4,
-    # so the following fonts are 0, 1, 2, 3, 5
-    #
-    for (1..5){
-        $self->_append($font);
-    }
-
-
-    # Iterate through the XF objects and write a FONT record if it isn't the
-    # same as the default FONT and if it hasn't already been used.
-    #
-    my %fonts;
-    my $key;
-    my $index = 6;                  # The first user defined FONT
-
-    $key = $format->get_font_key(); # The default font from _tmp_format
-    $fonts{$key} = 0;               # Index of the default font
-
-
-    foreach $format (@{$self->{_formats}}) {
-        $key = $format->get_font_key();
-
-        if (exists $fonts{$key}) {
-            # FONT has already been used
-            $format->{_font_index} = $fonts{$key};
-        }
-        else {
-            # Add a new FONT record
-            $fonts{$key}           = $index;
-            $format->{_font_index} = $index;
-            $index++;
-            $font = $format->get_font();
-            $self->_append($font);
-        }
-    }
-}
-
-
-###############################################################################
-#
-# _store_all_num_formats()
-#
-# Store user defined numerical formats i.e. FORMAT records
-#
-sub _store_all_num_formats {
-
-    my $self = shift;
-
-    # Leaning num_format syndrome
-    my %num_formats;
-    my @num_formats;
-    my $num_format;
-    my $index = 164; # User defined FORMAT records start from 0xA4
-
-
-    # Iterate through the XF objects and write a FORMAT record if it isn't a
-    # built-in format type and if the FORMAT string hasn't already been used.
-    #
-    foreach my $format (@{$self->{_formats}}) {
-        my $num_format = $format->{_num_format};
-        my $encoding   = $format->{_num_format_enc};
-
-        # Check if $num_format is an index to a built-in format.
-        # Also check for a string of zeros, which is a valid format string
-        # but would evaluate to zero.
-        #
-        if ($num_format !~ m/^0+\d/) {
-            next if $num_format =~ m/^\d+$/; # built-in
-        }
-
-        if (exists($num_formats{$num_format})) {
-            # FORMAT has already been used
-            $format->{_num_format} = $num_formats{$num_format};
-        }
-        else{
-            # Add a new FORMAT
-            $num_formats{$num_format} = $index;
-            $format->{_num_format}    = $index;
-            $self->_store_num_format($num_format, $index, $encoding);
-            $index++;
-        }
-    }
-}
-
-
-###############################################################################
-#
-# _store_all_xfs()
-#
-# Write all XF records.
-#
-sub _store_all_xfs {
-
-    my $self = shift;
-
-    # _tmp_format is added by new(). We use this to write the default XF's
-    # The default font index is 0
-    #
-    my $format = $self->{_tmp_format};
-    my $xf;
-
-    for (0..14) {
-        $xf = $format->get_xf('style'); # Style XF
-        $self->_append($xf);
-    }
-
-    $xf = $format->get_xf('cell');      # Cell XF
-    $self->_append($xf);
-
-
-    # User defined XFs
-    foreach $format (@{$self->{_formats}}) {
-        $xf = $format->get_xf('cell');
-        $self->_append($xf);
-    }
-}
-
-
-###############################################################################
-#
-# _store_all_styles()
-#
-# Write all STYLE records.
-#
-sub _store_all_styles {
-
-    my $self = shift;
-
-    $self->_store_style();
-}
-
-
-###############################################################################
-#
-# _store_names()
-#
-# Write the NAME record to define the print area and the repeat rows and cols.
-#
-sub _store_names {
-
-    my $self        = shift;
-    my $index       = 0;
-    my %ext_refs    = %{$self->{_ext_refs}};
-
-    # Create the print area NAME records
-    foreach my $worksheet (@{$self->{_worksheets}}) {
-
-        my $key = "$index:$index";
-        my $ref = $ext_refs{$key};
-        $index++;
-
-        # Write a Name record if the print area has been defined
-        if (defined $worksheet->{_print_rowmin}) {
-            $self->_store_name_short(
-                $worksheet->{_index},
-                0x06, # NAME type
-                $ref,
-                $worksheet->{_print_rowmin},
-                $worksheet->{_print_rowmax},
-                $worksheet->{_print_colmin},
-                $worksheet->{_print_colmax}
-            );
-        }
-    }
-
-    $index = 0;
-
-    # Create the print title NAME records
-    foreach my $worksheet (@{$self->{_worksheets}}) {
-
-        my $rowmin = $worksheet->{_title_rowmin};
-        my $rowmax = $worksheet->{_title_rowmax};
-        my $colmin = $worksheet->{_title_colmin};
-        my $colmax = $worksheet->{_title_colmax};
-        my $key    = "$index:$index";
-        my $ref    = $ext_refs{$key};
-        $index++;
-
-        # Determine if row + col, row, col or nothing has been defined
-        # and write the appropriate record
-        #
-        if (defined $rowmin && defined $colmin) {
-            # Row and column titles have been defined.
-            # Row title has been defined.
-            $self->_store_name_long(
-                $worksheet->{_index},
-                0x07, # NAME type
-                $ref,
-                $rowmin,
-                $rowmax,
-                $colmin,
-                $colmax
-           );
-        }
-        elsif (defined $rowmin) {
-            # Row title has been defined.
-            $self->_store_name_short(
-                $worksheet->{_index},
-                0x07, # NAME type
-                $ref,
-                $rowmin,
-                $rowmax,
-                0x00,
-                0xff
-            );
-        }
-        elsif (defined $colmin) {
-            # Column title has been defined.
-            $self->_store_name_short(
-                $worksheet->{_index},
-                0x07, # NAME type
-                $ref,
-                0x0000,
-                0xffff,
-                $colmin,
-                $colmax
-            );
-        }
-        else {
-            # Nothing left to do
-        }
-    }
-}
-
-
-
-
-###############################################################################
-###############################################################################
-#
-# BIFF RECORDS
-#
-
-
-###############################################################################
-#
-# _store_window1()
-#
-# Write Excel BIFF WINDOW1 record.
-#
-sub _store_window1 {
-
-    my $self      = shift;
-
-    my $record    = 0x003D;                 # Record identifier
-    my $length    = 0x0012;                 # Number of bytes to follow
-
-    my $xWn       = 0x0000;                 # Horizontal position of window
-    my $yWn       = 0x0000;                 # Vertical position of window
-    my $dxWn      = 0x25BC;                 # Width of window
-    my $dyWn      = 0x1572;                 # Height of window
-
-    my $grbit     = 0x0038;                 # Option flags
-    my $ctabsel   = $self->{_selected};     # Number of workbook tabs selected
-    my $wTabRatio = 0x0258;                 # Tab to scrollbar ratio
-
-    my $itabFirst = $self->{_firstsheet};   # 1st displayed worksheet
-    my $itabCur   = $self->{_activesheet};  # Active worksheet
-
-    my $header    = pack("vv",        $record, $length);
-    my $data      = pack("vvvvvvvvv", $xWn, $yWn, $dxWn, $dyWn,
-                                      $grbit,
-                                      $itabCur, $itabFirst,
-                                      $ctabsel, $wTabRatio);
-
-    $self->_append($header, $data);
-}
-
-
-###############################################################################
-#
-# _store_boundsheet()
-#
-# Writes Excel BIFF BOUNDSHEET record.
-#
-sub _store_boundsheet {
-
-    my $self      = shift;
-
-    my $record    = 0x0085;               # Record identifier
-    my $length    = 0x08 + length($_[0]); # Number of bytes to follow
-
-    my $sheetname = $_[0];                # Worksheet name
-    my $offset    = $_[1];                # Location of worksheet BOF
-    my $type      = $_[2];                # Worksheet type
-    my $hidden    = $_[3];                # Worksheet hidden flag
-    my $encoding  = $_[4];                # Sheet name encoding
-    my $cch       = length($sheetname);   # Length of sheet name
-
-    my $grbit     = $type | $hidden;
-
-    # Character length is num of chars not num of bytes
-    $cch /= 2 if $encoding;
-
-    # Change the UTF-16 name from BE to LE
-    $sheetname = pack 'n*', unpack 'v*', $sheetname if $encoding;
-
-    my $header    = pack("vv",   $record, $length);
-    my $data      = pack("VvCC", $offset, $grbit, $cch, $encoding);
-
-    $self->_append($header, $data, $sheetname);
-}
-
-
-###############################################################################
-#
-# _store_style()
-#
-# Write Excel BIFF STYLE records.
-#
-sub _store_style {
-
-    my $self      = shift;
-
-    my $record    = 0x0293; # Record identifier
-    my $length    = 0x0004; # Bytes to follow
-
-    my $ixfe      = 0x8000; # Index to style XF
-    my $BuiltIn   = 0x00;   # Built-in style
-    my $iLevel    = 0xff;   # Outline style level
-
-    my $header    = pack("vv",  $record, $length);
-    my $data      = pack("vCC", $ixfe, $BuiltIn, $iLevel);
-
-    $self->_append($header, $data);
-}
-
-
-###############################################################################
-#
-# _store_num_format()
-#
-# Writes Excel FORMAT record for non "built-in" numerical formats.
-#
-sub _store_num_format {
-
-    my $self      = shift;
-
-    my $record    = 0x041E;         # Record identifier
-    my $length;                     # Number of bytes to follow
-
-    my $format    = $_[0];          # Custom format string
-    my $ifmt      = $_[1];          # Format index code
-    my $encoding  = $_[2];          # Char encoding for format string
-
-
-    # Handle utf8 strings in newer perls.
-    if ($] >= 5.008) {
-        require Encode;
-
-        if (Encode::is_utf8($format)) {
-            $format = Encode::encode("UTF-16BE", $format);
-            $encoding = 1;
-        }
-    }
-
-
-    # Char length of format string
-    my $cch = length $format;
-
-
-    # Handle Unicode format strings.
-    if ($encoding == 1) {
-        croak "Uneven number of bytes in Unicode font name" if $cch % 2;
-        $cch    /= 2 if $encoding;
-        $format  = pack 'v*', unpack 'n*', $format;
-    }
-
-
-    # Special case to handle Euro symbol, 0x80, in non-Unicode strings.
-    if ($encoding == 0 and $format =~ /\x80/) {
-        $format   =  pack 'v*', unpack 'C*', $format;
-        $format   =~ s/\x80\x00/\xAC\x20/g;
-        $encoding =  1;
-    }
-
-    $length       = 0x05 + length $format;
-
-    my $header    = pack("vv", $record, $length);
-    my $data      = pack("vvC", $ifmt, $cch, $encoding);
-
-    $self->_append($header, $data, $format);
-}
-
-
-###############################################################################
-#
-# _store_1904()
-#
-# Write Excel 1904 record to indicate the date system in use.
-#
-sub _store_1904 {
-
-    my $self      = shift;
-
-    my $record    = 0x0022;         # Record identifier
-    my $length    = 0x0002;         # Bytes to follow
-
-    my $f1904     = $self->{_1904}; # Flag for 1904 date system
-
-    my $header    = pack("vv",  $record, $length);
-    my $data      = pack("v", $f1904);
-
-    $self->_append($header, $data);
-}
-
-
-###############################################################################
-#
-# _store_supbook()
-#
-# Write BIFF record SUPBOOK to indicate that the workbook contains external
-# references, in our case, formula, print area and print title refs.
-#
-sub _store_supbook {
-
-    my $self        = shift;
-
-    my $record      = 0x01AE;                   # Record identifier
-    my $length      = 0x0004;                   # Number of bytes to follow
-
-    my $ctabs       = @{$self->{_worksheets}};  # Number of worksheets
-    my $StVirtPath  = 0x0401;                   # Encoded workbook filename
-
-    my $header      = pack("vv", $record, $length);
-    my $data        = pack("vv", $ctabs, $StVirtPath);
-
-    $self->_append($header, $data);
-}
-
-
-###############################################################################
-#
-# _store_externsheet()
-#
-#
-# Writes the Excel BIFF EXTERNSHEET record. These references are used by
-# formulas. TODO NAME record is required to define the print area and the repeat
-# rows and columns.
-#
-sub _store_externsheet {
-
-    my $self        = shift;
-
-    my $record      = 0x0017;                   # Record identifier
-    my $length;                                 # Number of bytes to follow
-
-
-    # Get the external refs
-    my %ext_refs = %{$self->{_ext_refs}};
-    my @ext_refs = sort {$ext_refs{$a} <=> $ext_refs{$b}} keys %ext_refs;
-
-    # Change the external refs from stringified "1:1" to [1, 1]
-    foreach my $ref (@ext_refs) {
-        $ref = [split /:/, $ref];
-    }
-
-
-    my $cxti        = scalar @ext_refs;         # Number of Excel XTI structures
-    my $rgxti       = '';                       # Array of XTI structures
-
-    # Write the XTI structs
-    foreach my $ext_ref (@ext_refs) {
-        $rgxti .= pack("vvv", 0, $ext_ref->[0], $ext_ref->[1])
-    }
-
-
-    my $data        = pack("v", $cxti) . $rgxti;
-    my $header      = pack("vv", $record, length $data);
-
-    $self->_append($header, $data);
-}
-
-
-###############################################################################
-#
-# _store_name_short()
-#
-#
-# Store the NAME record in the short format that is used for storing the print
-# area, repeat rows only and repeat columns only.
-#
-sub _store_name_short {
-
-    my $self            = shift;
-
-    my $record          = 0x0018;       # Record identifier
-    my $length          = 0x001b;       # Number of bytes to follow
-
-    my $index           = shift;        # Sheet index
-    my $type            = shift;
-    my $ext_ref         = shift;        # TODO
-
-    my $grbit           = 0x0020;       # Option flags
-    my $chKey           = 0x00;         # Keyboard shortcut
-    my $cch             = 0x01;         # Length of text name
-    my $cce             = 0x000b;       # Length of text definition
-    my $unknown01       = 0x0000;       #
-    my $ixals           = $index +1;    # Sheet index
-    my $unknown02       = 0x00;         #
-    my $cchCustMenu     = 0x00;         # Length of cust menu text
-    my $cchDescription  = 0x00;         # Length of description text
-    my $cchHelptopic    = 0x00;         # Length of help topic text
-    my $cchStatustext   = 0x00;         # Length of status bar text
-    my $rgch            = $type;        # Built-in name type
-    my $unknown03       = 0x3b;         #
-
-    my $rowmin          = $_[0];        # Start row
-    my $rowmax          = $_[1];        # End row
-    my $colmin          = $_[2];        # Start column
-    my $colmax          = $_[3];        # end column
-
-
-    my $header          = pack("vv", $record, $length);
-    my $data            = pack("v",  $grbit);
-    $data              .= pack("C",  $chKey);
-    $data              .= pack("C",  $cch);
-    $data              .= pack("v",  $cce);
-    $data              .= pack("v",  $unknown01);
-    $data              .= pack("v",  $ixals);
-    $data              .= pack("C",  $unknown02);
-    $data              .= pack("C",  $cchCustMenu);
-    $data              .= pack("C",  $cchDescription);
-    $data              .= pack("C",  $cchHelptopic);
-    $data              .= pack("C",  $cchStatustext);
-    $data              .= pack("C",  $rgch);
-    $data              .= pack("C",  $unknown03);
-    $data              .= pack("v",  $ext_ref);
-
-    $data              .= pack("v",  $rowmin);
-    $data              .= pack("v",  $rowmax);
-    $data              .= pack("v",  $colmin);
-    $data              .= pack("v",  $colmax);
-
-    $self->_append($header, $data);
-}
-
-
-###############################################################################
-#
-# _store_name_long()
-#
-#
-# Store the NAME record in the long format that is used for storing the repeat
-# rows and columns when both are specified. This share a lot of code with
-# _store_name_short() but we use a separate method to keep the code clean.
-# Code abstraction for reuse can be carried too far, and I should know. ;-)
-#
-sub _store_name_long {
-
-    my $self            = shift;
-
-    my $record          = 0x0018;       # Record identifier
-    my $length          = 0x002a;       # Number of bytes to follow
-
-    my $index           = shift;        # Sheet index
-    my $type            = shift;
-    my $ext_ref         = shift;        # TODO
-
-    my $grbit           = 0x0020;       # Option flags
-    my $chKey           = 0x00;         # Keyboard shortcut
-    my $cch             = 0x01;         # Length of text name
-    my $cce             = 0x001a;       # Length of text definition
-    my $unknown01       = 0x0000;       #
-    my $ixals           = $index +1;    # Sheet index
-    my $unknown02       = 0x00;         #
-    my $cchCustMenu     = 0x00;         # Length of cust menu text
-    my $cchDescription  = 0x00;         # Length of description text
-    my $cchHelptopic    = 0x00;         # Length of help topic text
-    my $cchStatustext   = 0x00;         # Length of status bar text
-    my $rgch            = $type;        # Built-in name type
-
-    my $unknown03       = 0x29;
-    my $unknown04       = 0x0017;
-    my $unknown05       = 0x3b;
-
-    my $rowmin          = $_[0];        # Start row
-    my $rowmax          = $_[1];        # End row
-    my $colmin          = $_[2];        # Start column
-    my $colmax          = $_[3];        # end column
-
-
-    my $header          = pack("vv", $record, $length);
-    my $data            = pack("v",  $grbit);
-    $data              .= pack("C",  $chKey);
-    $data              .= pack("C",  $cch);
-    $data              .= pack("v",  $cce);
-    $data              .= pack("v",  $unknown01);
-    $data              .= pack("v",  $ixals);
-    $data              .= pack("C",  $unknown02);
-    $data              .= pack("C",  $cchCustMenu);
-    $data              .= pack("C",  $cchDescription);
-    $data              .= pack("C",  $cchHelptopic);
-    $data              .= pack("C",  $cchStatustext);
-    $data              .= pack("C",  $rgch);
-
-    # Column definition
-    $data              .= pack("C",  $unknown03);
-    $data              .= pack("v",  $unknown04);
-    $data              .= pack("C",  $unknown05);
-    $data              .= pack("v",  $ext_ref);
-    $data              .= pack("v",  0x0000);
-    $data              .= pack("v",  0xffff);
-    $data              .= pack("v",  $colmin);
-    $data              .= pack("v",  $colmax);
-
-    # Row definition
-    $data              .= pack("C",  $unknown05);
-    $data              .= pack("v",  $ext_ref);
-    $data              .= pack("v",  $rowmin);
-    $data              .= pack("v",  $rowmax);
-    $data              .= pack("v",  0x00);
-    $data              .= pack("v",  0xff);
-    # End of data
-    $data              .= pack("C",  0x10);
-
-    $self->_append($header, $data);
-}
-
-
-###############################################################################
-#
-# _store_palette()
-#
-# Stores the PALETTE biff record.
-#
-sub _store_palette {
-
-    my $self            = shift;
-
-    my $aref            = $self->{_palette};
-
-    my $record          = 0x0092;           # Record identifier
-    my $length          = 2 + 4 * @$aref;   # Number of bytes to follow
-    my $ccv             =         @$aref;   # Number of RGB values to follow
-    my $data;                               # The RGB data
-
-    # Pack the RGB data
-    $data .= pack "CCCC", @$_ for @$aref;
-
-    my $header = pack("vvv",  $record, $length, $ccv);
-
-    $self->_append($header, $data);
-}
-
-
-###############################################################################
-#
-# _store_codepage()
-#
-# Stores the CODEPAGE biff record.
-#
-sub _store_codepage {
-
-    my $self            = shift;
-
-    my $record          = 0x0042;               # Record identifier
-    my $length          = 0x0002;               # Number of bytes to follow
-    my $cv              = $self->{_codepage};   # The code page
-
-    my $header          = pack("vv", $record, $length);
-    my $data            = pack("v",  $cv);
-
-    $self->_append($header, $data);
-}
-
-
-
-
-###############################################################################
-###############################################################################
-###############################################################################
-
-
-
-###############################################################################
-#
-# _calculate_extern_sizes()
-#
-# We need to calculate the space required by the SUPBOOK, EXTERNSHEET and NAME
-# records so that it can be added to the BOUNDSHEET offsets.
-#
-sub _calculate_extern_sizes {
-
-    my $self   = shift;
-
-
-    my %ext_refs        = $self->{_parser}->get_ext_sheets();
-    my $ext_ref_count   = scalar keys %ext_refs;
-    my $length          = 0;
-    my $index           = 0;
-
-    foreach my $worksheet (@{$self->{_worksheets}}) {
-
-        my $rowmin      = $worksheet->{_title_rowmin};
-        my $colmin      = $worksheet->{_title_colmin};
-        my $key         = "$index:$index";
-        $index++;
-
-
-        # Print area NAME records
-        if (defined $worksheet->{_print_rowmin}) {
-            $ext_refs{$key} = $ext_ref_count++ if not exists $ext_refs{$key};
-
-            $length += 31 ;
-        }
-
-
-        # Print title  NAME records
-        if (defined $rowmin and defined $colmin) {
-            $ext_refs{$key} = $ext_ref_count++ if not exists $ext_refs{$key};
-
-            $length += 46;
-        }
-        elsif (defined $rowmin or defined $colmin) {
-            $ext_refs{$key} = $ext_ref_count++ if not exists $ext_refs{$key};
-
-            $length += 31;
-        }
-        else {
-            # TODO
-        }
-
-
-    }
-
-
-    # TODO
-    $self->{_ext_ref_count} = $ext_ref_count;
-    $self->{_ext_refs}      = {%ext_refs};
-
-
-
-    # If there are no external refs then we don't write, SUPBOOK, EXTERNSHEET
-    # and NAME. Therefore the length is 0.
-
-    return $length = 0 if $ext_ref_count == 0;
-
-
-
-    # The SUPBOOK record is 8 bytes
-    $length += 8;
-
-    # The EXTERNSHEET record is 6 bytes + 6 bytes for each external ref
-    $length += 6 * (1 + $ext_ref_count);
-
-    return $length;
-}
-
-
-###############################################################################
-#
-# _calculate_shared_string_sizes()
-#
-# Handling of the SST continue blocks is complicated by the need to include an
-# additional continuation byte depending on whether the string is split between
-# blocks or whether it starts at the beginning of the block. (There are also
-# additional complications that will arise later when/if Rich Strings are
-# supported). As such we cannot use the simple CONTINUE mechanism provided by
-# the _add_continue() method in BIFFwriter.pm. Thus we have to make two passes
-# through the strings data. The first is to calculate the required block sizes
-# and the second, in _store_shared_strings(), is to write the actual strings.
-# The first pass through the data is also used to calculate the size of the SST
-# and CONTINUE records for use in setting the BOUNDSHEET record offsets. The
-# downside of this is that the same algorithm repeated in _store_shared_strings.
-#
-sub _calculate_shared_string_sizes {
-
-    my $self    = shift;
-
-    my @strings;
-    $#strings = $self->{_str_unique} -1; # Pre-extend array
-
-    while (my $key = each %{$self->{_str_table}}) {
-        $strings[$self->{_str_table}->{$key}] = $key;
-    }
-
-    # The SST data could be very large, free some memory (maybe).
-    $self->{_str_table} = undef;
-    $self->{_str_array} = [@strings];
-
-
-    # Iterate through the strings to calculate the CONTINUE block sizes.
-    #
-    # The SST blocks requires a specialised CONTINUE block, so we have to
-    # ensure that the maximum data block size is less than the limit used by
-    # _add_continue() in BIFFwriter.pm. For simplicity we use the same size
-    # for the SST and CONTINUE records:
-    #   8228 : Maximum Excel97 block size
-    #     -4 : Length of block header
-    #     -8 : Length of additional SST header information
-    #     -8 : Arbitrary number to keep within _add_continue() limit
-    # = 8208
-    #
-    my $continue_limit = 8208;
-    my $block_length   = 0;
-    my $written        = 0;
-    my @block_sizes;
-    my $continue       = 0;
-
-    for my $string (@strings) {
-
-        my $string_length = length $string;
-        my $encoding      = unpack "xx C", $string;
-        my $split_string  = 0;
-
-
-        # Block length is the total length of the strings that will be
-        # written out in a single SST or CONTINUE block.
-        #
-        $block_length += $string_length;
-
-
-        # We can write the string if it doesn't cross a CONTINUE boundary
-        if ($block_length < $continue_limit) {
-            $written += $string_length;
-            next;
-        }
-
-
-        # Deal with the cases where the next string to be written will exceed
-        # the CONTINUE boundary. If the string is very long it may need to be
-        # written in more than one CONTINUE record.
-        #
-        while ($block_length >= $continue_limit) {
-
-            # We need to avoid the case where a string is continued in the first
-            # n bytes that contain the string header information.
-            #
-            my $header_length   = 3; # Min string + header size -1
-            my $space_remaining = $continue_limit -$written -$continue;
-
-
-            # Unicode data should only be split on char (2 byte) boundaries.
-            # Therefore, in some cases we need to reduce the amount of available
-            # space by 1 byte to ensure the correct alignment.
-            my $align = 0;
-
-            # Only applies to Unicode strings
-            if ($encoding == 1) {
-                # Min string + header size -1
-                $header_length = 4;
-
-                if ($space_remaining > $header_length) {
-                    # String contains 3 byte header => split on odd boundary
-                    if (not $split_string and $space_remaining % 2 != 1) {
-                        $space_remaining--;
-                        $align = 1;
-                    }
-                    # Split section without header => split on even boundary
-                    elsif ($split_string and $space_remaining % 2 == 1) {
-                        $space_remaining--;
-                        $align = 1;
-                    }
-
-                    $split_string = 1;
-                }
-            }
-
-
-            if ($space_remaining > $header_length) {
-                # Write as much as possible of the string in the current block
-                $written      += $space_remaining;
-
-                # Reduce the current block length by the amount written
-                $block_length -= $continue_limit -$continue -$align;
-
-                # Store the max size for this block
-                push @block_sizes, $continue_limit -$align;
-
-                # If the current string was split then the next CONTINUE block
-                # should have the string continue flag (grbit) set unless the
-                # split string fits exactly into the remaining space.
-                #
-                if ($block_length > 0) {
-                    $continue = 1;
-                }
-                else {
-                    $continue = 0;
-                }
-
-            }
-            else {
-                # Store the max size for this block
-                push @block_sizes, $written +$continue;
-
-                # Not enough space to start the string in the current block
-                $block_length -= $continue_limit -$space_remaining -$continue;
-                $continue = 0;
-
-            }
-
-            # If the string (or substr) is small enough we can write it in the
-            # new CONTINUE block. Else, go through the loop again to write it in
-            # one or more CONTINUE blocks
-            #
-            if ($block_length < $continue_limit) {
-                $written = $block_length;
-            }
-            else {
-                $written = 0;
-            }
-        }
-    }
-
-    # Store the max size for the last block unless it is empty
-    push @block_sizes, $written +$continue if $written +$continue;
-
-
-    $self->{_str_block_sizes} = [@block_sizes];
-
-
-    # Calculate the total length of the SST and associated CONTINUEs (if any).
-    # The SST record will have a length even if it contains no strings.
-    # This length is required to set the offsets in the BOUNDSHEET records since
-    # they must be written before the SST records
-    #
-    my $length  = 12;
-    $length    +=     shift @block_sizes if    @block_sizes; # SST
-    $length    += 4 + shift @block_sizes while @block_sizes; # CONTINUEs
-
-    return $length;
-}
-
-
-###############################################################################
-#
-# _store_shared_strings()
-#
-# Write all of the workbooks strings into an indexed array.
-#
-# See the comments in _calculate_shared_string_sizes() for more information.
-#
-# The Excel documentation says that the SST record should be followed by an
-# EXTSST record. The EXTSST record is a hash table that is used to optimise
-# access to SST. However, despite the documentation it doesn't seem to be
-# required so we will ignore it.
-#
-sub _store_shared_strings {
-
-    my $self                = shift;
-
-    my @strings = @{$self->{_str_array}};
-
-
-    my $record              = 0x00FC;   # Record identifier
-    my $length              = 0x0008;   # Number of bytes to follow
-    my $total               = 0x0000;
-
-    # Iterate through the strings to calculate the CONTINUE block sizes
-    my $continue_limit = 8208;
-    my $block_length   = 0;
-    my $written        = 0;
-    my $continue       = 0;
-
-    # The SST and CONTINUE block sizes have been pre-calculated by
-    # _calculate_shared_string_sizes()
-    my @block_sizes    = @{$self->{_str_block_sizes}};
-
-
-    # The SST record is required even if it contains no strings. Thus we will
-    # always have a length
-    #
-    if (@block_sizes) {
-        $length = 8 + shift @block_sizes;
-    }
-    else {
-        # No strings
-        $length = 8;
-    }
-
-    # Write the SST block header information
-    my $header      = pack("vv", $record, $length);
-    my $data        = pack("VV", $self->{_str_total}, $self->{_str_unique});
-    $self->_append($header, $data);
-
-
-    # Iterate through the strings and write them out
-    for my $string (@strings) {
-
-        my $string_length = length $string;
-        my $encoding      = unpack "xx C", $string;
-        my $split_string  = 0;
-
-
-        # Block length is the total length of the strings that will be
-        # written out in a single SST or CONTINUE block.
-        #
-        $block_length += $string_length;
-
-
-        # We can write the string if it doesn't cross a CONTINUE boundary
-        if ($block_length < $continue_limit) {
-            $self->_append($string);
-            $written += $string_length;
-            next;
-        }
-
-
-        # Deal with the cases where the next string to be written will exceed
-        # the CONTINUE boundary. If the string is very long it may need to be
-        # written in more than one CONTINUE record.
-        #
-        while ($block_length >= $continue_limit) {
-
-            # We need to avoid the case where a string is continued in the first
-            # n bytes that contain the string header information.
-            #
-            my $header_length   = 3; # Min string + header size -1
-            my $space_remaining = $continue_limit -$written -$continue;
-
-
-            # Unicode data should only be split on char (2 byte) boundaries.
-            # Therefore, in some cases we need to reduce the amount of available
-            # space by 1 byte to ensure the correct alignment.
-            my $align = 0;
-
-            # Only applies to Unicode strings
-            if ($encoding == 1) {
-                # Min string + header size -1
-                $header_length = 4;
-
-                if ($space_remaining > $header_length) {
-                    # String contains 3 byte header => split on odd boundary
-                    if (not $split_string and $space_remaining % 2 != 1) {
-                        $space_remaining--;
-                        $align = 1;
-                    }
-                    # Split section without header => split on even boundary
-                    elsif ($split_string and $space_remaining % 2 == 1) {
-                        $space_remaining--;
-                        $align = 1;
-                    }
-
-                    $split_string = 1;
-                }
-            }
-
-
-            if ($space_remaining > $header_length) {
-                # Write as much as possible of the string in the current block
-                my $tmp = substr $string, 0, $space_remaining;
-                $self->_append($tmp);
-
-                # The remainder will be written in the next block(s)
-                $string = substr $string, $space_remaining;
-
-                # Reduce the current block length by the amount written
-                $block_length -= $continue_limit -$continue -$align;
-
-                # If the current string was split then the next CONTINUE block
-                # should have the string continue flag (grbit) set unless the
-                # split string fits exactly into the remaining space.
-                #
-                if ($block_length > 0) {
-                    $continue = 1;
-                }
-                else {
-                    $continue = 0;
-                }
-            }
-            else {
-                # Not enough space to start the string in the current block
-                $block_length -= $continue_limit -$space_remaining -$continue;
-                $continue = 0;
-            }
-
-            # Write the CONTINUE block header
-            if (@block_sizes) {
-                $record  = 0x003C;
-                $length  = shift @block_sizes;
-
-                $header  = pack("vv", $record, $length);
-                $header .= pack("C", $encoding) if $continue;
-
-                $self->_append($header);
-            }
-
-            # If the string (or substr) is small enough we can write it in the
-            # new CONTINUE block. Else, go through the loop again to write it in
-            # one or more CONTINUE blocks
-            #
-            if ($block_length < $continue_limit) {
-                $self->_append($string);
-
-                $written = $block_length;
-            }
-            else {
-                $written = 0;
-            }
-        }
-    }
-}
-
-
-1;
-
-
-__END__
-
-
-=head1 NAME
-
-Workbook - A writer class for Excel Workbooks.
-
-=head1 SYNOPSIS
-
-See the documentation for Spreadsheet::WriteExcel
-
-=head1 DESCRIPTION
-
-This module is used in conjunction with Spreadsheet::WriteExcel.
-
-=head1 AUTHOR
-
-John McNamara jmcnamara at cpan.org
-
-=head1 COPYRIGHT
-
-© MM-MMV, John McNamara.
-
-All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.
+package Spreadsheet::WriteExcel::Workbook;
+
+###############################################################################
+#
+# Workbook - A writer class for Excel Workbooks.
+#
+#
+# Used in conjunction with Spreadsheet::WriteExcel
+#
+# Copyright 2000-2006, John McNamara, jmcnamara at cpan.org
+#
+# Documentation after __END__
+#
+
+use Exporter;
+use strict;
+use Carp;
+use Spreadsheet::WriteExcel::BIFFwriter;
+use Spreadsheet::WriteExcel::OLEwriter;
+use Spreadsheet::WriteExcel::Worksheet;
+use Spreadsheet::WriteExcel::Format;
+use Spreadsheet::WriteExcel::Chart;
+
+use vars qw($VERSION @ISA);
+ at ISA = qw(Spreadsheet::WriteExcel::BIFFwriter Exporter);
+
+$VERSION = '2.16';
+
+###############################################################################
+#
+# new()
+#
+# Constructor. Creates a new Workbook object from a BIFFwriter object.
+#
+sub new {
+
+    my $class       = shift;
+    my $self        = Spreadsheet::WriteExcel::BIFFwriter->new();
+    my $byte_order  = $self->{_byte_order};
+    my $parser      = Spreadsheet::WriteExcel::Formula->new($byte_order);
+
+    $self->{_filename}          = $_[0] || '';
+    $self->{_parser}            = $parser;
+    $self->{_tempdir}           = undef;
+    $self->{_1904}              = 0;
+    $self->{_activesheet}       = 0;
+    $self->{_firstsheet}        = 0;
+    $self->{_selected}          = 0;
+    $self->{_xf_index}          = 0;
+    $self->{_fileclosed}        = 0;
+    $self->{_biffsize}          = 0;
+    $self->{_sheetname}         = "Sheet";
+    $self->{_url_format}        = '';
+    $self->{_codepage}          = 0x04E4;
+    $self->{_worksheets}        = [];
+    $self->{_sheetnames}        = [];
+    $self->{_formats}           = [];
+    $self->{_palette}           = [];
+
+    $self->{_using_tmpfile}     = 1;
+    $self->{_filehandle}        = "";
+    $self->{_temp_file}         = "";
+    $self->{_internal_fh}       = 0;
+    $self->{_fh_out}            = "";
+
+    $self->{_str_total}         = 0;
+    $self->{_str_unique}        = 0;
+    $self->{_str_table}         = {};
+    $self->{_str_array}         = [];
+    $self->{_str_block_sizes}   = [];
+
+    $self->{_ext_ref_count}     = 0;
+    $self->{_ext_refs}          = {};
+
+    $self->{_mso_clusters}      = [];
+    $self->{_mso_size}          = 0;
+
+    $self->{_hideobj}           = 0;
+
+
+    bless $self, $class;
+
+
+    # Add the in-built style formats and the default cell format.
+    $self->add_format(type => 1);                       #  0 Normal
+    $self->add_format(type => 1);                       #  1 RowLevel 1
+    $self->add_format(type => 1);                       #  2 RowLevel 2
+    $self->add_format(type => 1);                       #  3 RowLevel 3
+    $self->add_format(type => 1);                       #  4 RowLevel 4
+    $self->add_format(type => 1);                       #  5 RowLevel 5
+    $self->add_format(type => 1);                       #  6 RowLevel 6
+    $self->add_format(type => 1);                       #  7 RowLevel 7
+    $self->add_format(type => 1);                       #  8 ColLevel 1
+    $self->add_format(type => 1);                       #  9 ColLevel 2
+    $self->add_format(type => 1);                       # 10 ColLevel 3
+    $self->add_format(type => 1);                       # 11 ColLevel 4
+    $self->add_format(type => 1);                       # 12 ColLevel 5
+    $self->add_format(type => 1);                       # 13 ColLevel 6
+    $self->add_format(type => 1);                       # 14 ColLevel 7
+    $self->add_format();                                # 15 Cell XF
+    $self->add_format(type => 1, num_format => 0x2B);   # 16 Comma
+    $self->add_format(type => 1, num_format => 0x29);   # 17 Comma[0]
+    $self->add_format(type => 1, num_format => 0x2C);   # 18 Currency
+    $self->add_format(type => 1, num_format => 0x2A);   # 19 Currency[0]
+    $self->add_format(type => 1, num_format => 0x09);   # 20 Percent
+
+
+    # Add the default format for hyperlinks
+    $self->{_url_format} = $self->add_format(color => 'blue', underline => 1);
+
+
+    # Check for a filename unless it is an existing filehandle
+    if (not ref $self->{_filename} and $self->{_filename} eq '') {
+        carp 'Filename required by Spreadsheet::WriteExcel->new()';
+        return undef;
+    }
+
+
+    # Convert the filename to a filehandle to pass to the OLE writer when the
+    # file is closed. If the filename is a reference it is assumed that it is
+    # a valid filehandle.
+    #
+    if (not ref $self->{_filename}) {
+
+        my $fh = FileHandle->new('>'. $self->{_filename});
+
+        if (not defined $fh) {
+            carp "Can't open " .
+                  $self->{_filename} .
+                  ". It may be in use or protected";
+            return undef;
+        }
+
+        # binmode file whether platform requires it or not
+        binmode($fh);
+        $self->{_internal_fh} = 1;
+        $self->{_fh_out}      = $fh;
+    }
+    else {
+        $self->{_internal_fh} = 0;
+        $self->{_fh_out}      = $self->{_filename};
+
+    }
+
+
+    # Set colour palette.
+    $self->set_palette_xl97();
+
+    $self->_initialize();
+    return $self;
+}
+
+
+###############################################################################
+#
+# _initialize()
+#
+# Open a tmp file to store the majority of the Worksheet data. If this fails,
+# for example due to write permissions, store the data in memory. This can be
+# slow for large files.
+#
+# TODO: Move this and other methods shared with Worksheet up into BIFFWriter.
+#
+sub _initialize {
+
+    my $self = shift;
+    my $fh;
+    my $tmp_dir;
+
+    # The following code is complicated by Windows limitations. Porters can
+    # choose a more direct method.
+
+
+
+    # In the default case we use IO::File->new_tmpfile(). This may fail, in
+    # particular with IIS on Windows, so we allow the user to specify a temp
+    # directory via File::Temp.
+    #
+    if (defined $self->{_tempdir}) {
+
+        # Delay loading File:Temp to reduce the module dependencies.
+        eval { require File::Temp };
+        die "The File::Temp module must be installed in order ".
+            "to call set_tempdir().\n" if $@;
+
+
+        # Trap but ignore File::Temp errors.
+        eval { $fh = File::Temp::tempfile(DIR => $self->{_tempdir}) };
+
+        # Store the failed tmp dir in case of errors.
+        $tmp_dir = $self->{_tempdir} || File::Spec->tmpdir if not $fh;
+    }
+    else {
+
+        $fh = IO::File->new_tmpfile();
+
+        # Store the failed tmp dir in case of errors.
+        $tmp_dir = "POSIX::tmpnam() directory" if not $fh;
+    }
+
+
+    # Check if the temp file creation was successful. Else store data in memory.
+    if ($fh) {
+
+        # binmode file whether platform requires it or not.
+        binmode($fh);
+
+        # Store filehandle
+        $self->{_filehandle} = $fh;
+    }
+    else {
+
+        # Set flag to store data in memory if XX::tempfile() failed.
+        $self->{_using_tmpfile} = 0;
+
+        if ($^W) {
+            my $dir = $self->{_tempdir} || File::Spec->tmpdir();
+
+            warn "Unable to create temp files in $tmp_dir. Data will be ".
+                 "stored in memory. Refer to set_tempdir() in the ".
+                 "Spreadsheet::WriteExcel documentation.\n" ;
+        }
+    }
+}
+
+
+###############################################################################
+#
+# _append(), overloaded.
+#
+# Store Worksheet data in memory using the base class _append() or to a
+# temporary file, the default.
+#
+sub _append {
+
+    my $self = shift;
+    my $data = '';
+
+    if ($self->{_using_tmpfile}) {
+        $data = join('', @_);
+
+        # Add CONTINUE records if necessary
+        $data = $self->_add_continue($data) if length($data) > $self->{_limit};
+
+        # Protect print() from -l on the command line.
+        local $\ = undef;
+
+        print {$self->{_filehandle}} $data;
+        $self->{_datasize} += length($data);
+    }
+    else {
+        $data = $self->SUPER::_append(@_);
+    }
+
+    return $data;
+}
+
+
+###############################################################################
+#
+# get_data().
+#
+# Retrieves data from memory in one chunk, or from disk in $buffer
+# sized chunks.
+#
+sub get_data {
+
+    my $self   = shift;
+    my $buffer = 4096;
+    my $tmp;
+
+    # Return data stored in memory
+    if (defined $self->{_data}) {
+        $tmp           = $self->{_data};
+        $self->{_data} = undef;
+        my $fh         = $self->{_filehandle};
+        seek($fh, 0, 0) if $self->{_using_tmpfile};
+        return $tmp;
+    }
+
+    # Return data stored on disk
+    if ($self->{_using_tmpfile}) {
+        return $tmp if read($self->{_filehandle}, $tmp, $buffer);
+    }
+
+    # No data to return
+    return undef;
+}
+
+
+###############################################################################
+#
+# close()
+#
+# Calls finalization methods and explicitly close the OLEwriter file
+# handle.
+#
+sub close {
+
+    my $self = shift;
+
+    return if $self->{_fileclosed}; # Prevent close() from being called twice.
+
+    $self->{_fileclosed} = 1;
+
+    return $self->_store_workbook();
+}
+
+
+###############################################################################
+#
+# DESTROY()
+#
+# Close the workbook if it hasn't already been explicitly closed.
+#
+sub DESTROY {
+
+    my $self = shift;
+
+    $self->close() if not $self->{_fileclosed};
+}
+
+
+###############################################################################
+#
+# sheets(slice,...)
+#
+# An accessor for the _worksheets[] array
+#
+# Returns: an optionally sliced list of the worksheet objects in a workbook.
+#
+sub sheets {
+
+    my $self = shift;
+
+    if (@_) {
+        # Return a slice of the array
+        return @{$self->{_worksheets}}[@_];
+    }
+    else {
+        # Return the entire list
+        return @{$self->{_worksheets}};
+    }
+}
+
+
+###############################################################################
+#
+# worksheets()
+#
+# An accessor for the _worksheets[] array.
+# This method is now deprecated. Use the sheets() method instead.
+#
+# Returns: an array reference
+#
+sub worksheets {
+
+    my $self = shift;
+
+    return $self->{_worksheets};
+}
+
+
+###############################################################################
+#
+# add_worksheet($name, $encoding)
+#
+# Add a new worksheet to the Excel workbook.
+#
+# Returns: reference to a worksheet object
+#
+sub add_worksheet {
+
+    my $self     = shift;
+    my $index    = @{$self->{_worksheets}};
+
+    my ($name, $encoding) = $self->_check_sheetname($_[0], $_[1]);
+
+
+    # Porters take note, the following scheme of passing references to Workbook
+    # data (in the \$self->{_foo} cases) instead of a reference to the Workbook
+    # itself is a workaround to avoid circular references between Workbook and
+    # Worksheet objects. Feel free to implement this in any way the suits your
+    # language.
+    #
+    my @init_data = (
+                         $name,
+                         $index,
+                         $encoding,
+                        \$self->{_activesheet},
+                        \$self->{_firstsheet},
+                         $self->{_url_format},
+                         $self->{_parser},
+                         $self->{_tempdir},
+                        \$self->{_str_total},
+                        \$self->{_str_unique},
+                        \$self->{_str_table},
+                         $self->{_1904},
+                    );
+
+    my $worksheet = Spreadsheet::WriteExcel::Worksheet->new(@init_data);
+    $self->{_worksheets}->[$index] = $worksheet;     # Store ref for iterator
+    $self->{_sheetnames}->[$index] = $name;          # Store EXTERNSHEET names
+    $self->{_parser}->set_ext_sheets($name, $index); # Store names in Formula.pm
+    return $worksheet;
+}
+
+
+###############################################################################
+#
+# add_chart_ext($name, $filename)
+#
+# Add an externally created chart.
+#
+#
+sub add_chart_ext {
+
+    my $self     = shift;
+    my $filename = $_[0];
+    my $index    = @{$self->{_worksheets}};
+
+    my ($name, $encoding) = $self->_check_sheetname($_[1], $_[2]);
+
+
+    my @init_data = (
+                         $filename,
+                         $name,
+                         $index,
+                         $encoding,
+                        \$self->{_activesheet},
+                        \$self->{_firstsheet},
+                    );
+
+    my $worksheet = Spreadsheet::WriteExcel::Chart->new(@init_data);
+    $self->{_worksheets}->[$index] = $worksheet;     # Store ref for iterator
+    $self->{_sheetnames}->[$index] = $name;          # Store EXTERNSHEET names
+    $self->{_parser}->set_ext_sheets($name, $index); # Store names in Formula.pm
+    return $worksheet;
+}
+
+
+###############################################################################
+#
+# _check_sheetname($name, $encoding)
+#
+# Check for valid worksheet names. We check the length, if it contains any
+# invalid characters and if the name is unique in the workbook.
+#
+sub _check_sheetname {
+
+    my $self            = shift;
+    my $name            = $_[0] || "";
+    my $encoding        = $_[1] || 0;
+    my $limit           = $encoding ? 62 : 31;
+    my $invalid_char    = qr([\[\]:*?/\\]);
+
+    # Supply default "Sheet" name if none has been defined.
+    my $index     = @{$self->{_worksheets}};
+    my $sheetname = $self->{_sheetname};
+
+    if ($name eq "" ) {
+        $name     = $sheetname . ($index+1);
+        $encoding = 0;
+    }
+
+
+    # Check that sheetname is <= 31 (1 or 2 byte chars). Excel limit.
+    croak "Sheetname $name must be <= 31 chars" if length $name > $limit;
+
+    # Check that Unicode sheetname has an even number of bytes
+    croak 'Odd number of bytes in Unicode worksheet name:' . $name
+          if $encoding == 1 and length($name) % 2;
+
+
+    # Check that sheetname doesn't contain any invalid characters
+    if ($encoding != 1 and $name =~ $invalid_char) {
+        # Check ASCII names
+        croak 'Invalid character []:*?/\\ in worksheet name: ' . $name;
+    }
+    else {
+        # Extract any 8bit clean chars from the UTF16 name and validate them.
+        for my $wchar ($name =~ /../sg) {
+            my ($hi, $lo) = unpack "aa", $wchar;
+            if ($hi eq "\0" and $lo =~ $invalid_char) {
+                croak 'Invalid character []:*?/\\ in worksheet name: ' . $name;
+            }
+        }
+    }
+
+
+    # Handle utf8 strings in perl 5.8.
+    if ($] >= 5.008) {
+        require Encode;
+
+        if (Encode::is_utf8($name)) {
+            $name = Encode::encode("UTF-16BE", $name);
+            $encoding = 1;
+        }
+    }
+
+
+    # Check that the worksheet name doesn't already exist since this is a fatal
+    # error in Excel 97. The check must also exclude case insensitive matches
+    # since the names 'Sheet1' and 'sheet1' are equivalent. The tests also have
+    # to take the encoding into account.
+    #
+    foreach my $worksheet (@{$self->{_worksheets}}) {
+        my $name_a  = $name;
+        my $encd_a  = $encoding;
+        my $name_b  = $worksheet->{_name};
+        my $encd_b  = $worksheet->{_encoding};
+        my $error   = 0;
+
+        if    ($encd_a == 0 and $encd_b == 0) {
+            $error  = 1 if lc($name_a) eq lc($name_b);
+        }
+        elsif ($encd_a == 0 and $encd_b == 1) {
+            $name_a = pack "n*", unpack "C*", $name_a;
+            $error  = 1 if lc($name_a) eq lc($name_b);
+        }
+        elsif ($encd_a == 1 and $encd_b == 0) {
+            $name_b = pack "n*", unpack "C*", $name_b;
+            $error  = 1 if lc($name_a) eq lc($name_b);
+        }
+        elsif ($encd_a == 1 and $encd_b == 1) {
+            # We can do a true case insensitive test with Perl 5.8 and utf8.
+            if ($] >= 5.008) {
+                $name_a = Encode::decode("UTF-16BE", $name_a);
+                $name_b = Encode::decode("UTF-16BE", $name_b);
+                $error  = 1 if lc($name_a) eq lc($name_b);
+            }
+            else {
+            # We can't easily do a case insensite test of the UTF16 names.
+            # As a special case we check if all of the high bytes are nulls and
+            # then do an ASCII style case insensitive test.
+
+                # Strip out the high bytes (funkily).
+                my $hi_a = grep {ord} $name_a =~ /(.)./sg;
+                my $hi_b = grep {ord} $name_b =~ /(.)./sg;
+
+                if ($hi_a or $hi_b) {
+                    $error  = 1 if    $name_a  eq    $name_b;
+                }
+                else {
+                    $error  = 1 if lc($name_a) eq lc($name_b);
+                }
+            }
+        }
+
+        # If any of the cases failed we throw the error here.
+        if ($error) {
+            croak "Worksheet name '$name', with case ignored, " .
+                  "is already in use";
+        }
+    }
+
+    return ($name,  $encoding);
+}
+
+
+###############################################################################
+#
+# addworksheet($name)
+#
+# This method is now deprecated. Use the add_worksheet() method instead.
+#
+sub addworksheet {
+
+    my $self = shift;
+
+    $self->add_worksheet(@_);
+}
+
+
+###############################################################################
+#
+# add_format(%properties)
+#
+# Add a new format to the Excel workbook. This adds an XF record and
+# a FONT record. Also, pass any properties to the Format::new().
+#
+sub add_format {
+
+    my $self = shift;
+
+    my $format = Spreadsheet::WriteExcel::Format->new($self->{_xf_index}, @_);
+
+    $self->{_xf_index} += 1;
+    push @{$self->{_formats}}, $format; # Store format reference
+
+    return $format;
+}
+
+
+###############################################################################
+#
+# addformat()
+#
+# This method is now deprecated. Use the add_format() method instead.
+#
+sub addformat {
+
+    my $self = shift;
+
+    $self->add_format(@_);
+}
+
+
+###############################################################################
+#
+# set_1904()
+#
+# Set the date system: 0 = 1900 (the default), 1 = 1904
+#
+sub set_1904 {
+
+    my $self      = shift;
+
+    croak "set_1904() must be called before add_worksheet" if $self->sheets();
+
+
+    if (defined($_[0])) {
+        $self->{_1904} = $_[0];
+    }
+    else {
+        $self->{_1904} = 1;
+    }
+}
+
+
+###############################################################################
+#
+# get_1904()
+#
+# Return the date system: 0 = 1900, 1 = 1904
+#
+sub get_1904 {
+
+    my $self = shift;
+
+    return $self->{_1904};
+}
+
+
+###############################################################################
+#
+# set_custom_color()
+#
+# Change the RGB components of the elements in the colour palette.
+#
+sub set_custom_color {
+
+    my $self    = shift;
+
+
+    # Match a HTML #xxyyzz style parameter
+    if (defined $_[1] and $_[1] =~ /^#(\w\w)(\w\w)(\w\w)/ ) {
+        @_ = ($_[0], hex $1, hex $2, hex $3);
+    }
+
+
+    my $index   = $_[0] || 0;
+    my $red     = $_[1] || 0;
+    my $green   = $_[2] || 0;
+    my $blue    = $_[3] || 0;
+
+    my $aref    = $self->{_palette};
+
+    # Check that the colour index is the right range
+    if ($index < 8 or $index > 64) {
+        carp "Color index $index outside range: 8 <= index <= 64";
+        return 0;
+    }
+
+    # Check that the colour components are in the right range
+    if ( ($red   < 0 or $red   > 255) ||
+         ($green < 0 or $green > 255) ||
+         ($blue  < 0 or $blue  > 255) )
+    {
+        carp "Color component outside range: 0 <= color <= 255";
+        return 0;
+    }
+
+    $index -=8; # Adjust colour index (wingless dragonfly)
+
+    # Set the RGB value
+    $$aref[$index] = [$red, $green, $blue, 0];
+
+    return $index +8;
+}
+
+
+###############################################################################
+#
+# set_palette_xl97()
+#
+# Sets the colour palette to the Excel 97+ default.
+#
+sub set_palette_xl97 {
+
+    my $self = shift;
+
+    $self->{_palette} = [
+                            [0x00, 0x00, 0x00, 0x00],   # 8
+                            [0xff, 0xff, 0xff, 0x00],   # 9
+                            [0xff, 0x00, 0x00, 0x00],   # 10
+                            [0x00, 0xff, 0x00, 0x00],   # 11
+                            [0x00, 0x00, 0xff, 0x00],   # 12
+                            [0xff, 0xff, 0x00, 0x00],   # 13
+                            [0xff, 0x00, 0xff, 0x00],   # 14
+                            [0x00, 0xff, 0xff, 0x00],   # 15
+                            [0x80, 0x00, 0x00, 0x00],   # 16
+                            [0x00, 0x80, 0x00, 0x00],   # 17
+                            [0x00, 0x00, 0x80, 0x00],   # 18
+                            [0x80, 0x80, 0x00, 0x00],   # 19
+                            [0x80, 0x00, 0x80, 0x00],   # 20
+                            [0x00, 0x80, 0x80, 0x00],   # 21
+                            [0xc0, 0xc0, 0xc0, 0x00],   # 22
+                            [0x80, 0x80, 0x80, 0x00],   # 23
+                            [0x99, 0x99, 0xff, 0x00],   # 24
+                            [0x99, 0x33, 0x66, 0x00],   # 25
+                            [0xff, 0xff, 0xcc, 0x00],   # 26
+                            [0xcc, 0xff, 0xff, 0x00],   # 27
+                            [0x66, 0x00, 0x66, 0x00],   # 28
+                            [0xff, 0x80, 0x80, 0x00],   # 29
+                            [0x00, 0x66, 0xcc, 0x00],   # 30
+                            [0xcc, 0xcc, 0xff, 0x00],   # 31
+                            [0x00, 0x00, 0x80, 0x00],   # 32
+                            [0xff, 0x00, 0xff, 0x00],   # 33
+                            [0xff, 0xff, 0x00, 0x00],   # 34
+                            [0x00, 0xff, 0xff, 0x00],   # 35
+                            [0x80, 0x00, 0x80, 0x00],   # 36
+                            [0x80, 0x00, 0x00, 0x00],   # 37
+                            [0x00, 0x80, 0x80, 0x00],   # 38
+                            [0x00, 0x00, 0xff, 0x00],   # 39
+                            [0x00, 0xcc, 0xff, 0x00],   # 40
+                            [0xcc, 0xff, 0xff, 0x00],   # 41
+                            [0xcc, 0xff, 0xcc, 0x00],   # 42
+                            [0xff, 0xff, 0x99, 0x00],   # 43
+                            [0x99, 0xcc, 0xff, 0x00],   # 44
+                            [0xff, 0x99, 0xcc, 0x00],   # 45
+                            [0xcc, 0x99, 0xff, 0x00],   # 46
+                            [0xff, 0xcc, 0x99, 0x00],   # 47
+                            [0x33, 0x66, 0xff, 0x00],   # 48
+                            [0x33, 0xcc, 0xcc, 0x00],   # 49
+                            [0x99, 0xcc, 0x00, 0x00],   # 50
+                            [0xff, 0xcc, 0x00, 0x00],   # 51
+                            [0xff, 0x99, 0x00, 0x00],   # 52
+                            [0xff, 0x66, 0x00, 0x00],   # 53
+                            [0x66, 0x66, 0x99, 0x00],   # 54
+                            [0x96, 0x96, 0x96, 0x00],   # 55
+                            [0x00, 0x33, 0x66, 0x00],   # 56
+                            [0x33, 0x99, 0x66, 0x00],   # 57
+                            [0x00, 0x33, 0x00, 0x00],   # 58
+                            [0x33, 0x33, 0x00, 0x00],   # 59
+                            [0x99, 0x33, 0x00, 0x00],   # 60
+                            [0x99, 0x33, 0x66, 0x00],   # 61
+                            [0x33, 0x33, 0x99, 0x00],   # 62
+                            [0x33, 0x33, 0x33, 0x00],   # 63
+                        ];
+
+    return 0;
+}
+
+
+###############################################################################
+#
+# set_tempdir()
+#
+# Change the default temp directory used by _initialize() in Worksheet.pm.
+#
+sub set_tempdir {
+
+    my $self = shift;
+
+    # Windows workaround. See Worksheet::_initialize()
+    my $dir  = shift || '';
+
+    croak "$dir is not a valid directory"       if $dir ne '' and not -d $dir;
+    croak "set_tempdir must be called before add_worksheet" if $self->sheets();
+
+    $self->{_tempdir} = $dir ;
+}
+
+
+###############################################################################
+#
+# set_codepage()
+#
+# See also the _store_codepage method. This is used to store the code page, i.e.
+# the character set used in the workbook.
+#
+sub set_codepage {
+
+    my $self        = shift;
+    my $codepage    = $_[0] || 1;
+    $codepage   = 0x04E4 if $codepage == 1;
+    $codepage   = 0x8000 if $codepage == 2;
+    $self->{_codepage} = $codepage;
+}
+
+
+###############################################################################
+#
+# _store_workbook()
+#
+# Assemble worksheets into a workbook and send the BIFF data to an OLE
+# storage.
+#
+sub _store_workbook {
+
+    my $self = shift;
+
+    # Add a default worksheet if non have been added.
+    $self->add_worksheet() if not @{$self->{_worksheets}};
+
+    # Calculate size required for MSO records and update worksheets.
+    $self->_calc_mso_sizes();
+
+    # Ensure that at least one worksheet has been selected.
+    if ($self->{_activesheet} == 0) {
+        @{$self->{_worksheets}}[0]->{_selected} = 1;
+        @{$self->{_worksheets}}[0]->{_hidden}   = 0;
+    }
+
+    # Calculate the number of selected worksheet tabs and call the finalization
+    # methods for each worksheet
+    foreach my $sheet (@{$self->{_worksheets}}) {
+        $self->{_selected}++ if $sheet->{_selected};
+        $sheet->{_active} = 1 if $sheet->{_index} == $self->{_activesheet};
+        $sheet->_close($self->{_sheetnames});
+    }
+
+    # Add Workbook globals
+    $self->_store_bof(0x0005);
+    $self->_store_codepage();
+    $self->_store_hideobj();
+    $self->_store_window1();
+    $self->_store_1904();
+    $self->_store_all_fonts();
+    $self->_store_all_num_formats();
+    $self->_store_all_xfs();
+    $self->_store_all_styles();
+    $self->_store_palette();
+
+    # Calculate the offsets required by the BOUNDSHEET records
+    $self->_calc_sheet_offsets();
+
+    # Add BOUNDSHEET records. For BIFF 7+ TODO ....
+    foreach my $sheet (@{$self->{_worksheets}}) {
+        $self->_store_boundsheet($sheet->{_name},
+                                 $sheet->{_offset},
+                                 $sheet->{_type},
+                                 $sheet->{_hidden},
+                                 $sheet->{_encoding});
+    }
+
+    # NOTE: If any records are added between here and EOF the
+    # _calc_sheet_offsets() should be updated to include the new length.
+    if ($self->{_ext_ref_count}) {
+        $self->_store_supbook();
+        $self->_store_externsheet();
+        $self->_store_names();
+    }
+    $self->_add_mso_drawing_group();
+    $self->_store_shared_strings();
+
+    # End Workbook globals
+    $self->_store_eof();
+
+    # Store the workbook in an OLE container
+    return $self->_store_OLE_file();
+}
+
+
+###############################################################################
+#
+# _store_OLE_file()
+#
+# Store the workbook in an OLE container if the total size of the workbook data
+# is less than ~ 7MB.
+#
+sub _store_OLE_file {
+
+    my $self = shift;
+
+    my $OLE  = Spreadsheet::WriteExcel::OLEwriter->new($self->{_fh_out});
+
+    # Indicate that we created the filehandle and want to close it.
+    $OLE->{_internal_fh} = $self->{_internal_fh};
+
+    # Write Worksheet data if data <~ 7MB
+    if ($OLE->set_size($self->{_biffsize})) {
+        $OLE->write_header();
+
+        while (my $tmp = $self->get_data()) {
+            $OLE->write($tmp);
+        }
+
+        foreach my $sheet (@{$self->{_worksheets}}) {
+            while (my $tmp = $sheet->get_data()) {
+                $OLE->write($tmp);
+            }
+        }
+
+        return $OLE->close();
+    }
+    else {
+        # File in greater than limit, set $! to "File too large"
+        $! = 27; # Perl error code "File too large"
+        my $maxsize = 7_087_104;
+
+        croak "Maximum Spreadsheet::WriteExcel filesize, $maxsize bytes, "    .
+              "exceeded. To create files bigger than this limit please refer ".
+              "to the \"Spreadsheet::WriteExcel::Big\" documentation.\n"      ;
+
+        # return 0;
+    }
+}
+
+
+###############################################################################
+#
+# _calc_sheet_offsets()
+#
+# Calculate Worksheet BOF offsets records for use in the BOUNDSHEET records.
+#
+sub _calc_sheet_offsets {
+
+    my $self    = shift;
+    my $BOF     = 12;
+    my $EOF     = 4;
+    my $offset  = $self->{_datasize};
+
+    # Add the length of the SST and associated CONTINUEs
+    $offset += $self->_calculate_shared_string_sizes();
+
+    # Add the length of the SUPBOOK, EXTERNSHEET and NAME records
+    $offset += $self->_calculate_extern_sizes();
+
+    # Add the length of the MSODRAWINGGROUP records
+    $offset += $self->{_mso_size};
+
+
+    foreach my $sheet (@{$self->{_worksheets}}) {
+        $offset += $BOF + length($sheet->{_name});
+    }
+
+    $offset += $EOF;
+
+    foreach my $sheet (@{$self->{_worksheets}}) {
+        $sheet->{_offset} = $offset;
+        $offset += $sheet->{_datasize};
+    }
+
+    $self->{_biffsize} = $offset;
+}
+
+
+###############################################################################
+#
+# _calc_mso_sizes()
+#
+# Calculate the MSODRAWINGGROUP sizes and the indexes of the Worksheet
+# MSODRAWING records.
+#
+# In the following SPID is shape id, according to Escher nonemclature.
+#
+sub _calc_mso_sizes {
+
+    my $self            = shift;
+
+    my $num_shapes      = 0;
+    my $mso_size        = 0;    # Size of the MSODRAWINGGROUP record
+    my $start_spid      = 1024; # Initial spid for each sheet
+    my $max_spid        = 1024; # spidMax
+    my $num_clusters    = 1;    # cidcl
+    my $shapes_saved    = 0;    # cspSaved
+    my $drawings_saved  = 0;    # cdgSaved
+    my @clusters        = ();
+
+
+    # Iterate through the worksheets, calculate the MSODRAWINGGROUP parameters
+    # and space required to store the record and the MSODRAWING parameters
+    # required by each worksheet.
+    #
+    foreach my $sheet (@{$self->{_worksheets}}) {
+        next unless $num_shapes = $sheet->_prepare_comments();
+
+        # Include 1 parent MSODRAWING shape, per sheet, in the shape count.
+        $num_shapes   += 1;
+        $shapes_saved += $num_shapes;
+
+
+        # Add a drawing object for each sheet with comments.
+        $drawings_saved++;
+
+
+        # For each sheet start the spids at the next 1024 interval.
+        $max_spid   = 1024 * (1 + int(($max_spid -1)/1024));
+        $start_spid = $max_spid;
+
+
+        # Max spid for each sheet and eventually for the workbook.
+        $max_spid  += $num_shapes;
+
+
+        # Store the cluster ids
+        for (my $i = $num_shapes; $i > 0; $i -= 1024) {
+            $num_clusters  += 1;
+            $mso_size      += 8;
+            my $size        = $i > 1024 ? 1024 : $i;
+
+            push @clusters, [$drawings_saved, $size];
+        }
+
+
+        # Pass calculate values back to the worksheet
+        $sheet->{_comments_ids} = [$start_spid, $drawings_saved,
+                                  $num_shapes, $max_spid -1];
+    }
+
+
+    # Calculate the MSODRAWINGGROUP size if we have stored some shapes.
+    $mso_size              += 86 if $mso_size; # Smallest size is 86+8=94
+
+
+    $self->{_mso_size}      = $mso_size;
+    $self->{_mso_clusters}  = [
+                                $max_spid, $num_clusters, $shapes_saved,
+                                $drawings_saved, [@clusters]
+                              ];
+}
+
+
+###############################################################################
+#
+# _store_all_fonts()
+#
+# Store the Excel FONT records.
+#
+sub _store_all_fonts {
+
+    my $self    = shift;
+
+    my $format  = $self->{_formats}->[15]; # The default cell format.
+    my $font    = $format->get_font();
+
+    # Note: Fonts are 0-indexed. According to the SDK there is no index 4,
+    # so the following fonts are 0, 1, 2, 3, 5
+    #
+    for (1..5){
+        $self->_append($font);
+    }
+
+
+    # Iterate through the XF objects and write a FONT record if it isn't the
+    # same as the default FONT and if it hasn't already been used.
+    #
+    my %fonts;
+    my $key;
+    my $index = 6;                  # The first user defined FONT
+
+    $key = $format->get_font_key(); # The default font for cell formats.
+    $fonts{$key} = 0;               # Index of the default font
+
+
+    foreach $format (@{$self->{_formats}}) {
+        $key = $format->get_font_key();
+
+        if (exists $fonts{$key}) {
+            # FONT has already been used
+            $format->{_font_index} = $fonts{$key};
+        }
+        else {
+            # Add a new FONT record
+            $fonts{$key}           = $index;
+            $format->{_font_index} = $index;
+            $index++;
+            $font = $format->get_font();
+            $self->_append($font);
+        }
+    }
+}
+
+
+###############################################################################
+#
+# _store_all_num_formats()
+#
+# Store user defined numerical formats i.e. FORMAT records
+#
+sub _store_all_num_formats {
+
+    my $self = shift;
+
+    my %num_formats;
+    my @num_formats;
+    my $num_format;
+    my $index = 164; # User defined FORMAT records start from 0xA4
+
+
+    # Iterate through the XF objects and write a FORMAT record if it isn't a
+    # built-in format type and if the FORMAT string hasn't already been used.
+    #
+    foreach my $format (@{$self->{_formats}}) {
+        my $num_format = $format->{_num_format};
+        my $encoding   = $format->{_num_format_enc};
+
+        # Check if $num_format is an index to a built-in format.
+        # Also check for a string of zeros, which is a valid format string
+        # but would evaluate to zero.
+        #
+        if ($num_format !~ m/^0+\d/) {
+            next if $num_format =~ m/^\d+$/; # built-in
+        }
+
+        if (exists($num_formats{$num_format})) {
+            # FORMAT has already been used
+            $format->{_num_format} = $num_formats{$num_format};
+        }
+        else{
+            # Add a new FORMAT
+            $num_formats{$num_format} = $index;
+            $format->{_num_format}    = $index;
+            $self->_store_num_format($num_format, $index, $encoding);
+            $index++;
+        }
+    }
+}
+
+
+###############################################################################
+#
+# _store_all_xfs()
+#
+# Write all XF records.
+#
+sub _store_all_xfs {
+
+    my $self = shift;
+
+    foreach my $format (@{$self->{_formats}}) {
+        my $xf = $format->get_xf();
+        $self->_append($xf);
+    }
+}
+
+
+###############################################################################
+#
+# _store_all_styles()
+#
+# Write all STYLE records.
+#
+sub _store_all_styles {
+
+    my $self = shift;
+
+    # Excel adds the built-in styles in alphabetical order.
+    my @built_ins = (
+        [0x03, 16], # Comma
+        [0x06, 17], # Comma[0]
+        [0x04, 18], # Currency
+        [0x07, 19], # Currency[0]
+        [0x00,  0], # Normal
+        [0x05, 20], # Percent
+
+        # We don't deal with these styles yet.
+        #[0x08, 21], # Hyperlink
+        #[0x02,  8], # ColLevel_n
+        #[0x01,  1], # RowLevel_n
+    );
+
+
+    for my $aref (@built_ins) {
+        my $type     = $aref->[0];
+        my $xf_index = $aref->[1];
+
+        $self->_store_style($type, $xf_index);
+    }
+}
+
+
+###############################################################################
+#
+# _store_names()
+#
+# Write the NAME record to define the print area and the repeat rows and cols.
+#
+sub _store_names {
+
+    my $self        = shift;
+    my $index       = 0;
+    my %ext_refs    = %{$self->{_ext_refs}};
+
+    # Create the print area NAME records
+    foreach my $worksheet (@{$self->{_worksheets}}) {
+
+        my $key = "$index:$index";
+        my $ref = $ext_refs{$key};
+        $index++;
+
+        # Write a Name record if the print area has been defined
+        if (defined $worksheet->{_print_rowmin}) {
+            $self->_store_name_short(
+                $worksheet->{_index},
+                0x06, # NAME type
+                $ref,
+                $worksheet->{_print_rowmin},
+                $worksheet->{_print_rowmax},
+                $worksheet->{_print_colmin},
+                $worksheet->{_print_colmax}
+            );
+        }
+    }
+
+    $index = 0;
+
+    # Create the print title NAME records
+    foreach my $worksheet (@{$self->{_worksheets}}) {
+
+        my $rowmin = $worksheet->{_title_rowmin};
+        my $rowmax = $worksheet->{_title_rowmax};
+        my $colmin = $worksheet->{_title_colmin};
+        my $colmax = $worksheet->{_title_colmax};
+        my $key    = "$index:$index";
+        my $ref    = $ext_refs{$key};
+        $index++;
+
+        # Determine if row + col, row, col or nothing has been defined
+        # and write the appropriate record
+        #
+        if (defined $rowmin && defined $colmin) {
+            # Row and column titles have been defined.
+            # Row title has been defined.
+            $self->_store_name_long(
+                $worksheet->{_index},
+                0x07, # NAME type
+                $ref,
+                $rowmin,
+                $rowmax,
+                $colmin,
+                $colmax
+           );
+        }
+        elsif (defined $rowmin) {
+            # Row title has been defined.
+            $self->_store_name_short(
+                $worksheet->{_index},
+                0x07, # NAME type
+                $ref,
+                $rowmin,
+                $rowmax,
+                0x00,
+                0xff
+            );
+        }
+        elsif (defined $colmin) {
+            # Column title has been defined.
+            $self->_store_name_short(
+                $worksheet->{_index},
+                0x07, # NAME type
+                $ref,
+                0x0000,
+                0xffff,
+                $colmin,
+                $colmax
+            );
+        }
+        else {
+            # Nothing left to do
+        }
+    }
+}
+
+
+
+
+###############################################################################
+###############################################################################
+#
+# BIFF RECORDS
+#
+
+
+###############################################################################
+#
+# _store_window1()
+#
+# Write Excel BIFF WINDOW1 record.
+#
+sub _store_window1 {
+
+    my $self      = shift;
+
+    my $record    = 0x003D;                 # Record identifier
+    my $length    = 0x0012;                 # Number of bytes to follow
+
+    my $xWn       = 0x0000;                 # Horizontal position of window
+    my $yWn       = 0x0000;                 # Vertical position of window
+    my $dxWn      = 0x25BC;                 # Width of window
+    my $dyWn      = 0x1572;                 # Height of window
+
+    my $grbit     = 0x0038;                 # Option flags
+    my $ctabsel   = $self->{_selected};     # Number of workbook tabs selected
+    my $wTabRatio = 0x0258;                 # Tab to scrollbar ratio
+
+    my $itabFirst = $self->{_firstsheet};   # 1st displayed worksheet
+    my $itabCur   = $self->{_activesheet};  # Active worksheet
+
+    my $header    = pack("vv",        $record, $length);
+    my $data      = pack("vvvvvvvvv", $xWn, $yWn, $dxWn, $dyWn,
+                                      $grbit,
+                                      $itabCur, $itabFirst,
+                                      $ctabsel, $wTabRatio);
+
+    $self->_append($header, $data);
+}
+
+
+###############################################################################
+#
+# _store_boundsheet()
+#
+# Writes Excel BIFF BOUNDSHEET record.
+#
+sub _store_boundsheet {
+
+    my $self      = shift;
+
+    my $record    = 0x0085;               # Record identifier
+    my $length    = 0x08 + length($_[0]); # Number of bytes to follow
+
+    my $sheetname = $_[0];                # Worksheet name
+    my $offset    = $_[1];                # Location of worksheet BOF
+    my $type      = $_[2];                # Worksheet type
+    my $hidden    = $_[3];                # Worksheet hidden flag
+    my $encoding  = $_[4];                # Sheet name encoding
+    my $cch       = length($sheetname);   # Length of sheet name
+
+    my $grbit     = $type | $hidden;
+
+    # Character length is num of chars not num of bytes
+    $cch /= 2 if $encoding;
+
+    # Change the UTF-16 name from BE to LE
+    $sheetname = pack 'n*', unpack 'v*', $sheetname if $encoding;
+
+    my $header    = pack("vv",   $record, $length);
+    my $data      = pack("VvCC", $offset, $grbit, $cch, $encoding);
+
+    $self->_append($header, $data, $sheetname);
+}
+
+
+###############################################################################
+#
+# _store_style()
+#
+# Write Excel BIFF STYLE records.
+#
+sub _store_style {
+
+    my $self      = shift;
+
+    my $record    = 0x0293; # Record identifier
+    my $length    = 0x0004; # Bytes to follow
+
+    my $type      = $_[0];  # Built-in style
+    my $xf_index  = $_[1];  # Index to style XF
+    my $level     = 0xff;   # Outline style level
+
+    $xf_index    |= 0x8000; # Add flag to indicate built-in style.
+
+
+    my $header    = pack("vv",  $record, $length);
+    my $data      = pack("vCC", $xf_index, $type, $level);
+
+    $self->_append($header, $data);
+}
+
+
+###############################################################################
+#
+# _store_num_format()
+#
+# Writes Excel FORMAT record for non "built-in" numerical formats.
+#
+sub _store_num_format {
+
+    my $self      = shift;
+
+    my $record    = 0x041E;         # Record identifier
+    my $length;                     # Number of bytes to follow
+
+    my $format    = $_[0];          # Custom format string
+    my $ifmt      = $_[1];          # Format index code
+    my $encoding  = $_[2];          # Char encoding for format string
+
+
+    # Handle utf8 strings in perl 5.8.
+    if ($] >= 5.008) {
+        require Encode;
+
+        if (Encode::is_utf8($format)) {
+            $format = Encode::encode("UTF-16BE", $format);
+            $encoding = 1;
+        }
+    }
+
+
+    # Char length of format string
+    my $cch = length $format;
+
+
+    # Handle Unicode format strings.
+    if ($encoding == 1) {
+        croak "Uneven number of bytes in Unicode font name" if $cch % 2;
+        $cch    /= 2 if $encoding;
+        $format  = pack 'v*', unpack 'n*', $format;
+    }
+
+
+    # Special case to handle Euro symbol, 0x80, in non-Unicode strings.
+    if ($encoding == 0 and $format =~ /\x80/) {
+        $format   =  pack 'v*', unpack 'C*', $format;
+        $format   =~ s/\x80\x00/\xAC\x20/g;
+        $encoding =  1;
+    }
+
+    $length       = 0x05 + length $format;
+
+    my $header    = pack("vv", $record, $length);
+    my $data      = pack("vvC", $ifmt, $cch, $encoding);
+
+    $self->_append($header, $data, $format);
+}
+
+
+###############################################################################
+#
+# _store_1904()
+#
+# Write Excel 1904 record to indicate the date system in use.
+#
+sub _store_1904 {
+
+    my $self      = shift;
+
+    my $record    = 0x0022;         # Record identifier
+    my $length    = 0x0002;         # Bytes to follow
+
+    my $f1904     = $self->{_1904}; # Flag for 1904 date system
+
+    my $header    = pack("vv",  $record, $length);
+    my $data      = pack("v", $f1904);
+
+    $self->_append($header, $data);
+}
+
+
+###############################################################################
+#
+# _store_supbook()
+#
+# Write BIFF record SUPBOOK to indicate that the workbook contains external
+# references, in our case, formula, print area and print title refs.
+#
+sub _store_supbook {
+
+    my $self        = shift;
+
+    my $record      = 0x01AE;                   # Record identifier
+    my $length      = 0x0004;                   # Number of bytes to follow
+
+    my $ctabs       = @{$self->{_worksheets}};  # Number of worksheets
+    my $StVirtPath  = 0x0401;                   # Encoded workbook filename
+
+    my $header      = pack("vv", $record, $length);
+    my $data        = pack("vv", $ctabs, $StVirtPath);
+
+    $self->_append($header, $data);
+}
+
+
+###############################################################################
+#
+# _store_externsheet()
+#
+#
+# Writes the Excel BIFF EXTERNSHEET record. These references are used by
+# formulas. TODO NAME record is required to define the print area and the repeat
+# rows and columns.
+#
+sub _store_externsheet {
+
+    my $self        = shift;
+
+    my $record      = 0x0017;                   # Record identifier
+    my $length;                                 # Number of bytes to follow
+
+
+    # Get the external refs
+    my %ext_refs = %{$self->{_ext_refs}};
+    my @ext_refs = sort {$ext_refs{$a} <=> $ext_refs{$b}} keys %ext_refs;
+
+    # Change the external refs from stringified "1:1" to [1, 1]
+    foreach my $ref (@ext_refs) {
+        $ref = [split /:/, $ref];
+    }
+
+
+    my $cxti        = scalar @ext_refs;         # Number of Excel XTI structures
+    my $rgxti       = '';                       # Array of XTI structures
+
+    # Write the XTI structs
+    foreach my $ext_ref (@ext_refs) {
+        $rgxti .= pack("vvv", 0, $ext_ref->[0], $ext_ref->[1])
+    }
+
+
+    my $data        = pack("v", $cxti) . $rgxti;
+    my $header      = pack("vv", $record, length $data);
+
+    $self->_append($header, $data);
+}
+
+
+###############################################################################
+#
+# _store_name_short()
+#
+#
+# Store the NAME record in the short format that is used for storing the print
+# area, repeat rows only and repeat columns only.
+#
+sub _store_name_short {
+
+    my $self            = shift;
+
+    my $record          = 0x0018;       # Record identifier
+    my $length          = 0x001b;       # Number of bytes to follow
+
+    my $index           = shift;        # Sheet index
+    my $type            = shift;
+    my $ext_ref         = shift;        # TODO
+
+    my $grbit           = 0x0020;       # Option flags
+    my $chKey           = 0x00;         # Keyboard shortcut
+    my $cch             = 0x01;         # Length of text name
+    my $cce             = 0x000b;       # Length of text definition
+    my $unknown01       = 0x0000;       #
+    my $ixals           = $index +1;    # Sheet index
+    my $unknown02       = 0x00;         #
+    my $cchCustMenu     = 0x00;         # Length of cust menu text
+    my $cchDescription  = 0x00;         # Length of description text
+    my $cchHelptopic    = 0x00;         # Length of help topic text
+    my $cchStatustext   = 0x00;         # Length of status bar text
+    my $rgch            = $type;        # Built-in name type
+    my $unknown03       = 0x3b;         #
+
+    my $rowmin          = $_[0];        # Start row
+    my $rowmax          = $_[1];        # End row
+    my $colmin          = $_[2];        # Start column
+    my $colmax          = $_[3];        # end column
+
+
+    my $header          = pack("vv", $record, $length);
+    my $data            = pack("v",  $grbit);
+    $data              .= pack("C",  $chKey);
+    $data              .= pack("C",  $cch);
+    $data              .= pack("v",  $cce);
+    $data              .= pack("v",  $unknown01);
+    $data              .= pack("v",  $ixals);
+    $data              .= pack("C",  $unknown02);
+    $data              .= pack("C",  $cchCustMenu);
+    $data              .= pack("C",  $cchDescription);
+    $data              .= pack("C",  $cchHelptopic);
+    $data              .= pack("C",  $cchStatustext);
+    $data              .= pack("C",  $rgch);
+    $data              .= pack("C",  $unknown03);
+    $data              .= pack("v",  $ext_ref);
+
+    $data              .= pack("v",  $rowmin);
+    $data              .= pack("v",  $rowmax);
+    $data              .= pack("v",  $colmin);
+    $data              .= pack("v",  $colmax);
+
+    $self->_append($header, $data);
+}
+
+
+###############################################################################
+#
+# _store_name_long()
+#
+#
+# Store the NAME record in the long format that is used for storing the repeat
+# rows and columns when both are specified. This share a lot of code with
+# _store_name_short() but we use a separate method to keep the code clean.
+# Code abstraction for reuse can be carried too far, and I should know. ;-)
+#
+sub _store_name_long {
+
+    my $self            = shift;
+
+    my $record          = 0x0018;       # Record identifier
+    my $length          = 0x002a;       # Number of bytes to follow
+
+    my $index           = shift;        # Sheet index
+    my $type            = shift;
+    my $ext_ref         = shift;        # TODO
+
+    my $grbit           = 0x0020;       # Option flags
+    my $chKey           = 0x00;         # Keyboard shortcut
+    my $cch             = 0x01;         # Length of text name
+    my $cce             = 0x001a;       # Length of text definition
+    my $unknown01       = 0x0000;       #
+    my $ixals           = $index +1;    # Sheet index
+    my $unknown02       = 0x00;         #
+    my $cchCustMenu     = 0x00;         # Length of cust menu text
+    my $cchDescription  = 0x00;         # Length of description text
+    my $cchHelptopic    = 0x00;         # Length of help topic text
+    my $cchStatustext   = 0x00;         # Length of status bar text
+    my $rgch            = $type;        # Built-in name type
+
+    my $unknown03       = 0x29;
+    my $unknown04       = 0x0017;
+    my $unknown05       = 0x3b;
+
+    my $rowmin          = $_[0];        # Start row
+    my $rowmax          = $_[1];        # End row
+    my $colmin          = $_[2];        # Start column
+    my $colmax          = $_[3];        # end column
+
+
+    my $header          = pack("vv", $record, $length);
+    my $data            = pack("v",  $grbit);
+    $data              .= pack("C",  $chKey);
+    $data              .= pack("C",  $cch);
+    $data              .= pack("v",  $cce);
+    $data              .= pack("v",  $unknown01);
+    $data              .= pack("v",  $ixals);
+    $data              .= pack("C",  $unknown02);
+    $data              .= pack("C",  $cchCustMenu);
+    $data              .= pack("C",  $cchDescription);
+    $data              .= pack("C",  $cchHelptopic);
+    $data              .= pack("C",  $cchStatustext);
+    $data              .= pack("C",  $rgch);
+
+    # Column definition
+    $data              .= pack("C",  $unknown03);
+    $data              .= pack("v",  $unknown04);
+    $data              .= pack("C",  $unknown05);
+    $data              .= pack("v",  $ext_ref);
+    $data              .= pack("v",  0x0000);
+    $data              .= pack("v",  0xffff);
+    $data              .= pack("v",  $colmin);
+    $data              .= pack("v",  $colmax);
+
+    # Row definition
+    $data              .= pack("C",  $unknown05);
+    $data              .= pack("v",  $ext_ref);
+    $data              .= pack("v",  $rowmin);
+    $data              .= pack("v",  $rowmax);
+    $data              .= pack("v",  0x00);
+    $data              .= pack("v",  0xff);
+    # End of data
+    $data              .= pack("C",  0x10);
+
+    $self->_append($header, $data);
+}
+
+
+###############################################################################
+#
+# _store_palette()
+#
+# Stores the PALETTE biff record.
+#
+sub _store_palette {
+
+    my $self            = shift;
+
+    my $aref            = $self->{_palette};
+
+    my $record          = 0x0092;           # Record identifier
+    my $length          = 2 + 4 * @$aref;   # Number of bytes to follow
+    my $ccv             =         @$aref;   # Number of RGB values to follow
+    my $data;                               # The RGB data
+
+    # Pack the RGB data
+    $data .= pack "CCCC", @$_ for @$aref;
+
+    my $header = pack("vvv",  $record, $length, $ccv);
+
+    $self->_append($header, $data);
+}
+
+
+###############################################################################
+#
+# _store_codepage()
+#
+# Stores the CODEPAGE biff record.
+#
+sub _store_codepage {
+
+    my $self            = shift;
+
+    my $record          = 0x0042;               # Record identifier
+    my $length          = 0x0002;               # Number of bytes to follow
+    my $cv              = $self->{_codepage};   # The code page
+
+    my $header          = pack("vv", $record, $length);
+    my $data            = pack("v",  $cv);
+
+    $self->_append($header, $data);
+}
+
+
+###############################################################################
+#
+# _store_hideobj()
+#
+# Stores the HIDEOBJ biff record.
+#
+sub _store_hideobj {
+
+    my $self            = shift;
+
+    my $record          = 0x008D;               # Record identifier
+    my $length          = 0x0002;               # Number of bytes to follow
+    my $hide            = $self->{_hideobj};    # Option to hide objects
+
+    my $header          = pack("vv", $record, $length);
+    my $data            = pack("v",  $hide);
+
+    $self->_append($header, $data);
+}
+
+
+
+
+###############################################################################
+###############################################################################
+###############################################################################
+
+
+
+###############################################################################
+#
+# _calculate_extern_sizes()
+#
+# We need to calculate the space required by the SUPBOOK, EXTERNSHEET and NAME
+# records so that it can be added to the BOUNDSHEET offsets.
+#
+sub _calculate_extern_sizes {
+
+    my $self   = shift;
+
+
+    my %ext_refs        = $self->{_parser}->get_ext_sheets();
+    my $ext_ref_count   = scalar keys %ext_refs;
+    my $length          = 0;
+    my $index           = 0;
+
+    foreach my $worksheet (@{$self->{_worksheets}}) {
+
+        my $rowmin      = $worksheet->{_title_rowmin};
+        my $colmin      = $worksheet->{_title_colmin};
+        my $key         = "$index:$index";
+        $index++;
+
+
+        # Print area NAME records
+        if (defined $worksheet->{_print_rowmin}) {
+            $ext_refs{$key} = $ext_ref_count++ if not exists $ext_refs{$key};
+
+            $length += 31 ;
+        }
+
+
+        # Print title  NAME records
+        if (defined $rowmin and defined $colmin) {
+            $ext_refs{$key} = $ext_ref_count++ if not exists $ext_refs{$key};
+
+            $length += 46;
+        }
+        elsif (defined $rowmin or defined $colmin) {
+            $ext_refs{$key} = $ext_ref_count++ if not exists $ext_refs{$key};
+
+            $length += 31;
+        }
+        else {
+            # TODO
+        }
+
+
+    }
+
+
+    # TODO
+    $self->{_ext_ref_count} = $ext_ref_count;
+    $self->{_ext_refs}      = {%ext_refs};
+
+
+
+    # If there are no external refs then we don't write, SUPBOOK, EXTERNSHEET
+    # and NAME. Therefore the length is 0.
+
+    return $length = 0 if $ext_ref_count == 0;
+
+
+
+    # The SUPBOOK record is 8 bytes
+    $length += 8;
+
+    # The EXTERNSHEET record is 6 bytes + 6 bytes for each external ref
+    $length += 6 * (1 + $ext_ref_count);
+
+    return $length;
+}
+
+
+###############################################################################
+#
+# _calculate_shared_string_sizes()
+#
+# Handling of the SST continue blocks is complicated by the need to include an
+# additional continuation byte depending on whether the string is split between
+# blocks or whether it starts at the beginning of the block. (There are also
+# additional complications that will arise later when/if Rich Strings are
+# supported). As such we cannot use the simple CONTINUE mechanism provided by
+# the _add_continue() method in BIFFwriter.pm. Thus we have to make two passes
+# through the strings data. The first is to calculate the required block sizes
+# and the second, in _store_shared_strings(), is to write the actual strings.
+# The first pass through the data is also used to calculate the size of the SST
+# and CONTINUE records for use in setting the BOUNDSHEET record offsets. The
+# downside of this is that the same algorithm repeated in _store_shared_strings.
+#
+sub _calculate_shared_string_sizes {
+
+    my $self    = shift;
+
+    my @strings;
+    $#strings = $self->{_str_unique} -1; # Pre-extend array
+
+    while (my $key = each %{$self->{_str_table}}) {
+        $strings[$self->{_str_table}->{$key}] = $key;
+    }
+
+    # The SST data could be very large, free some memory (maybe).
+    $self->{_str_table} = undef;
+    $self->{_str_array} = [@strings];
+
+
+    # Iterate through the strings to calculate the CONTINUE block sizes.
+    #
+    # The SST blocks requires a specialised CONTINUE block, so we have to
+    # ensure that the maximum data block size is less than the limit used by
+    # _add_continue() in BIFFwriter.pm. For simplicity we use the same size
+    # for the SST and CONTINUE records:
+    #   8228 : Maximum Excel97 block size
+    #     -4 : Length of block header
+    #     -8 : Length of additional SST header information
+    #     -8 : Arbitrary number to keep within _add_continue() limit
+    # = 8208
+    #
+    my $continue_limit = 8208;
+    my $block_length   = 0;
+    my $written        = 0;
+    my @block_sizes;
+    my $continue       = 0;
+
+    for my $string (@strings) {
+
+        my $string_length = length $string;
+        my $encoding      = unpack "xx C", $string;
+        my $split_string  = 0;
+
+
+        # Block length is the total length of the strings that will be
+        # written out in a single SST or CONTINUE block.
+        #
+        $block_length += $string_length;
+
+
+        # We can write the string if it doesn't cross a CONTINUE boundary
+        if ($block_length < $continue_limit) {
+            $written += $string_length;
+            next;
+        }
+
+
+        # Deal with the cases where the next string to be written will exceed
+        # the CONTINUE boundary. If the string is very long it may need to be
+        # written in more than one CONTINUE record.
+        #
+        while ($block_length >= $continue_limit) {
+
+            # We need to avoid the case where a string is continued in the first
+            # n bytes that contain the string header information.
+            #
+            my $header_length   = 3; # Min string + header size -1
+            my $space_remaining = $continue_limit -$written -$continue;
+
+
+            # Unicode data should only be split on char (2 byte) boundaries.
+            # Therefore, in some cases we need to reduce the amount of available
+            # space by 1 byte to ensure the correct alignment.
+            my $align = 0;
+
+            # Only applies to Unicode strings
+            if ($encoding == 1) {
+                # Min string + header size -1
+                $header_length = 4;
+
+                if ($space_remaining > $header_length) {
+                    # String contains 3 byte header => split on odd boundary
+                    if (not $split_string and $space_remaining % 2 != 1) {
+                        $space_remaining--;
+                        $align = 1;
+                    }
+                    # Split section without header => split on even boundary
+                    elsif ($split_string and $space_remaining % 2 == 1) {
+                        $space_remaining--;
+                        $align = 1;
+                    }
+
+                    $split_string = 1;
+                }
+            }
+
+
+            if ($space_remaining > $header_length) {
+                # Write as much as possible of the string in the current block
+                $written      += $space_remaining;
+
+                # Reduce the current block length by the amount written
+                $block_length -= $continue_limit -$continue -$align;
+
+                # Store the max size for this block
+                push @block_sizes, $continue_limit -$align;
+
+                # If the current string was split then the next CONTINUE block
+                # should have the string continue flag (grbit) set unless the
+                # split string fits exactly into the remaining space.
+                #
+                if ($block_length > 0) {
+                    $continue = 1;
+                }
+                else {
+                    $continue = 0;
+                }
+
+            }
+            else {
+                # Store the max size for this block
+                push @block_sizes, $written +$continue;
+
+                # Not enough space to start the string in the current block
+                $block_length -= $continue_limit -$space_remaining -$continue;
+                $continue = 0;
+
+            }
+
+            # If the string (or substr) is small enough we can write it in the
+            # new CONTINUE block. Else, go through the loop again to write it in
+            # one or more CONTINUE blocks
+            #
+            if ($block_length < $continue_limit) {
+                $written = $block_length;
+            }
+            else {
+                $written = 0;
+            }
+        }
+    }
+
+    # Store the max size for the last block unless it is empty
+    push @block_sizes, $written +$continue if $written +$continue;
+
+
+    $self->{_str_block_sizes} = [@block_sizes];
+
+
+    # Calculate the total length of the SST and associated CONTINUEs (if any).
+    # The SST record will have a length even if it contains no strings.
+    # This length is required to set the offsets in the BOUNDSHEET records since
+    # they must be written before the SST records
+    #
+    my $length  = 12;
+    $length    +=     shift @block_sizes if    @block_sizes; # SST
+    $length    += 4 + shift @block_sizes while @block_sizes; # CONTINUEs
+
+    return $length;
+}
+
+
+###############################################################################
+#
+# _store_shared_strings()
+#
+# Write all of the workbooks strings into an indexed array.
+#
+# See the comments in _calculate_shared_string_sizes() for more information.
+#
+# The Excel documentation says that the SST record should be followed by an
+# EXTSST record. The EXTSST record is a hash table that is used to optimise
+# access to SST. However, despite the documentation it doesn't seem to be
+# required so we will ignore it.
+#
+sub _store_shared_strings {
+
+    my $self                = shift;
+
+    my @strings = @{$self->{_str_array}};
+
+
+    my $record              = 0x00FC;   # Record identifier
+    my $length              = 0x0008;   # Number of bytes to follow
+    my $total               = 0x0000;
+
+    # Iterate through the strings to calculate the CONTINUE block sizes
+    my $continue_limit = 8208;
+    my $block_length   = 0;
+    my $written        = 0;
+    my $continue       = 0;
+
+    # The SST and CONTINUE block sizes have been pre-calculated by
+    # _calculate_shared_string_sizes()
+    my @block_sizes    = @{$self->{_str_block_sizes}};
+
+
+    # The SST record is required even if it contains no strings. Thus we will
+    # always have a length
+    #
+    if (@block_sizes) {
+        $length = 8 + shift @block_sizes;
+    }
+    else {
+        # No strings
+        $length = 8;
+    }
+
+    # Write the SST block header information
+    my $header      = pack("vv", $record, $length);
+    my $data        = pack("VV", $self->{_str_total}, $self->{_str_unique});
+    $self->_append($header, $data);
+
+
+    # Iterate through the strings and write them out
+    for my $string (@strings) {
+
+        my $string_length = length $string;
+        my $encoding      = unpack "xx C", $string;
+        my $split_string  = 0;
+
+
+        # Block length is the total length of the strings that will be
+        # written out in a single SST or CONTINUE block.
+        #
+        $block_length += $string_length;
+
+
+        # We can write the string if it doesn't cross a CONTINUE boundary
+        if ($block_length < $continue_limit) {
+            $self->_append($string);
+            $written += $string_length;
+            next;
+        }
+
+
+        # Deal with the cases where the next string to be written will exceed
+        # the CONTINUE boundary. If the string is very long it may need to be
+        # written in more than one CONTINUE record.
+        #
+        while ($block_length >= $continue_limit) {
+
+            # We need to avoid the case where a string is continued in the first
+            # n bytes that contain the string header information.
+            #
+            my $header_length   = 3; # Min string + header size -1
+            my $space_remaining = $continue_limit -$written -$continue;
+
+
+            # Unicode data should only be split on char (2 byte) boundaries.
+            # Therefore, in some cases we need to reduce the amount of available
+            # space by 1 byte to ensure the correct alignment.
+            my $align = 0;
+
+            # Only applies to Unicode strings
+            if ($encoding == 1) {
+                # Min string + header size -1
+                $header_length = 4;
+
+                if ($space_remaining > $header_length) {
+                    # String contains 3 byte header => split on odd boundary
+                    if (not $split_string and $space_remaining % 2 != 1) {
+                        $space_remaining--;
+                        $align = 1;
+                    }
+                    # Split section without header => split on even boundary
+                    elsif ($split_string and $space_remaining % 2 == 1) {
+                        $space_remaining--;
+                        $align = 1;
+                    }
+
+                    $split_string = 1;
+                }
+            }
+
+
+            if ($space_remaining > $header_length) {
+                # Write as much as possible of the string in the current block
+                my $tmp = substr $string, 0, $space_remaining;
+                $self->_append($tmp);
+
+                # The remainder will be written in the next block(s)
+                $string = substr $string, $space_remaining;
+
+                # Reduce the current block length by the amount written
+                $block_length -= $continue_limit -$continue -$align;
+
+                # If the current string was split then the next CONTINUE block
+                # should have the string continue flag (grbit) set unless the
+                # split string fits exactly into the remaining space.
+                #
+                if ($block_length > 0) {
+                    $continue = 1;
+                }
+                else {
+                    $continue = 0;
+                }
+            }
+            else {
+                # Not enough space to start the string in the current block
+                $block_length -= $continue_limit -$space_remaining -$continue;
+                $continue = 0;
+            }
+
+            # Write the CONTINUE block header
+            if (@block_sizes) {
+                $record  = 0x003C;
+                $length  = shift @block_sizes;
+
+                $header  = pack("vv", $record, $length);
+                $header .= pack("C", $encoding) if $continue;
+
+                $self->_append($header);
+            }
+
+            # If the string (or substr) is small enough we can write it in the
+            # new CONTINUE block. Else, go through the loop again to write it in
+            # one or more CONTINUE blocks
+            #
+            if ($block_length < $continue_limit) {
+                $self->_append($string);
+
+                $written = $block_length;
+            }
+            else {
+                $written = 0;
+            }
+        }
+    }
+}
+
+#
+# Methods related to comments and MSO objects.
+#
+
+###############################################################################
+#
+# _add_mso_drawing_group()
+#
+# Write the MSODRAWINGGROUP record that keeps track of the Escher drawing
+# objects in the file such as images, comments and filters.
+#
+sub _add_mso_drawing_group {
+
+    my $self    = shift;
+
+    return unless $self->{_mso_size};
+
+    my $record  = 0x00EB;               # Record identifier
+    my $length  = 0x0000;               # Number of bytes to follow
+
+    my $data    = $self->_store_mso_dgg_container();
+       $data   .= $self->_store_mso_dgg(@{$self->{_mso_clusters}});
+       $data   .= $self->_store_mso_opt();
+       $data   .= $self->_store_mso_split_menu_colors();
+
+       $length  = length $data;
+    my $header  = pack("vv", $record, $length);
+
+    $self->_append($header, $data);
+
+
+    return $header . $data;
+
+}
+
+
+###############################################################################
+#
+# _store_mso_dgg_container()
+#
+# Write the Escher DggContainer record that is part of MSODRAWINGGROUP.
+#
+sub _store_mso_dgg_container {
+
+    my $self        = shift;
+
+    my $type        = 0xF000;
+    my $version     = 15;
+    my $instance    = 0;
+    my $data        = '';
+    my $length      = $self->{_mso_size} -12; # -4 (biff header) -8 (for this).
+
+
+    return $self->_add_mso_generic($type, $version, $instance, $data, $length);
+}
+
+
+###############################################################################
+#
+# _store_mso_dgg()
+#
+# Write the Escher Dgg record that is part of MSODRAWINGGROUP.
+#
+sub _store_mso_dgg {
+
+    my $self        = shift;
+
+    my $type            = 0xF006;
+    my $version         = 0;
+    my $instance        = 0;
+    my $data            = '';
+    my $length          = undef; # Calculate automatically.
+
+    my $max_spid        = $_[0];
+    my $num_clusters    = $_[1];
+    my $shapes_saved    = $_[2];
+    my $drawings_saved  = $_[3];
+    my $clusters        = $_[4];
+
+    $data               = pack "VVVV",  $max_spid,     $num_clusters,
+                                        $shapes_saved, $drawings_saved;
+
+    for my $aref (@$clusters) {
+        my $drawing_id      = $aref->[0];
+        my $shape_ids_used  = $aref->[1];
+
+        $data              .= pack "VV",  $drawing_id, $shape_ids_used;
+    }
+
+
+    return $self->_add_mso_generic($type, $version, $instance, $data, $length);
+}
+
+
+###############################################################################
+#
+# _store_mso_opt()
+#
+# Write the Escher Opt record that is part of MSODRAWINGGROUP.
+#
+sub _store_mso_opt {
+
+    my $self        = shift;
+
+    my $type        = 0xF00B;
+    my $version     = 3;
+    my $instance    = 3;
+    my $data        = '';
+    my $length      = 18;
+
+    $data           = pack "H*", 'BF0008000800810109000008C0014000' .
+                                 '0008';
+
+
+    return $self->_add_mso_generic($type, $version, $instance, $data, $length);
+}
+
+
+###############################################################################
+#
+# _store_mso_split_menu_colors()
+#
+# Write the Escher SplitMenuColors record that is part of MSODRAWINGGROUP.
+#
+sub _store_mso_split_menu_colors {
+
+    my $self        = shift;
+
+    my $type        = 0xF11E;
+    my $version     = 0;
+    my $instance    = 4;
+    my $data        = '';
+    my $length      = 16;
+
+    $data           = pack "H*", '0D0000080C00000817000008F7000010';
+
+
+    return $self->_add_mso_generic($type, $version, $instance, $data, $length);
+}
+
+
+1;
+
+
+__END__
+
+
+=head1 NAME
+
+Workbook - A writer class for Excel Workbooks.
+
+=head1 SYNOPSIS
+
+See the documentation for Spreadsheet::WriteExcel
+
+=head1 DESCRIPTION
+
+This module is used in conjunction with Spreadsheet::WriteExcel.
+
+=head1 AUTHOR
+
+John McNamara jmcnamara at cpan.org
+
+=head1 COPYRIGHT
+
+© MM-MMVI, John McNamara.
+
+All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.

Modified: packages/libspreadsheet-writeexcel-perl/trunk/lib/Spreadsheet/WriteExcel/WorkbookBig.pm
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/lib/Spreadsheet/WriteExcel/WorkbookBig.pm	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/lib/Spreadsheet/WriteExcel/WorkbookBig.pm	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,117 +1,117 @@
-package Spreadsheet::WriteExcel::WorkbookBig;
-
-###############################################################################
-#
-# WorkbookBig - A writer class for Excel Workbooks > 7MB.
-#
-#
-# Used in conjunction with Spreadsheet::WriteExcel
-#
-# Copyright 2000-2005, John McNamara and Kawai Takanori.
-#
-# Documentation after __END__
-#
-
-use Exporter;
-use strict;
-use Carp;
-use Spreadsheet::WriteExcel::Workbook;
-use OLE::Storage_Lite;
-use Spreadsheet::WriteExcel::Worksheet;
-use Spreadsheet::WriteExcel::Format;
-
-
-use vars qw($VERSION @ISA);
- at ISA = qw(Spreadsheet::WriteExcel::Workbook Exporter);
-
-$VERSION = '2.15';
-
-###############################################################################
-#
-# new()
-#
-# Constructor. Creates a new WorkbookBig object from a Workbook object.
-#
-sub new {
-
-    my $class = shift;
-    my $self  = Spreadsheet::WriteExcel::Workbook->new(@_);
-
-    bless $self, $class;
-    return $self;
-}
-
-
-###############################################################################
-#
-# _store_OLE_file(). Over-ridden.
-#
-# Store the workbook in an OLE container using OLE::Storage_Lite.
-#
-sub _store_OLE_file {
-
-    my $self = shift;
-
-    my $stream  = pack 'v*', unpack 'C*', 'Workbook';
-    my $OLE     = OLE::Storage_Lite::PPS::File->newFile($stream);
-
-
-    my $tmp;
-    $OLE->append($tmp) while $tmp = $self->get_data();
-
-    foreach my $worksheet (@{$self->{_worksheets}}) {
-        $OLE->append($tmp) while $tmp = $worksheet->get_data();
-    }
-
-    my @ltime = localtime();
-    splice(@ltime, 6);
-    my $date = OLE::Storage_Lite::PPS::Root->new(\@ltime, \@ltime,[$OLE]);
-    $date->save($self->{_filename});
-
-    # Close the filehandle if it was created internally.
-    return CORE::close($self->{_fh_out}) if $self->{_internal_fh};
-
-
-}
-
-
-1;
-
-
-__END__
-
-
-=head1 NAME
-
-WorkbookBig - A writer class for Excel Workbooks > 7MB.
-
-
-=head1 SYNOPSIS
-
-See the documentation for Spreadsheet::WriteExcel.
-
-
-=head1 DESCRIPTION
-
-This module is used in conjunction with Spreadsheet::WriteExcel.
-
-It is a sub-class of the Spreadsheet::WriteExcel::Workbook module.
-
-
-=head1 REQUIREMENTS
-
-IO::Stringy and OLE::Storage_Lite
-
-
-=head1 AUTHORS
-
-John McNamara jmcnamara at cpan.org
-
-Kawai Takanori kwitknr at cpan.org
-
-
-=head1 COPYRIGHT
-
-© MM-MMV, John McNamara and Kawai Takanori.
-
-All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.
+package Spreadsheet::WriteExcel::WorkbookBig;
+
+###############################################################################
+#
+# WorkbookBig - A writer class for Excel Workbooks > 7MB.
+#
+#
+# Used in conjunction with Spreadsheet::WriteExcel
+#
+# Copyright 2000-2006, John McNamara and Kawai Takanori.
+#
+# Documentation after __END__
+#
+
+use Exporter;
+use strict;
+use Carp;
+use Spreadsheet::WriteExcel::Workbook;
+use OLE::Storage_Lite;
+use Spreadsheet::WriteExcel::Worksheet;
+use Spreadsheet::WriteExcel::Format;
+
+
+use vars qw($VERSION @ISA);
+ at ISA = qw(Spreadsheet::WriteExcel::Workbook Exporter);
+
+$VERSION = '2.15';
+
+###############################################################################
+#
+# new()
+#
+# Constructor. Creates a new WorkbookBig object from a Workbook object.
+#
+sub new {
+
+    my $class = shift;
+    my $self  = Spreadsheet::WriteExcel::Workbook->new(@_);
+
+    bless $self, $class;
+    return $self;
+}
+
+
+###############################################################################
+#
+# _store_OLE_file(). Over-ridden.
+#
+# Store the workbook in an OLE container using OLE::Storage_Lite.
+#
+sub _store_OLE_file {
+
+    my $self = shift;
+
+    my $stream  = pack 'v*', unpack 'C*', 'Workbook';
+    my $OLE     = OLE::Storage_Lite::PPS::File->newFile($stream);
+
+
+    my $tmp;
+    $OLE->append($tmp) while $tmp = $self->get_data();
+
+    foreach my $worksheet (@{$self->{_worksheets}}) {
+        $OLE->append($tmp) while $tmp = $worksheet->get_data();
+    }
+
+    my @ltime = localtime();
+    splice(@ltime, 6);
+    my $date = OLE::Storage_Lite::PPS::Root->new(\@ltime, \@ltime,[$OLE]);
+    $date->save($self->{_filename});
+
+    # Close the filehandle if it was created internally.
+    return CORE::close($self->{_fh_out}) if $self->{_internal_fh};
+
+
+}
+
+
+1;
+
+
+__END__
+
+
+=head1 NAME
+
+WorkbookBig - A writer class for Excel Workbooks > 7MB.
+
+
+=head1 SYNOPSIS
+
+See the documentation for Spreadsheet::WriteExcel.
+
+
+=head1 DESCRIPTION
+
+This module is used in conjunction with Spreadsheet::WriteExcel.
+
+It is a sub-class of the Spreadsheet::WriteExcel::Workbook module.
+
+
+=head1 REQUIREMENTS
+
+IO::Stringy and OLE::Storage_Lite
+
+
+=head1 AUTHORS
+
+John McNamara jmcnamara at cpan.org
+
+Kawai Takanori kwitknr at cpan.org
+
+
+=head1 COPYRIGHT
+
+© MM-MMVI, John McNamara and Kawai Takanori.
+
+All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.

Modified: packages/libspreadsheet-writeexcel-perl/trunk/lib/Spreadsheet/WriteExcel/Worksheet.pm
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/lib/Spreadsheet/WriteExcel/Worksheet.pm	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/lib/Spreadsheet/WriteExcel/Worksheet.pm	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,4423 +1,5419 @@
-package Spreadsheet::WriteExcel::Worksheet;
-
-###############################################################################
-#
-# Worksheet - A writer class for Excel Worksheets.
-#
-#
-# Used in conjunction with Spreadsheet::WriteExcel
-#
-# Copyright 2000-2005, John McNamara, jmcnamara at cpan.org
-#
-# Documentation after __END__
-#
-
-use Exporter;
-use strict;
-use Carp;
-use Spreadsheet::WriteExcel::BIFFwriter;
-use Spreadsheet::WriteExcel::Format;
-use Spreadsheet::WriteExcel::Formula;
-
-
-
-use vars qw($VERSION @ISA);
- at ISA = qw(Spreadsheet::WriteExcel::BIFFwriter);
-
-$VERSION = '2.15';
-
-###############################################################################
-#
-# new()
-#
-# Constructor. Creates a new Worksheet object from a BIFFwriter object
-#
-sub new {
-
-    my $class                   = shift;
-    my $self                    = Spreadsheet::WriteExcel::BIFFwriter->new();
-    my $rowmax                  = 65536;
-    my $colmax                  = 256;
-    my $strmax                  = 0;
-
-    $self->{_name}              = $_[0];
-    $self->{_index}             = $_[1];
-    $self->{_encoding}          = $_[2];
-    $self->{_activesheet}       = $_[3];
-    $self->{_firstsheet}        = $_[4];
-    $self->{_url_format}        = $_[5];
-    $self->{_parser}            = $_[6];
-    $self->{_tempdir}           = $_[7];
-
-    $self->{_str_total}         = $_[8];
-    $self->{_str_unique}        = $_[9];
-    $self->{_str_table}         = $_[10];
-    $self->{_1904}              = $_[11];
-
-    $self->{_type}              = 0x0000;
-    $self->{_ext_sheets}        = [];
-    $self->{_using_tmpfile}     = 1;
-    $self->{_filehandle}        = "";
-    $self->{_fileclosed}        = 0;
-    $self->{_offset}            = 0;
-    $self->{_xls_rowmax}        = $rowmax;
-    $self->{_xls_colmax}        = $colmax;
-    $self->{_xls_strmax}        = $strmax;
-    $self->{_dim_rowmin}        = $rowmax +1;
-    $self->{_dim_rowmax}        = 0;
-    $self->{_dim_colmin}        = $colmax +1;
-    $self->{_dim_colmax}        = 0;
-    $self->{_dim_changed}       = 0;
-    $self->{_colinfo}           = [];
-    $self->{_selection}         = [0, 0];
-    $self->{_panes}             = [];
-    $self->{_active_pane}       = 3;
-    $self->{_frozen}            = 0;
-    $self->{_selected}          = 0;
-    $self->{_hidden}            = 0;
-    $self->{_active}            = 0;
-
-    $self->{_paper_size}        = 0x0;
-    $self->{_orientation}       = 0x1;
-    $self->{_header}            = '';
-    $self->{_footer}            = '';
-    $self->{_header_encoding}   = 0;
-    $self->{_footer_encoding}   = 0;
-    $self->{_hcenter}           = 0;
-    $self->{_vcenter}           = 0;
-    $self->{_margin_header}     = 0.50;
-    $self->{_margin_footer}     = 0.50;
-    $self->{_margin_left}       = 0.75;
-    $self->{_margin_right}      = 0.75;
-    $self->{_margin_top}        = 1.00;
-    $self->{_margin_bottom}     = 1.00;
-
-    $self->{_title_rowmin}      = undef;
-    $self->{_title_rowmax}      = undef;
-    $self->{_title_colmin}      = undef;
-    $self->{_title_colmax}      = undef;
-    $self->{_print_rowmin}      = undef;
-    $self->{_print_rowmax}      = undef;
-    $self->{_print_colmin}      = undef;
-    $self->{_print_colmax}      = undef;
-
-    $self->{_print_gridlines}   = 1;
-    $self->{_screen_gridlines}  = 1;
-    $self->{_print_headers}     = 0;
-
-    $self->{_page_order}        = 0;
-    $self->{_black_white}       = 0;
-    $self->{_draft_quality}     = 0;
-    $self->{_print_comments}    = 0;
-    $self->{_page_start}        = 1;
-
-    $self->{_fit_page}          = 0;
-    $self->{_fit_width}         = 0;
-    $self->{_fit_height}        = 0;
-
-    $self->{_hbreaks}           = [];
-    $self->{_vbreaks}           = [];
-
-    $self->{_protect}           = 0;
-    $self->{_password}          = undef;
-
-    $self->{_col_sizes}         = {};
-    $self->{_row_sizes}         = {};
-
-    $self->{_col_formats}       = {};
-    $self->{_row_formats}       = {};
-
-    $self->{_zoom}              = 100;
-    $self->{_print_scale}       = 100;
-
-    $self->{_leading_zeros}     = 0;
-
-    $self->{_outline_row_level} = 0;
-    $self->{_outline_style}     = 0;
-    $self->{_outline_below}     = 1;
-    $self->{_outline_right}     = 1;
-    $self->{_outline_on}        = 1;
-
-    $self->{_write_match}       = [];
-
-
-    bless $self, $class;
-    $self->_initialize();
-    return $self;
-}
-
-
-###############################################################################
-#
-# _initialize()
-#
-# Open a tmp file to store the majority of the Worksheet data. If this fails,
-# for example due to write permissions, store the data in memory. This can be
-# slow for large files.
-#
-sub _initialize {
-
-    my $self = shift;
-    my $fh;
-    my $tmp_dir;
-
-    # The following code is complicated by Windows limitations. Porters can
-    # choose a more direct method.
-
-
-
-    # In the default case we use IO::File->new_tmpfile(). This may fail, in
-    # particular with IIS on Windows, so we allow the user to specify a temp
-    # directory via File::Temp.
-    #
-    if (defined $self->{_tempdir}) {
-
-        # Delay loading File:Temp to reduce the module dependencies.
-        eval { require File::Temp };
-        die "The File::Temp module must be installed in order ".
-            "to call set_tempdir().\n" if $@;
-
-
-        # Trap but ignore File::Temp errors.
-        eval { $fh = File::Temp::tempfile(DIR => $self->{_tempdir}) };
-
-        # Store the failed tmp dir in case of errors.
-        $tmp_dir = $self->{_tempdir} || File::Spec->tmpdir if not $fh;
-    }
-    else {
-
-        $fh = IO::File->new_tmpfile();
-
-        # Store the failed tmp dir in case of errors.
-        $tmp_dir = "POSIX::tmpnam() directory" if not $fh;
-    }
-
-
-    # Check if the temp file creation was successful. Else store data in memory.
-    if ($fh) {
-
-        # binmode file whether platform requires it or not.
-        binmode($fh);
-
-        # Store filehandle
-        $self->{_filehandle} = $fh;
-    }
-    else {
-
-        # Set flag to store data in memory if XX::tempfile() failed.
-        $self->{_using_tmpfile} = 0;
-
-        if ($self->{_index} == 0 && $^W) {
-            my $dir = $self->{_tempdir} || File::Spec->tmpdir();
-
-            warn "Unable to create temp files in $tmp_dir. Data will be ".
-                 "stored in memory. Refer to set_tempdir() in the ".
-                 "Spreadsheet::WriteExcel documentation.\n" ;
-        }
-    }
-}
-
-
-###############################################################################
-#
-# _close()
-#
-# Add data to the beginning of the workbook (note the reverse order)
-# and to the end of the workbook.
-#
-sub _close {
-
-    my $self = shift;
-    my $sheetnames = shift;
-    my $num_sheets = scalar @$sheetnames;
-
-    ################################################
-    # Prepend in reverse order!!
-    #
-
-    # Prepend the sheet dimensions
-    $self->_store_dimensions();
-
-    # Prepend the COLINFO records if they exist
-    if (@{$self->{_colinfo}}){
-        my @colinfo = @{$self->{_colinfo}};
-        while (@colinfo) {
-            my $arrayref = pop @colinfo;
-            $self->_store_colinfo(@$arrayref);
-        }
-
-        # Add the DEFCOLWIDTH record
-        $self->_store_defcol();
-    }
-
-    # Prepend the sheet password
-    $self->_store_password();
-
-    # Prepend the sheet protection
-    $self->_store_protect();
-
-    # Prepend the page setup
-    $self->_store_setup();
-
-    # Prepend the bottom margin
-    $self->_store_margin_bottom();
-
-    # Prepend the top margin
-    $self->_store_margin_top();
-
-    # Prepend the right margin
-    $self->_store_margin_right();
-
-    # Prepend the left margin
-    $self->_store_margin_left();
-
-    # Prepend the page vertical centering
-    $self->_store_vcenter();
-
-    # Prepend the page horizontal centering
-    $self->_store_hcenter();
-
-    # Prepend the page footer
-    $self->_store_footer();
-
-    # Prepend the page header
-    $self->_store_header();
-
-    # Prepend the vertical page breaks
-    $self->_store_vbreak();
-
-    # Prepend the horizontal page breaks
-    $self->_store_hbreak();
-
-    # Prepend WSBOOL
-    $self->_store_wsbool();
-
-    # Prepend GUTS
-    $self->_store_guts();
-
-    # Prepend GRIDSET
-    $self->_store_gridset();
-
-    # Prepend PRINTGRIDLINES
-    $self->_store_print_gridlines();
-
-    # Prepend PRINTHEADERS
-    $self->_store_print_headers();
-
-    # Prepend the BOF record
-    $self->_store_bof(0x0010);
-
-    #
-    # End of prepend. Read upwards from here.
-    ################################################
-
-    # Append
-    #$self->_dev_note(); # TODO
-    $self->_store_window2();
-    $self->_store_zoom();
-    $self->_store_panes(@{$self->{_panes}}) if @{$self->{_panes}};
-    $self->_store_selection(@{$self->{_selection}});
-    $self->_store_eof();
-}
-
-
-###############################################################################
-#
-# get_name().
-#
-# Retrieve the worksheet name.
-#
-sub get_name {
-
-    my $self    = shift;
-
-    return $self->{_name};
-}
-
-
-###############################################################################
-#
-# get_data().
-#
-# Retrieves data from memory in one chunk, or from disk in $buffer
-# sized chunks.
-#
-sub get_data {
-
-    my $self   = shift;
-    my $buffer = 4096;
-    my $tmp;
-
-    # Return data stored in memory
-    if (defined $self->{_data}) {
-        $tmp           = $self->{_data};
-        $self->{_data} = undef;
-        my $fh         = $self->{_filehandle};
-        seek($fh, 0, 0) if $self->{_using_tmpfile};
-        return $tmp;
-    }
-
-    # Return data stored on disk
-    if ($self->{_using_tmpfile}) {
-        return $tmp if read($self->{_filehandle}, $tmp, $buffer);
-    }
-
-    # No data to return
-    return undef;
-}
-
-
-###############################################################################
-#
-# select()
-#
-# Set this worksheet as a selected worksheet, i.e. the worksheet has its tab
-# highlighted.
-#
-sub select {
-
-    my $self = shift;
-
-    $self->{_hidden}         = 0; # Selected worksheet can't be hidden.
-    $self->{_selected}       = 1;
-}
-
-
-###############################################################################
-#
-# activate()
-#
-# Set this worksheet as the active worksheet, i.e. the worksheet that is
-# displayed when the workbook is opened. Also set it as selected.
-#
-sub activate {
-
-    my $self = shift;
-
-    $self->{_hidden}         = 0; # Active worksheet can't be hidden.
-    $self->{_selected}       = 1;
-    ${$self->{_activesheet}} = $self->{_index};
-}
-
-
-###############################################################################
-#
-# hide()
-#
-# Hide this worksheet.
-#
-sub hide {
-
-    my $self = shift;
-
-    $self->{_hidden}         = 1;
-
-    # A hidden worksheet shouldn't be active or selected.
-    $self->{_selected}       = 0;
-    ${$self->{_activesheet}} = 0;
-    ${$self->{_firstsheet}}  = 0;
-}
-
-
-###############################################################################
-#
-# set_first_sheet()
-#
-# Set this worksheet as the first visible sheet. This is necessary
-# when there are a large number of worksheets and the activated
-# worksheet is not visible on the screen.
-#
-sub set_first_sheet {
-
-    my $self = shift;
-
-    $self->{_hidden}         = 0; # Active worksheet can't be hidden.
-    ${$self->{_firstsheet}}  = $self->{_index};
-}
-
-
-###############################################################################
-#
-# protect($password)
-#
-# Set the worksheet protection flag to prevent accidental modification and to
-# hide formulas if the locked and hidden format properties have been set.
-#
-sub protect {
-
-    my $self = shift;
-
-    $self->{_protect}   = 1;
-    $self->{_password}  = $self->_encode_password($_[0]) if defined $_[0];
-
-}
-
-
-###############################################################################
-#
-# set_column($firstcol, $lastcol, $width, $format, $hidden, $level)
-#
-# Set the width of a single column or a range of columns.
-# See also: _store_colinfo
-#
-sub set_column {
-
-    my $self = shift;
-    my $cell = $_[0];
-
-    # Check for a cell reference in A1 notation and substitute row and column
-    if ($cell =~ /^\D/) {
-        @_ = $self->_substitute_cellref(@_);
-
-        # Returned values $row1 and $row2 aren't required here. Remove them.
-        shift  @_;       # $row1
-        splice @_, 1, 1; # $row2
-    }
-
-    push @{$self->{_colinfo}}, [ @_ ];
-
-
-    # Store the col sizes for use when calculating image vertices taking
-    # hidden columns into account. Also store the column formats.
-    #
-    return if @_ < 3; # Ensure at least $firstcol, $lastcol and $width
-
-    my $width  = $_[4] ? 0 : $_[2]; # Set width to zero if column is hidden
-    my $format = $_[3];
-
-    my ($firstcol, $lastcol) = @_;
-
-    foreach my $col ($firstcol .. $lastcol) {
-        $self->{_col_sizes}->{$col}   = $width;
-        $self->{_col_formats}->{$col} = $format if defined $format;
-    }
-}
-
-
-###############################################################################
-#
-# set_selection()
-#
-# Set which cell or cells are selected in a worksheet: see also the
-# sub _store_selection
-#
-sub set_selection {
-
-    my $self = shift;
-
-    # Check for a cell reference in A1 notation and substitute row and column
-    if ($_[0] =~ /^\D/) {
-        @_ = $self->_substitute_cellref(@_);
-    }
-
-    $self->{_selection} = [ @_ ];
-}
-
-
-###############################################################################
-#
-# freeze_panes()
-#
-# Set panes and mark them as frozen. See also _store_panes().
-#
-sub freeze_panes {
-
-    my $self = shift;
-
-    # Check for a cell reference in A1 notation and substitute row and column
-    if ($_[0] =~ /^\D/) {
-        @_ = $self->_substitute_cellref(@_);
-    }
-
-    $self->{_frozen} = 1;
-    $self->{_panes}  = [ @_ ];
-}
-
-
-###############################################################################
-#
-# thaw_panes()
-#
-# Set panes and mark them as unfrozen. See also _store_panes().
-#
-sub thaw_panes {
-
-    my $self = shift;
-
-    $self->{_frozen} = 0;
-    $self->{_panes}  = [ @_ ];
-}
-
-
-###############################################################################
-#
-# set_portrait()
-#
-# Set the page orientation as portrait.
-#
-sub set_portrait {
-
-    my $self = shift;
-
-    $self->{_orientation} = 1;
-}
-
-
-###############################################################################
-#
-# set_landscape()
-#
-# Set the page orientation as landscape.
-#
-sub set_landscape {
-
-    my $self = shift;
-
-    $self->{_orientation} = 0;
-}
-
-
-###############################################################################
-#
-# set_paper()
-#
-# Set the paper type. Ex. 1 = US Letter, 9 = A4
-#
-sub set_paper {
-
-    my $self = shift;
-
-    $self->{_paper_size} = $_[0] || 0;
-}
-
-
-###############################################################################
-#
-# set_header()
-#
-# Set the page header caption and optional margin.
-#
-sub set_header {
-
-    my $self     = shift;
-    my $string   = $_[0] || '';
-    my $margin   = $_[1] || 0.50;
-    my $encoding = $_[2] || 0;
-
-    # Handle utf8 strings in newer perls.
-    if ($] >= 5.008) {
-        require Encode;
-
-        if (Encode::is_utf8($string)) {
-            $string = Encode::encode("UTF-16BE", $string);
-            $encoding = 1;
-        }
-    }
-
-    my $limit    = $encoding ? 255 *2 : 255;
-
-    if (length $string >= $limit) {
-        carp 'Header string must be less than 255 characters';
-        return;
-    }
-
-    $self->{_header}          = $string;
-    $self->{_margin_header}   = $margin;
-    $self->{_header_encoding} = $encoding;
-}
-
-
-###############################################################################
-#
-# set_footer()
-#
-# Set the page footer caption and optional margin.
-#
-sub set_footer {
-
-    my $self     = shift;
-    my $string   = $_[0] || '';
-    my $margin   = $_[1] || 0.50;
-    my $encoding = $_[2] || 0;
-
-    # Handle utf8 strings in newer perls.
-    if ($] >= 5.008) {
-        require Encode;
-
-        if (Encode::is_utf8($string)) {
-            $string = Encode::encode("UTF-16BE", $string);
-            $encoding = 1;
-        }
-    }
-
-    my $limit    = $encoding ? 255 *2 : 255;
-
-
-    if (length $string >= $limit) {
-        carp 'Footer string must be less than 255 characters';
-        return;
-    }
-
-    $self->{_footer}          = $string;
-    $self->{_margin_footer}   = $margin;
-    $self->{_footer_encoding} = $encoding;
-}
-
-
-###############################################################################
-#
-# center_horizontally()
-#
-# Center the page horizontally.
-#
-sub center_horizontally {
-
-    my $self = shift;
-
-    if (defined $_[0]) {
-        $self->{_hcenter} = $_[0];
-    }
-    else {
-        $self->{_hcenter} = 1;
-    }
-}
-
-
-###############################################################################
-#
-# center_vertically()
-#
-# Center the page horinzontally.
-#
-sub center_vertically {
-
-    my $self = shift;
-
-    if (defined $_[0]) {
-        $self->{_vcenter} = $_[0];
-    }
-    else {
-        $self->{_vcenter} = 1;
-    }
-}
-
-
-###############################################################################
-#
-# set_margins()
-#
-# Set all the page margins to the same value in inches.
-#
-sub set_margins {
-
-    my $self = shift;
-
-    $self->set_margin_left($_[0]);
-    $self->set_margin_right($_[0]);
-    $self->set_margin_top($_[0]);
-    $self->set_margin_bottom($_[0]);
-}
-
-
-###############################################################################
-#
-# set_margins_LR()
-#
-# Set the left and right margins to the same value in inches.
-#
-sub set_margins_LR {
-
-    my $self = shift;
-
-    $self->set_margin_left($_[0]);
-    $self->set_margin_right($_[0]);
-}
-
-
-###############################################################################
-#
-# set_margins_TB()
-#
-# Set the top and bottom margins to the same value in inches.
-#
-sub set_margins_TB {
-
-    my $self = shift;
-
-    $self->set_margin_top($_[0]);
-    $self->set_margin_bottom($_[0]);
-}
-
-
-###############################################################################
-#
-# set_margin_left()
-#
-# Set the left margin in inches.
-#
-sub set_margin_left {
-
-    my $self = shift;
-
-    $self->{_margin_left} = defined $_[0] ? $_[0] : 0.75;
-}
-
-
-###############################################################################
-#
-# set_margin_right()
-#
-# Set the right margin in inches.
-#
-sub set_margin_right {
-
-    my $self = shift;
-
-    $self->{_margin_right} = defined $_[0] ? $_[0] : 0.75;
-}
-
-
-###############################################################################
-#
-# set_margin_top()
-#
-# Set the top margin in inches.
-#
-sub set_margin_top {
-
-    my $self = shift;
-
-    $self->{_margin_top} = defined $_[0] ? $_[0] : 1.00;
-}
-
-
-###############################################################################
-#
-# set_margin_bottom()
-#
-# Set the bottom margin in inches.
-#
-sub set_margin_bottom {
-
-    my $self = shift;
-
-    $self->{_margin_bottom} = defined $_[0] ? $_[0] : 1.00;
-}
-
-
-###############################################################################
-#
-# repeat_rows($first_row, $last_row)
-#
-# Set the rows to repeat at the top of each printed page. See also the
-# _store_name_xxxx() methods in Workbook.pm.
-#
-sub repeat_rows {
-
-    my $self = shift;
-
-    $self->{_title_rowmin}  = $_[0];
-    $self->{_title_rowmax}  = $_[1] || $_[0]; # Second row is optional
-}
-
-
-###############################################################################
-#
-# repeat_columns($first_col, $last_col)
-#
-# Set the columns to repeat at the left hand side of each printed page.
-# See also the _store_names() methods in Workbook.pm.
-#
-sub repeat_columns {
-
-    my $self = shift;
-
-    # Check for a cell reference in A1 notation and substitute row and column
-    if ($_[0] =~ /^\D/) {
-        @_ = $self->_substitute_cellref(@_);
-
-        # Returned values $row1 and $row2 aren't required here. Remove them.
-        shift  @_;       # $row1
-        splice @_, 1, 1; # $row2
-    }
-
-    $self->{_title_colmin}  = $_[0];
-    $self->{_title_colmax}  = $_[1] || $_[0]; # Second col is optional
-}
-
-
-###############################################################################
-#
-# print_area($first_row, $first_col, $last_row, $last_col)
-#
-# Set the area of each worksheet that will be printed. See also the
-# _store_names() methods in Workbook.pm.
-#
-sub print_area {
-
-    my $self = shift;
-
-    # Check for a cell reference in A1 notation and substitute row and column
-    if ($_[0] =~ /^\D/) {
-        @_ = $self->_substitute_cellref(@_);
-    }
-
-    return if @_ != 4; # Require 4 parameters
-
-    $self->{_print_rowmin} = $_[0];
-    $self->{_print_colmin} = $_[1];
-    $self->{_print_rowmax} = $_[2];
-    $self->{_print_colmax} = $_[3];
-}
-
-
-###############################################################################
-#
-# hide_gridlines()
-#
-# Set the option to hide gridlines on the screen and the printed page.
-# There are two ways of doing this in the Excel BIFF format: The first is by
-# setting the DspGrid field of the WINDOW2 record, this turns off the screen
-# and subsequently the print gridline. The second method is to via the
-# PRINTGRIDLINES and GRIDSET records, this turns off the printed gridlines
-# only. The first method is probably sufficient for most cases. The second
-# method is supported for backwards compatibility. Porters take note.
-#
-sub hide_gridlines {
-
-    my $self   = shift;
-    my $option = $_[0];
-
-    $option = 1 unless defined $option; # Default to hiding printed gridlines
-
-    if ($option == 0) {
-        $self->{_print_gridlines}  = 1; # 1 = display, 0 = hide
-        $self->{_screen_gridlines} = 1;
-    }
-    elsif ($option == 1) {
-        $self->{_print_gridlines}  = 0;
-        $self->{_screen_gridlines} = 1;
-    }
-    else {
-        $self->{_print_gridlines}  = 0;
-        $self->{_screen_gridlines} = 0;
-    }
-}
-
-
-###############################################################################
-#
-# print_row_col_headers()
-#
-# Set the option to print the row and column headers on the printed page.
-# See also the _store_print_headers() method below.
-#
-sub print_row_col_headers {
-
-    my $self = shift;
-
-    if (defined $_[0]) {
-        $self->{_print_headers} = $_[0];
-    }
-    else {
-        $self->{_print_headers} = 1;
-    }
-}
-
-
-###############################################################################
-#
-# fit_to_pages($width, $height)
-#
-# Store the vertical and horizontal number of pages that will define the
-# maximum area printed. See also _store_setup() and _store_wsbool() below.
-#
-sub fit_to_pages {
-
-    my $self = shift;
-
-    $self->{_fit_page}      = 1;
-    $self->{_fit_width}     = $_[0] || 0;
-    $self->{_fit_height}    = $_[1] || 0;
-}
-
-
-###############################################################################
-#
-# set_h_pagebreaks(@breaks)
-#
-# Store the horizontal page breaks on a worksheet.
-#
-sub set_h_pagebreaks {
-
-    my $self = shift;
-
-    push @{$self->{_hbreaks}}, @_;
-}
-
-
-###############################################################################
-#
-# set_v_pagebreaks(@breaks)
-#
-# Store the vertical page breaks on a worksheet.
-#
-sub set_v_pagebreaks {
-
-    my $self = shift;
-
-    push @{$self->{_vbreaks}}, @_;
-}
-
-
-###############################################################################
-#
-# set_zoom($scale)
-#
-# Set the worksheet zoom factor.
-#
-sub set_zoom {
-
-    my $self  = shift;
-    my $scale = $_[0] || 100;
-
-    # Confine the scale to Excel's range
-    if ($scale < 10 or $scale > 400) {
-        carp "Zoom factor $scale outside range: 10 <= zoom <= 400";
-        $scale = 100;
-    }
-
-    $self->{_zoom} = int $scale;
-}
-
-
-###############################################################################
-#
-# set_print_scale($scale)
-#
-# Set the scale factor for the printed page.
-#
-sub set_print_scale {
-
-    my $self  = shift;
-    my $scale = $_[0] || 100;
-
-    # Confine the scale to Excel's range
-    if ($scale < 10 or $scale > 400) {
-        carp "Print scale $scale outside range: 10 <= zoom <= 400";
-        $scale = 100;
-    }
-
-    # Turn off "fit to page" option
-    $self->{_fit_page}    = 0;
-
-    $self->{_print_scale} = int $scale;
-}
-
-
-###############################################################################
-#
-# keep_leading_zeros()
-#
-# Causes the write() method to treat integers with a leading zero as a string.
-# This ensures that any leading zeros such, as in zip codes, are maintained.
-#
-sub keep_leading_zeros {
-
-    my $self = shift;
-
-    if (defined $_[0]) {
-        $self->{_leading_zeros} = $_[0];
-    }
-    else {
-        $self->{_leading_zeros} = 1;
-    }
-}
-
-
-###############################################################################
-#
-# add_write_handler($re, $code_ref)
-#
-# Allow the user to add their own matches and handlers to the write() method.
-#
-sub add_write_handler {
-
-    my $self = shift;
-
-    return unless @_ == 2;
-    return unless ref $_[1] eq 'CODE';
-
-    push @{$self->{_write_match}}, [ @_ ];
-}
-
-
-
-###############################################################################
-#
-# write($row, $col, $token, $format)
-#
-# Parse $token and call appropriate write method. $row and $column are zero
-# indexed. $format is optional.
-#
-# Returns: return value of called subroutine
-#
-sub write {
-
-    my $self = shift;
-
-    # Check for a cell reference in A1 notation and substitute row and column
-    if ($_[0] =~ /^\D/) {
-        @_ = $self->_substitute_cellref(@_);
-    }
-
-    my $token = $_[2];
-
-    # Handle undefs as blanks
-    $token = '' unless defined $token;
-
-
-    # First try user defined matches.
-    for my $aref (@{$self->{_write_match}}) {
-        my $re  = $aref->[0];
-        my $sub = $aref->[1];
-
-        if ($token =~ /$re/) {
-            my $match = &$sub($self, @_);
-            return $match if defined $match;
-        }
-    }
-
-
-    # Match an array ref.
-    if (ref $token eq "ARRAY") {
-        return $self->write_row(@_);
-    }
-    # Match integer with leading zero(s)
-    elsif ($self->{_leading_zeros} and $token =~ /^0\d+$/) {
-        return $self->write_string(@_);
-    }
-    # Match number
-    elsif ($token =~ /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/) {
-        return $self->write_number(@_);
-    }
-    # Match http, https or ftp URL
-    elsif ($token =~ m|^[fh]tt?ps?://|) {
-        return $self->write_url(@_);
-    }
-    # Match mailto:
-    elsif ($token =~ m/^mailto:/) {
-        return $self->write_url(@_);
-    }
-    # Match internal or external sheet link
-    elsif ($token =~ m[^(?:in|ex)ternal:]) {
-        return $self->write_url(@_);
-    }
-    # Match formula
-    elsif ($token =~ /^=/) {
-        return $self->write_formula(@_);
-    }
-    # Match blank
-    elsif ($token eq '') {
-        splice @_, 2, 1; # remove the empty string from the parameter list
-        return $self->write_blank(@_);
-    }
-    else {
-        return $self->write_string(@_);
-    }
-}
-
-
-###############################################################################
-#
-# write_row($row, $col, $array_ref, $format)
-#
-# Write a row of data starting from ($row, $col). Call write_col() if any of
-# the elements of the array ref are in turn array refs. This allows the writing
-# of 1D or 2D arrays of data in one go.
-#
-# Returns: the first encountered error value or zero for no errors
-#
-sub write_row {
-
-    my $self = shift;
-
-
-    # Check for a cell reference in A1 notation and substitute row and column
-    if ($_[0] =~ /^\D/) {
-        @_ = $self->_substitute_cellref(@_);
-    }
-
-    # Catch non array refs passed by user.
-    if (ref $_[2] ne 'ARRAY') {
-        croak "Not an array ref in call to write_row()$!";
-    }
-
-    my $row     = shift;
-    my $col     = shift;
-    my $tokens  = shift;
-    my @options = @_;
-    my $error   = 0;
-    my $ret;
-
-    foreach my $token (@$tokens) {
-
-        # Check for nested arrays
-        if (ref $token eq "ARRAY") {
-            $ret = $self->write_col($row, $col, $token, @options);
-        } else {
-            $ret = $self->write    ($row, $col, $token, @options);
-        }
-
-        # Return only the first error encountered, if any.
-        $error ||= $ret;
-        $col++;
-    }
-
-    return $error;
-}
-
-
-###############################################################################
-#
-# write_col($row, $col, $array_ref, $format)
-#
-# Write a column of data starting from ($row, $col). Call write_row() if any of
-# the elements of the array ref are in turn array refs. This allows the writing
-# of 1D or 2D arrays of data in one go.
-#
-# Returns: the first encountered error value or zero for no errors
-#
-sub write_col {
-
-    my $self = shift;
-
-
-    # Check for a cell reference in A1 notation and substitute row and column
-    if ($_[0] =~ /^\D/) {
-        @_ = $self->_substitute_cellref(@_);
-    }
-
-    # Catch non array refs passed by user.
-    if (ref $_[2] ne 'ARRAY') {
-        croak "Not an array ref in call to write_row()$!";
-    }
-
-    my $row     = shift;
-    my $col     = shift;
-    my $tokens  = shift;
-    my @options = @_;
-    my $error   = 0;
-    my $ret;
-
-    foreach my $token (@$tokens) {
-
-        # write() will deal with any nested arrays
-        $ret = $self->write($row, $col, $token, @options);
-
-        # Return only the first error encountered, if any.
-        $error ||= $ret;
-        $row++;
-    }
-
-    return $error;
-}
-
-
-###############################################################################
-#
-# write_comment($row, $col, $comment)
-#
-# Write a comment to the specified row and column (zero indexed). The maximum
-# comment size is 30831 chars. Excel5 probably accepts 32k-1 chars. However, it
-# can only display 30831 chars. Excel 7 and 2000 will crash above 32k-1.
-#
-# In Excel 5 a comment is referred to as a NOTE.
-#
-# Returns  0 : normal termination
-#         -1 : insufficient number of arguments
-#         -2 : row or column out of range
-#         -3 : long comment truncated to 30831 chars
-#
-sub write_comment {
-
-    # Not available in this release
-    return -4;
-
-}
-
-
-###############################################################################
-#
-# _XF()
-#
-# Returns an index to the XF record in the workbook.
-#
-# Note: this is a function, not a method.
-#
-sub _XF {
-
-    my $self   = $_[0];
-    my $row    = $_[1];
-    my $col    = $_[2];
-    my $format = $_[3];
-
-    my $error = "Error: refer to merge_range() in the documentation. " .
-                 "Can't use previously merged format in non-merged cell";
-
-    if (ref($format)) {
-        # Temp code to prevent merged formats in non-merged cells.
-        croak $error if $format->{_used_merge} == 1;
-        $format->{_used_merge} = -1;
-
-        return $format->get_xf_index();
-    }
-    elsif (exists $self->{_row_formats}->{$row}) {
-        # Temp code to prevent merged formats in non-merged cells.
-        croak $error if $self->{_row_formats}->{$row}->{_used_merge} == 1;
-        $self->{_row_formats}->{$row}->{_used_merge} = -1;
-
-        return $self->{_row_formats}->{$row}->get_xf_index();
-    }
-    elsif (exists $self->{_col_formats}->{$col}) {
-        # Temp code to prevent merged formats in non-merged cells.
-        croak $error if $self->{_col_formats}->{$col}->{_used_merge} == 1;
-        $self->{_col_formats}->{$col}->{_used_merge} = -1;
-
-        return $self->{_col_formats}->{$col}->get_xf_index();
-    }
-    else {
-        return 0x0F;
-    }
-}
-
-
-###############################################################################
-###############################################################################
-#
-# Internal methods
-#
-
-
-###############################################################################
-#
-# _append(), overloaded.
-#
-# Store Worksheet data in memory using the base class _append() or to a
-# temporary file, the default.
-#
-sub _append {
-
-    my $self = shift;
-
-    if ($self->{_using_tmpfile}) {
-        my $data = join('', @_);
-
-        # Add CONTINUE records if necessary
-        $data = $self->_add_continue($data) if length($data) > $self->{_limit};
-
-        # Protect print() from -l on the command line.
-        local $\ = undef;
-
-        print {$self->{_filehandle}} $data;
-        $self->{_datasize} += length($data);
-    }
-    else {
-        $self->SUPER::_append(@_);
-    }
-}
-
-
-###############################################################################
-#
-# _substitute_cellref()
-#
-# Substitute an Excel cell reference in A1 notation for  zero based row and
-# column values in an argument list.
-#
-# Ex: ("A4", "Hello") is converted to (3, 0, "Hello").
-#
-sub _substitute_cellref {
-
-    my $self = shift;
-    my $cell = uc(shift);
-
-    # Convert a column range: 'A:A' or 'B:G'.
-    # A range such as A:A is equivalent to A1:65536, so add rows as required
-    if ($cell =~ /\$?([A-I]?[A-Z]):\$?([A-I]?[A-Z])/) {
-        my ($row1, $col1) =  $self->_cell_to_rowcol($1 .'1');
-        my ($row2, $col2) =  $self->_cell_to_rowcol($2 .'65536');
-        return $row1, $col1, $row2, $col2, @_;
-    }
-
-    # Convert a cell range: 'A1:B7'
-    if ($cell =~ /\$?([A-I]?[A-Z]\$?\d+):\$?([A-I]?[A-Z]\$?\d+)/) {
-        my ($row1, $col1) =  $self->_cell_to_rowcol($1);
-        my ($row2, $col2) =  $self->_cell_to_rowcol($2);
-        return $row1, $col1, $row2, $col2, @_;
-    }
-
-    # Convert a cell reference: 'A1' or 'AD2000'
-    if ($cell =~ /\$?([A-I]?[A-Z]\$?\d+)/) {
-        my ($row1, $col1) =  $self->_cell_to_rowcol($1);
-        return $row1, $col1, @_;
-
-    }
-
-    croak("Unknown cell reference $cell");
-}
-
-
-###############################################################################
-#
-# _cell_to_rowcol($cell_ref)
-#
-# Convert an Excel cell reference in A1 notation to a zero based row and column
-# reference; converts C1 to (0, 2).
-#
-# Returns: row, column
-#
-sub _cell_to_rowcol {
-
-    my $self = shift;
-    my $cell = shift;
-
-    $cell =~ /\$?([A-I]?[A-Z])\$?(\d+)/;
-
-    my $col     = $1;
-    my $row     = $2;
-
-    # Convert base26 column string to number
-    # All your Base are belong to us.
-    my @chars = split //, $col;
-    my $expn  = 0;
-    $col      = 0;
-
-    while (@chars) {
-        my $char = pop(@chars); # LS char first
-        $col += (ord($char) -ord('A') +1) * (26**$expn);
-        $expn++;
-    }
-
-    # Convert 1-index to zero-index
-    $row--;
-    $col--;
-
-    return $row, $col;
-}
-
-
-###############################################################################
-#
-# _sort_pagebreaks()
-#
-#
-# This is an internal method that is used to filter elements of the array of
-# pagebreaks used in the _store_hbreak() and _store_vbreak() methods. It:
-#   1. Removes duplicate entries from the list.
-#   2. Sorts the list.
-#   3. Removes 0 from the list if present.
-#
-sub _sort_pagebreaks {
-
-    my $self= shift;
-
-    my %hash;
-    my @array;
-
-    @hash{@_} = undef;                       # Hash slice to remove duplicates
-    @array    = sort {$a <=> $b} keys %hash; # Numerical sort
-    shift @array if $array[0] == 0;          # Remove zero
-
-    # 1000 vertical pagebreaks appears to be an internal Excel 5 limit.
-    # It is slightly higher in Excel 97/200, approx. 1026
-    splice(@array, 1000) if (@array > 1000);
-
-    return @array
-}
-
-
-###############################################################################
-#
-# _encode_password($password)
-#
-# Based on the algorithm provided by Daniel Rentz of OpenOffice.
-#
-#
-sub _encode_password {
-
-    use integer;
-
-    my $self      = shift;
-    my $plaintext = $_[0];
-    my $password;
-    my $count;
-    my @chars;
-    my $i = 0;
-
-    $count = @chars = split //, $plaintext;
-
-    foreach my $char (@chars) {
-        my $low_15;
-        my $high_15;
-        $char     = ord($char) << ++$i;
-        $low_15   = $char & 0x7fff;
-        $high_15  = $char & 0x7fff << 15;
-        $high_15  = $high_15 >> 15;
-        $char     = $low_15 | $high_15;
-    }
-
-    $password  = 0x0000;
-    $password ^= $_ for @chars;
-    $password ^= $count;
-    $password ^= 0xCE4B;
-
-    return $password;
-}
-
-
-###############################################################################
-#
-# outline_settings($visible, $symbols_below, $symbols_right, $auto_style)
-#
-# This method sets the properties for outlining and grouping. The defaults
-# correspond to Excel's defaults.
-#
-sub outline_settings {
-
-    my $self                = shift;
-
-    $self->{_outline_on}    = defined $_[0] ? $_[0] : 1;
-    $self->{_outline_below} = defined $_[1] ? $_[1] : 1;
-    $self->{_outline_right} = defined $_[2] ? $_[2] : 1;
-    $self->{_outline_style} =         $_[3] || 0;
-
-    # Ensure this is a boolean vale for Window2
-    $self->{_outline_on}    = 1 if $self->{_outline_on};
-}
-
-
-
-
-###############################################################################
-###############################################################################
-#
-# BIFF RECORDS
-#
-
-
-###############################################################################
-#
-# write_number($row, $col, $num, $format)
-#
-# Write a double to the specified row and column (zero indexed).
-# An integer can be written as a double. Excel will display an
-# integer. $format is optional.
-#
-# Returns  0 : normal termination
-#         -1 : insufficient number of arguments
-#         -2 : row or column out of range
-#
-sub write_number {
-
-    my $self = shift;
-
-    # Check for a cell reference in A1 notation and substitute row and column
-    if ($_[0] =~ /^\D/) {
-        @_ = $self->_substitute_cellref(@_);
-    }
-
-    if (@_ < 3) { return -1 }                    # Check the number of args
-
-    my $record  = 0x0203;                        # Record identifier
-    my $length  = 0x000E;                        # Number of bytes to follow
-
-    my $row     = $_[0];                         # Zero indexed row
-    my $col     = $_[1];                         # Zero indexed column
-    my $num     = $_[2];
-    my $xf      = _XF($self, $row, $col, $_[3]); # The cell format
-
-    # Check that row and col are valid and store max and min values
-    return -2 if $self->_check_dimensions($row, $col);
-
-    my $header    = pack("vv",  $record, $length);
-    my $data      = pack("vvv", $row, $col, $xf);
-    my $xl_double = pack("d",   $num);
-
-    if ($self->{_byte_order}) { $xl_double = reverse $xl_double }
-
-    $self->_append($header, $data, $xl_double);
-
-    return 0;
-}
-
-
-###############################################################################
-#
-# write_string ($row, $col, $string, $format)
-#
-# Write a string to the specified row and column (zero indexed).
-# NOTE: there is an Excel 5 defined limit of 255 characters.
-# $format is optional.
-# Returns  0 : normal termination
-#         -1 : insufficient number of arguments
-#         -2 : row or column out of range
-#         -3 : long string truncated to 255 chars
-#
-sub write_string {
-
-    my $self = shift;
-
-    # Check for a cell reference in A1 notation and substitute row and column
-    if ($_[0] =~ /^\D/) {
-        @_ = $self->_substitute_cellref(@_);
-    }
-
-    if (@_ < 3) { return -1 }                        # Check the number of args
-
-    my $record      = 0x00FD;                        # Record identifier
-    my $length      = 0x000A;                        # Bytes to follow
-
-    my $row         = $_[0];                         # Zero indexed row
-    my $col         = $_[1];                         # Zero indexed column
-    my $strlen      = length($_[2]);
-    my $str         = $_[2];
-    my $xf          = _XF($self, $row, $col, $_[3]); # The cell format
-    my $encoding    = 0x0;
-    my $str_error   = 0;
-
-
-    # Handle utf8 strings in newer perls.
-    if ($] >= 5.008) {
-        require Encode;
-
-        if (Encode::is_utf8($str)) {
-            my $tmp = Encode::encode("UTF-16LE", $str);
-            return $self->write_unicode_le($row, $col, $tmp, $_[3]);
-        }
-    }
-
-
-    # Check that row and col are valid and store max and min values
-    return -2 if $self->_check_dimensions($row, $col);
-
-    # TODO Should be 32k chars not bytes. Check.
-    if ($strlen > 32767) {
-        $str       = substr($str, 0, 32767);
-        $str_error = -3;
-    }
-
-
-    # Preprend the string with the type.
-    my $str_header  = pack("vC", length($str), $encoding);
-    $str            = $str_header . $str;
-
-
-    if (not exists ${$self->{_str_table}}->{$str}) {
-        ${$self->{_str_table}}->{$str} = ${$self->{_str_unique}}++;
-    }
-
-
-    ${$self->{_str_total}}++;
-
-
-    my $header = pack("vv",   $record, $length);
-    my $data   = pack("vvvV", $row, $col, $xf, ${$self->{_str_table}}->{$str});
-
-    $self->_append($header, $data);
-
-    return $str_error;
-}
-
-
-###############################################################################
-#
-# write_blank($row, $col, $format)
-#
-# Write a blank cell to the specified row and column (zero indexed).
-# A blank cell is used to specify formatting without adding a string
-# or a number.
-#
-# A blank cell without a format serves no purpose. Therefore, we don't write
-# a BLANK record unless a format is specified. This is mainly an optimisation
-# for the write_row() and write_col() methods.
-#
-# Returns  0 : normal termination (including no format)
-#         -1 : insufficient number of arguments
-#         -2 : row or column out of range
-#
-sub write_blank {
-
-    my $self = shift;
-
-    # Check for a cell reference in A1 notation and substitute row and column
-    if ($_[0] =~ /^\D/) {
-        @_ = $self->_substitute_cellref(@_);
-    }
-
-    # Check the number of args
-    return -1 if @_ < 2;
-
-    # Don't write a blank cell unless it has a format
-    return 0 if not defined $_[2];
-
-
-    my $record  = 0x0201;                        # Record identifier
-    my $length  = 0x0006;                        # Number of bytes to follow
-
-    my $row     = $_[0];                         # Zero indexed row
-    my $col     = $_[1];                         # Zero indexed column
-    my $xf      = _XF($self, $row, $col, $_[2]); # The cell format
-
-    # Check that row and col are valid and store max and min values
-    return -2 if $self->_check_dimensions($row, $col);
-
-    my $header    = pack("vv",  $record, $length);
-    my $data      = pack("vvv", $row, $col, $xf);
-
-    $self->_append($header, $data);
-
-    return 0;
-}
-
-
-###############################################################################
-#
-# write_formula($row, $col, $formula, $format, $value)
-#
-# Write a formula to the specified row and column (zero indexed).
-# The textual representation of the formula is passed to the parser in
-# Formula.pm which returns a packed binary string.
-#
-# $format is optional.
-#
-# $value is an optional result of the formula that can be supplied by the user.
-#
-# Returns  0 : normal termination
-#         -1 : insufficient number of arguments
-#         -2 : row or column out of range
-#
-sub write_formula{
-
-    my $self = shift;
-
-    # Check for a cell reference in A1 notation and substitute row and column
-    if ($_[0] =~ /^\D/) {
-        @_ = $self->_substitute_cellref(@_);
-    }
-
-    if (@_ < 3) { return -1 }   # Check the number of args
-
-    my $record    = 0x0006;     # Record identifier
-    my $length;                 # Bytes to follow
-
-    my $row       = $_[0];      # Zero indexed row
-    my $col       = $_[1];      # Zero indexed column
-    my $formula   = $_[2];      # The formula text string
-    my $value     = $_[4];      # The formula text string
-
-
-    # Excel normally stores the last calculated value of the formula in $num.
-    # Clearly we are not in a position to calculate this a priori. Instead
-    # we set $num to zero and set the option flags in $grbit to ensure
-    # automatic calculation of the formula when the file is opened.
-
-    # As a workaround for some non-Excel apps we also allow the user to
-    # specify the result of the formula.
-    #
-    my $xf        = _XF($self, $row, $col, $_[3]);  # The cell format
-    my $chn       = 0x0000;                         # Must be zero
-    my $is_string = 0;                              # Formula evaluates to str
-    my $num;                                        # Current value of formula
-    my $grbit;                                      # Option flags
-
-    ($num, $grbit, $is_string) = $self->_encode_formula_result($value);
-
-
-    # Check that row and col are valid and store max and min values
-    return -2 if $self->_check_dimensions($row, $col);
-
-    # Strip the = sign at the beginning of the formula string
-    $formula    =~ s(^=)();
-
-    my $tmp     = $formula;
-
-    # Parse the formula using the parser in Formula.pm
-    my $parser  = $self->{_parser};
-
-    # In order to raise formula errors from the point of view of the calling
-    # program we use an eval block and re-raise the error from here.
-    #
-    eval { $formula = $parser->parse_formula($formula) };
-
-    if ($@) {
-        $@ =~ s/\n$//;  # Strip the \n used in the Formula.pm die()
-        croak $@;       # Re-raise the error
-    }
-
-
-    my $formlen = length($formula); # Length of the binary string
-       $length  = 0x16 + $formlen;  # Length of the record data
-
-    my $header  = pack("vv",    $record, $length);
-    my $data    = pack("vvv",   $row, $col, $xf);
-       $data   .= $num;
-       $data   .= pack("vVv",   $grbit, $chn, $formlen);
-
-    $self->_append($header, $data, $formula);
-
-    $self->_write_formula_string($value) if $is_string;
-
-    return 0;
-}
-###############################################################################
-#
-# _encode_formula_result()
-#
-# Encode the user supplied result for a formula.
-#
-sub _encode_formula_result{
-
-    my $self = shift;
-
-    my $value     = $_[0];      # Result to be encoded.
-    my $is_string = 0;          # Formula evaluates to str.
-    my $num;                    # Current value of formula.
-    my $grbit;                  # Option flags.
-
-    if (not defined $value) {
-        $grbit  = 0x03;
-        $num    = pack "d", 0;
-    }
-    else {
-        # The user specified the result of the formula. We turn off the recalc
-        # flag and check the result type.
-        $grbit  = 0x00;
-
-        if ($value =~ /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/) {
-            # Value is a number.
-            $num = pack "d", $value;
-        }
-        else {
-
-            my %bools = (
-                            'TRUE'    => [1,  1],
-                            'FALSE'   => [1,  0],
-                            '#NULL!'  => [2,  0],
-                            '#DIV/0!' => [2,  7],
-                            '#VALUE!' => [2, 15],
-                            '#REF!'   => [2, 23],
-                            '#NAME?'  => [2, 29],
-                            '#NUM!'   => [2, 36],
-                            '#N/A'    => [2, 42],
-                        );
-
-            if (exists $bools{$value}) {
-                # Value is a boolean.
-                $num = pack "vvvv", $bools{$value}->[0],
-                                    $bools{$value}->[1],
-                                    0,
-                                    0xFFFF;
-            }
-            else {
-                # Value is a string.
-                $num = pack "vvvv", 0,
-                                    0,
-                                    0,
-                                    0xFFFF;
-                $is_string = 1;
-            }
-        }
-    }
-
-    return ($num, $grbit, $is_string);
-}
-
-
-###############################################################################
-#
-# _write_formula_string()
-#
-# Write the string value when a formula evaluates to a string. The value cannot
-# be calculated by the module and thus must be supplied by the user.
-#
-sub _write_formula_string {
-
-    my $self = shift;
-
-    my $record    = 0x0207;         # Record identifier
-    my $length    = 0x00;           # Bytes to follow
-    my $string    = $_[0];          # Formula string.
-    my $strlen    = length $_[0];   # Length of the formula string (chars).
-    my $encoding  = 0;              # String encoding.
-
-
-    # Handle utf8 strings in newer perls.
-    if ($] >= 5.008) {
-        require Encode;
-
-        if (Encode::is_utf8($string)) {
-            $string = Encode::encode("UTF-16BE", $string);
-            $encoding = 1;
-        }
-    }
-
-
-    $length       = 0x03 + length $string;  # Length of the record data
-
-    my $header    = pack("vv", $record, $length);
-    my $data      = pack("vC", $strlen, $encoding);
-
-    $self->_append($header, $data, $string);
-
-    return 0;
-}
-
-
-###############################################################################
-#
-# store_formula($formula)
-#
-# Pre-parse a formula. This is used in conjunction with repeat_formula()
-# to repetitively rewrite a formula without re-parsing it.
-#
-sub store_formula{
-
-    my $self    = shift;
-    my $formula = $_[0];      # The formula text string
-
-    # Strip the = sign at the beginning of the formula string
-    $formula    =~ s(^=)();
-
-    # Parse the formula using the parser in Formula.pm
-    my $parser  = $self->{_parser};
-
-    # In order to raise formula errors from the point of view of the calling
-    # program we use an eval block and re-raise the error from here.
-    #
-    my @tokens;
-    eval { @tokens = $parser->parse_formula($formula) };
-
-    if ($@) {
-        $@ =~ s/\n$//;  # Strip the \n used in the Formula.pm die()
-        croak $@;       # Re-raise the error
-    }
-
-
-    # Return the parsed tokens in an anonymous array
-    return [@tokens];
-}
-
-
-###############################################################################
-#
-# repeat_formula($row, $col, $formula, $format, ($pattern => $replacement,...))
-#
-# Write a formula to the specified row and column (zero indexed) by
-# substituting $pattern $replacement pairs in the $formula created via
-# store_formula(). This allows the user to repetitively rewrite a formula
-# without the significant overhead of parsing.
-#
-# Returns  0 : normal termination
-#         -1 : insufficient number of arguments
-#         -2 : row or column out of range
-#
-sub repeat_formula {
-
-    my $self = shift;
-
-    # Check for a cell reference in A1 notation and substitute row and column
-    if ($_[0] =~ /^\D/) {
-        @_ = $self->_substitute_cellref(@_);
-    }
-
-    if (@_ < 2) { return -1 }   # Check the number of args
-
-    my $record      = 0x0006;   # Record identifier
-    my $length;                 # Bytes to follow
-
-    my $row         = shift;    # Zero indexed row
-    my $col         = shift;    # Zero indexed column
-    my $formula_ref = shift;    # Array ref with formula tokens
-    my $format      = shift;    # XF format
-    my @pairs       = @_;       # Pattern/replacement pairs
-
-
-    # Enforce an even number of arguments in the pattern/replacement list
-    croak "Odd number of elements in pattern/replacement list" if @pairs %2;
-
-    # Check that $formula is an array ref
-    croak "Not a valid formula" if ref $formula_ref ne 'ARRAY';
-
-    my @tokens  = @$formula_ref;
-
-    # Ensure that there are tokens to substitute
-    croak "No tokens in formula" unless @tokens;
-
-
-    # As a temporary and undocumented measure we allow the user to specify the
-    # result of the formula by appending a result => $value pair to the end
-    # of the arguments.
-    my $value = undef;
-    if ($pairs[-2] eq 'result') {
-        $value = pop @pairs;
-                 pop @pairs;
-    }
-
-
-    while (@pairs) {
-        my $pattern = shift @pairs;
-        my $replace = shift @pairs;
-
-        foreach my $token (@tokens) {
-            last if $token =~ s/$pattern/$replace/;
-        }
-    }
-
-
-    # Change the parameters in the formula cached by the Formula.pm object
-    my $parser    = $self->{_parser};
-    my $formula   = $parser->parse_tokens(@tokens);
-
-    croak "Unrecognised token in formula" unless defined $formula;
-
-
-    # Excel normally stores the last calculated value of the formula in $num.
-    # Clearly we are not in a position to calculate this a priori. Instead
-    # we set $num to zero and set the option flags in $grbit to ensure
-    # automatic calculation of the formula when the file is opened.
-
-    # As a workaround for some non-Excel apps we also allow the user to
-    # specify the result of the formula.
-    #
-    my $xf        = _XF($self, $row, $col, $format); # The cell format
-    my $chn       = 0x0000;                          # Must be zero
-    my $is_string = 0;                               # Formula evaluates to str
-    my $num;                                         # Current value of formula
-    my $grbit;                                       # Option flags
-
-    ($num, $grbit, $is_string) = $self->_encode_formula_result($value);
-
-    # Check that row and col are valid and store max and min values
-    return -2 if $self->_check_dimensions($row, $col);
-
-
-    my $formlen   = length($formula); # Length of the binary string
-    $length       = 0x16 + $formlen;  # Length of the record data
-
-    my $header    = pack("vv",    $record, $length);
-    my $data      = pack("vvv",   $row, $col, $xf);
-       $data     .= $num;
-       $data     .= pack("vVv",   $grbit, $chn, $formlen);
-
-
-    $self->_append($header, $data, $formula);
-
-    $self->_write_formula_string($value) if $is_string;
-
-    return 0;
-}
-
-
-###############################################################################
-#
-# write_url($row, $col, $url, $string, $format)
-#
-# Write a hyperlink. This is comprised of two elements: the visible label and
-# the invisible link. The visible label is the same as the link unless an
-# alternative string is specified. The label is written using the
-# write_string() method. Therefore the 255 characters string limit applies.
-# $string and $format are optional and their order is interchangeable.
-#
-# The hyperlink can be to a http, ftp, mail, internal sheet, or external
-# directory url.
-#
-# Returns  0 : normal termination
-#         -1 : insufficient number of arguments
-#         -2 : row or column out of range
-#         -3 : long string truncated to 255 chars
-#
-sub write_url {
-
-    my $self = shift;
-
-    # Check for a cell reference in A1 notation and substitute row and column
-    if ($_[0] =~ /^\D/) {
-        @_ = $self->_substitute_cellref(@_);
-    }
-
-    # Check the number of args
-    return -1 if @_ < 3;
-
-    # Add start row and col to arg list
-    return $self->write_url_range($_[0], $_[1], @_);
-}
-
-
-###############################################################################
-#
-# write_url_range($row1, $col1, $row2, $col2, $url, $string, $format)
-#
-# This is the more general form of write_url(). It allows a hyperlink to be
-# written to a range of cells. This function also decides the type of hyperlink
-# to be written. These are either, Web (http, ftp, mailto), Internal
-# (Sheet1!A1) or external ('c:\temp\foo.xls#Sheet1!A1').
-#
-# See also write_url() above for a general description and return values.
-#
-sub write_url_range {
-
-    my $self = shift;
-
-    # Check for a cell reference in A1 notation and substitute row and column
-    if ($_[0] =~ /^\D/) {
-        @_ = $self->_substitute_cellref(@_);
-    }
-
-    # Check the number of args
-    return -1 if @_ < 5;
-
-
-    # Reverse the order of $string and $format if necessary. We work on a copy
-    # in order to protect the callers args. We don't use "local @_" in case of
-    # perl50005 threads.
-    #
-    my @args = @_;
-
-    ($args[5], $args[6]) = ($args[6], $args[5]) if ref $args[5];
-
-    my $url = $args[4];
-
-
-    # Check for internal/external sheet links or default to web link
-    return $self->_write_url_internal(@args) if $url =~ m[^internal:];
-    return $self->_write_url_external(@args) if $url =~ m[^external:];
-    return $self->_write_url_web(@args);
-}
-
-
-###############################################################################
-#
-# _write_url_web($row1, $col1, $row2, $col2, $url, $string, $format)
-#
-# Used to write http, ftp and mailto hyperlinks.
-# The link type ($options) is 0x03 is the same as absolute dir ref without
-# sheet. However it is differentiated by the $unknown2 data stream.
-#
-# See also write_url() above for a general description and return values.
-#
-sub _write_url_web {
-
-    my $self    = shift;
-
-    my $record      = 0x01B8;                       # Record identifier
-    my $length      = 0x00000;                      # Bytes to follow
-
-    my $row1        = $_[0];                        # Start row
-    my $col1        = $_[1];                        # Start column
-    my $row2        = $_[2];                        # End row
-    my $col2        = $_[3];                        # End column
-    my $url         = $_[4];                        # URL string
-    my $str         = $_[5];                        # Alternative label
-    my $xf          = $_[6] || $self->{_url_format};# The cell format
-
-
-    # Write the visible label using the write_string() method.
-    $str            = $url unless defined $str;
-    my $str_error   = $self->write_string($row1, $col1, $str, $xf);
-    return $str_error if $str_error == -2;
-
-
-    # Pack the undocumented parts of the hyperlink stream
-    my $unknown1    = pack("H*", "D0C9EA79F9BACE118C8200AA004BA90B02000000");
-    my $unknown2    = pack("H*", "E0C9EA79F9BACE118C8200AA004BA90B");
-
-
-    # Pack the option flags
-    my $options     = pack("V", 0x03);
-
-    # Convert URL to a null terminated wchar string
-    $url            = join("\0", split('', $url));
-    $url            = $url . "\0\0\0";
-
-
-    # Pack the length of the URL
-    my $url_len     = pack("V", length($url));
-
-
-    # Calculate the data length
-    $length         = 0x34 + length($url);
-
-
-    # Pack the header data
-    my $header      = pack("vv",   $record, $length);
-    my $data        = pack("vvvv", $row1, $row2, $col1, $col2);
-
-
-    # Write the packed data
-    $self->_append( $header,
-                    $data,
-                    $unknown1,
-                    $options,
-                    $unknown2,
-                    $url_len,
-                    $url);
-
-    return $str_error;
-}
-
-
-###############################################################################
-#
-# _write_url_internal($row1, $col1, $row2, $col2, $url, $string, $format)
-#
-# Used to write internal reference hyperlinks such as "Sheet1!A1".
-#
-# See also write_url() above for a general description and return values.
-#
-sub _write_url_internal {
-
-    my $self    = shift;
-
-    my $record      = 0x01B8;                       # Record identifier
-    my $length      = 0x00000;                      # Bytes to follow
-
-    my $row1        = $_[0];                        # Start row
-    my $col1        = $_[1];                        # Start column
-    my $row2        = $_[2];                        # End row
-    my $col2        = $_[3];                        # End column
-    my $url         = $_[4];                        # URL string
-    my $str         = $_[5];                        # Alternative label
-    my $xf          = $_[6] || $self->{_url_format};# The cell format
-
-    # Strip URL type
-    $url            =~ s[^internal:][];
-
-
-    # Write the visible label
-    $str            = $url unless defined $str;
-    my $str_error   = $self->write_string($row1, $col1, $str, $xf);
-    return $str_error if $str_error == -2;
-
-
-    # Pack the undocumented parts of the hyperlink stream
-    my $unknown1    = pack("H*", "D0C9EA79F9BACE118C8200AA004BA90B02000000");
-
-
-    # Pack the option flags
-    my $options     = pack("V", 0x08);
-
-
-    # Convert the URL type and to a null terminated wchar string
-    $url            = join("\0", split('', $url));
-    $url            = $url . "\0\0\0";
-
-
-    # Pack the length of the URL as chars (not wchars)
-    my $url_len     = pack("V", int(length($url)/2));
-
-
-    # Calculate the data length
-    $length         = 0x24 + length($url);
-
-
-    # Pack the header data
-    my $header      = pack("vv",   $record, $length);
-    my $data        = pack("vvvv", $row1, $row2, $col1, $col2);
-
-
-    # Write the packed data
-    $self->_append( $header,
-                    $data,
-                    $unknown1,
-                    $options,
-                    $url_len,
-                    $url);
-
-    return $str_error;
-}
-
-
-###############################################################################
-#
-# _write_url_external($row1, $col1, $row2, $col2, $url, $string, $format)
-#
-# Write links to external directory names such as 'c:\foo.xls',
-# c:\foo.xls#Sheet1!A1', '../../foo.xls'. and '../../foo.xls#Sheet1!A1'.
-#
-# Note: Excel writes some relative links with the $dir_long string. We ignore
-# these cases for the sake of simpler code.
-#
-# See also write_url() above for a general description and return values.
-#
-sub _write_url_external {
-
-    my $self    = shift;
-
-    # Network drives are different. We will handle them separately
-    # MS/Novell network drives and shares start with \\
-    return $self->_write_url_external_net(@_) if $_[4] =~ m[^external:\\\\];
-
-
-    my $record      = 0x01B8;                       # Record identifier
-    my $length      = 0x00000;                      # Bytes to follow
-
-    my $row1        = $_[0];                        # Start row
-    my $col1        = $_[1];                        # Start column
-    my $row2        = $_[2];                        # End row
-    my $col2        = $_[3];                        # End column
-    my $url         = $_[4];                        # URL string
-    my $str         = $_[5];                        # Alternative label
-    my $xf          = $_[6] || $self->{_url_format};# The cell format
-
-
-    # Strip URL type and change Unix dir separator to Dos style (if needed)
-    #
-    $url            =~ s[^external:][];
-    $url            =~ s[/][\\]g;
-
-
-    # Write the visible label
-    ($str = $url)   =~ s[\#][ - ] unless defined $str;
-    my $str_error   = $self->write_string($row1, $col1, $str, $xf);
-    return $str_error if $str_error == -2;
-
-
-    # Determine if the link is relative or absolute:
-    # Absolute if link starts with DOS drive specifier like C:
-    # Otherwise default to 0x00 for relative link.
-    #
-    my $absolute    = 0x00;
-       $absolute    = 0x02  if $url =~ m/^[A-Za-z]:/;
-
-
-    # Determine if the link contains a sheet reference and change some of the
-    # parameters accordingly.
-    # Split the dir name and sheet name (if it exists)
-    #
-    my ($dir_long , $sheet) = split /\#/, $url;
-    my $link_type           = 0x01 | $absolute;
-    my $sheet_len;
-
-    if (defined $sheet) {
-        $link_type |= 0x08;
-        $sheet_len  = pack("V", length($sheet) + 0x01);
-        $sheet      = join("\0", split('', $sheet));
-        $sheet     .= "\0\0\0";
-    }
-    else {
-        $sheet_len  = '';
-        $sheet      = '';
-    }
-
-
-    # Pack the link type
-    $link_type      = pack("V", $link_type);
-
-
-    # Calculate the up-level dir count e.g. (..\..\..\ == 3)
-    my $up_count    = 0;
-    $up_count++       while $dir_long =~ s[^\.\.\\][];
-    $up_count       = pack("v", $up_count);
-
-
-    # Store the short dos dir name (null terminated)
-    my $dir_short   = $dir_long . "\0";
-
-
-    # Store the long dir name as a wchar string (non-null terminated)
-    $dir_long       = join("\0", split('', $dir_long));
-    $dir_long       = $dir_long . "\0";
-
-
-    # Pack the lengths of the dir strings
-    my $dir_short_len = pack("V", length $dir_short      );
-    my $dir_long_len  = pack("V", length $dir_long       );
-    my $stream_len    = pack("V", length($dir_long) + 0x06);
-
-
-    # Pack the undocumented parts of the hyperlink stream
-    my $unknown1 =pack("H*",'D0C9EA79F9BACE118C8200AA004BA90B02000000'       );
-    my $unknown2 =pack("H*",'0303000000000000C000000000000046'               );
-    my $unknown3 =pack("H*",'FFFFADDE000000000000000000000000000000000000000');
-    my $unknown4 =pack("v",  0x03                                            );
-
-
-    # Pack the main data stream
-    my $data        = pack("vvvv", $row1, $row2, $col1, $col2) .
-                      $unknown1     .
-                      $link_type    .
-                      $unknown2     .
-                      $up_count     .
-                      $dir_short_len.
-                      $dir_short    .
-                      $unknown3     .
-                      $stream_len   .
-                      $dir_long_len .
-                      $unknown4     .
-                      $dir_long     .
-                      $sheet_len    .
-                      $sheet        ;
-
-
-    # Pack the header data
-    $length         = length $data;
-    my $header      = pack("vv",   $record, $length);
-
-
-    # Write the packed data
-    $self->_append( $header, $data);
-
-    return $str_error;
-}
-
-
-
-
-###############################################################################
-#
-# _write_url_external_net($row1, $col1, $row2, $col2, $url, $string, $format)
-#
-# Write links to external MS/Novell network drives and shares such as
-# '//NETWORK/share/foo.xls' and '//NETWORK/share/foo.xls#Sheet1!A1'.
-#
-# See also write_url() above for a general description and return values.
-#
-sub _write_url_external_net {
-
-    my $self    = shift;
-
-    my $record      = 0x01B8;                       # Record identifier
-    my $length      = 0x00000;                      # Bytes to follow
-
-    my $row1        = $_[0];                        # Start row
-    my $col1        = $_[1];                        # Start column
-    my $row2        = $_[2];                        # End row
-    my $col2        = $_[3];                        # End column
-    my $url         = $_[4];                        # URL string
-    my $str         = $_[5];                        # Alternative label
-    my $xf          = $_[6] || $self->{_url_format};# The cell format
-
-
-    # Strip URL type and change Unix dir separator to Dos style (if needed)
-    #
-    $url            =~ s[^external:][];
-    $url            =~ s[/][\\]g;
-
-
-    # Write the visible label
-    ($str = $url)   =~ s[\#][ - ] unless defined $str;
-    my $str_error   = $self->write_string($row1, $col1, $str, $xf);
-    return $str_error if $str_error == -2;
-
-
-    # Determine if the link contains a sheet reference and change some of the
-    # parameters accordingly.
-    # Split the dir name and sheet name (if it exists)
-    #
-    my ($dir_long , $sheet) = split /\#/, $url;
-    my $link_type           = 0x0103; # Always absolute
-    my $sheet_len;
-
-    if (defined $sheet) {
-        $link_type |= 0x08;
-        $sheet_len  = pack("V", length($sheet) + 0x01);
-        $sheet      = join("\0", split('', $sheet));
-        $sheet     .= "\0\0\0";
-    }
-    else {
-        $sheet_len   = '';
-        $sheet       = '';
-    }
-
-    # Pack the link type
-    $link_type      = pack("V", $link_type);
-
-
-    # Make the string null terminated
-    $dir_long       = $dir_long . "\0";
-
-
-    # Pack the lengths of the dir string
-    my $dir_long_len  = pack("V", length $dir_long);
-
-
-    # Store the long dir name as a wchar string (non-null terminated)
-    $dir_long       = join("\0", split('', $dir_long));
-    $dir_long       = $dir_long . "\0";
-
-
-    # Pack the undocumented part of the hyperlink stream
-    my $unknown1    = pack("H*",'D0C9EA79F9BACE118C8200AA004BA90B02000000');
-
-
-    # Pack the main data stream
-    my $data        = pack("vvvv", $row1, $row2, $col1, $col2) .
-                      $unknown1     .
-                      $link_type    .
-                      $dir_long_len .
-                      $dir_long     .
-                      $sheet_len    .
-                      $sheet        ;
-
-
-    # Pack the header data
-    $length         = length $data;
-    my $header      = pack("vv",   $record, $length);
-
-
-    # Write the packed data
-    $self->_append( $header, $data);
-
-    return $str_error;
-}
-
-
-###############################################################################
-#
-# write_date_time ($row, $col, $string, $format)
-#
-# Write a datetime string in ISO8601 "yyyy-mm-ddThh:mm:ss.ss" format as a
-# number representing an Excel date. $format is optional.
-#
-# Returns  0 : normal termination
-#         -1 : insufficient number of arguments
-#         -2 : row or column out of range
-#         -3 : Invalid date_time, written as string
-#
-sub write_date_time {
-
-    my $self = shift;
-
-    # Check for a cell reference in A1 notation and substitute row and column
-    if ($_[0] =~ /^\D/) {
-        @_ = $self->_substitute_cellref(@_);
-    }
-
-    if (@_ < 3) { return -1 }                        # Check the number of args
-
-    my $row       = $_[0];                           # Zero indexed row
-    my $col       = $_[1];                           # Zero indexed column
-    my $str       = $_[2];
-
-
-    # Check that row and col are valid and store max and min values
-    return -2 if $self->_check_dimensions($row, $col);
-
-    my $error     = 0;
-    my $date_time = $self->convert_date_time($str);
-
-    if (defined $date_time) {
-        $error = $self->write_number($row, $col, $date_time, $_[3]);
-    }
-    else {
-        # The date isn't valid so write it as a string.
-        $self->write_string($row, $col, $str, $_[3]);
-        $error = -3;
-    }
-    return $error;
-}
-
-
-
-###############################################################################
-#
-# convert_date_time($date_time_string)
-#
-# The function takes a date and time in ISO8601 "yyyy-mm-ddThh:mm:ss.ss" format
-# and converts it to a decimal number representing a valid Excel date.
-#
-# Dates and times in Excel are represented by real numbers. The integer part of
-# the number stores the number of days since the epoch and the fractional part
-# stores the percentage of the day in seconds. The epoch can be either 1900 or
-# 1904.
-#
-# Parameter: Date and time string in one of the following formats:
-#               yyyy-mm-ddThh:mm:ss.ss  # Standard
-#               yyyy-mm-ddT             # Date only
-#                         Thh:mm:ss.ss  # Time only
-#
-# Returns:
-#            A decimal number representing a valid Excel date, or
-#            undef if the date is invalid.
-#
-sub convert_date_time {
-
-    my $self      = shift;
-    my $date_time = $_[0];
-
-    my $days      = 0; # Number of days since epoch
-    my $seconds   = 0; # Time expressed as fraction of 24h hours in seconds
-
-    my ($year, $month, $day);
-    my ($hour, $min, $sec);
-
-
-    # Strip leading and trailing whitespace.
-    $date_time =~ s/^\s+//;
-    $date_time =~ s/\s+$//;
-
-    # Check for invalid date char.
-    return if     $date_time =~ /[^0-9T:\-\.Z]/;
-
-    # Check for "T" after date or before time.
-    return unless $date_time =~ /\dT|T\d/;
-
-    # Strip trailing Z in ISO8601 date.
-    $date_time =~ s/Z$//;
-
-
-    # Split into date and time.
-    my ($date, $time) = split /T/, $date_time;
-
-
-    # We allow the time portion of the input DateTime to be optional.
-    if ($time ne '') {
-        # Match hh:mm:ss.sss+ where the seconds are optional
-        if ($time =~ /^(\d\d):(\d\d)(:(\d\d(\.\d+)?))?/) {
-            $hour   = $1;
-            $min    = $2;
-            $sec    = $4 || 0;
-        }
-        else {
-            return undef; # Not a valid time format.
-        }
-
-        # Some boundary checks
-        return if $hour >= 24;
-        return if $min  >= 60;
-        return if $sec  >= 60;
-
-        # Excel expresses seconds as a fraction of the number in 24 hours.
-        $seconds = ($hour *60*60 + $min *60 + $sec) / (24 *60 *60);
-    }
-
-
-    # We allow the date portion of the input DateTime to be optional.
-    return $seconds if $date eq '';
-
-
-    # Match date as yyyy-mm-dd.
-    if ($date =~ /^(\d\d\d\d)-(\d\d)-(\d\d)$/) {
-        $year   = $1;
-        $month  = $2;
-        $day    = $3;
-    }
-    else {
-        return undef; # Not a valid date format.
-    }
-
-    # Set the epoch as 1900 or 1904. Defaults to 1900.
-    my $date_1904 = $self->{_1904};
-
-
-    # Special cases for Excel.
-    if (not $date_1904) {
-        return      $seconds if $date eq '1899-12-31'; # Excel 1900 epoch
-        return      $seconds if $date eq '1900-01-00'; # Excel 1900 epoch
-        return 60 + $seconds if $date eq '1900-02-29'; # Excel false leapday
-    }
-
-
-    # We calculate the date by calculating the number of days since the epoch
-    # and adjust for the number of leap days. We calculate the number of leap
-    # days by normalising the year in relation to the epoch. Thus the year 2000
-    # becomes 100 for 4 and 100 year leapdays and 400 for 400 year leapdays.
-    #
-    my $epoch   = $date_1904 ? 1904 : 1900;
-    my $offset  = $date_1904 ?    4 :    0;
-    my $norm    = 300;
-    my $range   = $year -$epoch;
-
-
-    # Set month days and check for leap year.
-    my @mdays   = (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
-    my $leap    = 0;
-       $leap    = 1  if $year % 4 == 0 and $year % 100 or $year % 400 == 0;
-    $mdays[1]   = 29 if $leap;
-
-
-    # Some boundary checks
-    return if $year  < $epoch or $year  > 9999;
-    return if $month < 1      or $month > 12;
-    return if $day   < 1      or $day   > $mdays[$month -1];
-
-    # Accumulate the number of days since the epoch.
-    $days  = $day;                              # Add days for current month
-    $days += $mdays[$_] for 0 .. $month -2;     # Add days for past months
-    $days += $range *365;                       # Add days for past years
-    $days += int(($range)                /  4); # Add leapdays
-    $days -= int(($range +$offset)       /100); # Subtract 100 year leapdays
-    $days += int(($range +$offset +$norm)/400); # Add 400 year leapdays
-    $days -= $leap;                             # Already counted above
-
-
-    # Adjust for Excel erroneously treating 1900 as a leap year.
-    $days++ if $date_1904 == 0 and $days > 59;
-
-    return $days + $seconds;
-}
-
-
-
-
-
-###############################################################################
-#
-# set_row($row, $height, $XF, $hidden, $level)
-#
-# This method is used to set the height and XF format for a row.
-# Writes the  BIFF record ROW.
-#
-sub set_row {
-
-    my $self        = shift;
-    my $record      = 0x0208;               # Record identifier
-    my $length      = 0x0010;               # Number of bytes to follow
-
-    my $rw          = $_[0];                # Row Number
-    my $colMic      = 0x0000;               # First defined column
-    my $colMac      = 0x0000;               # Last defined column
-    my $miyRw;                              # Row height
-    my $irwMac      = 0x0000;               # Used by Excel to optimise loading
-    my $reserved    = 0x0000;               # Reserved
-    my $grbit       = 0x0000;               # Option flags
-    my $ixfe;                               # XF index
-    my $height      = $_[1];                # Format object
-    my $format      = $_[2];                # Format object
-    my $hidden      = $_[3] || 0;           # Hidden flag
-    my $level       = $_[4] || 0;           # Outline level
-
-
-    # Check for a format object
-    if (ref $format) {
-        $ixfe = $format->get_xf_index();
-    }
-    else {
-        $ixfe = 0x0F;
-    }
-
-
-    # Set the row height in units of 1/20 of a point. Note, some heights may
-    # not be obtained exactly due to rounding in Excel.
-    #
-    if (defined $height) {
-        $miyRw = $height *20;
-    }
-    else {
-        $miyRw = 0xff; # The default row height
-    }
-
-
-    # Set the limits for the outline levels (0 <= x <= 7).
-    $level = 0 if $level < 0;
-    $level = 7 if $level > 7;
-
-    $self->{_outline_row_level} = $level if $level >$self->{_outline_row_level};
-
-
-    # Set the options flags. fUnsynced is used to show that the font and row
-    # heights are not compatible. This is usually the case for WriteExcel.
-    # The collapsed flag 0x10 doesn't seem to be used to indicate that a row
-    # is collapsed. Instead it is used to indicate that the previous row is
-    # collapsed. The zero height flag, 0x20, is used to collapse a row.
-    #
-    $grbit |= $level;
-    $grbit |= 0x0020 if $hidden;
-    $grbit |= 0x0040; # fUnsynced
-    $grbit |= 0x0080 if $format;
-    $grbit |= 0x0100;
-
-
-    my $header   = pack("vv",       $record, $length);
-    my $data     = pack("vvvvvvvv", $rw, $colMic, $colMac, $miyRw,
-                                    $irwMac,$reserved, $grbit, $ixfe);
-
-    $self->_append($header, $data);
-
-    # Store the row sizes for use when calculating image vertices.
-    # Also store the column formats.
-    #
-    return if @_ < 2;# Ensure at least $row and $height
-
-    $self->{_row_sizes}->{$_[0]}   = $height;
-    $self->{_row_formats}->{$_[0]} = $format if defined $format;
-}
-
-
-###############################################################################
-#
-# _check_dimensions($row, $col)
-#
-# Check that $row and $col are valid and store max and min values for use in
-# DIMENSIONS record. See, _store_dimensions().
-#
-sub _check_dimensions {
-
-    my $self    = shift;
-    my $row     = $_[0];
-    my $col     = $_[1];
-
-    if ($row >= $self->{_xls_rowmax}) { return -2 }
-    if ($col >= $self->{_xls_colmax}) { return -2 }
-
-    $self->{_dim_changed} = 1;
-
-    if ($row <  $self->{_dim_rowmin}) { $self->{_dim_rowmin} = $row }
-    if ($row >  $self->{_dim_rowmax}) { $self->{_dim_rowmax} = $row }
-    if ($col <  $self->{_dim_colmin}) { $self->{_dim_colmin} = $col }
-    if ($col >  $self->{_dim_colmax}) { $self->{_dim_colmax} = $col }
-
-    return 0;
-}
-
-
-###############################################################################
-#
-# _store_dimensions()
-#
-# Writes Excel DIMENSIONS to define the area in which there is data.
-#
-sub _store_dimensions {
-
-    my $self      = shift;
-    my $record    = 0x0200;         # Record identifier
-    my $length    = 0x000E;         # Number of bytes to follow
-    my $row_min;                    # First row
-    my $row_max;                    # Last row plus 1
-    my $col_min;                    # First column
-    my $col_max;                    # Last column plus 1
-    my $reserved  = 0x0000;         # Reserved by Excel
-
-
-    # Set the data range if data has been written to the worksheet
-    if ($self->{_dim_changed}) {
-        $row_min = $self->{_dim_rowmin};
-        $row_max = $self->{_dim_rowmax} +1;
-        $col_min = $self->{_dim_colmin};
-        $col_max = $self->{_dim_colmax} +1;
-    }
-    else {
-        # Special case, not data was written
-        $row_min = 0;
-        $row_max = 0;
-        $col_min = 0;
-        $col_max = 256;
-
-    }
-
-
-    my $header    = pack("vv",    $record, $length);
-    my $data      = pack("VVvvv", $row_min, $row_max,
-                                  $col_min, $col_max, $reserved);
-    $self->_prepend($header, $data);
-}
-
-
-###############################################################################
-#
-# _store_window2()
-#
-# Write BIFF record Window2.
-#
-sub _store_window2 {
-
-    use integer;    # Avoid << shift bug in Perl 5.6.0 on HP-UX
-
-    my $self           = shift;
-    my $record         = 0x023E;     # Record identifier
-    my $length         = 0x0012;     # Number of bytes to follow
-
-    my $grbit          = 0x00B6;     # Option flags
-    my $rwTop          = 0x0000;     # Top row visible in window
-    my $colLeft        = 0x0000;     # Leftmost column visible in window
-    my $rgbHdr         = 0x00000040; # Row/column heading and gridline color
-
-    my $wScaleSLV      = 0x0000;     #
-    my $wScaleNormal   = 0x0000;     #
-    my $reserved       = 0x00000000; #
-
-
-    # The options flags that comprise $grbit
-    my $fDspFmla       = 0;                          # 0 - bit
-    my $fDspGrid       = $self->{_screen_gridlines}; # 1
-    my $fDspRwCol      = 1;                          # 2
-    my $fFrozen        = $self->{_frozen};           # 3
-    my $fDspZeros      = 1;                          # 4
-    my $fDefaultHdr    = 1;                          # 5
-    my $fArabic        = 0;                          # 6
-    my $fDspGuts       = $self->{_outline_on};       # 7
-    my $fFrozenNoSplit = 0;                          # 0 - bit
-    my $fSelected      = $self->{_selected};         # 1
-    my $fPaged         = $self->{_active};           # 2
-    my $fBreakPreview  = 0;                          # 3
-
-    $grbit             = $fDspFmla;
-    $grbit            |= $fDspGrid       << 1;
-    $grbit            |= $fDspRwCol      << 2;
-    $grbit            |= $fFrozen        << 3;
-    $grbit            |= $fDspZeros      << 4;
-    $grbit            |= $fDefaultHdr    << 5;
-    $grbit            |= $fArabic        << 6;
-    $grbit            |= $fDspGuts       << 7;
-    $grbit            |= $fFrozenNoSplit << 8;
-    $grbit            |= $fSelected      << 9;
-    $grbit            |= $fPaged         << 10;
-    $grbit            |= $fBreakPreview  << 11;
-
-    my $header  = pack("vv",      $record, $length);
-    my $data    = pack("vvvVvvV", $grbit, $rwTop, $colLeft, $rgbHdr,
-                                  $wScaleSLV, $wScaleNormal, $reserved );
-
-    $self->_append($header, $data);
-}
-
-
-###############################################################################
-#
-# _store_defcol()
-#
-# Write BIFF record DEFCOLWIDTH if COLINFO records are in use.
-#
-sub _store_defcol {
-
-    my $self     = shift;
-    my $record   = 0x0055;      # Record identifier
-    my $length   = 0x0002;      # Number of bytes to follow
-
-    my $colwidth = 0x0008;      # Default column width
-
-    my $header   = pack("vv", $record, $length);
-    my $data     = pack("v",  $colwidth);
-
-    $self->_prepend($header, $data);
-}
-
-
-###############################################################################
-#
-# _store_colinfo($firstcol, $lastcol, $width, $format, $hidden)
-#
-# Write BIFF record COLINFO to define column widths
-#
-# Note: The SDK says the record length is 0x0B but Excel writes a 0x0C
-# length record.
-#
-sub _store_colinfo {
-
-    my $self     = shift;
-    my $record   = 0x007D;          # Record identifier
-    my $length   = 0x000B;          # Number of bytes to follow
-
-    my $colFirst = $_[0] || 0;      # First formatted column
-    my $colLast  = $_[1] || 0;      # Last formatted column
-    my $width    = $_[2] || 8.43;   # Col width in user units, 8.43 is default
-    my $coldx;                      # Col width in internal units
-    my $pixels;                     # Col width in pixels
-
-    # Excel rounds the column width to the nearest pixel. Therefore we first
-    # convert to pixels and then to the internal units. The pixel to users-units
-    # relationship is different for values less than 1.
-    #
-    if ($width < 1) {
-        $pixels = int($width *12);
-    }
-    else {
-        $pixels = int($width *7 ) +5;
-    }
-
-    $coldx = int($pixels *256/7);
-
-
-    my $ixfe;                       # XF index
-    my $grbit    = 0x0000;          # Option flags
-    my $reserved = 0x00;            # Reserved
-    my $format   = $_[3];           # Format object
-    my $hidden   = $_[4] || 0;      # Hidden flag
-    my $level    = $_[5] || 0;      # Outline level
-
-
-    # Check for a format object
-    if (ref $format) {
-        $ixfe = $format->get_xf_index();
-    }
-    else {
-        $ixfe = 0x0F;
-    }
-
-
-    # Set the limits for the outline levels (0 <= x <= 7).
-    $level = 0 if $level < 0;
-    $level = 7 if $level > 7;
-
-
-    # Set the options flags.
-    # The collapsed flag 0x10 doesn't seem to be used to indicate that a col
-    # is collapsed. Instead it is used to indicate that the previous col is
-    # collapsed. The zero height flag, 0x20, is used to collapse a col.
-    #
-    $grbit |= 0x0001 if $hidden;
-    $grbit |= $level << 8;
-
-
-    my $header   = pack("vv",     $record, $length);
-    my $data     = pack("vvvvvC", $colFirst, $colLast, $coldx,
-                                  $ixfe, $grbit, $reserved);
-
-    $self->_prepend($header, $data);
-}
-
-
-###############################################################################
-#
-# _store_selection($first_row, $first_col, $last_row, $last_col)
-#
-# Write BIFF record SELECTION.
-#
-sub _store_selection {
-
-    my $self     = shift;
-    my $record   = 0x001D;                  # Record identifier
-    my $length   = 0x000F;                  # Number of bytes to follow
-
-    my $pnn      = $self->{_active_pane};   # Pane position
-    my $rwAct    = $_[0];                   # Active row
-    my $colAct   = $_[1];                   # Active column
-    my $irefAct  = 0;                       # Active cell ref
-    my $cref     = 1;                       # Number of refs
-
-    my $rwFirst  = $_[0];                   # First row in reference
-    my $colFirst = $_[1];                   # First col in reference
-    my $rwLast   = $_[2] || $rwFirst;       # Last  row in reference
-    my $colLast  = $_[3] || $colFirst;      # Last  col in reference
-
-    # Swap last row/col for first row/col as necessary
-    if ($rwFirst > $rwLast) {
-        ($rwFirst, $rwLast) = ($rwLast, $rwFirst);
-    }
-
-    if ($colFirst > $colLast) {
-        ($colFirst, $colLast) = ($colLast, $colFirst);
-    }
-
-
-    my $header   = pack("vv",           $record, $length);
-    my $data     = pack("CvvvvvvCC",    $pnn, $rwAct, $colAct,
-                                        $irefAct, $cref,
-                                        $rwFirst, $rwLast,
-                                        $colFirst, $colLast);
-
-    $self->_append($header, $data);
-}
-
-
-###############################################################################
-#
-# _store_externcount($count)
-#
-# Write BIFF record EXTERNCOUNT to indicate the number of external sheet
-# references in a worksheet.
-#
-# Excel only stores references to external sheets that are used in formulas.
-# For simplicity we store references to all the sheets in the workbook
-# regardless of whether they are used or not. This reduces the overall
-# complexity and eliminates the need for a two way dialogue between the formula
-# parser the worksheet objects.
-#
-sub _store_externcount {
-
-    my $self     = shift;
-    my $record   = 0x0016;          # Record identifier
-    my $length   = 0x0002;          # Number of bytes to follow
-
-    my $cxals    = $_[0];           # Number of external references
-
-    my $header   = pack("vv", $record, $length);
-    my $data     = pack("v",  $cxals);
-
-    $self->_prepend($header, $data);
-}
-
-
-###############################################################################
-#
-# _store_externsheet($sheetname)
-#
-#
-# Writes the Excel BIFF EXTERNSHEET record. These references are used by
-# formulas. A formula references a sheet name via an index. Since we store a
-# reference to all of the external worksheets the EXTERNSHEET index is the same
-# as the worksheet index.
-#
-sub _store_externsheet {
-
-    my $self      = shift;
-
-    my $record    = 0x0017;         # Record identifier
-    my $length;                     # Number of bytes to follow
-
-    my $sheetname = $_[0];          # Worksheet name
-    my $cch;                        # Length of sheet name
-    my $rgch;                       # Filename encoding
-
-    # References to the current sheet are encoded differently to references to
-    # external sheets.
-    #
-    if ($self->{_name} eq $sheetname) {
-        $sheetname = '';
-        $length    = 0x02;  # The following 2 bytes
-        $cch       = 1;     # The following byte
-        $rgch      = 0x02;  # Self reference
-    }
-    else {
-        $length    = 0x02 + length($_[0]);
-        $cch       = length($sheetname);
-        $rgch      = 0x03;  # Reference to a sheet in the current workbook
-    }
-
-    my $header     = pack("vv",  $record, $length);
-    my $data       = pack("CC", $cch, $rgch);
-
-    $self->_prepend($header, $data, $sheetname);
-}
-
-
-###############################################################################
-#
-# _store_panes()
-#
-#
-# Writes the Excel BIFF PANE record.
-# The panes can either be frozen or thawed (unfrozen).
-# Frozen panes are specified in terms of a integer number of rows and columns.
-# Thawed panes are specified in terms of Excel's units for rows and columns.
-#
-sub _store_panes {
-
-    my $self    = shift;
-    my $record  = 0x0041;       # Record identifier
-    my $length  = 0x000A;       # Number of bytes to follow
-
-    my $y       = $_[0] || 0;   # Vertical split position
-    my $x       = $_[1] || 0;   # Horizontal split position
-    my $rwTop   = $_[2];        # Top row visible
-    my $colLeft = $_[3];        # Leftmost column visible
-    my $pnnAct  = $_[4];        # Active pane
-
-
-    # Code specific to frozen or thawed panes.
-    if ($self->{_frozen}) {
-        # Set default values for $rwTop and $colLeft
-        $rwTop   = $y unless defined $rwTop;
-        $colLeft = $x unless defined $colLeft;
-    }
-    else {
-        # Set default values for $rwTop and $colLeft
-        $rwTop   = 0  unless defined $rwTop;
-        $colLeft = 0  unless defined $colLeft;
-
-        # Convert Excel's row and column units to the internal units.
-        # The default row height is 12.75
-        # The default column width is 8.43
-        # The following slope and intersection values were interpolated.
-        #
-        $y = 20*$y      + 255;
-        $x = 113.879*$x + 390;
-    }
-
-
-    # Determine which pane should be active. There is also the undocumented
-    # option to override this should it be necessary: may be removed later.
-    #
-    if (not defined $pnnAct) {
-        $pnnAct = 0 if ($x != 0 && $y != 0); # Bottom right
-        $pnnAct = 1 if ($x != 0 && $y == 0); # Top right
-        $pnnAct = 2 if ($x == 0 && $y != 0); # Bottom left
-        $pnnAct = 3 if ($x == 0 && $y == 0); # Top left
-    }
-
-    $self->{_active_pane} = $pnnAct; # Used in _store_selection
-
-    my $header     = pack("vv",    $record, $length);
-    my $data       = pack("vvvvv", $x, $y, $rwTop, $colLeft, $pnnAct);
-
-    $self->_append($header, $data);
-}
-
-
-###############################################################################
-#
-# _store_setup()
-#
-# Store the page setup SETUP BIFF record.
-#
-sub _store_setup {
-
-    use integer;    # Avoid << shift bug in Perl 5.6.0 on HP-UX
-
-    my $self         = shift;
-    my $record       = 0x00A1;                  # Record identifier
-    my $length       = 0x0022;                  # Number of bytes to follow
-
-
-    # TODO some of these props don't have accessors. Add then as requested.
-
-    my $iPaperSize   = $self->{_paper_size};    # Paper size
-    my $iScale       = $self->{_print_scale};   # Print scaling factor
-    my $iPageStart   = $self->{_page_start};    # Starting page number
-    my $iFitWidth    = $self->{_fit_width};     # Fit to number of pages wide
-    my $iFitHeight   = $self->{_fit_height};    # Fit to number of pages high
-    my $grbit        = 0x00;                    # Option flags
-    my $iRes         = 0x0258;                  # Print resolution
-    my $iVRes        = 0x0258;                  # Vertical print resolution
-    my $numHdr       = $self->{_margin_header}; # Header Margin
-    my $numFtr       = $self->{_margin_footer}; # Footer Margin
-    my $iCopies      = 0x01;                    # Number of copies
-
-
-    my $fLeftToRight = $self->{_page_order};    # Print over then down
-    my $fLandscape   = $self->{_orientation};   # Page orientation
-    my $fNoPls       = 0x0;                     # Setup not read from printer
-    my $fNoColor     = $self->{_black_white};   # Print black and white
-    my $fDraft       = $self->{_draft_quality}; # Print draft quality
-    my $fNotes       = $self->{_print_comments};# Print notes
-    my $fNoOrient    = 0x0;                     # Orientation not set
-    my $fUsePage     = 0x0;                     # Use custom starting page
-
-
-    $grbit           = $fLeftToRight;
-    $grbit          |= $fLandscape    << 1;
-    $grbit          |= $fNoPls        << 2;
-    $grbit          |= $fNoColor      << 3;
-    $grbit          |= $fDraft        << 4;
-    $grbit          |= $fNotes        << 5;
-    $grbit          |= $fNoOrient     << 6;
-    $grbit          |= $fUsePage      << 7;
-
-
-    $numHdr = pack("d", $numHdr);
-    $numFtr = pack("d", $numFtr);
-
-    if ($self->{_byte_order}) {
-        $numHdr = reverse $numHdr;
-        $numFtr = reverse $numFtr;
-    }
-
-    my $header = pack("vv",         $record, $length);
-    my $data1  = pack("vvvvvvvv",   $iPaperSize,
-                                    $iScale,
-                                    $iPageStart,
-                                    $iFitWidth,
-                                    $iFitHeight,
-                                    $grbit,
-                                    $iRes,
-                                    $iVRes);
-    my $data2  = $numHdr .$numFtr;
-    my $data3  = pack("v", $iCopies);
-
-    $self->_prepend($header, $data1, $data2, $data3);
-
-}
-
-###############################################################################
-#
-# _store_header()
-#
-# Store the header caption BIFF record.
-#
-sub _store_header {
-
-    my $self        = shift;
-
-    my $record      = 0x0014;                       # Record identifier
-    my $length;                                     # Bytes to follow
-
-    my $str         = $self->{_header};             # header string
-    my $cch         = length($str);                 # Length of header string
-    my $encoding    = $self->{_header_encoding};    # Character encoding
-
-
-    # Character length is num of chars not num of bytes
-    $cch           /= 2 if $encoding;
-
-    # Change the UTF-16 name from BE to LE
-    $str            = pack 'n*', unpack 'v*', $str if $encoding;
-
-    $length         = 3 + length($str);
-
-    my $header      = pack("vv",  $record, $length);
-    my $data        = pack("vC",  $cch, $encoding);
-
-    $self->_prepend($header, $data, $str);
-}
-
-
-###############################################################################
-#
-# _store_footer()
-#
-# Store the footer caption BIFF record.
-#
-sub _store_footer {
-
-    my $self        = shift;
-
-    my $record      = 0x0015;                       # Record identifier
-    my $length;                                     # Bytes to follow
-
-    my $str         = $self->{_footer};             # footer string
-    my $cch         = length($str);                 # Length of footer string
-    my $encoding    = $self->{_footer_encoding};    # Character encoding
-
-
-    # Character length is num of chars not num of bytes
-    $cch           /= 2 if $encoding;
-
-    # Change the UTF-16 name from BE to LE
-    $str            = pack 'n*', unpack 'v*', $str if $encoding;
-
-    $length         = 3 + length($str);
-
-    my $header      = pack("vv",  $record, $length);
-    my $data        = pack("vC",  $cch, $encoding);
-
-    $self->_prepend($header, $data, $str);
-}
-
-
-###############################################################################
-#
-# _store_hcenter()
-#
-# Store the horizontal centering HCENTER BIFF record.
-#
-sub _store_hcenter {
-
-    my $self     = shift;
-
-    my $record   = 0x0083;              # Record identifier
-    my $length   = 0x0002;              # Bytes to follow
-
-    my $fHCenter = $self->{_hcenter};   # Horizontal centering
-
-    my $header    = pack("vv",  $record, $length);
-    my $data      = pack("v",   $fHCenter);
-
-    $self->_prepend($header, $data);
-}
-
-
-###############################################################################
-#
-# _store_vcenter()
-#
-# Store the vertical centering VCENTER BIFF record.
-#
-sub _store_vcenter {
-
-    my $self     = shift;
-
-    my $record   = 0x0084;              # Record identifier
-    my $length   = 0x0002;              # Bytes to follow
-
-    my $fVCenter = $self->{_vcenter};   # Horizontal centering
-
-    my $header    = pack("vv",  $record, $length);
-    my $data      = pack("v",   $fVCenter);
-
-    $self->_prepend($header, $data);
-}
-
-
-###############################################################################
-#
-# _store_margin_left()
-#
-# Store the LEFTMARGIN BIFF record.
-#
-sub _store_margin_left {
-
-    my $self    = shift;
-
-    my $record  = 0x0026;                   # Record identifier
-    my $length  = 0x0008;                   # Bytes to follow
-
-    my $margin  = $self->{_margin_left};    # Margin in inches
-
-    my $header    = pack("vv",  $record, $length);
-    my $data      = pack("d",   $margin);
-
-    if ($self->{_byte_order}) { $data = reverse $data }
-
-    $self->_prepend($header, $data);
-}
-
-
-###############################################################################
-#
-# _store_margin_right()
-#
-# Store the RIGHTMARGIN BIFF record.
-#
-sub _store_margin_right {
-
-    my $self    = shift;
-
-    my $record  = 0x0027;                   # Record identifier
-    my $length  = 0x0008;                   # Bytes to follow
-
-    my $margin  = $self->{_margin_right};   # Margin in inches
-
-    my $header    = pack("vv",  $record, $length);
-    my $data      = pack("d",   $margin);
-
-    if ($self->{_byte_order}) { $data = reverse $data }
-
-    $self->_prepend($header, $data);
-}
-
-
-###############################################################################
-#
-# _store_margin_top()
-#
-# Store the TOPMARGIN BIFF record.
-#
-sub _store_margin_top {
-
-    my $self    = shift;
-
-    my $record  = 0x0028;                   # Record identifier
-    my $length  = 0x0008;                   # Bytes to follow
-
-    my $margin  = $self->{_margin_top};     # Margin in inches
-
-    my $header    = pack("vv",  $record, $length);
-    my $data      = pack("d",   $margin);
-
-    if ($self->{_byte_order}) { $data = reverse $data }
-
-    $self->_prepend($header, $data);
-}
-
-
-###############################################################################
-#
-# _store_margin_bottom()
-#
-# Store the BOTTOMMARGIN BIFF record.
-#
-sub _store_margin_bottom {
-
-    my $self    = shift;
-
-    my $record  = 0x0029;                   # Record identifier
-    my $length  = 0x0008;                   # Bytes to follow
-
-    my $margin  = $self->{_margin_bottom};  # Margin in inches
-
-    my $header    = pack("vv",  $record, $length);
-    my $data      = pack("d",   $margin);
-
-    if ($self->{_byte_order}) { $data = reverse $data }
-
-    $self->_prepend($header, $data);
-}
-
-
-###############################################################################
-#
-# merge_cells($first_row, $first_col, $last_row, $last_col)
-#
-# This is an Excel97/2000 method. It is required to perform more complicated
-# merging than the normal align merge in Format.pm
-#
-sub merge_cells {
-
-    my $self    = shift;
-
-    # Check for a cell reference in A1 notation and substitute row and column
-    if ($_[0] =~ /^\D/) {
-        @_ = $self->_substitute_cellref(@_);
-    }
-
-    my $record  = 0x00E5;                   # Record identifier
-    my $length  = 0x000A;                   # Bytes to follow
-
-    my $cref     = 1;                       # Number of refs
-    my $rwFirst  = $_[0];                   # First row in reference
-    my $colFirst = $_[1];                   # First col in reference
-    my $rwLast   = $_[2] || $rwFirst;       # Last  row in reference
-    my $colLast  = $_[3] || $colFirst;      # Last  col in reference
-
-
-    # Excel doesn't allow a single cell to be merged
-    return if $rwFirst == $rwLast and $colFirst == $colLast;
-
-    # Swap last row/col with first row/col as necessary
-    ($rwFirst,  $rwLast ) = ($rwLast,  $rwFirst ) if $rwFirst  > $rwLast;
-    ($colFirst, $colLast) = ($colLast, $colFirst) if $colFirst > $colLast;
-
-    my $header   = pack("vv",       $record, $length);
-    my $data     = pack("vvvvv",    $cref,
-                                    $rwFirst, $rwLast,
-                                    $colFirst, $colLast);
-
-    $self->_append($header, $data);
-}
-
-
-###############################################################################
-#
-# merge_range($first_row, $first_col, $last_row, $last_col, $string, $format)
-#
-# This is a wrapper to ensure correct use of the merge_cells method, i.e., write
-# the first cell of the range, write the formatted blank cells in the range and
-# then call the merge_cells record. Failing to do the steps in this order will
-# cause Excel 97 to crash.
-#
-sub merge_range {
-
-    my $self    = shift;
-
-    # Check for a cell reference in A1 notation and substitute row and column
-    if ($_[0] =~ /^\D/) {
-        @_ = $self->_substitute_cellref(@_);
-    }
-    croak "Incorrect number of arguments" if @_ != 6;
-    croak "Final argument must be a format object" unless ref $_[5];
-
-    my $rwFirst  = $_[0];
-    my $colFirst = $_[1];
-    my $rwLast   = $_[2];
-    my $colLast  = $_[3];
-    my $string   = $_[4];
-    my $format   = $_[5];
-
-
-    # Temp code to prevent merged formats in non-merged cells.
-    my $error = "Error: refer to merge_range() in the documentation. " .
-                "Can't use previously non-merged format in merged cells";
-
-    croak $error if $format->{_used_merge} == -1;
-    $format->{_used_merge} = 0; # Until the end of this function.
-
-
-    # Set the merge_range property of the format object. For BIFF8+.
-    $format->set_merge_range();
-
-    # Excel doesn't allow a single cell to be merged
-    croak "Can't merge single cell" if $rwFirst  == $rwLast and
-                                       $colFirst == $colLast;
-
-    # Swap last row/col with first row/col as necessary
-    ($rwFirst,  $rwLast ) = ($rwLast,  $rwFirst ) if $rwFirst  > $rwLast;
-    ($colFirst, $colLast) = ($colLast, $colFirst) if $colFirst > $colLast;
-
-    # Write the first cell
-    $self->write($rwFirst, $colFirst, $string, $format);
-
-    # Pad out the rest of the area with formatted blank cells.
-    for my $row ($rwFirst .. $rwLast) {
-        for my $col ($colFirst .. $colLast) {
-            next if $row == $rwFirst and $col == $colFirst;
-            $self->write_blank($row, $col, $format);
-        }
-    }
-
-    $self->merge_cells($rwFirst, $colFirst, $rwLast, $colLast);
-
-    # Temp code to prevent merged formats in non-merged cells.
-    $format->{_used_merge} = 1;
-
-}
-
-
-###############################################################################
-#
-# _store_print_headers()
-#
-# Write the PRINTHEADERS BIFF record.
-#
-sub _store_print_headers {
-
-    my $self        = shift;
-
-    my $record      = 0x002a;                   # Record identifier
-    my $length      = 0x0002;                   # Bytes to follow
-
-    my $fPrintRwCol = $self->{_print_headers};  # Boolean flag
-
-    my $header      = pack("vv",  $record, $length);
-    my $data        = pack("v",   $fPrintRwCol);
-
-    $self->_prepend($header, $data);
-}
-
-
-###############################################################################
-#
-# _store_print_gridlines()
-#
-# Write the PRINTGRIDLINES BIFF record. Must be used in conjunction with the
-# GRIDSET record.
-#
-sub _store_print_gridlines {
-
-    my $self        = shift;
-
-    my $record      = 0x002b;                    # Record identifier
-    my $length      = 0x0002;                    # Bytes to follow
-
-    my $fPrintGrid  = $self->{_print_gridlines}; # Boolean flag
-
-    my $header      = pack("vv",  $record, $length);
-    my $data        = pack("v",   $fPrintGrid);
-
-    $self->_prepend($header, $data);
-}
-
-
-###############################################################################
-#
-# _store_gridset()
-#
-# Write the GRIDSET BIFF record. Must be used in conjunction with the
-# PRINTGRIDLINES record.
-#
-sub _store_gridset {
-
-    my $self        = shift;
-
-    my $record      = 0x0082;                        # Record identifier
-    my $length      = 0x0002;                        # Bytes to follow
-
-    my $fGridSet    = not $self->{_print_gridlines}; # Boolean flag
-
-    my $header      = pack("vv",  $record, $length);
-    my $data        = pack("v",   $fGridSet);
-
-    $self->_prepend($header, $data);
-
-}
-
-
-###############################################################################
-#
-# _store_guts()
-#
-# Write the GUTS BIFF record. This is used to configure the gutter margins
-# where Excel outline symbols are displayed. The visibility of the gutters is
-# controlled by a flag in WSBOOL. See also _store_wsbool().
-#
-# We are all in the gutter but some of us are looking at the stars.
-#
-sub _store_guts {
-
-    my $self        = shift;
-
-    my $record      = 0x0080;   # Record identifier
-    my $length      = 0x0008;   # Bytes to follow
-
-    my $dxRwGut     = 0x0000;   # Size of row gutter
-    my $dxColGut    = 0x0000;   # Size of col gutter
-
-    my $row_level   = $self->{_outline_row_level};
-    my $col_level   = 0;
-
-
-    # Calculate the maximum column outline level. The equivalent calculation
-    # for the row outline level is carried out in set_row().
-    #
-    foreach my $colinfo (@{$self->{_colinfo}}) {
-        # Skip cols without outline level info.
-        next if @{$colinfo} < 6;
-        $col_level = @{$colinfo}[5] if @{$colinfo}[5] > $col_level;
-    }
-
-
-    # Set the limits for the outline levels (0 <= x <= 7).
-    $col_level = 0 if $col_level < 0;
-    $col_level = 7 if $col_level > 7;
-
-
-    # The displayed level is one greater than the max outline levels
-    $row_level++ if $row_level > 0;
-    $col_level++ if $col_level > 0;
-
-    my $header      = pack("vv",   $record, $length);
-    my $data        = pack("vvvv", $dxRwGut, $dxColGut, $row_level, $col_level);
-
-    $self->_prepend($header, $data);
-
-}
-
-
-###############################################################################
-#
-# _store_wsbool()
-#
-# Write the WSBOOL BIFF record, mainly for fit-to-page. Used in conjunction
-# with the SETUP record.
-#
-sub _store_wsbool {
-
-    my $self        = shift;
-
-    my $record      = 0x0081;   # Record identifier
-    my $length      = 0x0002;   # Bytes to follow
-
-    my $grbit       = 0x0000;   # Option flags
-
-    # Set the option flags
-    $grbit |= 0x0001;                            # Auto page breaks visible
-    $grbit |= 0x0020 if $self->{_outline_style}; # Auto outline styles
-    $grbit |= 0x0040 if $self->{_outline_below}; # Outline summary below
-    $grbit |= 0x0080 if $self->{_outline_right}; # Outline summary right
-    $grbit |= 0x0100 if $self->{_fit_page};      # Page setup fit to page
-    $grbit |= 0x0400 if $self->{_outline_on};    # Outline symbols displayed
-
-
-    my $header      = pack("vv",  $record, $length);
-    my $data        = pack("v",   $grbit);
-
-    $self->_prepend($header, $data);
-}
-
-
-###############################################################################
-#
-# _store_hbreak()
-#
-# Write the HORIZONTALPAGEBREAKS BIFF record.
-#
-sub _store_hbreak {
-
-    my $self    = shift;
-
-    # Return if the user hasn't specified pagebreaks
-    return unless @{$self->{_hbreaks}};
-
-    # Sort and filter array of page breaks
-    my @breaks  = $self->_sort_pagebreaks(@{$self->{_hbreaks}});
-
-    my $record  = 0x001b;               # Record identifier
-    my $cbrk    = scalar @breaks;       # Number of page breaks
-    my $length  = 2 + 6*$cbrk;          # Bytes to follow
-
-
-    my $header  = pack("vv",  $record, $length);
-    my $data    = pack("v",   $cbrk);
-
-    # Append each page break
-    foreach my $break (@breaks) {
-        $data .= pack("vvv", $break, 0x0000, 0x00ff);
-    }
-
-    $self->_prepend($header, $data);
-}
-
-
-###############################################################################
-#
-# _store_vbreak()
-#
-# Write the VERTICALPAGEBREAKS BIFF record.
-#
-sub _store_vbreak {
-
-    my $self    = shift;
-
-    # Return if the user hasn't specified pagebreaks
-    return unless @{$self->{_vbreaks}};
-
-    # Sort and filter array of page breaks
-    my @breaks  = $self->_sort_pagebreaks(@{$self->{_vbreaks}});
-
-    my $record  = 0x001a;               # Record identifier
-    my $cbrk    = scalar @breaks;       # Number of page breaks
-    my $length  = 2 + 6*$cbrk;          # Bytes to follow
-
-
-    my $header  = pack("vv",  $record, $length);
-    my $data    = pack("v",   $cbrk);
-
-    # Append each page break
-    foreach my $break (@breaks) {
-        $data .= pack("vvv", $break, 0x0000, 0xffff);
-    }
-
-    $self->_prepend($header, $data);
-}
-
-
-###############################################################################
-#
-# _store_protect()
-#
-# Set the Biff PROTECT record to indicate that the worksheet is protected.
-#
-sub _store_protect {
-
-    my $self        = shift;
-
-    # Exit unless sheet protection has been specified
-    return unless $self->{_protect};
-
-    my $record      = 0x0012;               # Record identifier
-    my $length      = 0x0002;               # Bytes to follow
-
-    my $fLock       = $self->{_protect};    # Worksheet is protected
-
-    my $header      = pack("vv", $record, $length);
-    my $data        = pack("v",  $fLock);
-
-    $self->_prepend($header, $data);
-}
-
-
-###############################################################################
-#
-# _store_password()
-#
-# Write the worksheet PASSWORD record.
-#
-sub _store_password {
-
-    my $self        = shift;
-
-    # Exit unless sheet protection and password have been specified
-    return unless $self->{_protect} and defined $self->{_password};
-
-    my $record      = 0x0013;               # Record identifier
-    my $length      = 0x0002;               # Bytes to follow
-
-    my $wPassword   = $self->{_password};   # Encoded password
-
-    my $header      = pack("vv", $record, $length);
-    my $data        = pack("v",  $wPassword);
-
-    $self->_prepend($header, $data);
-}
-
-
-###############################################################################
-#
-# insert_bitmap($row, $col, $filename, $x, $y, $scale_x, $scale_y)
-#
-# Insert a 24bit bitmap image in a worksheet. The main record required is
-# IMDATA but it must be proceeded by a OBJ record to define its position.
-#
-sub insert_bitmap {
-
-    my $self        = shift;
-
-    # Check for a cell reference in A1 notation and substitute row and column
-    if ($_[0] =~ /^\D/) {
-        @_ = $self->_substitute_cellref(@_);
-    }
-
-    my $row         = $_[0];
-    my $col         = $_[1];
-    my $bitmap      = $_[2];
-    my $x           = $_[3] || 0;
-    my $y           = $_[4] || 0;
-    my $scale_x     = $_[5] || 1;
-    my $scale_y     = $_[6] || 1;
-
-    my ($width, $height, $size, $data) = $self-> _process_bitmap($bitmap);
-
-    # Scale the frame of the image.
-    $width  *= $scale_x;
-    $height *= $scale_y;
-
-    # Calculate the vertices of the image and write the OBJ record
-    $self->_position_image($col, $row, $x, $y, $width, $height);
-
-
-    # Write the IMDATA record to store the bitmap data
-    my $record      = 0x007f;
-    my $length      = 8 + $size;
-    my $cf          = 0x09;
-    my $env         = 0x01;
-    my $lcb         = $size;
-
-    my $header      = pack("vvvvV", $record, $length, $cf, $env, $lcb);
-
-    $self->_append($header, $data);
-}
-
-
-###############################################################################
-#
-#  _position_image()
-#
-# Calculate the vertices that define the position of the image as required by
-# the OBJ record.
-#
-#         +------------+------------+
-#         |     A      |      B     |
-#   +-----+------------+------------+
-#   |     |(x1,y1)     |            |
-#   |  1  |(A1)._______|______      |
-#   |     |    |              |     |
-#   |     |    |              |     |
-#   +-----+----|    BITMAP    |-----+
-#   |     |    |              |     |
-#   |  2  |    |______________.     |
-#   |     |            |        (B2)|
-#   |     |            |     (x2,y2)|
-#   +---- +------------+------------+
-#
-# Example of a bitmap that covers some of the area from cell A1 to cell B2.
-#
-# Based on the width and height of the bitmap we need to calculate 8 vars:
-#     $col_start, $row_start, $col_end, $row_end, $x1, $y1, $x2, $y2.
-# The width and height of the cells are also variable and have to be taken into
-# account.
-# The values of $col_start and $row_start are passed in from the calling
-# function. The values of $col_end and $row_end are calculated by subtracting
-# the width and height of the bitmap from the width and height of the
-# underlying cells.
-# The vertices are expressed as a percentage of the underlying cell width as
-# follows (rhs values are in pixels):
-#
-#       x1 = X / W *1024
-#       y1 = Y / H *256
-#       x2 = (X-1) / W *1024
-#       y2 = (Y-1) / H *256
-#
-#       Where:  X is distance from the left side of the underlying cell
-#               Y is distance from the top of the underlying cell
-#               W is the width of the cell
-#               H is the height of the cell
-#
-# Note: the SDK incorrectly states that the height should be expressed as a
-# percentage of 1024.
-#
-sub _position_image {
-
-    my $self = shift;
-
-    my $col_start;  # Col containing upper left corner of object
-    my $x1;         # Distance to left side of object
-
-    my $row_start;  # Row containing top left corner of object
-    my $y1;         # Distance to top of object
-
-    my $col_end;    # Col containing lower right corner of object
-    my $x2;         # Distance to right side of object
-
-    my $row_end;    # Row containing bottom right corner of object
-    my $y2;         # Distance to bottom of object
-
-    my $width;      # Width of image frame
-    my $height;     # Height of image frame
-
-    ($col_start, $row_start, $x1, $y1, $width, $height) = @_;
-
-
-    # Adjust start column for offsets that are greater than the col width
-    while ($x1 >= $self->_size_col($col_start)) {
-        $x1 -= $self->_size_col($col_start);
-        $col_start++;
-    }
-
-    # Adjust start row for offsets that are greater than the row height
-    while ($y1 >= $self->_size_row($row_start)) {
-        $y1 -= $self->_size_row($row_start);
-        $row_start++;
-    }
-
-
-    # Initialise end cell to the same as the start cell
-    $col_end    = $col_start;
-    $row_end    = $row_start;
-
-    $width      = $width  + $x1 -1;
-    $height     = $height + $y1 -1;
-
-
-    # Subtract the underlying cell widths to find the end cell of the image
-    while ($width >= $self->_size_col($col_end)) {
-        $width -= $self->_size_col($col_end);
-        $col_end++;
-    }
-
-    # Subtract the underlying cell heights to find the end cell of the image
-    while ($height >= $self->_size_row($row_end)) {
-        $height -= $self->_size_row($row_end);
-        $row_end++;
-    }
-
-    # Bitmap isn't allowed to start or finish in a hidden cell, i.e. a cell
-    # with zero eight or width.
-    #
-    return if $self->_size_col($col_start) == 0;
-    return if $self->_size_col($col_end)   == 0;
-    return if $self->_size_row($row_start) == 0;
-    return if $self->_size_row($row_end)   == 0;
-
-    # Convert the pixel values to the percentage value expected by Excel
-    $x1 = $x1     / $self->_size_col($col_start)   * 1024;
-    $y1 = $y1     / $self->_size_row($row_start)   *  256;
-    $x2 = $width  / $self->_size_col($col_end)     * 1024;
-    $y2 = $height / $self->_size_row($row_end)     *  256;
-
-    $self->_store_obj_picture(  $col_start, $x1,
-                                $row_start, $y1,
-                                $col_end, $x2,
-                                $row_end, $y2
-                             );
-}
-
-
-###############################################################################
-#
-# _size_col($col)
-#
-# Convert the width of a cell from user's units to pixels. Excel rounds the
-# column width to the nearest pixel. If the width hasn't been set by the user
-# we use the default value. If the column is hidden we use a value of zero.
-#
-sub _size_col {
-
-    my $self = shift;
-    my $col  = $_[0];
-
-    # Look up the cell value to see if it has been changed
-    if (exists $self->{_col_sizes}->{$col}) {
-        my $width = $self->{_col_sizes}->{$col};
-
-        # The relationship is different for user units less than 1.
-        if ($width < 1) {
-            return int($width *12);
-        }
-        else {
-            return int($width *7 ) +5;
-        }
-    }
-    else {
-        return 64;
-    }
-}
-
-
-###############################################################################
-#
-# _size_row($row)
-#
-# Convert the height of a cell from user's units to pixels. By interpolation
-# the relationship is: y = 4/3x. If the height hasn't been set by the user we
-# use the default value. If the row is hidden we use a value of zero. (Not
-# possible to hide row yet).
-#
-sub _size_row {
-
-    my $self = shift;
-    my $row  = $_[0];
-
-    # Look up the cell value to see if it has been changed
-    if (exists $self->{_row_sizes}->{$row}) {
-        if ($self->{_row_sizes}->{$row} == 0) {
-            return 0;
-        }
-        else {
-            return int (4/3 * $self->{_row_sizes}->{$row});
-        }
-    }
-    else {
-        return 17;
-    }
-}
-
-
-###############################################################################
-#
-# _store_obj_picture(   $col_start, $x1,
-#                       $row_start, $y1,
-#                       $col_end,   $x2,
-#                       $row_end,   $y2 )
-#
-# Store the OBJ record that precedes an IMDATA record. This could be generalise
-# to support other Excel objects.
-#
-sub _store_obj_picture {
-
-    my $self        = shift;
-
-    my $record      = 0x005d;   # Record identifier
-    my $length      = 0x003c;   # Bytes to follow
-
-    my $cObj        = 0x0001;   # Count of objects in file (set to 1)
-    my $OT          = 0x0008;   # Object type. 8 = Picture
-    my $id          = 0x0001;   # Object ID
-    my $grbit       = 0x0614;   # Option flags
-
-    my $colL        = $_[0];    # Col containing upper left corner of object
-    my $dxL         = $_[1];    # Distance from left side of cell
-
-    my $rwT         = $_[2];    # Row containing top left corner of object
-    my $dyT         = $_[3];    # Distance from top of cell
-
-    my $colR        = $_[4];    # Col containing lower right corner of object
-    my $dxR         = $_[5];    # Distance from right of cell
-
-    my $rwB         = $_[6];    # Row containing bottom right corner of object
-    my $dyB         = $_[7];    # Distance from bottom of cell
-
-    my $cbMacro     = 0x0000;   # Length of FMLA structure
-    my $Reserved1   = 0x0000;   # Reserved
-    my $Reserved2   = 0x0000;   # Reserved
-
-    my $icvBack     = 0x09;     # Background colour
-    my $icvFore     = 0x09;     # Foreground colour
-    my $fls         = 0x00;     # Fill pattern
-    my $fAuto       = 0x00;     # Automatic fill
-    my $icv         = 0x08;     # Line colour
-    my $lns         = 0xff;     # Line style
-    my $lnw         = 0x01;     # Line weight
-    my $fAutoB      = 0x00;     # Automatic border
-    my $frs         = 0x0000;   # Frame style
-    my $cf          = 0x0009;   # Image format, 9 = bitmap
-    my $Reserved3   = 0x0000;   # Reserved
-    my $cbPictFmla  = 0x0000;   # Length of FMLA structure
-    my $Reserved4   = 0x0000;   # Reserved
-    my $grbit2      = 0x0001;   # Option flags
-    my $Reserved5   = 0x0000;   # Reserved
-
-
-    my $header      = pack("vv", $record, $length);
-    my $data        = pack("V",  $cObj);
-       $data       .= pack("v",  $OT);
-       $data       .= pack("v",  $id);
-       $data       .= pack("v",  $grbit);
-       $data       .= pack("v",  $colL);
-       $data       .= pack("v",  $dxL);
-       $data       .= pack("v",  $rwT);
-       $data       .= pack("v",  $dyT);
-       $data       .= pack("v",  $colR);
-       $data       .= pack("v",  $dxR);
-       $data       .= pack("v",  $rwB);
-       $data       .= pack("v",  $dyB);
-       $data       .= pack("v",  $cbMacro);
-       $data       .= pack("V",  $Reserved1);
-       $data       .= pack("v",  $Reserved2);
-       $data       .= pack("C",  $icvBack);
-       $data       .= pack("C",  $icvFore);
-       $data       .= pack("C",  $fls);
-       $data       .= pack("C",  $fAuto);
-       $data       .= pack("C",  $icv);
-       $data       .= pack("C",  $lns);
-       $data       .= pack("C",  $lnw);
-       $data       .= pack("C",  $fAutoB);
-       $data       .= pack("v",  $frs);
-       $data       .= pack("V",  $cf);
-       $data       .= pack("v",  $Reserved3);
-       $data       .= pack("v",  $cbPictFmla);
-       $data       .= pack("v",  $Reserved4);
-       $data       .= pack("v",  $grbit2);
-       $data       .= pack("V",  $Reserved5);
-
-    $self->_append($header, $data);
-}
-
-
-###############################################################################
-#
-# _process_bitmap()
-#
-# Convert a 24 bit bitmap into the modified internal format used by Windows.
-# This is described in BITMAPCOREHEADER and BITMAPCOREINFO structures in the
-# MSDN library.
-#
-sub _process_bitmap {
-
-    my $self   = shift;
-    my $bitmap = shift;
-
-    # Open file and binmode the data in case the platform needs it.
-    my $fh = FileHandle->new($bitmap);
-    croak "Couldn't import $bitmap: $!" unless defined $fh;
-    binmode $fh;
-
-
-    # Slurp the file into a string.
-    my $data = do {local $/; <$fh>};
-
-    $fh->close;
-
-    # Check that the file is big enough to be a bitmap.
-    if (length $data <= 0x36) {
-        croak "$bitmap doesn't contain enough data.";
-    }
-
-
-    # The first 2 bytes are used to identify the bitmap.
-    if (unpack("A2", $data) ne "BM") {
-        croak "$bitmap doesn't appear to be a valid bitmap image.";
-    }
-
-
-    # Remove bitmap data: ID.
-    $data = substr $data, 2;
-
-
-    # Read and remove the bitmap size. This is more reliable than reading
-    # the data size at offset 0x22.
-    #
-    my $size   =  unpack "V", substr $data, 0, 4, "";
-       $size  -=  0x36;   # Subtract size of bitmap header.
-       $size  +=  0x0C;   # Add size of BIFF header.
-
-
-    # Remove bitmap data: reserved, offset, header length.
-    $data = substr $data, 12;
-
-
-    # Read and remove the bitmap width and height. Verify the sizes.
-    my ($width, $height) = unpack "V2", substr $data, 0, 8, "";
-
-    if ($width > 0xFFFF) {
-        croak "$bitmap: largest image width supported is 65k.";
-    }
-
-    if ($height > 0xFFFF) {
-        croak "$bitmap: largest image height supported is 65k.";
-    }
-
-    # Read and remove the bitmap planes and bpp data. Verify them.
-    my ($planes, $bitcount) = unpack "v2", substr $data, 0, 4, "";
-
-    if ($bitcount != 24) {
-        croak "$bitmap isn't a 24bit true color bitmap.";
-    }
-
-    if ($planes != 1) {
-        croak "$bitmap: only 1 plane supported in bitmap image.";
-    }
-
-
-    # Read and remove the bitmap compression. Verify compression.
-    my $compression = unpack "V", substr $data, 0, 4, "";
-
-    if ($compression != 0) {
-        croak "$bitmap: compression not supported in bitmap image.";
-    }
-
-    # Remove bitmap data: data size, hres, vres, colours, imp. colours.
-    $data = substr $data, 20;
-
-    # Add the BITMAPCOREHEADER data
-    my $header  = pack("Vvvvv", 0x000c, $width, $height, 0x01, 0x18);
-    $data       = $header . $data;
-
-    return ($width, $height, $size, $data);
-}
-
-
-###############################################################################
-#
-# _store_zoom($zoom)
-#
-#
-# Store the window zoom factor. This should be a reduced fraction but for
-# simplicity we will store all fractions with a numerator of 100.
-#
-sub _store_zoom {
-
-    my $self        = shift;
-
-    # If scale is 100 we don't need to write a record
-    return if $self->{_zoom} == 100;
-
-    my $record      = 0x00A0;               # Record identifier
-    my $length      = 0x0004;               # Bytes to follow
-
-    my $header      = pack("vv", $record, $length   );
-    my $data        = pack("vv", $self->{_zoom}, 100);
-
-    $self->_append($header, $data);
-}
-
-
-###############################################################################
-#
-# write_unicode ($row, $col, $string, $format)
-#
-# Write a Unicode string to the specified row and column (zero indexed).
-# $format is optional.
-# Returns  0 : normal termination
-#         -1 : insufficient number of arguments
-#         -2 : row or column out of range
-#         -3 : long string truncated to 255 chars
-#
-sub write_unicode {
-
-    my $self = shift;
-
-    # Check for a cell reference in A1 notation and substitute row and column
-    if ($_[0] =~ /^\D/) {
-        @_ = $self->_substitute_cellref(@_);
-    }
-
-    if (@_ < 3) { return -1 }                        # Check the number of args
-
-    my $record      = 0x00FD;                        # Record identifier
-    my $length      = 0x000A;                        # Bytes to follow
-
-    my $row         = $_[0];                         # Zero indexed row
-    my $col         = $_[1];                         # Zero indexed column
-    my $strlen      = length($_[2]);
-    my $str         = $_[2];
-    my $xf          = _XF($self, $row, $col, $_[3]); # The cell format
-    my $encoding    = 0x1;
-    my $str_error   = 0;
-
-    # Check that row and col are valid and store max and min values
-    return -2 if $self->_check_dimensions($row, $col);
-
-    # TODO This should probably be the number of chars and not bytes. check.
-    if ($strlen > 32766) {
-        $str       = substr($str, 0, 32766);
-        $str_error = -3;
-    }
-
-
-    my $num_bytes = length $str;
-    my $num_chars = int($num_bytes / 2);
-
-
-    # Check for a valid 2-byte char string.
-    croak "Uneven number of bytes in Unicode string" if $num_bytes % 2;
-
-
-    # Change from UTF16 big-endian to little endian
-    $str = pack "v*", unpack "n*", $str;
-
-
-    # Add the encoding and length header to the string.
-    my $str_header  = pack("vC", $num_chars, $encoding);
-    $str            = $str_header . $str;
-
-
-    if (not exists ${$self->{_str_table}}->{$str}) {
-        ${$self->{_str_table}}->{$str} = ${$self->{_str_unique}}++;
-    }
-
-
-    ${$self->{_str_total}}++;
-
-
-    my $header = pack("vv",   $record, $length);
-    my $data   = pack("vvvV", $row, $col, $xf, ${$self->{_str_table}}->{$str});
-
-    $self->_append($header, $data);
-
-    return $str_error;
-}
-
-
-
-###############################################################################
-#
-# write_unicode_le ($row, $col, $string, $format)
-#
-# Write a Unicode string to the specified row and column (zero indexed).
-# $format is optional.
-# Returns  0 : normal termination
-#         -1 : insufficient number of arguments
-#         -2 : row or column out of range
-#         -3 : long string truncated to 255 chars
-#
-# TODO Refactor. Too much code share with write_unicode().
-#
-sub write_unicode_le {
-
-    my $self = shift;
-
-    # Check for a cell reference in A1 notation and substitute row and column
-    if ($_[0] =~ /^\D/) {
-        @_ = $self->_substitute_cellref(@_);
-    }
-
-    if (@_ < 3) { return -1 }                        # Check the number of args
-
-    my $record      = 0x00FD;                        # Record identifier
-    my $length      = 0x000A;                        # Bytes to follow
-
-    my $row         = $_[0];                         # Zero indexed row
-    my $col         = $_[1];                         # Zero indexed column
-    my $strlen      = length($_[2]);
-    my $str         = $_[2];
-    my $xf          = _XF($self, $row, $col, $_[3]); # The cell format
-    my $encoding    = 0x1;
-    my $str_error   = 0;
-
-    # Check that row and col are valid and store max and min values
-    return -2 if $self->_check_dimensions($row, $col);
-
-    # TODO This should probably be the number of chars and not bytes. check.
-    if ($strlen > 32766) {
-        $str       = substr($str, 0, 32766);
-        $str_error = -3;
-    }
-
-
-    my $num_bytes = length $str;
-    my $num_chars = int($num_bytes / 2);
-
-
-    # Check for a valid 2-byte char string.
-    croak "Uneven number of bytes in Unicode string" if $num_bytes % 2;
-
-    # Add the encoding and length header to the string.
-    my $str_header  = pack("vC", $num_chars, $encoding);
-       $str         = $str_header . $str;
-
-
-    if (not exists ${$self->{_str_table}}->{$str}) {
-        ${$self->{_str_table}}->{$str} = ${$self->{_str_unique}}++;
-    }
-
-
-    ${$self->{_str_total}}++;
-
-
-    my $header = pack("vv",   $record, $length);
-    my $data   = pack("vvvV", $row, $col, $xf, ${$self->{_str_table}}->{$str});
-
-    $self->_append($header, $data);
-
-    return $str_error;
-}
-
-
-1;
-
-
-__END__
-
-
-=head1 NAME
-
-Worksheet - A writer class for Excel Worksheets.
-
-=head1 SYNOPSIS
-
-See the documentation for Spreadsheet::WriteExcel
-
-=head1 DESCRIPTION
-
-This module is used in conjunction with Spreadsheet::WriteExcel.
-
-=head1 AUTHOR
-
-John McNamara jmcnamara at cpan.org
-
-=head1 COPYRIGHT
-
-© MM-MMV, John McNamara.
-
-All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.
-
+package Spreadsheet::WriteExcel::Worksheet;
+
+###############################################################################
+#
+# Worksheet - A writer class for Excel Worksheets.
+#
+#
+# Used in conjunction with Spreadsheet::WriteExcel
+#
+# Copyright 2000-2006, John McNamara, jmcnamara at cpan.org
+#
+# Documentation after __END__
+#
+
+use Exporter;
+use strict;
+use Carp;
+use Spreadsheet::WriteExcel::BIFFwriter;
+use Spreadsheet::WriteExcel::Format;
+use Spreadsheet::WriteExcel::Formula;
+
+
+
+use vars qw($VERSION @ISA);
+ at ISA = qw(Spreadsheet::WriteExcel::BIFFwriter);
+
+$VERSION = '2.16';
+
+###############################################################################
+#
+# new()
+#
+# Constructor. Creates a new Worksheet object from a BIFFwriter object
+#
+sub new {
+
+    my $class                       = shift;
+    my $self                        = Spreadsheet::WriteExcel::BIFFwriter->new();
+    my $rowmax                      = 65536;
+    my $colmax                      = 256;
+    my $strmax                      = 0;
+
+    $self->{_name}                  = $_[0];
+    $self->{_index}                 = $_[1];
+    $self->{_encoding}              = $_[2];
+    $self->{_activesheet}           = $_[3];
+    $self->{_firstsheet}            = $_[4];
+    $self->{_url_format}            = $_[5];
+    $self->{_parser}                = $_[6];
+    $self->{_tempdir}               = $_[7];
+
+    $self->{_str_total}             = $_[8];
+    $self->{_str_unique}            = $_[9];
+    $self->{_str_table}             = $_[10];
+    $self->{_1904}                  = $_[11];
+
+    $self->{_type}                  = 0x0000;
+    $self->{_ext_sheets}            = [];
+    $self->{_using_tmpfile}         = 1;
+    $self->{_filehandle}            = "";
+    $self->{_fileclosed}            = 0;
+    $self->{_offset}                = 0;
+    $self->{_xls_rowmax}            = $rowmax;
+    $self->{_xls_colmax}            = $colmax;
+    $self->{_xls_strmax}            = $strmax;
+    $self->{_dim_rowmin}            = $rowmax +1;
+    $self->{_dim_rowmax}            = 0;
+    $self->{_dim_colmin}            = $colmax +1;
+    $self->{_dim_colmax}            = 0;
+    $self->{_dim_changed}           = 0;
+    $self->{_colinfo}               = [];
+    $self->{_selection}             = [0, 0];
+    $self->{_panes}                 = [];
+    $self->{_active_pane}           = 3;
+    $self->{_frozen}                = 0;
+    $self->{_selected}              = 0;
+    $self->{_hidden}                = 0;
+    $self->{_active}                = 0;
+
+    $self->{_first_row}             = 0;
+    $self->{_first_col}             = 0;
+    $self->{_display_formulas}      = 0;
+    $self->{_display_headers}       = 1;
+    $self->{_display_zeros}         = 1;
+    $self->{_display_arabic}        = 0;
+
+    $self->{_paper_size}            = 0x0;
+    $self->{_orientation}           = 0x1;
+    $self->{_header}                = '';
+    $self->{_footer}                = '';
+    $self->{_header_encoding}       = 0;
+    $self->{_footer_encoding}       = 0;
+    $self->{_hcenter}               = 0;
+    $self->{_vcenter}               = 0;
+    $self->{_margin_header}         = 0.50;
+    $self->{_margin_footer}         = 0.50;
+    $self->{_margin_left}           = 0.75;
+    $self->{_margin_right}          = 0.75;
+    $self->{_margin_top}            = 1.00;
+    $self->{_margin_bottom}         = 1.00;
+
+    $self->{_title_rowmin}          = undef;
+    $self->{_title_rowmax}          = undef;
+    $self->{_title_colmin}          = undef;
+    $self->{_title_colmax}          = undef;
+    $self->{_print_rowmin}          = undef;
+    $self->{_print_rowmax}          = undef;
+    $self->{_print_colmin}          = undef;
+    $self->{_print_colmax}          = undef;
+
+    $self->{_print_gridlines}       = 1;
+    $self->{_screen_gridlines}      = 1;
+    $self->{_print_headers}         = 0;
+
+    $self->{_page_order}            = 0;
+    $self->{_black_white}           = 0;
+    $self->{_draft_quality}         = 0;
+    $self->{_print_comments}        = 0;
+    $self->{_page_start}            = 1;
+
+    $self->{_fit_page}              = 0;
+    $self->{_fit_width}             = 0;
+    $self->{_fit_height}            = 0;
+
+    $self->{_hbreaks}               = [];
+    $self->{_vbreaks}               = [];
+
+    $self->{_protect}               = 0;
+    $self->{_password}              = undef;
+
+    $self->{_col_sizes}             = {};
+    $self->{_row_sizes}             = {};
+
+    $self->{_col_formats}           = {};
+    $self->{_row_formats}           = {};
+
+    $self->{_zoom}                  = 100;
+    $self->{_print_scale}           = 100;
+
+    $self->{_leading_zeros}         = 0;
+
+    $self->{_outline_row_level}     = 0;
+    $self->{_outline_style}         = 0;
+    $self->{_outline_below}         = 1;
+    $self->{_outline_right}         = 1;
+    $self->{_outline_on}            = 1;
+
+    $self->{_write_match}           = [];
+    $self->{_comments}              = {};
+    $self->{_comments_ids}          = [];
+    $self->{_comments_author}       = '';
+    $self->{_comments_author_enc}   = 0;
+    $self->{_comments_visible}      = 0;
+
+    $self->{_writing_url}           = 0;
+
+
+    bless $self, $class;
+    $self->_initialize();
+    return $self;
+}
+
+
+###############################################################################
+#
+# _initialize()
+#
+# Open a tmp file to store the majority of the Worksheet data. If this fails,
+# for example due to write permissions, store the data in memory. This can be
+# slow for large files.
+#
+sub _initialize {
+
+    my $self = shift;
+    my $fh;
+    my $tmp_dir;
+
+    # The following code is complicated by Windows limitations. Porters can
+    # choose a more direct method.
+
+
+
+    # In the default case we use IO::File->new_tmpfile(). This may fail, in
+    # particular with IIS on Windows, so we allow the user to specify a temp
+    # directory via File::Temp.
+    #
+    if (defined $self->{_tempdir}) {
+
+        # Delay loading File:Temp to reduce the module dependencies.
+        eval { require File::Temp };
+        die "The File::Temp module must be installed in order ".
+            "to call set_tempdir().\n" if $@;
+
+
+        # Trap but ignore File::Temp errors.
+        eval { $fh = File::Temp::tempfile(DIR => $self->{_tempdir}) };
+
+        # Store the failed tmp dir in case of errors.
+        $tmp_dir = $self->{_tempdir} || File::Spec->tmpdir if not $fh;
+    }
+    else {
+
+        $fh = IO::File->new_tmpfile();
+
+        # Store the failed tmp dir in case of errors.
+        $tmp_dir = "POSIX::tmpnam() directory" if not $fh;
+    }
+
+
+    # Check if the temp file creation was successful. Else store data in memory.
+    if ($fh) {
+
+        # binmode file whether platform requires it or not.
+        binmode($fh);
+
+        # Store filehandle
+        $self->{_filehandle} = $fh;
+    }
+    else {
+
+        # Set flag to store data in memory if XX::tempfile() failed.
+        $self->{_using_tmpfile} = 0;
+
+        if ($self->{_index} == 0 && $^W) {
+            my $dir = $self->{_tempdir} || File::Spec->tmpdir();
+
+            warn "Unable to create temp files in $tmp_dir. Data will be ".
+                 "stored in memory. Refer to set_tempdir() in the ".
+                 "Spreadsheet::WriteExcel documentation.\n" ;
+        }
+    }
+}
+
+
+###############################################################################
+#
+# _close()
+#
+# Add data to the beginning of the workbook (note the reverse order)
+# and to the end of the workbook.
+#
+sub _close {
+
+    my $self = shift;
+    my $sheetnames = shift;
+    my $num_sheets = scalar @$sheetnames;
+
+    ################################################
+    # Prepend in reverse order!!
+    #
+
+    # Prepend the sheet dimensions
+    $self->_store_dimensions();
+
+    # Prepend the COLINFO records if they exist
+    if (@{$self->{_colinfo}}){
+        my @colinfo = @{$self->{_colinfo}};
+        while (@colinfo) {
+            my $arrayref = pop @colinfo;
+            $self->_store_colinfo(@$arrayref);
+        }
+
+        # Add the DEFCOLWIDTH record
+        $self->_store_defcol();
+    }
+
+    # Prepend the sheet password
+    $self->_store_password();
+
+    # Prepend the sheet protection
+    $self->_store_protect();
+    $self->_store_obj_protect();
+
+    # Prepend the page setup
+    $self->_store_setup();
+
+    # Prepend the bottom margin
+    $self->_store_margin_bottom();
+
+    # Prepend the top margin
+    $self->_store_margin_top();
+
+    # Prepend the right margin
+    $self->_store_margin_right();
+
+    # Prepend the left margin
+    $self->_store_margin_left();
+
+    # Prepend the page vertical centering
+    $self->_store_vcenter();
+
+    # Prepend the page horizontal centering
+    $self->_store_hcenter();
+
+    # Prepend the page footer
+    $self->_store_footer();
+
+    # Prepend the page header
+    $self->_store_header();
+
+    # Prepend the vertical page breaks
+    $self->_store_vbreak();
+
+    # Prepend the horizontal page breaks
+    $self->_store_hbreak();
+
+    # Prepend WSBOOL
+    $self->_store_wsbool();
+
+    # Prepend GUTS
+    $self->_store_guts();
+
+    # Prepend GRIDSET
+    $self->_store_gridset();
+
+    # Prepend PRINTGRIDLINES
+    $self->_store_print_gridlines();
+
+    # Prepend PRINTHEADERS
+    $self->_store_print_headers();
+
+    # Prepend the BOF record
+    $self->_store_bof(0x0010);
+
+    #
+    # End of prepend. Read upwards from here.
+    ################################################
+
+    # Append
+    $self->_store_comments();
+    $self->_store_window2();
+    $self->_store_zoom();
+    $self->_store_panes(@{$self->{_panes}}) if @{$self->{_panes}};
+    $self->_store_selection(@{$self->{_selection}});
+    $self->_store_eof();
+}
+
+
+###############################################################################
+#
+# get_name().
+#
+# Retrieve the worksheet name.
+#
+sub get_name {
+
+    my $self    = shift;
+
+    return $self->{_name};
+}
+
+
+###############################################################################
+#
+# get_data().
+#
+# Retrieves data from memory in one chunk, or from disk in $buffer
+# sized chunks.
+#
+sub get_data {
+
+    my $self   = shift;
+    my $buffer = 4096;
+    my $tmp;
+
+    # Return data stored in memory
+    if (defined $self->{_data}) {
+        $tmp           = $self->{_data};
+        $self->{_data} = undef;
+        my $fh         = $self->{_filehandle};
+        seek($fh, 0, 0) if $self->{_using_tmpfile};
+        return $tmp;
+    }
+
+    # Return data stored on disk
+    if ($self->{_using_tmpfile}) {
+        return $tmp if read($self->{_filehandle}, $tmp, $buffer);
+    }
+
+    # No data to return
+    return undef;
+}
+
+
+###############################################################################
+#
+# select()
+#
+# Set this worksheet as a selected worksheet, i.e. the worksheet has its tab
+# highlighted.
+#
+sub select {
+
+    my $self = shift;
+
+    $self->{_hidden}         = 0; # Selected worksheet can't be hidden.
+    $self->{_selected}       = 1;
+}
+
+
+###############################################################################
+#
+# activate()
+#
+# Set this worksheet as the active worksheet, i.e. the worksheet that is
+# displayed when the workbook is opened. Also set it as selected.
+#
+sub activate {
+
+    my $self = shift;
+
+    $self->{_hidden}         = 0; # Active worksheet can't be hidden.
+    $self->{_selected}       = 1;
+    ${$self->{_activesheet}} = $self->{_index};
+}
+
+
+###############################################################################
+#
+# hide()
+#
+# Hide this worksheet.
+#
+sub hide {
+
+    my $self = shift;
+
+    $self->{_hidden}         = 1;
+
+    # A hidden worksheet shouldn't be active or selected.
+    $self->{_selected}       = 0;
+    ${$self->{_activesheet}} = 0;
+    ${$self->{_firstsheet}}  = 0;
+}
+
+
+###############################################################################
+#
+# set_first_sheet()
+#
+# Set this worksheet as the first visible sheet. This is necessary
+# when there are a large number of worksheets and the activated
+# worksheet is not visible on the screen.
+#
+sub set_first_sheet {
+
+    my $self = shift;
+
+    $self->{_hidden}         = 0; # Active worksheet can't be hidden.
+    ${$self->{_firstsheet}}  = $self->{_index};
+}
+
+
+###############################################################################
+#
+# protect($password)
+#
+# Set the worksheet protection flag to prevent accidental modification and to
+# hide formulas if the locked and hidden format properties have been set.
+#
+sub protect {
+
+    my $self = shift;
+
+    $self->{_protect}   = 1;
+    $self->{_password}  = $self->_encode_password($_[0]) if defined $_[0];
+
+}
+
+
+###############################################################################
+#
+# set_column($firstcol, $lastcol, $width, $format, $hidden, $level)
+#
+# Set the width of a single column or a range of columns.
+# See also: _store_colinfo
+#
+sub set_column {
+
+    my $self = shift;
+    my $cell = $_[0];
+
+    # Check for a cell reference in A1 notation and substitute row and column
+    if ($cell =~ /^\D/) {
+        @_ = $self->_substitute_cellref(@_);
+
+        # Returned values $row1 and $row2 aren't required here. Remove them.
+        shift  @_;       # $row1
+        splice @_, 1, 1; # $row2
+    }
+
+    push @{$self->{_colinfo}}, [ @_ ];
+
+
+    # Store the col sizes for use when calculating image vertices taking
+    # hidden columns into account. Also store the column formats.
+    #
+    return if @_ < 3; # Ensure at least $firstcol, $lastcol and $width
+
+    my $width  = $_[4] ? 0 : $_[2]; # Set width to zero if column is hidden
+    my $format = $_[3];
+
+    my ($firstcol, $lastcol) = @_;
+
+    foreach my $col ($firstcol .. $lastcol) {
+        $self->{_col_sizes}->{$col}   = $width;
+        $self->{_col_formats}->{$col} = $format if defined $format;
+    }
+}
+
+
+###############################################################################
+#
+# set_selection()
+#
+# Set which cell or cells are selected in a worksheet: see also the
+# sub _store_selection
+#
+sub set_selection {
+
+    my $self = shift;
+
+    # Check for a cell reference in A1 notation and substitute row and column
+    if ($_[0] =~ /^\D/) {
+        @_ = $self->_substitute_cellref(@_);
+    }
+
+    $self->{_selection} = [ @_ ];
+}
+
+
+###############################################################################
+#
+# freeze_panes()
+#
+# Set panes and mark them as frozen. See also _store_panes().
+#
+sub freeze_panes {
+
+    my $self = shift;
+
+    # Check for a cell reference in A1 notation and substitute row and column
+    if ($_[0] =~ /^\D/) {
+        @_ = $self->_substitute_cellref(@_);
+    }
+
+    $self->{_frozen} = 1;
+    $self->{_panes}  = [ @_ ];
+}
+
+
+###############################################################################
+#
+# thaw_panes()
+#
+# Set panes and mark them as unfrozen. See also _store_panes().
+#
+sub thaw_panes {
+
+    my $self = shift;
+
+    $self->{_frozen} = 0;
+    $self->{_panes}  = [ @_ ];
+}
+
+
+###############################################################################
+#
+# set_portrait()
+#
+# Set the page orientation as portrait.
+#
+sub set_portrait {
+
+    my $self = shift;
+
+    $self->{_orientation} = 1;
+}
+
+
+###############################################################################
+#
+# set_landscape()
+#
+# Set the page orientation as landscape.
+#
+sub set_landscape {
+
+    my $self = shift;
+
+    $self->{_orientation} = 0;
+}
+
+
+###############################################################################
+#
+# set_paper()
+#
+# Set the paper type. Ex. 1 = US Letter, 9 = A4
+#
+sub set_paper {
+
+    my $self = shift;
+
+    $self->{_paper_size} = $_[0] || 0;
+}
+
+
+###############################################################################
+#
+# set_header()
+#
+# Set the page header caption and optional margin.
+#
+sub set_header {
+
+    my $self     = shift;
+    my $string   = $_[0] || '';
+    my $margin   = $_[1] || 0.50;
+    my $encoding = $_[2] || 0;
+
+    # Handle utf8 strings in perl 5.8.
+    if ($] >= 5.008) {
+        require Encode;
+
+        if (Encode::is_utf8($string)) {
+            $string = Encode::encode("UTF-16BE", $string);
+            $encoding = 1;
+        }
+    }
+
+    my $limit    = $encoding ? 255 *2 : 255;
+
+    if (length $string >= $limit) {
+        carp 'Header string must be less than 255 characters';
+        return;
+    }
+
+    $self->{_header}          = $string;
+    $self->{_margin_header}   = $margin;
+    $self->{_header_encoding} = $encoding;
+}
+
+
+###############################################################################
+#
+# set_footer()
+#
+# Set the page footer caption and optional margin.
+#
+sub set_footer {
+
+    my $self     = shift;
+    my $string   = $_[0] || '';
+    my $margin   = $_[1] || 0.50;
+    my $encoding = $_[2] || 0;
+
+    # Handle utf8 strings in perl 5.8.
+    if ($] >= 5.008) {
+        require Encode;
+
+        if (Encode::is_utf8($string)) {
+            $string = Encode::encode("UTF-16BE", $string);
+            $encoding = 1;
+        }
+    }
+
+    my $limit    = $encoding ? 255 *2 : 255;
+
+
+    if (length $string >= $limit) {
+        carp 'Footer string must be less than 255 characters';
+        return;
+    }
+
+    $self->{_footer}          = $string;
+    $self->{_margin_footer}   = $margin;
+    $self->{_footer_encoding} = $encoding;
+}
+
+
+###############################################################################
+#
+# center_horizontally()
+#
+# Center the page horizontally.
+#
+sub center_horizontally {
+
+    my $self = shift;
+
+    if (defined $_[0]) {
+        $self->{_hcenter} = $_[0];
+    }
+    else {
+        $self->{_hcenter} = 1;
+    }
+}
+
+
+###############################################################################
+#
+# center_vertically()
+#
+# Center the page horinzontally.
+#
+sub center_vertically {
+
+    my $self = shift;
+
+    if (defined $_[0]) {
+        $self->{_vcenter} = $_[0];
+    }
+    else {
+        $self->{_vcenter} = 1;
+    }
+}
+
+
+###############################################################################
+#
+# set_margins()
+#
+# Set all the page margins to the same value in inches.
+#
+sub set_margins {
+
+    my $self = shift;
+
+    $self->set_margin_left($_[0]);
+    $self->set_margin_right($_[0]);
+    $self->set_margin_top($_[0]);
+    $self->set_margin_bottom($_[0]);
+}
+
+
+###############################################################################
+#
+# set_margins_LR()
+#
+# Set the left and right margins to the same value in inches.
+#
+sub set_margins_LR {
+
+    my $self = shift;
+
+    $self->set_margin_left($_[0]);
+    $self->set_margin_right($_[0]);
+}
+
+
+###############################################################################
+#
+# set_margins_TB()
+#
+# Set the top and bottom margins to the same value in inches.
+#
+sub set_margins_TB {
+
+    my $self = shift;
+
+    $self->set_margin_top($_[0]);
+    $self->set_margin_bottom($_[0]);
+}
+
+
+###############################################################################
+#
+# set_margin_left()
+#
+# Set the left margin in inches.
+#
+sub set_margin_left {
+
+    my $self = shift;
+
+    $self->{_margin_left} = defined $_[0] ? $_[0] : 0.75;
+}
+
+
+###############################################################################
+#
+# set_margin_right()
+#
+# Set the right margin in inches.
+#
+sub set_margin_right {
+
+    my $self = shift;
+
+    $self->{_margin_right} = defined $_[0] ? $_[0] : 0.75;
+}
+
+
+###############################################################################
+#
+# set_margin_top()
+#
+# Set the top margin in inches.
+#
+sub set_margin_top {
+
+    my $self = shift;
+
+    $self->{_margin_top} = defined $_[0] ? $_[0] : 1.00;
+}
+
+
+###############################################################################
+#
+# set_margin_bottom()
+#
+# Set the bottom margin in inches.
+#
+sub set_margin_bottom {
+
+    my $self = shift;
+
+    $self->{_margin_bottom} = defined $_[0] ? $_[0] : 1.00;
+}
+
+
+###############################################################################
+#
+# repeat_rows($first_row, $last_row)
+#
+# Set the rows to repeat at the top of each printed page. See also the
+# _store_name_xxxx() methods in Workbook.pm.
+#
+sub repeat_rows {
+
+    my $self = shift;
+
+    $self->{_title_rowmin}  = $_[0];
+    $self->{_title_rowmax}  = $_[1] || $_[0]; # Second row is optional
+}
+
+
+###############################################################################
+#
+# repeat_columns($first_col, $last_col)
+#
+# Set the columns to repeat at the left hand side of each printed page.
+# See also the _store_names() methods in Workbook.pm.
+#
+sub repeat_columns {
+
+    my $self = shift;
+
+    # Check for a cell reference in A1 notation and substitute row and column
+    if ($_[0] =~ /^\D/) {
+        @_ = $self->_substitute_cellref(@_);
+
+        # Returned values $row1 and $row2 aren't required here. Remove them.
+        shift  @_;       # $row1
+        splice @_, 1, 1; # $row2
+    }
+
+    $self->{_title_colmin}  = $_[0];
+    $self->{_title_colmax}  = $_[1] || $_[0]; # Second col is optional
+}
+
+
+###############################################################################
+#
+# print_area($first_row, $first_col, $last_row, $last_col)
+#
+# Set the area of each worksheet that will be printed. See also the
+# _store_names() methods in Workbook.pm.
+#
+sub print_area {
+
+    my $self = shift;
+
+    # Check for a cell reference in A1 notation and substitute row and column
+    if ($_[0] =~ /^\D/) {
+        @_ = $self->_substitute_cellref(@_);
+    }
+
+    return if @_ != 4; # Require 4 parameters
+
+    $self->{_print_rowmin} = $_[0];
+    $self->{_print_colmin} = $_[1];
+    $self->{_print_rowmax} = $_[2];
+    $self->{_print_colmax} = $_[3];
+}
+
+
+###############################################################################
+#
+# hide_gridlines()
+#
+# Set the option to hide gridlines on the screen and the printed page.
+# There are two ways of doing this in the Excel BIFF format: The first is by
+# setting the DspGrid field of the WINDOW2 record, this turns off the screen
+# and subsequently the print gridline. The second method is to via the
+# PRINTGRIDLINES and GRIDSET records, this turns off the printed gridlines
+# only. The first method is probably sufficient for most cases. The second
+# method is supported for backwards compatibility. Porters take note.
+#
+sub hide_gridlines {
+
+    my $self   = shift;
+    my $option = $_[0];
+
+    $option = 1 unless defined $option; # Default to hiding printed gridlines
+
+    if ($option == 0) {
+        $self->{_print_gridlines}  = 1; # 1 = display, 0 = hide
+        $self->{_screen_gridlines} = 1;
+    }
+    elsif ($option == 1) {
+        $self->{_print_gridlines}  = 0;
+        $self->{_screen_gridlines} = 1;
+    }
+    else {
+        $self->{_print_gridlines}  = 0;
+        $self->{_screen_gridlines} = 0;
+    }
+}
+
+
+###############################################################################
+#
+# print_row_col_headers()
+#
+# Set the option to print the row and column headers on the printed page.
+# See also the _store_print_headers() method below.
+#
+sub print_row_col_headers {
+
+    my $self = shift;
+
+    if (defined $_[0]) {
+        $self->{_print_headers} = $_[0];
+    }
+    else {
+        $self->{_print_headers} = 1;
+    }
+}
+
+
+###############################################################################
+#
+# fit_to_pages($width, $height)
+#
+# Store the vertical and horizontal number of pages that will define the
+# maximum area printed. See also _store_setup() and _store_wsbool() below.
+#
+sub fit_to_pages {
+
+    my $self = shift;
+
+    $self->{_fit_page}      = 1;
+    $self->{_fit_width}     = $_[0] || 0;
+    $self->{_fit_height}    = $_[1] || 0;
+}
+
+
+###############################################################################
+#
+# set_h_pagebreaks(@breaks)
+#
+# Store the horizontal page breaks on a worksheet.
+#
+sub set_h_pagebreaks {
+
+    my $self = shift;
+
+    push @{$self->{_hbreaks}}, @_;
+}
+
+
+###############################################################################
+#
+# set_v_pagebreaks(@breaks)
+#
+# Store the vertical page breaks on a worksheet.
+#
+sub set_v_pagebreaks {
+
+    my $self = shift;
+
+    push @{$self->{_vbreaks}}, @_;
+}
+
+
+###############################################################################
+#
+# set_zoom($scale)
+#
+# Set the worksheet zoom factor.
+#
+sub set_zoom {
+
+    my $self  = shift;
+    my $scale = $_[0] || 100;
+
+    # Confine the scale to Excel's range
+    if ($scale < 10 or $scale > 400) {
+        carp "Zoom factor $scale outside range: 10 <= zoom <= 400";
+        $scale = 100;
+    }
+
+    $self->{_zoom} = int $scale;
+}
+
+
+###############################################################################
+#
+# set_print_scale($scale)
+#
+# Set the scale factor for the printed page.
+#
+sub set_print_scale {
+
+    my $self  = shift;
+    my $scale = $_[0] || 100;
+
+    # Confine the scale to Excel's range
+    if ($scale < 10 or $scale > 400) {
+        carp "Print scale $scale outside range: 10 <= zoom <= 400";
+        $scale = 100;
+    }
+
+    # Turn off "fit to page" option
+    $self->{_fit_page}    = 0;
+
+    $self->{_print_scale} = int $scale;
+}
+
+
+###############################################################################
+#
+# keep_leading_zeros()
+#
+# Causes the write() method to treat integers with a leading zero as a string.
+# This ensures that any leading zeros such, as in zip codes, are maintained.
+#
+sub keep_leading_zeros {
+
+    my $self = shift;
+
+    if (defined $_[0]) {
+        $self->{_leading_zeros} = $_[0];
+    }
+    else {
+        $self->{_leading_zeros} = 1;
+    }
+}
+
+
+###############################################################################
+#
+# show_comments()
+#
+# Make any comments in the worksheet visible.
+#
+sub show_comments {
+
+    my $self = shift;
+
+    $self->{_comments_visible} = defined $_[0] ? $_[0] : 1;
+}
+
+
+###############################################################################
+#
+# set_comments_author()
+#
+# Set the default author of the cell comments.
+#
+sub set_comments_author {
+
+    my $self = shift;
+
+    $self->{_comments_author}     = defined $_[0] ? $_[0] : '';
+    $self->{_comments_author_enc} =         $_[1] ? 1     : 0;
+}
+
+
+###############################################################################
+#
+# right_to_left()
+#
+# Display the worksheet right to left for some eastern versions of Excel.
+#
+sub right_to_left {
+
+    my $self = shift;
+
+    $self->{_display_arabic} = defined $_[0] ? $_[0] : 1;
+}
+
+
+###############################################################################
+#
+# hide_zero()
+#
+# Hide cell zero values.
+#
+sub hide_zero {
+
+    my $self = shift;
+
+    $self->{_display_zeros} = defined $_[0] ? not $_[0] : 0;
+}
+
+
+###############################################################################
+#
+# print_across()
+#
+# Set the order in which pages are printed.
+#
+sub print_across {
+
+    my $self = shift;
+
+    $self->{_page_order} = defined $_[0] ? $_[0] : 1;
+}
+
+
+###############################################################################
+#
+# set_first_row_column()
+#
+# Set the topmost and leftmost visible row and column.
+# TODO: Document this when tested fully for interaction with panes.
+#
+sub set_first_row_column {
+
+    my $self = shift;
+
+    my $row  = $_[0] || 0;
+    my $col  = $_[1] || 0;
+
+    $row = 65535 if $row > 65535;
+    $col = 255   if $col > 255;
+
+    $self->{_first_row} = $row;
+    $self->{_first_col} = $col;
+}
+
+
+###############################################################################
+#
+# add_write_handler($re, $code_ref)
+#
+# Allow the user to add their own matches and handlers to the write() method.
+#
+sub add_write_handler {
+
+    my $self = shift;
+
+    return unless @_ == 2;
+    return unless ref $_[1] eq 'CODE';
+
+    push @{$self->{_write_match}}, [ @_ ];
+}
+
+
+
+###############################################################################
+#
+# write($row, $col, $token, $format)
+#
+# Parse $token and call appropriate write method. $row and $column are zero
+# indexed. $format is optional.
+#
+# The write_url() methods have a flag to prevent recursion when writing a
+# string that looks like a url.
+#
+# Returns: return value of called subroutine
+#
+sub write {
+
+    my $self = shift;
+
+    # Check for a cell reference in A1 notation and substitute row and column
+    if ($_[0] =~ /^\D/) {
+        @_ = $self->_substitute_cellref(@_);
+    }
+
+    my $token = $_[2];
+
+    # Handle undefs as blanks
+    $token = '' unless defined $token;
+
+
+    # First try user defined matches.
+    for my $aref (@{$self->{_write_match}}) {
+        my $re  = $aref->[0];
+        my $sub = $aref->[1];
+
+        if ($token =~ /$re/) {
+            my $match = &$sub($self, @_);
+            return $match if defined $match;
+        }
+    }
+
+
+    # Match an array ref.
+    if (ref $token eq "ARRAY") {
+        return $self->write_row(@_);
+    }
+    # Match integer with leading zero(s)
+    elsif ($self->{_leading_zeros} and $token =~ /^0\d+$/) {
+        return $self->write_string(@_);
+    }
+    # Match number
+    elsif ($token =~ /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/) {
+        return $self->write_number(@_);
+    }
+    # Match http, https or ftp URL
+    elsif ($token =~ m|^[fh]tt?ps?://|    and not $self->{_writing_url}) {
+        return $self->write_url(@_);
+    }
+    # Match mailto:
+    elsif ($token =~ m/^mailto:/          and not $self->{_writing_url}) {
+        return $self->write_url(@_);
+    }
+    # Match internal or external sheet link
+    elsif ($token =~ m[^(?:in|ex)ternal:] and not $self->{_writing_url}) {
+        return $self->write_url(@_);
+    }
+    # Match formula
+    elsif ($token =~ /^=/) {
+        return $self->write_formula(@_);
+    }
+    # Match blank
+    elsif ($token eq '') {
+        splice @_, 2, 1; # remove the empty string from the parameter list
+        return $self->write_blank(@_);
+    }
+    else {
+        return $self->write_string(@_);
+    }
+}
+
+
+###############################################################################
+#
+# write_row($row, $col, $array_ref, $format)
+#
+# Write a row of data starting from ($row, $col). Call write_col() if any of
+# the elements of the array ref are in turn array refs. This allows the writing
+# of 1D or 2D arrays of data in one go.
+#
+# Returns: the first encountered error value or zero for no errors
+#
+sub write_row {
+
+    my $self = shift;
+
+
+    # Check for a cell reference in A1 notation and substitute row and column
+    if ($_[0] =~ /^\D/) {
+        @_ = $self->_substitute_cellref(@_);
+    }
+
+    # Catch non array refs passed by user.
+    if (ref $_[2] ne 'ARRAY') {
+        croak "Not an array ref in call to write_row()$!";
+    }
+
+    my $row     = shift;
+    my $col     = shift;
+    my $tokens  = shift;
+    my @options = @_;
+    my $error   = 0;
+    my $ret;
+
+    foreach my $token (@$tokens) {
+
+        # Check for nested arrays
+        if (ref $token eq "ARRAY") {
+            $ret = $self->write_col($row, $col, $token, @options);
+        } else {
+            $ret = $self->write    ($row, $col, $token, @options);
+        }
+
+        # Return only the first error encountered, if any.
+        $error ||= $ret;
+        $col++;
+    }
+
+    return $error;
+}
+
+
+###############################################################################
+#
+# write_col($row, $col, $array_ref, $format)
+#
+# Write a column of data starting from ($row, $col). Call write_row() if any of
+# the elements of the array ref are in turn array refs. This allows the writing
+# of 1D or 2D arrays of data in one go.
+#
+# Returns: the first encountered error value or zero for no errors
+#
+sub write_col {
+
+    my $self = shift;
+
+
+    # Check for a cell reference in A1 notation and substitute row and column
+    if ($_[0] =~ /^\D/) {
+        @_ = $self->_substitute_cellref(@_);
+    }
+
+    # Catch non array refs passed by user.
+    if (ref $_[2] ne 'ARRAY') {
+        croak "Not an array ref in call to write_row()$!";
+    }
+
+    my $row     = shift;
+    my $col     = shift;
+    my $tokens  = shift;
+    my @options = @_;
+    my $error   = 0;
+    my $ret;
+
+    foreach my $token (@$tokens) {
+
+        # write() will deal with any nested arrays
+        $ret = $self->write($row, $col, $token, @options);
+
+        # Return only the first error encountered, if any.
+        $error ||= $ret;
+        $row++;
+    }
+
+    return $error;
+}
+
+
+###############################################################################
+#
+# write_comment($row, $col, $comment)
+#
+# Write a comment to the specified row and column (zero indexed).
+#
+# Returns  0 : normal termination
+#         -1 : insufficient number of arguments
+#         -2 : row or column out of range
+#
+sub write_comment {
+
+    my $self = shift;
+
+
+    # Check for a cell reference in A1 notation and substitute row and column
+    if ($_[0] =~ /^\D/) {
+        @_ = $self->_substitute_cellref(@_);
+    }
+
+    if (@_ < 3) { return -1 } # Check the number of args
+
+
+    my $row = $_[0];
+    my $col = $_[1];
+
+    # Check for pairs of optional arguments, i.e. an odd number of args.
+    croak "Uneven number of additional arguments" unless @_ % 2;
+
+
+    # Check that row and col are valid and store max and min values
+    return -2 if $self->_check_dimensions($row, $col);
+
+
+    # We have to avoid duplicate comments in cells or else Excel will complain.
+    $self->{_comments}->{$row}->{$col} = [ $self->_comment_params(@_) ];
+
+}
+
+
+###############################################################################
+#
+# _XF()
+#
+# Returns an index to the XF record in the workbook.
+#
+# Note: this is a function, not a method.
+#
+sub _XF {
+
+    my $self   = $_[0];
+    my $row    = $_[1];
+    my $col    = $_[2];
+    my $format = $_[3];
+
+    my $error = "Error: refer to merge_range() in the documentation. " .
+                 "Can't use previously merged format in non-merged cell";
+
+    if (ref($format)) {
+        # Temp code to prevent merged formats in non-merged cells.
+        croak $error if $format->{_used_merge} == 1;
+        $format->{_used_merge} = -1;
+
+        return $format->get_xf_index();
+    }
+    elsif (exists $self->{_row_formats}->{$row}) {
+        # Temp code to prevent merged formats in non-merged cells.
+        croak $error if $self->{_row_formats}->{$row}->{_used_merge} == 1;
+        $self->{_row_formats}->{$row}->{_used_merge} = -1;
+
+        return $self->{_row_formats}->{$row}->get_xf_index();
+    }
+    elsif (exists $self->{_col_formats}->{$col}) {
+        # Temp code to prevent merged formats in non-merged cells.
+        croak $error if $self->{_col_formats}->{$col}->{_used_merge} == 1;
+        $self->{_col_formats}->{$col}->{_used_merge} = -1;
+
+        return $self->{_col_formats}->{$col}->get_xf_index();
+    }
+    else {
+        return 0x0F;
+    }
+}
+
+
+###############################################################################
+###############################################################################
+#
+# Internal methods
+#
+
+
+###############################################################################
+#
+# _append(), overloaded.
+#
+# Store Worksheet data in memory using the base class _append() or to a
+# temporary file, the default.
+#
+sub _append {
+
+    my $self = shift;
+    my $data = '';
+
+    if ($self->{_using_tmpfile}) {
+        $data = join('', @_);
+
+        # Add CONTINUE records if necessary
+        $data = $self->_add_continue($data) if length($data) > $self->{_limit};
+
+        # Protect print() from -l on the command line.
+        local $\ = undef;
+
+        print {$self->{_filehandle}} $data;
+        $self->{_datasize} += length($data);
+    }
+    else {
+        $data = $self->SUPER::_append(@_);
+    }
+
+    return $data;
+}
+
+
+###############################################################################
+#
+# _substitute_cellref()
+#
+# Substitute an Excel cell reference in A1 notation for  zero based row and
+# column values in an argument list.
+#
+# Ex: ("A4", "Hello") is converted to (3, 0, "Hello").
+#
+sub _substitute_cellref {
+
+    my $self = shift;
+    my $cell = uc(shift);
+
+    # Convert a column range: 'A:A' or 'B:G'.
+    # A range such as A:A is equivalent to A1:65536, so add rows as required
+    if ($cell =~ /\$?([A-I]?[A-Z]):\$?([A-I]?[A-Z])/) {
+        my ($row1, $col1) =  $self->_cell_to_rowcol($1 .'1');
+        my ($row2, $col2) =  $self->_cell_to_rowcol($2 .'65536');
+        return $row1, $col1, $row2, $col2, @_;
+    }
+
+    # Convert a cell range: 'A1:B7'
+    if ($cell =~ /\$?([A-I]?[A-Z]\$?\d+):\$?([A-I]?[A-Z]\$?\d+)/) {
+        my ($row1, $col1) =  $self->_cell_to_rowcol($1);
+        my ($row2, $col2) =  $self->_cell_to_rowcol($2);
+        return $row1, $col1, $row2, $col2, @_;
+    }
+
+    # Convert a cell reference: 'A1' or 'AD2000'
+    if ($cell =~ /\$?([A-I]?[A-Z]\$?\d+)/) {
+        my ($row1, $col1) =  $self->_cell_to_rowcol($1);
+        return $row1, $col1, @_;
+
+    }
+
+    croak("Unknown cell reference $cell");
+}
+
+
+###############################################################################
+#
+# _cell_to_rowcol($cell_ref)
+#
+# Convert an Excel cell reference in A1 notation to a zero based row and column
+# reference; converts C1 to (0, 2).
+#
+# Returns: row, column
+#
+sub _cell_to_rowcol {
+
+    my $self = shift;
+    my $cell = shift;
+
+    $cell =~ /\$?([A-I]?[A-Z])\$?(\d+)/;
+
+    my $col     = $1;
+    my $row     = $2;
+
+    # Convert base26 column string to number
+    # All your Base are belong to us.
+    my @chars = split //, $col;
+    my $expn  = 0;
+    $col      = 0;
+
+    while (@chars) {
+        my $char = pop(@chars); # LS char first
+        $col += (ord($char) -ord('A') +1) * (26**$expn);
+        $expn++;
+    }
+
+    # Convert 1-index to zero-index
+    $row--;
+    $col--;
+
+    return $row, $col;
+}
+
+
+###############################################################################
+#
+# _sort_pagebreaks()
+#
+#
+# This is an internal method that is used to filter elements of the array of
+# pagebreaks used in the _store_hbreak() and _store_vbreak() methods. It:
+#   1. Removes duplicate entries from the list.
+#   2. Sorts the list.
+#   3. Removes 0 from the list if present.
+#
+sub _sort_pagebreaks {
+
+    my $self= shift;
+
+    my %hash;
+    my @array;
+
+    @hash{@_} = undef;                       # Hash slice to remove duplicates
+    @array    = sort {$a <=> $b} keys %hash; # Numerical sort
+    shift @array if $array[0] == 0;          # Remove zero
+
+    # 1000 vertical pagebreaks appears to be an internal Excel 5 limit.
+    # It is slightly higher in Excel 97/200, approx. 1026
+    splice(@array, 1000) if (@array > 1000);
+
+    return @array
+}
+
+
+###############################################################################
+#
+# _encode_password($password)
+#
+# Based on the algorithm provided by Daniel Rentz of OpenOffice.
+#
+#
+sub _encode_password {
+
+    use integer;
+
+    my $self      = shift;
+    my $plaintext = $_[0];
+    my $password;
+    my $count;
+    my @chars;
+    my $i = 0;
+
+    $count = @chars = split //, $plaintext;
+
+    foreach my $char (@chars) {
+        my $low_15;
+        my $high_15;
+        $char     = ord($char) << ++$i;
+        $low_15   = $char & 0x7fff;
+        $high_15  = $char & 0x7fff << 15;
+        $high_15  = $high_15 >> 15;
+        $char     = $low_15 | $high_15;
+    }
+
+    $password  = 0x0000;
+    $password ^= $_ for @chars;
+    $password ^= $count;
+    $password ^= 0xCE4B;
+
+    return $password;
+}
+
+
+###############################################################################
+#
+# outline_settings($visible, $symbols_below, $symbols_right, $auto_style)
+#
+# This method sets the properties for outlining and grouping. The defaults
+# correspond to Excel's defaults.
+#
+sub outline_settings {
+
+    my $self                = shift;
+
+    $self->{_outline_on}    = defined $_[0] ? $_[0] : 1;
+    $self->{_outline_below} = defined $_[1] ? $_[1] : 1;
+    $self->{_outline_right} = defined $_[2] ? $_[2] : 1;
+    $self->{_outline_style} =         $_[3] || 0;
+
+    # Ensure this is a boolean vale for Window2
+    $self->{_outline_on}    = 1 if $self->{_outline_on};
+}
+
+
+
+
+###############################################################################
+###############################################################################
+#
+# BIFF RECORDS
+#
+
+
+###############################################################################
+#
+# write_number($row, $col, $num, $format)
+#
+# Write a double to the specified row and column (zero indexed).
+# An integer can be written as a double. Excel will display an
+# integer. $format is optional.
+#
+# Returns  0 : normal termination
+#         -1 : insufficient number of arguments
+#         -2 : row or column out of range
+#
+sub write_number {
+
+    my $self = shift;
+
+    # Check for a cell reference in A1 notation and substitute row and column
+    if ($_[0] =~ /^\D/) {
+        @_ = $self->_substitute_cellref(@_);
+    }
+
+    if (@_ < 3) { return -1 }                    # Check the number of args
+
+    my $record  = 0x0203;                        # Record identifier
+    my $length  = 0x000E;                        # Number of bytes to follow
+
+    my $row     = $_[0];                         # Zero indexed row
+    my $col     = $_[1];                         # Zero indexed column
+    my $num     = $_[2];
+    my $xf      = _XF($self, $row, $col, $_[3]); # The cell format
+
+    # Check that row and col are valid and store max and min values
+    return -2 if $self->_check_dimensions($row, $col);
+
+    my $header    = pack("vv",  $record, $length);
+    my $data      = pack("vvv", $row, $col, $xf);
+    my $xl_double = pack("d",   $num);
+
+    if ($self->{_byte_order}) { $xl_double = reverse $xl_double }
+
+    $self->_append($header, $data, $xl_double);
+
+    return 0;
+}
+
+
+###############################################################################
+#
+# write_string ($row, $col, $string, $format)
+#
+# Write a string to the specified row and column (zero indexed).
+# NOTE: there is an Excel 5 defined limit of 255 characters.
+# $format is optional.
+# Returns  0 : normal termination
+#         -1 : insufficient number of arguments
+#         -2 : row or column out of range
+#         -3 : long string truncated to 255 chars
+#
+sub write_string {
+
+    my $self = shift;
+
+    # Check for a cell reference in A1 notation and substitute row and column
+    if ($_[0] =~ /^\D/) {
+        @_ = $self->_substitute_cellref(@_);
+    }
+
+    if (@_ < 3) { return -1 }                        # Check the number of args
+
+    my $record      = 0x00FD;                        # Record identifier
+    my $length      = 0x000A;                        # Bytes to follow
+
+    my $row         = $_[0];                         # Zero indexed row
+    my $col         = $_[1];                         # Zero indexed column
+    my $strlen      = length($_[2]);
+    my $str         = $_[2];
+    my $xf          = _XF($self, $row, $col, $_[3]); # The cell format
+    my $encoding    = 0x0;
+    my $str_error   = 0;
+
+
+    # Handle utf8 strings in perl 5.8.
+    if ($] >= 5.008) {
+        require Encode;
+
+        if (Encode::is_utf8($str)) {
+            my $tmp = Encode::encode("UTF-16LE", $str);
+            return $self->write_unicode_le($row, $col, $tmp, $_[3]);
+        }
+    }
+
+
+    # Check that row and col are valid and store max and min values
+    return -2 if $self->_check_dimensions($row, $col);
+
+    # Limit the string to the max number of chars.
+    if ($strlen > 32767) {
+        $str       = substr($str, 0, 32767);
+        $str_error = -3;
+    }
+
+
+    # Preprend the string with the type.
+    my $str_header  = pack("vC", length($str), $encoding);
+    $str            = $str_header . $str;
+
+
+    if (not exists ${$self->{_str_table}}->{$str}) {
+        ${$self->{_str_table}}->{$str} = ${$self->{_str_unique}}++;
+    }
+
+
+    ${$self->{_str_total}}++;
+
+
+    my $header = pack("vv",   $record, $length);
+    my $data   = pack("vvvV", $row, $col, $xf, ${$self->{_str_table}}->{$str});
+
+    $self->_append($header, $data);
+
+    return $str_error;
+}
+
+
+###############################################################################
+#
+# write_blank($row, $col, $format)
+#
+# Write a blank cell to the specified row and column (zero indexed).
+# A blank cell is used to specify formatting without adding a string
+# or a number.
+#
+# A blank cell without a format serves no purpose. Therefore, we don't write
+# a BLANK record unless a format is specified. This is mainly an optimisation
+# for the write_row() and write_col() methods.
+#
+# Returns  0 : normal termination (including no format)
+#         -1 : insufficient number of arguments
+#         -2 : row or column out of range
+#
+sub write_blank {
+
+    my $self = shift;
+
+    # Check for a cell reference in A1 notation and substitute row and column
+    if ($_[0] =~ /^\D/) {
+        @_ = $self->_substitute_cellref(@_);
+    }
+
+    # Check the number of args
+    return -1 if @_ < 2;
+
+    # Don't write a blank cell unless it has a format
+    return 0 if not defined $_[2];
+
+
+    my $record  = 0x0201;                        # Record identifier
+    my $length  = 0x0006;                        # Number of bytes to follow
+
+    my $row     = $_[0];                         # Zero indexed row
+    my $col     = $_[1];                         # Zero indexed column
+    my $xf      = _XF($self, $row, $col, $_[2]); # The cell format
+
+    # Check that row and col are valid and store max and min values
+    return -2 if $self->_check_dimensions($row, $col);
+
+    my $header    = pack("vv",  $record, $length);
+    my $data      = pack("vvv", $row, $col, $xf);
+
+    $self->_append($header, $data);
+
+    return 0;
+}
+
+
+###############################################################################
+#
+# write_formula($row, $col, $formula, $format, $value)
+#
+# Write a formula to the specified row and column (zero indexed).
+# The textual representation of the formula is passed to the parser in
+# Formula.pm which returns a packed binary string.
+#
+# $format is optional.
+#
+# $value is an optional result of the formula that can be supplied by the user.
+#
+# Returns  0 : normal termination
+#         -1 : insufficient number of arguments
+#         -2 : row or column out of range
+#
+sub write_formula{
+
+    my $self = shift;
+
+    # Check for a cell reference in A1 notation and substitute row and column
+    if ($_[0] =~ /^\D/) {
+        @_ = $self->_substitute_cellref(@_);
+    }
+
+    if (@_ < 3) { return -1 }   # Check the number of args
+
+    my $record    = 0x0006;     # Record identifier
+    my $length;                 # Bytes to follow
+
+    my $row       = $_[0];      # Zero indexed row
+    my $col       = $_[1];      # Zero indexed column
+    my $formula   = $_[2];      # The formula text string
+    my $value     = $_[4];      # The formula text string
+
+
+    # Excel normally stores the last calculated value of the formula in $num.
+    # Clearly we are not in a position to calculate this a priori. Instead
+    # we set $num to zero and set the option flags in $grbit to ensure
+    # automatic calculation of the formula when the file is opened.
+
+    # As a workaround for some non-Excel apps we also allow the user to
+    # specify the result of the formula.
+    #
+    my $xf        = _XF($self, $row, $col, $_[3]);  # The cell format
+    my $chn       = 0x0000;                         # Must be zero
+    my $is_string = 0;                              # Formula evaluates to str
+    my $num;                                        # Current value of formula
+    my $grbit;                                      # Option flags
+
+    ($num, $grbit, $is_string) = $self->_encode_formula_result($value);
+
+
+    # Check that row and col are valid and store max and min values
+    return -2 if $self->_check_dimensions($row, $col);
+
+    # Strip the = sign at the beginning of the formula string
+    $formula    =~ s(^=)();
+
+    my $tmp     = $formula;
+
+    # Parse the formula using the parser in Formula.pm
+    my $parser  = $self->{_parser};
+
+    # In order to raise formula errors from the point of view of the calling
+    # program we use an eval block and re-raise the error from here.
+    #
+    eval { $formula = $parser->parse_formula($formula) };
+
+    if ($@) {
+        $@ =~ s/\n$//;  # Strip the \n used in the Formula.pm die()
+        croak $@;       # Re-raise the error
+    }
+
+
+    my $formlen = length($formula); # Length of the binary string
+       $length  = 0x16 + $formlen;  # Length of the record data
+
+    my $header  = pack("vv",    $record, $length);
+    my $data    = pack("vvv",   $row, $col, $xf);
+       $data   .= $num;
+       $data   .= pack("vVv",   $grbit, $chn, $formlen);
+
+    $self->_append($header, $data, $formula);
+
+    $self->_write_formula_string($value) if $is_string;
+
+    return 0;
+}
+###############################################################################
+#
+# _encode_formula_result()
+#
+# Encode the user supplied result for a formula.
+#
+sub _encode_formula_result{
+
+    my $self = shift;
+
+    my $value     = $_[0];      # Result to be encoded.
+    my $is_string = 0;          # Formula evaluates to str.
+    my $num;                    # Current value of formula.
+    my $grbit;                  # Option flags.
+
+    if (not defined $value) {
+        $grbit  = 0x03;
+        $num    = pack "d", 0;
+    }
+    else {
+        # The user specified the result of the formula. We turn off the recalc
+        # flag and check the result type.
+        $grbit  = 0x00;
+
+        if ($value =~ /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/) {
+            # Value is a number.
+            $num = pack "d", $value;
+        }
+        else {
+
+            my %bools = (
+                            'TRUE'    => [1,  1],
+                            'FALSE'   => [1,  0],
+                            '#NULL!'  => [2,  0],
+                            '#DIV/0!' => [2,  7],
+                            '#VALUE!' => [2, 15],
+                            '#REF!'   => [2, 23],
+                            '#NAME?'  => [2, 29],
+                            '#NUM!'   => [2, 36],
+                            '#N/A'    => [2, 42],
+                        );
+
+            if (exists $bools{$value}) {
+                # Value is a boolean.
+                $num = pack "vvvv", $bools{$value}->[0],
+                                    $bools{$value}->[1],
+                                    0,
+                                    0xFFFF;
+            }
+            else {
+                # Value is a string.
+                $num = pack "vvvv", 0,
+                                    0,
+                                    0,
+                                    0xFFFF;
+                $is_string = 1;
+            }
+        }
+    }
+
+    return ($num, $grbit, $is_string);
+}
+
+
+###############################################################################
+#
+# _write_formula_string()
+#
+# Write the string value when a formula evaluates to a string. The value cannot
+# be calculated by the module and thus must be supplied by the user.
+#
+sub _write_formula_string {
+
+    my $self = shift;
+
+    my $record    = 0x0207;         # Record identifier
+    my $length    = 0x00;           # Bytes to follow
+    my $string    = $_[0];          # Formula string.
+    my $strlen    = length $_[0];   # Length of the formula string (chars).
+    my $encoding  = 0;              # String encoding.
+
+
+    # Handle utf8 strings in perl 5.8.
+    if ($] >= 5.008) {
+        require Encode;
+
+        if (Encode::is_utf8($string)) {
+            $string = Encode::encode("UTF-16BE", $string);
+            $encoding = 1;
+        }
+    }
+
+
+    $length       = 0x03 + length $string;  # Length of the record data
+
+    my $header    = pack("vv", $record, $length);
+    my $data      = pack("vC", $strlen, $encoding);
+
+    $self->_append($header, $data, $string);
+
+    return 0;
+}
+
+
+###############################################################################
+#
+# store_formula($formula)
+#
+# Pre-parse a formula. This is used in conjunction with repeat_formula()
+# to repetitively rewrite a formula without re-parsing it.
+#
+sub store_formula{
+
+    my $self    = shift;
+    my $formula = $_[0];      # The formula text string
+
+    # Strip the = sign at the beginning of the formula string
+    $formula    =~ s(^=)();
+
+    # Parse the formula using the parser in Formula.pm
+    my $parser  = $self->{_parser};
+
+    # In order to raise formula errors from the point of view of the calling
+    # program we use an eval block and re-raise the error from here.
+    #
+    my @tokens;
+    eval { @tokens = $parser->parse_formula($formula) };
+
+    if ($@) {
+        $@ =~ s/\n$//;  # Strip the \n used in the Formula.pm die()
+        croak $@;       # Re-raise the error
+    }
+
+
+    # Return the parsed tokens in an anonymous array
+    return [@tokens];
+}
+
+
+###############################################################################
+#
+# repeat_formula($row, $col, $formula, $format, ($pattern => $replacement,...))
+#
+# Write a formula to the specified row and column (zero indexed) by
+# substituting $pattern $replacement pairs in the $formula created via
+# store_formula(). This allows the user to repetitively rewrite a formula
+# without the significant overhead of parsing.
+#
+# Returns  0 : normal termination
+#         -1 : insufficient number of arguments
+#         -2 : row or column out of range
+#
+sub repeat_formula {
+
+    my $self = shift;
+
+    # Check for a cell reference in A1 notation and substitute row and column
+    if ($_[0] =~ /^\D/) {
+        @_ = $self->_substitute_cellref(@_);
+    }
+
+    if (@_ < 2) { return -1 }   # Check the number of args
+
+    my $record      = 0x0006;   # Record identifier
+    my $length;                 # Bytes to follow
+
+    my $row         = shift;    # Zero indexed row
+    my $col         = shift;    # Zero indexed column
+    my $formula_ref = shift;    # Array ref with formula tokens
+    my $format      = shift;    # XF format
+    my @pairs       = @_;       # Pattern/replacement pairs
+
+
+    # Enforce an even number of arguments in the pattern/replacement list
+    croak "Odd number of elements in pattern/replacement list" if @pairs %2;
+
+    # Check that $formula is an array ref
+    croak "Not a valid formula" if ref $formula_ref ne 'ARRAY';
+
+    my @tokens  = @$formula_ref;
+
+    # Ensure that there are tokens to substitute
+    croak "No tokens in formula" unless @tokens;
+
+
+    # As a temporary and undocumented measure we allow the user to specify the
+    # result of the formula by appending a result => $value pair to the end
+    # of the arguments.
+    my $value = undef;
+    if ($pairs[-2] eq 'result') {
+        $value = pop @pairs;
+                 pop @pairs;
+    }
+
+
+    while (@pairs) {
+        my $pattern = shift @pairs;
+        my $replace = shift @pairs;
+
+        foreach my $token (@tokens) {
+            last if $token =~ s/$pattern/$replace/;
+        }
+    }
+
+
+    # Change the parameters in the formula cached by the Formula.pm object
+    my $parser    = $self->{_parser};
+    my $formula   = $parser->parse_tokens(@tokens);
+
+    croak "Unrecognised token in formula" unless defined $formula;
+
+
+    # Excel normally stores the last calculated value of the formula in $num.
+    # Clearly we are not in a position to calculate this a priori. Instead
+    # we set $num to zero and set the option flags in $grbit to ensure
+    # automatic calculation of the formula when the file is opened.
+
+    # As a workaround for some non-Excel apps we also allow the user to
+    # specify the result of the formula.
+    #
+    my $xf        = _XF($self, $row, $col, $format); # The cell format
+    my $chn       = 0x0000;                          # Must be zero
+    my $is_string = 0;                               # Formula evaluates to str
+    my $num;                                         # Current value of formula
+    my $grbit;                                       # Option flags
+
+    ($num, $grbit, $is_string) = $self->_encode_formula_result($value);
+
+    # Check that row and col are valid and store max and min values
+    return -2 if $self->_check_dimensions($row, $col);
+
+
+    my $formlen   = length($formula); # Length of the binary string
+    $length       = 0x16 + $formlen;  # Length of the record data
+
+    my $header    = pack("vv",    $record, $length);
+    my $data      = pack("vvv",   $row, $col, $xf);
+       $data     .= $num;
+       $data     .= pack("vVv",   $grbit, $chn, $formlen);
+
+
+    $self->_append($header, $data, $formula);
+
+    $self->_write_formula_string($value) if $is_string;
+
+    return 0;
+}
+
+
+###############################################################################
+#
+# write_url($row, $col, $url, $string, $format)
+#
+# Write a hyperlink. This is comprised of two elements: the visible label and
+# the invisible link. The visible label is the same as the link unless an
+# alternative string is specified.
+#
+# The parameters $string and $format are optional and their order is
+# interchangeable for backward compatibity reasons.
+#
+# The hyperlink can be to a http, ftp, mail, internal sheet, or external
+# directory url.
+#
+# Returns  0 : normal termination
+#         -1 : insufficient number of arguments
+#         -2 : row or column out of range
+#         -3 : long string truncated to 255 chars
+#
+sub write_url {
+
+    my $self = shift;
+
+    # Check for a cell reference in A1 notation and substitute row and column
+    if ($_[0] =~ /^\D/) {
+        @_ = $self->_substitute_cellref(@_);
+    }
+
+    # Check the number of args
+    return -1 if @_ < 3;
+
+    # Add start row and col to arg list
+    return $self->write_url_range($_[0], $_[1], @_);
+}
+
+
+###############################################################################
+#
+# write_url_range($row1, $col1, $row2, $col2, $url, $string, $format)
+#
+# This is the more general form of write_url(). It allows a hyperlink to be
+# written to a range of cells. This function also decides the type of hyperlink
+# to be written. These are either, Web (http, ftp, mailto), Internal
+# (Sheet1!A1) or external ('c:\temp\foo.xls#Sheet1!A1').
+#
+# See also write_url() above for a general description and return values.
+#
+sub write_url_range {
+
+    my $self = shift;
+
+    # Check for a cell reference in A1 notation and substitute row and column
+    if ($_[0] =~ /^\D/) {
+        @_ = $self->_substitute_cellref(@_);
+    }
+
+    # Check the number of args
+    return -1 if @_ < 5;
+
+
+    # Reverse the order of $string and $format if necessary. We work on a copy
+    # in order to protect the callers args. We don't use "local @_" in case of
+    # perl50005 threads.
+    #
+    my @args = @_;
+
+    ($args[5], $args[6]) = ($args[6], $args[5]) if ref $args[5];
+
+    my $url = $args[4];
+
+
+    # Check for internal/external sheet links or default to web link
+    return $self->_write_url_internal(@args) if $url =~ m[^internal:];
+    return $self->_write_url_external(@args) if $url =~ m[^external:];
+    return $self->_write_url_web(@args);
+}
+
+
+###############################################################################
+#
+# _write_url_web($row1, $col1, $row2, $col2, $url, $string, $format)
+#
+# Used to write http, ftp and mailto hyperlinks.
+# The link type ($options) is 0x03 is the same as absolute dir ref without
+# sheet. However it is differentiated by the $unknown2 data stream.
+#
+# See also write_url() above for a general description and return values.
+#
+sub _write_url_web {
+
+    my $self    = shift;
+
+    my $record      = 0x01B8;                       # Record identifier
+    my $length      = 0x00000;                      # Bytes to follow
+
+    my $row1        = $_[0];                        # Start row
+    my $col1        = $_[1];                        # Start column
+    my $row2        = $_[2];                        # End row
+    my $col2        = $_[3];                        # End column
+    my $url         = $_[4];                        # URL string
+    my $str         = $_[5];                        # Alternative label
+    my $xf          = $_[6] || $self->{_url_format};# The cell format
+
+
+    # Write the visible label but protect against url recursion in write().
+    $str                  = $url unless defined $str;
+    $self->{_writing_url} = 1;
+    my $error             = $self->write($row1, $col1, $str, $xf);
+    $self->{_writing_url} = 0;
+    return $error         if $error == -2;
+
+
+    # Pack the undocumented parts of the hyperlink stream
+    my $unknown1    = pack("H*", "D0C9EA79F9BACE118C8200AA004BA90B02000000");
+    my $unknown2    = pack("H*", "E0C9EA79F9BACE118C8200AA004BA90B");
+
+
+    # Pack the option flags
+    my $options     = pack("V", 0x03);
+
+    # Convert URL to a null terminated wchar string
+    $url            = join("\0", split('', $url));
+    $url            = $url . "\0\0\0";
+
+
+    # Pack the length of the URL
+    my $url_len     = pack("V", length($url));
+
+
+    # Calculate the data length
+    $length         = 0x34 + length($url);
+
+
+    # Pack the header data
+    my $header      = pack("vv",   $record, $length);
+    my $data        = pack("vvvv", $row1, $row2, $col1, $col2);
+
+
+    # Write the packed data
+    $self->_append( $header,
+                    $data,
+                    $unknown1,
+                    $options,
+                    $unknown2,
+                    $url_len,
+                    $url);
+
+    return $error;
+}
+
+
+###############################################################################
+#
+# _write_url_internal($row1, $col1, $row2, $col2, $url, $string, $format)
+#
+# Used to write internal reference hyperlinks such as "Sheet1!A1".
+#
+# See also write_url() above for a general description and return values.
+#
+sub _write_url_internal {
+
+    my $self    = shift;
+
+    my $record      = 0x01B8;                       # Record identifier
+    my $length      = 0x00000;                      # Bytes to follow
+
+    my $row1        = $_[0];                        # Start row
+    my $col1        = $_[1];                        # Start column
+    my $row2        = $_[2];                        # End row
+    my $col2        = $_[3];                        # End column
+    my $url         = $_[4];                        # URL string
+    my $str         = $_[5];                        # Alternative label
+    my $xf          = $_[6] || $self->{_url_format};# The cell format
+
+    # Strip URL type
+    $url            =~ s[^internal:][];
+
+
+    # Write the visible label but protect against url recursion in write().
+    $str                  = $url unless defined $str;
+    $self->{_writing_url} = 1;
+    my $error             = $self->write($row1, $col1, $str, $xf);
+    $self->{_writing_url} = 0;
+    return $error         if $error == -2;
+
+
+    # Pack the undocumented parts of the hyperlink stream
+    my $unknown1    = pack("H*", "D0C9EA79F9BACE118C8200AA004BA90B02000000");
+
+
+    # Pack the option flags
+    my $options     = pack("V", 0x08);
+
+
+    # URL encoding.
+    my $encoding    = 0;
+
+
+    # Convert an Utf8 URL type and to a null terminated wchar string.
+    if ($] >= 5.008) {
+        require Encode;
+
+        if (Encode::is_utf8($url)) {
+            # Quote sheet name if not already, i.e., Sheet!A1 to 'Sheet!A1'.
+            $url      =~ s/^(.+)!/'$1'!/ if not $url =~ /^'/;
+
+            $url      = Encode::encode("UTF-16LE", $url);
+            $url     .= "\0\0"; # URL is null terminated.
+            $encoding = 1;
+        }
+    }
+
+
+    # Convert an Ascii URL type and to a null terminated wchar string.
+    if ($encoding == 0) {
+        $url       .= "\0";
+        $url        = pack 'v*', unpack 'c*', $url;
+    }
+
+
+    # Pack the length of the URL as chars (not wchars)
+    my $url_len     = pack("V", int(length($url)/2));
+
+
+    # Calculate the data length
+    $length         = 0x24 + length($url);
+
+
+    # Pack the header data
+    my $header      = pack("vv",   $record, $length);
+    my $data        = pack("vvvv", $row1, $row2, $col1, $col2);
+
+
+    # Write the packed data
+    $self->_append( $header,
+                    $data,
+                    $unknown1,
+                    $options,
+                    $url_len,
+                    $url);
+
+    return $error;
+}
+
+
+###############################################################################
+#
+# _write_url_external($row1, $col1, $row2, $col2, $url, $string, $format)
+#
+# Write links to external directory names such as 'c:\foo.xls',
+# c:\foo.xls#Sheet1!A1', '../../foo.xls'. and '../../foo.xls#Sheet1!A1'.
+#
+# Note: Excel writes some relative links with the $dir_long string. We ignore
+# these cases for the sake of simpler code.
+#
+# See also write_url() above for a general description and return values.
+#
+sub _write_url_external {
+
+    my $self    = shift;
+
+    # Network drives are different. We will handle them separately
+    # MS/Novell network drives and shares start with \\
+    return $self->_write_url_external_net(@_) if $_[4] =~ m[^external:\\\\];
+
+
+    my $record      = 0x01B8;                       # Record identifier
+    my $length      = 0x00000;                      # Bytes to follow
+
+    my $row1        = $_[0];                        # Start row
+    my $col1        = $_[1];                        # Start column
+    my $row2        = $_[2];                        # End row
+    my $col2        = $_[3];                        # End column
+    my $url         = $_[4];                        # URL string
+    my $str         = $_[5];                        # Alternative label
+    my $xf          = $_[6] || $self->{_url_format};# The cell format
+
+
+    # Strip URL type and change Unix dir separator to Dos style (if needed)
+    #
+    $url            =~ s[^external:][];
+    $url            =~ s[/][\\]g;
+
+
+    # Write the visible label but protect against url recursion in write().
+    ($str = $url)         =~ s[\#][ - ] unless defined $str;
+    $self->{_writing_url} = 1;
+    my $error             = $self->write($row1, $col1, $str, $xf);
+    $self->{_writing_url} = 0;
+    return $error         if $error == -2;
+
+
+    # Determine if the link is relative or absolute:
+    # Absolute if link starts with DOS drive specifier like C:
+    # Otherwise default to 0x00 for relative link.
+    #
+    my $absolute    = 0x00;
+       $absolute    = 0x02  if $url =~ m/^[A-Za-z]:/;
+
+
+    # Determine if the link contains a sheet reference and change some of the
+    # parameters accordingly.
+    # Split the dir name and sheet name (if it exists)
+    #
+    my ($dir_long , $sheet) = split /\#/, $url;
+    my $link_type           = 0x01 | $absolute;
+    my $sheet_len;
+
+    if (defined $sheet) {
+        $link_type |= 0x08;
+        $sheet_len  = pack("V", length($sheet) + 0x01);
+        $sheet      = join("\0", split('', $sheet));
+        $sheet     .= "\0\0\0";
+    }
+    else {
+        $sheet_len  = '';
+        $sheet      = '';
+    }
+
+
+    # Pack the link type
+    $link_type      = pack("V", $link_type);
+
+
+    # Calculate the up-level dir count e.g. (..\..\..\ == 3)
+    my $up_count    = 0;
+    $up_count++       while $dir_long =~ s[^\.\.\\][];
+    $up_count       = pack("v", $up_count);
+
+
+    # Store the short dos dir name (null terminated)
+    my $dir_short   = $dir_long . "\0";
+
+
+    # Store the long dir name as a wchar string (non-null terminated)
+    $dir_long       = join("\0", split('', $dir_long));
+    $dir_long       = $dir_long . "\0";
+
+
+    # Pack the lengths of the dir strings
+    my $dir_short_len = pack("V", length $dir_short      );
+    my $dir_long_len  = pack("V", length $dir_long       );
+    my $stream_len    = pack("V", length($dir_long) + 0x06);
+
+
+    # Pack the undocumented parts of the hyperlink stream
+    my $unknown1 =pack("H*",'D0C9EA79F9BACE118C8200AA004BA90B02000000'       );
+    my $unknown2 =pack("H*",'0303000000000000C000000000000046'               );
+    my $unknown3 =pack("H*",'FFFFADDE000000000000000000000000000000000000000');
+    my $unknown4 =pack("v",  0x03                                            );
+
+
+    # Pack the main data stream
+    my $data        = pack("vvvv", $row1, $row2, $col1, $col2) .
+                      $unknown1     .
+                      $link_type    .
+                      $unknown2     .
+                      $up_count     .
+                      $dir_short_len.
+                      $dir_short    .
+                      $unknown3     .
+                      $stream_len   .
+                      $dir_long_len .
+                      $unknown4     .
+                      $dir_long     .
+                      $sheet_len    .
+                      $sheet        ;
+
+
+    # Pack the header data
+    $length         = length $data;
+    my $header      = pack("vv",   $record, $length);
+
+
+    # Write the packed data
+    $self->_append( $header, $data);
+
+    return $error;
+}
+
+
+
+
+###############################################################################
+#
+# _write_url_external_net($row1, $col1, $row2, $col2, $url, $string, $format)
+#
+# Write links to external MS/Novell network drives and shares such as
+# '//NETWORK/share/foo.xls' and '//NETWORK/share/foo.xls#Sheet1!A1'.
+#
+# See also write_url() above for a general description and return values.
+#
+sub _write_url_external_net {
+
+    my $self    = shift;
+
+    my $record      = 0x01B8;                       # Record identifier
+    my $length      = 0x00000;                      # Bytes to follow
+
+    my $row1        = $_[0];                        # Start row
+    my $col1        = $_[1];                        # Start column
+    my $row2        = $_[2];                        # End row
+    my $col2        = $_[3];                        # End column
+    my $url         = $_[4];                        # URL string
+    my $str         = $_[5];                        # Alternative label
+    my $xf          = $_[6] || $self->{_url_format};# The cell format
+
+
+    # Strip URL type and change Unix dir separator to Dos style (if needed)
+    #
+    $url            =~ s[^external:][];
+    $url            =~ s[/][\\]g;
+
+
+    # Write the visible label but protect against url recursion in write().
+    ($str = $url)         =~ s[\#][ - ] unless defined $str;
+    $self->{_writing_url} = 1;
+    my $error             = $self->write($row1, $col1, $str, $xf);
+    $self->{_writing_url} = 0;
+    return $error         if $error == -2;
+
+
+    # Determine if the link contains a sheet reference and change some of the
+    # parameters accordingly.
+    # Split the dir name and sheet name (if it exists)
+    #
+    my ($dir_long , $sheet) = split /\#/, $url;
+    my $link_type           = 0x0103; # Always absolute
+    my $sheet_len;
+
+    if (defined $sheet) {
+        $link_type |= 0x08;
+        $sheet_len  = pack("V", length($sheet) + 0x01);
+        $sheet      = join("\0", split('', $sheet));
+        $sheet     .= "\0\0\0";
+    }
+    else {
+        $sheet_len   = '';
+        $sheet       = '';
+    }
+
+    # Pack the link type
+    $link_type      = pack("V", $link_type);
+
+
+    # Make the string null terminated
+    $dir_long       = $dir_long . "\0";
+
+
+    # Pack the lengths of the dir string
+    my $dir_long_len  = pack("V", length $dir_long);
+
+
+    # Store the long dir name as a wchar string (non-null terminated)
+    $dir_long       = join("\0", split('', $dir_long));
+    $dir_long       = $dir_long . "\0";
+
+
+    # Pack the undocumented part of the hyperlink stream
+    my $unknown1    = pack("H*",'D0C9EA79F9BACE118C8200AA004BA90B02000000');
+
+
+    # Pack the main data stream
+    my $data        = pack("vvvv", $row1, $row2, $col1, $col2) .
+                      $unknown1     .
+                      $link_type    .
+                      $dir_long_len .
+                      $dir_long     .
+                      $sheet_len    .
+                      $sheet        ;
+
+
+    # Pack the header data
+    $length         = length $data;
+    my $header      = pack("vv",   $record, $length);
+
+
+    # Write the packed data
+    $self->_append( $header, $data);
+
+    return $error;
+}
+
+
+###############################################################################
+#
+# write_date_time ($row, $col, $string, $format)
+#
+# Write a datetime string in ISO8601 "yyyy-mm-ddThh:mm:ss.ss" format as a
+# number representing an Excel date. $format is optional.
+#
+# Returns  0 : normal termination
+#         -1 : insufficient number of arguments
+#         -2 : row or column out of range
+#         -3 : Invalid date_time, written as string
+#
+sub write_date_time {
+
+    my $self = shift;
+
+    # Check for a cell reference in A1 notation and substitute row and column
+    if ($_[0] =~ /^\D/) {
+        @_ = $self->_substitute_cellref(@_);
+    }
+
+    if (@_ < 3) { return -1 }                        # Check the number of args
+
+    my $row       = $_[0];                           # Zero indexed row
+    my $col       = $_[1];                           # Zero indexed column
+    my $str       = $_[2];
+
+
+    # Check that row and col are valid and store max and min values
+    return -2 if $self->_check_dimensions($row, $col);
+
+    my $error     = 0;
+    my $date_time = $self->convert_date_time($str);
+
+    if (defined $date_time) {
+        $error = $self->write_number($row, $col, $date_time, $_[3]);
+    }
+    else {
+        # The date isn't valid so write it as a string.
+        $self->write_string($row, $col, $str, $_[3]);
+        $error = -3;
+    }
+    return $error;
+}
+
+
+
+###############################################################################
+#
+# convert_date_time($date_time_string)
+#
+# The function takes a date and time in ISO8601 "yyyy-mm-ddThh:mm:ss.ss" format
+# and converts it to a decimal number representing a valid Excel date.
+#
+# Dates and times in Excel are represented by real numbers. The integer part of
+# the number stores the number of days since the epoch and the fractional part
+# stores the percentage of the day in seconds. The epoch can be either 1900 or
+# 1904.
+#
+# Parameter: Date and time string in one of the following formats:
+#               yyyy-mm-ddThh:mm:ss.ss  # Standard
+#               yyyy-mm-ddT             # Date only
+#                         Thh:mm:ss.ss  # Time only
+#
+# Returns:
+#            A decimal number representing a valid Excel date, or
+#            undef if the date is invalid.
+#
+sub convert_date_time {
+
+    my $self      = shift;
+    my $date_time = $_[0];
+
+    my $days      = 0; # Number of days since epoch
+    my $seconds   = 0; # Time expressed as fraction of 24h hours in seconds
+
+    my ($year, $month, $day);
+    my ($hour, $min, $sec);
+
+
+    # Strip leading and trailing whitespace.
+    $date_time =~ s/^\s+//;
+    $date_time =~ s/\s+$//;
+
+    # Check for invalid date char.
+    return if     $date_time =~ /[^0-9T:\-\.Z]/;
+
+    # Check for "T" after date or before time.
+    return unless $date_time =~ /\dT|T\d/;
+
+    # Strip trailing Z in ISO8601 date.
+    $date_time =~ s/Z$//;
+
+
+    # Split into date and time.
+    my ($date, $time) = split /T/, $date_time;
+
+
+    # We allow the time portion of the input DateTime to be optional.
+    if ($time ne '') {
+        # Match hh:mm:ss.sss+ where the seconds are optional
+        if ($time =~ /^(\d\d):(\d\d)(:(\d\d(\.\d+)?))?/) {
+            $hour   = $1;
+            $min    = $2;
+            $sec    = $4 || 0;
+        }
+        else {
+            return undef; # Not a valid time format.
+        }
+
+        # Some boundary checks
+        return if $hour >= 24;
+        return if $min  >= 60;
+        return if $sec  >= 60;
+
+        # Excel expresses seconds as a fraction of the number in 24 hours.
+        $seconds = ($hour *60*60 + $min *60 + $sec) / (24 *60 *60);
+    }
+
+
+    # We allow the date portion of the input DateTime to be optional.
+    return $seconds if $date eq '';
+
+
+    # Match date as yyyy-mm-dd.
+    if ($date =~ /^(\d\d\d\d)-(\d\d)-(\d\d)$/) {
+        $year   = $1;
+        $month  = $2;
+        $day    = $3;
+    }
+    else {
+        return undef; # Not a valid date format.
+    }
+
+    # Set the epoch as 1900 or 1904. Defaults to 1900.
+    my $date_1904 = $self->{_1904};
+
+
+    # Special cases for Excel.
+    if (not $date_1904) {
+        return      $seconds if $date eq '1899-12-31'; # Excel 1900 epoch
+        return      $seconds if $date eq '1900-01-00'; # Excel 1900 epoch
+        return 60 + $seconds if $date eq '1900-02-29'; # Excel false leapday
+    }
+
+
+    # We calculate the date by calculating the number of days since the epoch
+    # and adjust for the number of leap days. We calculate the number of leap
+    # days by normalising the year in relation to the epoch. Thus the year 2000
+    # becomes 100 for 4 and 100 year leapdays and 400 for 400 year leapdays.
+    #
+    my $epoch   = $date_1904 ? 1904 : 1900;
+    my $offset  = $date_1904 ?    4 :    0;
+    my $norm    = 300;
+    my $range   = $year -$epoch;
+
+
+    # Set month days and check for leap year.
+    my @mdays   = (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
+    my $leap    = 0;
+       $leap    = 1  if $year % 4 == 0 and $year % 100 or $year % 400 == 0;
+    $mdays[1]   = 29 if $leap;
+
+
+    # Some boundary checks
+    return if $year  < $epoch or $year  > 9999;
+    return if $month < 1      or $month > 12;
+    return if $day   < 1      or $day   > $mdays[$month -1];
+
+    # Accumulate the number of days since the epoch.
+    $days  = $day;                              # Add days for current month
+    $days += $mdays[$_] for 0 .. $month -2;     # Add days for past months
+    $days += $range *365;                       # Add days for past years
+    $days += int(($range)                /  4); # Add leapdays
+    $days -= int(($range +$offset)       /100); # Subtract 100 year leapdays
+    $days += int(($range +$offset +$norm)/400); # Add 400 year leapdays
+    $days -= $leap;                             # Already counted above
+
+
+    # Adjust for Excel erroneously treating 1900 as a leap year.
+    $days++ if $date_1904 == 0 and $days > 59;
+
+    return $days + $seconds;
+}
+
+
+
+
+
+###############################################################################
+#
+# set_row($row, $height, $XF, $hidden, $level)
+#
+# This method is used to set the height and XF format for a row.
+# Writes the  BIFF record ROW.
+#
+sub set_row {
+
+    my $self        = shift;
+    my $record      = 0x0208;               # Record identifier
+    my $length      = 0x0010;               # Number of bytes to follow
+
+    my $rw          = $_[0];                # Row Number
+    my $colMic      = 0x0000;               # First defined column
+    my $colMac      = 0x0000;               # Last defined column
+    my $miyRw;                              # Row height
+    my $irwMac      = 0x0000;               # Used by Excel to optimise loading
+    my $reserved    = 0x0000;               # Reserved
+    my $grbit       = 0x0000;               # Option flags
+    my $ixfe;                               # XF index
+    my $height      = $_[1];                # Format object
+    my $format      = $_[2];                # Format object
+    my $hidden      = $_[3] || 0;           # Hidden flag
+    my $level       = $_[4] || 0;           # Outline level
+
+
+    # Check for a format object
+    if (ref $format) {
+        $ixfe = $format->get_xf_index();
+    }
+    else {
+        $ixfe = 0x0F;
+    }
+
+
+    # Set the row height in units of 1/20 of a point. Note, some heights may
+    # not be obtained exactly due to rounding in Excel.
+    #
+    if (defined $height) {
+        $miyRw = $height *20;
+    }
+    else {
+        $miyRw = 0xff; # The default row height
+    }
+
+
+    # Set the limits for the outline levels (0 <= x <= 7).
+    $level = 0 if $level < 0;
+    $level = 7 if $level > 7;
+
+    $self->{_outline_row_level} = $level if $level >$self->{_outline_row_level};
+
+
+    # Set the options flags. fUnsynced is used to show that the font and row
+    # heights are not compatible. This is usually the case for WriteExcel.
+    # The collapsed flag 0x10 doesn't seem to be used to indicate that a row
+    # is collapsed. Instead it is used to indicate that the previous row is
+    # collapsed. The zero height flag, 0x20, is used to collapse a row.
+    #
+    $grbit |= $level;
+    $grbit |= 0x0020 if $hidden;
+    $grbit |= 0x0040; # fUnsynced
+    $grbit |= 0x0080 if $format;
+    $grbit |= 0x0100;
+
+
+    my $header   = pack("vv",       $record, $length);
+    my $data     = pack("vvvvvvvv", $rw, $colMic, $colMac, $miyRw,
+                                    $irwMac,$reserved, $grbit, $ixfe);
+
+    $self->_append($header, $data);
+
+    # Store the row sizes for use when calculating image vertices.
+    # Also store the column formats.
+    #
+    return if @_ < 2;# Ensure at least $row and $height
+
+    $self->{_row_sizes}->{$_[0]}   = $height;
+    $self->{_row_formats}->{$_[0]} = $format if defined $format;
+}
+
+
+###############################################################################
+#
+# _check_dimensions($row, $col)
+#
+# Check that $row and $col are valid and store max and min values for use in
+# DIMENSIONS record. See, _store_dimensions().
+#
+sub _check_dimensions {
+
+    my $self    = shift;
+    my $row     = $_[0];
+    my $col     = $_[1];
+
+    if ($row >= $self->{_xls_rowmax}) { return -2 }
+    if ($col >= $self->{_xls_colmax}) { return -2 }
+
+    $self->{_dim_changed} = 1;
+
+    if ($row <  $self->{_dim_rowmin}) { $self->{_dim_rowmin} = $row }
+    if ($row >  $self->{_dim_rowmax}) { $self->{_dim_rowmax} = $row }
+    if ($col <  $self->{_dim_colmin}) { $self->{_dim_colmin} = $col }
+    if ($col >  $self->{_dim_colmax}) { $self->{_dim_colmax} = $col }
+
+    return 0;
+}
+
+
+###############################################################################
+#
+# _store_dimensions()
+#
+# Writes Excel DIMENSIONS to define the area in which there is data.
+#
+sub _store_dimensions {
+
+    my $self      = shift;
+    my $record    = 0x0200;         # Record identifier
+    my $length    = 0x000E;         # Number of bytes to follow
+    my $row_min;                    # First row
+    my $row_max;                    # Last row plus 1
+    my $col_min;                    # First column
+    my $col_max;                    # Last column plus 1
+    my $reserved  = 0x0000;         # Reserved by Excel
+
+
+    # Set the data range if data has been written to the worksheet
+    if ($self->{_dim_changed}) {
+        $row_min = $self->{_dim_rowmin};
+        $row_max = $self->{_dim_rowmax} +1;
+        $col_min = $self->{_dim_colmin};
+        $col_max = $self->{_dim_colmax} +1;
+    }
+    else {
+        # Special case, not data was written
+        $row_min = 0;
+        $row_max = 0;
+        $col_min = 0;
+        $col_max = 256;
+
+    }
+
+
+    my $header    = pack("vv",    $record, $length);
+    my $data      = pack("VVvvv", $row_min, $row_max,
+                                  $col_min, $col_max, $reserved);
+    $self->_prepend($header, $data);
+}
+
+
+###############################################################################
+#
+# _store_window2()
+#
+# Write BIFF record Window2.
+#
+sub _store_window2 {
+
+    use integer;    # Avoid << shift bug in Perl 5.6.0 on HP-UX
+
+    my $self           = shift;
+    my $record         = 0x023E;     # Record identifier
+    my $length         = 0x0012;     # Number of bytes to follow
+
+    my $grbit          = 0x00B6;     # Option flags
+    my $rwTop          = $self->{_first_row};   # Top visible row
+    my $colLeft        = $self->{_first_col};   # Leftmost visible column
+    my $rgbHdr         = 0x00000040;            # Row/col heading, grid color
+
+    my $wScaleSLV      = 0x0000;                # Zoom in page break preview
+    my $wScaleNormal   = 0x0000;                # Zoom in normal view
+    my $reserved       = 0x00000000;
+
+
+    # The options flags that comprise $grbit
+    my $fDspFmla       = $self->{_display_formulas}; # 0 - bit
+    my $fDspGrid       = $self->{_screen_gridlines}; # 1
+    my $fDspRwCol      = $self->{_display_headers};  # 2
+    my $fFrozen        = $self->{_frozen};           # 3
+    my $fDspZeros      = $self->{_display_zeros};    # 4
+    my $fDefaultHdr    = 1;                          # 5
+    my $fArabic        = $self->{_display_arabic};   # 6
+    my $fDspGuts       = $self->{_outline_on};       # 7
+    my $fFrozenNoSplit = 0;                          # 0 - bit
+    my $fSelected      = $self->{_selected};         # 1
+    my $fPaged         = $self->{_active};           # 2
+    my $fBreakPreview  = 0;                          # 3
+
+    $grbit             = $fDspFmla;
+    $grbit            |= $fDspGrid       << 1;
+    $grbit            |= $fDspRwCol      << 2;
+    $grbit            |= $fFrozen        << 3;
+    $grbit            |= $fDspZeros      << 4;
+    $grbit            |= $fDefaultHdr    << 5;
+    $grbit            |= $fArabic        << 6;
+    $grbit            |= $fDspGuts       << 7;
+    $grbit            |= $fFrozenNoSplit << 8;
+    $grbit            |= $fSelected      << 9;
+    $grbit            |= $fPaged         << 10;
+    $grbit            |= $fBreakPreview  << 11;
+
+    my $header  = pack("vv",      $record, $length);
+    my $data    = pack("vvvVvvV", $grbit, $rwTop, $colLeft, $rgbHdr,
+                                  $wScaleSLV, $wScaleNormal, $reserved );
+
+    $self->_append($header, $data);
+}
+
+
+###############################################################################
+#
+# _store_defcol()
+#
+# Write BIFF record DEFCOLWIDTH if COLINFO records are in use.
+#
+sub _store_defcol {
+
+    my $self     = shift;
+    my $record   = 0x0055;      # Record identifier
+    my $length   = 0x0002;      # Number of bytes to follow
+
+    my $colwidth = 0x0008;      # Default column width
+
+    my $header   = pack("vv", $record, $length);
+    my $data     = pack("v",  $colwidth);
+
+    $self->_prepend($header, $data);
+}
+
+
+###############################################################################
+#
+# _store_colinfo($firstcol, $lastcol, $width, $format, $hidden)
+#
+# Write BIFF record COLINFO to define column widths
+#
+# Note: The SDK says the record length is 0x0B but Excel writes a 0x0C
+# length record.
+#
+sub _store_colinfo {
+
+    my $self     = shift;
+    my $record   = 0x007D;          # Record identifier
+    my $length   = 0x000B;          # Number of bytes to follow
+
+    my $colFirst = $_[0] || 0;      # First formatted column
+    my $colLast  = $_[1] || 0;      # Last formatted column
+    my $width    = $_[2] || 8.43;   # Col width in user units, 8.43 is default
+    my $coldx;                      # Col width in internal units
+    my $pixels;                     # Col width in pixels
+
+    # Excel rounds the column width to the nearest pixel. Therefore we first
+    # convert to pixels and then to the internal units. The pixel to users-units
+    # relationship is different for values less than 1.
+    #
+    if ($width < 1) {
+        $pixels = int($width *12);
+    }
+    else {
+        $pixels = int($width *7 ) +5;
+    }
+
+    $coldx = int($pixels *256/7);
+
+
+    my $ixfe;                       # XF index
+    my $grbit    = 0x0000;          # Option flags
+    my $reserved = 0x00;            # Reserved
+    my $format   = $_[3];           # Format object
+    my $hidden   = $_[4] || 0;      # Hidden flag
+    my $level    = $_[5] || 0;      # Outline level
+
+
+    # Check for a format object
+    if (ref $format) {
+        $ixfe = $format->get_xf_index();
+    }
+    else {
+        $ixfe = 0x0F;
+    }
+
+
+    # Set the limits for the outline levels (0 <= x <= 7).
+    $level = 0 if $level < 0;
+    $level = 7 if $level > 7;
+
+
+    # Set the options flags.
+    # The collapsed flag 0x10 doesn't seem to be used to indicate that a col
+    # is collapsed. Instead it is used to indicate that the previous col is
+    # collapsed. The zero height flag, 0x20, is used to collapse a col.
+    #
+    $grbit |= 0x0001 if $hidden;
+    $grbit |= $level << 8;
+
+
+    my $header   = pack("vv",     $record, $length);
+    my $data     = pack("vvvvvC", $colFirst, $colLast, $coldx,
+                                  $ixfe, $grbit, $reserved);
+
+    $self->_prepend($header, $data);
+}
+
+
+###############################################################################
+#
+# _store_selection($first_row, $first_col, $last_row, $last_col)
+#
+# Write BIFF record SELECTION.
+#
+sub _store_selection {
+
+    my $self     = shift;
+    my $record   = 0x001D;                  # Record identifier
+    my $length   = 0x000F;                  # Number of bytes to follow
+
+    my $pnn      = $self->{_active_pane};   # Pane position
+    my $rwAct    = $_[0];                   # Active row
+    my $colAct   = $_[1];                   # Active column
+    my $irefAct  = 0;                       # Active cell ref
+    my $cref     = 1;                       # Number of refs
+
+    my $rwFirst  = $_[0];                   # First row in reference
+    my $colFirst = $_[1];                   # First col in reference
+    my $rwLast   = $_[2] || $rwFirst;       # Last  row in reference
+    my $colLast  = $_[3] || $colFirst;      # Last  col in reference
+
+    # Swap last row/col for first row/col as necessary
+    if ($rwFirst > $rwLast) {
+        ($rwFirst, $rwLast) = ($rwLast, $rwFirst);
+    }
+
+    if ($colFirst > $colLast) {
+        ($colFirst, $colLast) = ($colLast, $colFirst);
+    }
+
+
+    my $header   = pack("vv",           $record, $length);
+    my $data     = pack("CvvvvvvCC",    $pnn, $rwAct, $colAct,
+                                        $irefAct, $cref,
+                                        $rwFirst, $rwLast,
+                                        $colFirst, $colLast);
+
+    $self->_append($header, $data);
+}
+
+
+###############################################################################
+#
+# _store_externcount($count)
+#
+# Write BIFF record EXTERNCOUNT to indicate the number of external sheet
+# references in a worksheet.
+#
+# Excel only stores references to external sheets that are used in formulas.
+# For simplicity we store references to all the sheets in the workbook
+# regardless of whether they are used or not. This reduces the overall
+# complexity and eliminates the need for a two way dialogue between the formula
+# parser the worksheet objects.
+#
+sub _store_externcount {
+
+    my $self     = shift;
+    my $record   = 0x0016;          # Record identifier
+    my $length   = 0x0002;          # Number of bytes to follow
+
+    my $cxals    = $_[0];           # Number of external references
+
+    my $header   = pack("vv", $record, $length);
+    my $data     = pack("v",  $cxals);
+
+    $self->_prepend($header, $data);
+}
+
+
+###############################################################################
+#
+# _store_externsheet($sheetname)
+#
+#
+# Writes the Excel BIFF EXTERNSHEET record. These references are used by
+# formulas. A formula references a sheet name via an index. Since we store a
+# reference to all of the external worksheets the EXTERNSHEET index is the same
+# as the worksheet index.
+#
+sub _store_externsheet {
+
+    my $self      = shift;
+
+    my $record    = 0x0017;         # Record identifier
+    my $length;                     # Number of bytes to follow
+
+    my $sheetname = $_[0];          # Worksheet name
+    my $cch;                        # Length of sheet name
+    my $rgch;                       # Filename encoding
+
+    # References to the current sheet are encoded differently to references to
+    # external sheets.
+    #
+    if ($self->{_name} eq $sheetname) {
+        $sheetname = '';
+        $length    = 0x02;  # The following 2 bytes
+        $cch       = 1;     # The following byte
+        $rgch      = 0x02;  # Self reference
+    }
+    else {
+        $length    = 0x02 + length($_[0]);
+        $cch       = length($sheetname);
+        $rgch      = 0x03;  # Reference to a sheet in the current workbook
+    }
+
+    my $header     = pack("vv",  $record, $length);
+    my $data       = pack("CC", $cch, $rgch);
+
+    $self->_prepend($header, $data, $sheetname);
+}
+
+
+###############################################################################
+#
+# _store_panes()
+#
+#
+# Writes the Excel BIFF PANE record.
+# The panes can either be frozen or thawed (unfrozen).
+# Frozen panes are specified in terms of a integer number of rows and columns.
+# Thawed panes are specified in terms of Excel's units for rows and columns.
+#
+sub _store_panes {
+
+    my $self    = shift;
+    my $record  = 0x0041;       # Record identifier
+    my $length  = 0x000A;       # Number of bytes to follow
+
+    my $y       = $_[0] || 0;   # Vertical split position
+    my $x       = $_[1] || 0;   # Horizontal split position
+    my $rwTop   = $_[2];        # Top row visible
+    my $colLeft = $_[3];        # Leftmost column visible
+    my $pnnAct  = $_[4];        # Active pane
+
+
+    # Code specific to frozen or thawed panes.
+    if ($self->{_frozen}) {
+        # Set default values for $rwTop and $colLeft
+        $rwTop   = $y unless defined $rwTop;
+        $colLeft = $x unless defined $colLeft;
+    }
+    else {
+        # Set default values for $rwTop and $colLeft
+        $rwTop   = 0  unless defined $rwTop;
+        $colLeft = 0  unless defined $colLeft;
+
+        # Convert Excel's row and column units to the internal units.
+        # The default row height is 12.75
+        # The default column width is 8.43
+        # The following slope and intersection values were interpolated.
+        #
+        $y = 20*$y      + 255;
+        $x = 113.879*$x + 390;
+    }
+
+
+    # Determine which pane should be active. There is also the undocumented
+    # option to override this should it be necessary: may be removed later.
+    #
+    if (not defined $pnnAct) {
+        $pnnAct = 0 if ($x != 0 && $y != 0); # Bottom right
+        $pnnAct = 1 if ($x != 0 && $y == 0); # Top right
+        $pnnAct = 2 if ($x == 0 && $y != 0); # Bottom left
+        $pnnAct = 3 if ($x == 0 && $y == 0); # Top left
+    }
+
+    $self->{_active_pane} = $pnnAct; # Used in _store_selection
+
+    my $header     = pack("vv",    $record, $length);
+    my $data       = pack("vvvvv", $x, $y, $rwTop, $colLeft, $pnnAct);
+
+    $self->_append($header, $data);
+}
+
+
+###############################################################################
+#
+# _store_setup()
+#
+# Store the page setup SETUP BIFF record.
+#
+sub _store_setup {
+
+    use integer;    # Avoid << shift bug in Perl 5.6.0 on HP-UX
+
+    my $self         = shift;
+    my $record       = 0x00A1;                  # Record identifier
+    my $length       = 0x0022;                  # Number of bytes to follow
+
+
+    # TODO some of these props don't have accessors. Add then as requested.
+
+    my $iPaperSize   = $self->{_paper_size};    # Paper size
+    my $iScale       = $self->{_print_scale};   # Print scaling factor
+    my $iPageStart   = $self->{_page_start};    # Starting page number
+    my $iFitWidth    = $self->{_fit_width};     # Fit to number of pages wide
+    my $iFitHeight   = $self->{_fit_height};    # Fit to number of pages high
+    my $grbit        = 0x00;                    # Option flags
+    my $iRes         = 0x0258;                  # Print resolution
+    my $iVRes        = 0x0258;                  # Vertical print resolution
+    my $numHdr       = $self->{_margin_header}; # Header Margin
+    my $numFtr       = $self->{_margin_footer}; # Footer Margin
+    my $iCopies      = 0x01;                    # Number of copies
+
+
+    my $fLeftToRight = $self->{_page_order};    # Print over then down
+    my $fLandscape   = $self->{_orientation};   # Page orientation
+    my $fNoPls       = 0x0;                     # Setup not read from printer
+    my $fNoColor     = $self->{_black_white};   # Print black and white
+    my $fDraft       = $self->{_draft_quality}; # Print draft quality
+    my $fNotes       = $self->{_print_comments};# Print notes
+    my $fNoOrient    = 0x0;                     # Orientation not set
+    my $fUsePage     = 0x0;                     # Use custom starting page
+       $fUsePage     = 0x1 if $self->{_page_start} > 1;
+
+
+    $grbit           = $fLeftToRight;
+    $grbit          |= $fLandscape    << 1;
+    $grbit          |= $fNoPls        << 2;
+    $grbit          |= $fNoColor      << 3;
+    $grbit          |= $fDraft        << 4;
+    $grbit          |= $fNotes        << 5;
+    $grbit          |= $fNoOrient     << 6;
+    $grbit          |= $fUsePage      << 7;
+
+
+    $numHdr = pack("d", $numHdr);
+    $numFtr = pack("d", $numFtr);
+
+    if ($self->{_byte_order}) {
+        $numHdr = reverse $numHdr;
+        $numFtr = reverse $numFtr;
+    }
+
+    my $header = pack("vv",         $record, $length);
+    my $data1  = pack("vvvvvvvv",   $iPaperSize,
+                                    $iScale,
+                                    $iPageStart,
+                                    $iFitWidth,
+                                    $iFitHeight,
+                                    $grbit,
+                                    $iRes,
+                                    $iVRes);
+    my $data2  = $numHdr .$numFtr;
+    my $data3  = pack("v", $iCopies);
+
+    $self->_prepend($header, $data1, $data2, $data3);
+
+}
+
+###############################################################################
+#
+# _store_header()
+#
+# Store the header caption BIFF record.
+#
+sub _store_header {
+
+    my $self        = shift;
+
+    my $record      = 0x0014;                       # Record identifier
+    my $length;                                     # Bytes to follow
+
+    my $str         = $self->{_header};             # header string
+    my $cch         = length($str);                 # Length of header string
+    my $encoding    = $self->{_header_encoding};    # Character encoding
+
+
+    # Character length is num of chars not num of bytes
+    $cch           /= 2 if $encoding;
+
+    # Change the UTF-16 name from BE to LE
+    $str            = pack 'n*', unpack 'v*', $str if $encoding;
+
+    $length         = 3 + length($str);
+
+    my $header      = pack("vv",  $record, $length);
+    my $data        = pack("vC",  $cch, $encoding);
+
+    $self->_prepend($header, $data, $str);
+}
+
+
+###############################################################################
+#
+# _store_footer()
+#
+# Store the footer caption BIFF record.
+#
+sub _store_footer {
+
+    my $self        = shift;
+
+    my $record      = 0x0015;                       # Record identifier
+    my $length;                                     # Bytes to follow
+
+    my $str         = $self->{_footer};             # footer string
+    my $cch         = length($str);                 # Length of footer string
+    my $encoding    = $self->{_footer_encoding};    # Character encoding
+
+
+    # Character length is num of chars not num of bytes
+    $cch           /= 2 if $encoding;
+
+    # Change the UTF-16 name from BE to LE
+    $str            = pack 'n*', unpack 'v*', $str if $encoding;
+
+    $length         = 3 + length($str);
+
+    my $header      = pack("vv",  $record, $length);
+    my $data        = pack("vC",  $cch, $encoding);
+
+    $self->_prepend($header, $data, $str);
+}
+
+
+###############################################################################
+#
+# _store_hcenter()
+#
+# Store the horizontal centering HCENTER BIFF record.
+#
+sub _store_hcenter {
+
+    my $self     = shift;
+
+    my $record   = 0x0083;              # Record identifier
+    my $length   = 0x0002;              # Bytes to follow
+
+    my $fHCenter = $self->{_hcenter};   # Horizontal centering
+
+    my $header    = pack("vv",  $record, $length);
+    my $data      = pack("v",   $fHCenter);
+
+    $self->_prepend($header, $data);
+}
+
+
+###############################################################################
+#
+# _store_vcenter()
+#
+# Store the vertical centering VCENTER BIFF record.
+#
+sub _store_vcenter {
+
+    my $self     = shift;
+
+    my $record   = 0x0084;              # Record identifier
+    my $length   = 0x0002;              # Bytes to follow
+
+    my $fVCenter = $self->{_vcenter};   # Horizontal centering
+
+    my $header    = pack("vv",  $record, $length);
+    my $data      = pack("v",   $fVCenter);
+
+    $self->_prepend($header, $data);
+}
+
+
+###############################################################################
+#
+# _store_margin_left()
+#
+# Store the LEFTMARGIN BIFF record.
+#
+sub _store_margin_left {
+
+    my $self    = shift;
+
+    my $record  = 0x0026;                   # Record identifier
+    my $length  = 0x0008;                   # Bytes to follow
+
+    my $margin  = $self->{_margin_left};    # Margin in inches
+
+    my $header    = pack("vv",  $record, $length);
+    my $data      = pack("d",   $margin);
+
+    if ($self->{_byte_order}) { $data = reverse $data }
+
+    $self->_prepend($header, $data);
+}
+
+
+###############################################################################
+#
+# _store_margin_right()
+#
+# Store the RIGHTMARGIN BIFF record.
+#
+sub _store_margin_right {
+
+    my $self    = shift;
+
+    my $record  = 0x0027;                   # Record identifier
+    my $length  = 0x0008;                   # Bytes to follow
+
+    my $margin  = $self->{_margin_right};   # Margin in inches
+
+    my $header    = pack("vv",  $record, $length);
+    my $data      = pack("d",   $margin);
+
+    if ($self->{_byte_order}) { $data = reverse $data }
+
+    $self->_prepend($header, $data);
+}
+
+
+###############################################################################
+#
+# _store_margin_top()
+#
+# Store the TOPMARGIN BIFF record.
+#
+sub _store_margin_top {
+
+    my $self    = shift;
+
+    my $record  = 0x0028;                   # Record identifier
+    my $length  = 0x0008;                   # Bytes to follow
+
+    my $margin  = $self->{_margin_top};     # Margin in inches
+
+    my $header    = pack("vv",  $record, $length);
+    my $data      = pack("d",   $margin);
+
+    if ($self->{_byte_order}) { $data = reverse $data }
+
+    $self->_prepend($header, $data);
+}
+
+
+###############################################################################
+#
+# _store_margin_bottom()
+#
+# Store the BOTTOMMARGIN BIFF record.
+#
+sub _store_margin_bottom {
+
+    my $self    = shift;
+
+    my $record  = 0x0029;                   # Record identifier
+    my $length  = 0x0008;                   # Bytes to follow
+
+    my $margin  = $self->{_margin_bottom};  # Margin in inches
+
+    my $header    = pack("vv",  $record, $length);
+    my $data      = pack("d",   $margin);
+
+    if ($self->{_byte_order}) { $data = reverse $data }
+
+    $self->_prepend($header, $data);
+}
+
+
+###############################################################################
+#
+# merge_cells($first_row, $first_col, $last_row, $last_col)
+#
+# This is an Excel97/2000 method. It is required to perform more complicated
+# merging than the normal align merge in Format.pm
+#
+sub merge_cells {
+
+    my $self    = shift;
+
+    # Check for a cell reference in A1 notation and substitute row and column
+    if ($_[0] =~ /^\D/) {
+        @_ = $self->_substitute_cellref(@_);
+    }
+
+    my $record  = 0x00E5;                   # Record identifier
+    my $length  = 0x000A;                   # Bytes to follow
+
+    my $cref     = 1;                       # Number of refs
+    my $rwFirst  = $_[0];                   # First row in reference
+    my $colFirst = $_[1];                   # First col in reference
+    my $rwLast   = $_[2] || $rwFirst;       # Last  row in reference
+    my $colLast  = $_[3] || $colFirst;      # Last  col in reference
+
+
+    # Excel doesn't allow a single cell to be merged
+    return if $rwFirst == $rwLast and $colFirst == $colLast;
+
+    # Swap last row/col with first row/col as necessary
+    ($rwFirst,  $rwLast ) = ($rwLast,  $rwFirst ) if $rwFirst  > $rwLast;
+    ($colFirst, $colLast) = ($colLast, $colFirst) if $colFirst > $colLast;
+
+    my $header   = pack("vv",       $record, $length);
+    my $data     = pack("vvvvv",    $cref,
+                                    $rwFirst, $rwLast,
+                                    $colFirst, $colLast);
+
+    $self->_append($header, $data);
+}
+
+
+###############################################################################
+#
+# merge_range($row1, $col1, $row2, $col2, $string, $format, $encoding)
+#
+# This is a wrapper to ensure correct use of the merge_cells method, i.e., write
+# the first cell of the range, write the formatted blank cells in the range and
+# then call the merge_cells record. Failing to do the steps in this order will
+# cause Excel 97 to crash.
+#
+sub merge_range {
+
+    my $self    = shift;
+
+    # Check for a cell reference in A1 notation and substitute row and column
+    if ($_[0] =~ /^\D/) {
+        @_ = $self->_substitute_cellref(@_);
+    }
+    croak "Incorrect number of arguments" if @_ != 6 and @_ != 7;
+    croak "Format argument is not a format object" unless ref $_[5];
+
+    my $rwFirst  = $_[0];
+    my $colFirst = $_[1];
+    my $rwLast   = $_[2];
+    my $colLast  = $_[3];
+    my $string   = $_[4];
+    my $format   = $_[5];
+    my $encoding = $_[6] ? 1 : 0;
+
+
+    # Temp code to prevent merged formats in non-merged cells.
+    my $error = "Error: refer to merge_range() in the documentation. " .
+                "Can't use previously non-merged format in merged cells";
+
+    croak $error if $format->{_used_merge} == -1;
+    $format->{_used_merge} = 0; # Until the end of this function.
+
+
+    # Set the merge_range property of the format object. For BIFF8+.
+    $format->set_merge_range();
+
+    # Excel doesn't allow a single cell to be merged
+    croak "Can't merge single cell" if $rwFirst  == $rwLast and
+                                       $colFirst == $colLast;
+
+    # Swap last row/col with first row/col as necessary
+    ($rwFirst,  $rwLast ) = ($rwLast,  $rwFirst ) if $rwFirst  > $rwLast;
+    ($colFirst, $colLast) = ($colLast, $colFirst) if $colFirst > $colLast;
+
+    # Write the first cell
+    if ($encoding) {
+        $self->write_unicode($rwFirst, $colFirst, $string, $format);
+    }
+    else {
+        $self->write        ($rwFirst, $colFirst, $string, $format);
+    }
+
+    # Pad out the rest of the area with formatted blank cells.
+    for my $row ($rwFirst .. $rwLast) {
+        for my $col ($colFirst .. $colLast) {
+            next if $row == $rwFirst and $col == $colFirst;
+            $self->write_blank($row, $col, $format);
+        }
+    }
+
+    $self->merge_cells($rwFirst, $colFirst, $rwLast, $colLast);
+
+    # Temp code to prevent merged formats in non-merged cells.
+    $format->{_used_merge} = 1;
+
+}
+
+
+###############################################################################
+#
+# _store_print_headers()
+#
+# Write the PRINTHEADERS BIFF record.
+#
+sub _store_print_headers {
+
+    my $self        = shift;
+
+    my $record      = 0x002a;                   # Record identifier
+    my $length      = 0x0002;                   # Bytes to follow
+
+    my $fPrintRwCol = $self->{_print_headers};  # Boolean flag
+
+    my $header      = pack("vv",  $record, $length);
+    my $data        = pack("v",   $fPrintRwCol);
+
+    $self->_prepend($header, $data);
+}
+
+
+###############################################################################
+#
+# _store_print_gridlines()
+#
+# Write the PRINTGRIDLINES BIFF record. Must be used in conjunction with the
+# GRIDSET record.
+#
+sub _store_print_gridlines {
+
+    my $self        = shift;
+
+    my $record      = 0x002b;                    # Record identifier
+    my $length      = 0x0002;                    # Bytes to follow
+
+    my $fPrintGrid  = $self->{_print_gridlines}; # Boolean flag
+
+    my $header      = pack("vv",  $record, $length);
+    my $data        = pack("v",   $fPrintGrid);
+
+    $self->_prepend($header, $data);
+}
+
+
+###############################################################################
+#
+# _store_gridset()
+#
+# Write the GRIDSET BIFF record. Must be used in conjunction with the
+# PRINTGRIDLINES record.
+#
+sub _store_gridset {
+
+    my $self        = shift;
+
+    my $record      = 0x0082;                        # Record identifier
+    my $length      = 0x0002;                        # Bytes to follow
+
+    my $fGridSet    = not $self->{_print_gridlines}; # Boolean flag
+
+    my $header      = pack("vv",  $record, $length);
+    my $data        = pack("v",   $fGridSet);
+
+    $self->_prepend($header, $data);
+
+}
+
+
+###############################################################################
+#
+# _store_guts()
+#
+# Write the GUTS BIFF record. This is used to configure the gutter margins
+# where Excel outline symbols are displayed. The visibility of the gutters is
+# controlled by a flag in WSBOOL. See also _store_wsbool().
+#
+# We are all in the gutter but some of us are looking at the stars.
+#
+sub _store_guts {
+
+    my $self        = shift;
+
+    my $record      = 0x0080;   # Record identifier
+    my $length      = 0x0008;   # Bytes to follow
+
+    my $dxRwGut     = 0x0000;   # Size of row gutter
+    my $dxColGut    = 0x0000;   # Size of col gutter
+
+    my $row_level   = $self->{_outline_row_level};
+    my $col_level   = 0;
+
+
+    # Calculate the maximum column outline level. The equivalent calculation
+    # for the row outline level is carried out in set_row().
+    #
+    foreach my $colinfo (@{$self->{_colinfo}}) {
+        # Skip cols without outline level info.
+        next if @{$colinfo} < 6;
+        $col_level = @{$colinfo}[5] if @{$colinfo}[5] > $col_level;
+    }
+
+
+    # Set the limits for the outline levels (0 <= x <= 7).
+    $col_level = 0 if $col_level < 0;
+    $col_level = 7 if $col_level > 7;
+
+
+    # The displayed level is one greater than the max outline levels
+    $row_level++ if $row_level > 0;
+    $col_level++ if $col_level > 0;
+
+    my $header      = pack("vv",   $record, $length);
+    my $data        = pack("vvvv", $dxRwGut, $dxColGut, $row_level, $col_level);
+
+    $self->_prepend($header, $data);
+
+}
+
+
+###############################################################################
+#
+# _store_wsbool()
+#
+# Write the WSBOOL BIFF record, mainly for fit-to-page. Used in conjunction
+# with the SETUP record.
+#
+sub _store_wsbool {
+
+    my $self        = shift;
+
+    my $record      = 0x0081;   # Record identifier
+    my $length      = 0x0002;   # Bytes to follow
+
+    my $grbit       = 0x0000;   # Option flags
+
+    # Set the option flags
+    $grbit |= 0x0001;                            # Auto page breaks visible
+    $grbit |= 0x0020 if $self->{_outline_style}; # Auto outline styles
+    $grbit |= 0x0040 if $self->{_outline_below}; # Outline summary below
+    $grbit |= 0x0080 if $self->{_outline_right}; # Outline summary right
+    $grbit |= 0x0100 if $self->{_fit_page};      # Page setup fit to page
+    $grbit |= 0x0400 if $self->{_outline_on};    # Outline symbols displayed
+
+
+    my $header      = pack("vv",  $record, $length);
+    my $data        = pack("v",   $grbit);
+
+    $self->_prepend($header, $data);
+}
+
+
+###############################################################################
+#
+# _store_hbreak()
+#
+# Write the HORIZONTALPAGEBREAKS BIFF record.
+#
+sub _store_hbreak {
+
+    my $self    = shift;
+
+    # Return if the user hasn't specified pagebreaks
+    return unless @{$self->{_hbreaks}};
+
+    # Sort and filter array of page breaks
+    my @breaks  = $self->_sort_pagebreaks(@{$self->{_hbreaks}});
+
+    my $record  = 0x001b;               # Record identifier
+    my $cbrk    = scalar @breaks;       # Number of page breaks
+    my $length  = 2 + 6*$cbrk;          # Bytes to follow
+
+
+    my $header  = pack("vv",  $record, $length);
+    my $data    = pack("v",   $cbrk);
+
+    # Append each page break
+    foreach my $break (@breaks) {
+        $data .= pack("vvv", $break, 0x0000, 0x00ff);
+    }
+
+    $self->_prepend($header, $data);
+}
+
+
+###############################################################################
+#
+# _store_vbreak()
+#
+# Write the VERTICALPAGEBREAKS BIFF record.
+#
+sub _store_vbreak {
+
+    my $self    = shift;
+
+    # Return if the user hasn't specified pagebreaks
+    return unless @{$self->{_vbreaks}};
+
+    # Sort and filter array of page breaks
+    my @breaks  = $self->_sort_pagebreaks(@{$self->{_vbreaks}});
+
+    my $record  = 0x001a;               # Record identifier
+    my $cbrk    = scalar @breaks;       # Number of page breaks
+    my $length  = 2 + 6*$cbrk;          # Bytes to follow
+
+
+    my $header  = pack("vv",  $record, $length);
+    my $data    = pack("v",   $cbrk);
+
+    # Append each page break
+    foreach my $break (@breaks) {
+        $data .= pack("vvv", $break, 0x0000, 0xffff);
+    }
+
+    $self->_prepend($header, $data);
+}
+
+
+###############################################################################
+#
+# _store_protect()
+#
+# Set the Biff PROTECT record to indicate that the worksheet is protected.
+#
+sub _store_protect {
+
+    my $self        = shift;
+
+    # Exit unless sheet protection has been specified
+    return unless $self->{_protect};
+
+    my $record      = 0x0012;               # Record identifier
+    my $length      = 0x0002;               # Bytes to follow
+
+    my $fLock       = $self->{_protect};    # Worksheet is protected
+
+    my $header      = pack("vv", $record, $length);
+    my $data        = pack("v",  $fLock);
+
+    $self->_prepend($header, $data);
+}
+
+
+###############################################################################
+#
+# _store_obj_protect()
+#
+# Set the Biff OBJPROTECT record to indicate that objects are protected.
+#
+sub _store_obj_protect {
+
+    my $self        = shift;
+
+    # Exit unless sheet protection has been specified
+    return unless $self->{_protect};
+
+    my $record      = 0x0063;               # Record identifier
+    my $length      = 0x0002;               # Bytes to follow
+
+    my $fLock       = $self->{_protect};    # Worksheet is protected
+
+    my $header      = pack("vv", $record, $length);
+    my $data        = pack("v",  $fLock);
+
+    $self->_prepend($header, $data);
+}
+
+
+###############################################################################
+#
+# _store_password()
+#
+# Write the worksheet PASSWORD record.
+#
+sub _store_password {
+
+    my $self        = shift;
+
+    # Exit unless sheet protection and password have been specified
+    return unless $self->{_protect} and defined $self->{_password};
+
+    my $record      = 0x0013;               # Record identifier
+    my $length      = 0x0002;               # Bytes to follow
+
+    my $wPassword   = $self->{_password};   # Encoded password
+
+    my $header      = pack("vv", $record, $length);
+    my $data        = pack("v",  $wPassword);
+
+    $self->_prepend($header, $data);
+}
+
+
+###############################################################################
+#
+# insert_bitmap($row, $col, $filename, $x, $y, $scale_x, $scale_y)
+#
+# Insert a 24bit bitmap image in a worksheet. The main record required is
+# IMDATA but it must be proceeded by a OBJ record to define its position.
+#
+sub insert_bitmap {
+
+    my $self        = shift;
+
+    # Check for a cell reference in A1 notation and substitute row and column
+    if ($_[0] =~ /^\D/) {
+        @_ = $self->_substitute_cellref(@_);
+    }
+
+    my $row         = $_[0];
+    my $col         = $_[1];
+    my $bitmap      = $_[2];
+    my $x           = $_[3] || 0;
+    my $y           = $_[4] || 0;
+    my $scale_x     = $_[5] || 1;
+    my $scale_y     = $_[6] || 1;
+
+    my ($width, $height, $size, $data) = $self->_process_bitmap($bitmap);
+
+    # Scale the frame of the image.
+    $width  *= $scale_x;
+    $height *= $scale_y;
+
+    # Calculate the vertices of the image and write the OBJ record
+    my @vertices = $self->_position_object($col, $row, $x, $y, $width, $height);
+    $self->_store_obj_picture(@vertices );
+
+    # Write the IMDATA record to store the bitmap data
+    my $record      = 0x007f;
+    my $length      = 8 + $size;
+    my $cf          = 0x09;
+    my $env         = 0x01;
+    my $lcb         = $size;
+
+    my $header      = pack("vvvvV", $record, $length, $cf, $env, $lcb);
+
+    $self->_append($header, $data);
+}
+
+
+###############################################################################
+#
+#  _position_object()
+#
+# Calculate the vertices that define the position of a graphical object within
+# the worksheet.
+#
+#         +------------+------------+
+#         |     A      |      B     |
+#   +-----+------------+------------+
+#   |     |(x1,y1)     |            |
+#   |  1  |(A1)._______|______      |
+#   |     |    |              |     |
+#   |     |    |              |     |
+#   +-----+----|    BITMAP    |-----+
+#   |     |    |              |     |
+#   |  2  |    |______________.     |
+#   |     |            |        (B2)|
+#   |     |            |     (x2,y2)|
+#   +---- +------------+------------+
+#
+# Example of a bitmap that covers some of the area from cell A1 to cell B2.
+#
+# Based on the width and height of the bitmap we need to calculate 8 vars:
+#     $col_start, $row_start, $col_end, $row_end, $x1, $y1, $x2, $y2.
+# The width and height of the cells are also variable and have to be taken into
+# account.
+# The values of $col_start and $row_start are passed in from the calling
+# function. The values of $col_end and $row_end are calculated by subtracting
+# the width and height of the bitmap from the width and height of the
+# underlying cells.
+# The vertices are expressed as a percentage of the underlying cell width as
+# follows (rhs values are in pixels):
+#
+#       x1 = X / W *1024
+#       y1 = Y / H *256
+#       x2 = (X-1) / W *1024
+#       y2 = (Y-1) / H *256
+#
+#       Where:  X is distance from the left side of the underlying cell
+#               Y is distance from the top of the underlying cell
+#               W is the width of the cell
+#               H is the height of the cell
+#
+# Note: the SDK incorrectly states that the height should be expressed as a
+# percentage of 1024.
+#
+sub _position_object {
+
+    my $self = shift;
+
+    my $col_start;  # Col containing upper left corner of object
+    my $x1;         # Distance to left side of object
+
+    my $row_start;  # Row containing top left corner of object
+    my $y1;         # Distance to top of object
+
+    my $col_end;    # Col containing lower right corner of object
+    my $x2;         # Distance to right side of object
+
+    my $row_end;    # Row containing bottom right corner of object
+    my $y2;         # Distance to bottom of object
+
+    my $width;      # Width of image frame
+    my $height;     # Height of image frame
+
+    ($col_start, $row_start, $x1, $y1, $width, $height) = @_;
+
+
+    # Adjust start column for offsets that are greater than the col width
+    while ($x1 >= $self->_size_col($col_start)) {
+        $x1 -= $self->_size_col($col_start);
+        $col_start++;
+    }
+
+    # Adjust start row for offsets that are greater than the row height
+    while ($y1 >= $self->_size_row($row_start)) {
+        $y1 -= $self->_size_row($row_start);
+        $row_start++;
+    }
+
+
+    # Initialise end cell to the same as the start cell
+    $col_end    = $col_start;
+    $row_end    = $row_start;
+
+    $width      = $width  + $x1 -1;
+    $height     = $height + $y1 -1;
+
+
+    # Subtract the underlying cell widths to find the end cell of the image
+    while ($width >= $self->_size_col($col_end)) {
+        $width -= $self->_size_col($col_end);
+        $col_end++;
+    }
+
+    # Subtract the underlying cell heights to find the end cell of the image
+    while ($height >= $self->_size_row($row_end)) {
+        $height -= $self->_size_row($row_end);
+        $row_end++;
+    }
+
+    # Bitmap isn't allowed to start or finish in a hidden cell, i.e. a cell
+    # with zero eight or width.
+    #
+    return if $self->_size_col($col_start) == 0;
+    return if $self->_size_col($col_end)   == 0;
+    return if $self->_size_row($row_start) == 0;
+    return if $self->_size_row($row_end)   == 0;
+
+    # Convert the pixel values to the percentage value expected by Excel
+    $x1 = $x1     / $self->_size_col($col_start)   * 1024;
+    $y1 = $y1     / $self->_size_row($row_start)   *  256;
+    $x2 = $width  / $self->_size_col($col_end)     * 1024;
+    $y2 = $height / $self->_size_row($row_end)     *  256;
+
+    # Simulate ceil() without calling POSIX::ceil().
+    $x1 = int($x1 +0.5);
+    $y1 = int($y1 +0.5);
+    $x2 = int($x2 +0.5);
+    $y2 = int($y2 +0.5);
+
+    return( $col_start, $x1,
+            $row_start, $y1,
+            $col_end,   $x2,
+            $row_end,   $y2
+          );
+}
+
+
+###############################################################################
+#
+# _size_col($col)
+#
+# Convert the width of a cell from user's units to pixels. Excel rounds the
+# column width to the nearest pixel. If the width hasn't been set by the user
+# we use the default value. If the column is hidden we use a value of zero.
+#
+sub _size_col {
+
+    my $self = shift;
+    my $col  = $_[0];
+
+    # Look up the cell value to see if it has been changed
+    if (exists $self->{_col_sizes}->{$col}) {
+        my $width = $self->{_col_sizes}->{$col};
+
+        # The relationship is different for user units less than 1.
+        if ($width < 1) {
+            return int($width *12);
+        }
+        else {
+            return int($width *7 ) +5;
+        }
+    }
+    else {
+        return 64;
+    }
+}
+
+
+###############################################################################
+#
+# _size_row($row)
+#
+# Convert the height of a cell from user's units to pixels. By interpolation
+# the relationship is: y = 4/3x. If the height hasn't been set by the user we
+# use the default value. If the row is hidden we use a value of zero. (Not
+# possible to hide row yet).
+#
+sub _size_row {
+
+    my $self = shift;
+    my $row  = $_[0];
+
+    # Look up the cell value to see if it has been changed
+    if (exists $self->{_row_sizes}->{$row}) {
+        if ($self->{_row_sizes}->{$row} == 0) {
+            return 0;
+        }
+        else {
+            return int (4/3 * $self->{_row_sizes}->{$row});
+        }
+    }
+    else {
+        return 17;
+    }
+}
+
+
+###############################################################################
+#
+# _store_obj_picture(   $col_start, $x1,
+#                       $row_start, $y1,
+#                       $col_end,   $x2,
+#                       $row_end,   $y2 )
+#
+# Store the OBJ record that precedes an IMDATA record. This could be generalise
+# to support other Excel objects.
+#
+sub _store_obj_picture {
+
+    my $self        = shift;
+
+    my $record      = 0x005d;   # Record identifier
+    my $length      = 0x003c;   # Bytes to follow
+
+    my $cObj        = 0x0001;   # Count of objects in file (set to 1)
+    my $OT          = 0x0008;   # Object type. 8 = Picture
+    my $id          = 0x0001;   # Object ID
+    my $grbit       = 0x0614;   # Option flags
+
+    my $colL        = $_[0];    # Col containing upper left corner of object
+    my $dxL         = $_[1];    # Distance from left side of cell
+
+    my $rwT         = $_[2];    # Row containing top left corner of object
+    my $dyT         = $_[3];    # Distance from top of cell
+
+    my $colR        = $_[4];    # Col containing lower right corner of object
+    my $dxR         = $_[5];    # Distance from right of cell
+
+    my $rwB         = $_[6];    # Row containing bottom right corner of object
+    my $dyB         = $_[7];    # Distance from bottom of cell
+
+    my $cbMacro     = 0x0000;   # Length of FMLA structure
+    my $Reserved1   = 0x0000;   # Reserved
+    my $Reserved2   = 0x0000;   # Reserved
+
+    my $icvBack     = 0x09;     # Background colour
+    my $icvFore     = 0x09;     # Foreground colour
+    my $fls         = 0x00;     # Fill pattern
+    my $fAuto       = 0x00;     # Automatic fill
+    my $icv         = 0x08;     # Line colour
+    my $lns         = 0xff;     # Line style
+    my $lnw         = 0x01;     # Line weight
+    my $fAutoB      = 0x00;     # Automatic border
+    my $frs         = 0x0000;   # Frame style
+    my $cf          = 0x0009;   # Image format, 9 = bitmap
+    my $Reserved3   = 0x0000;   # Reserved
+    my $cbPictFmla  = 0x0000;   # Length of FMLA structure
+    my $Reserved4   = 0x0000;   # Reserved
+    my $grbit2      = 0x0001;   # Option flags
+    my $Reserved5   = 0x0000;   # Reserved
+
+
+    my $header      = pack("vv", $record, $length);
+    my $data        = pack("V",  $cObj);
+       $data       .= pack("v",  $OT);
+       $data       .= pack("v",  $id);
+       $data       .= pack("v",  $grbit);
+       $data       .= pack("v",  $colL);
+       $data       .= pack("v",  $dxL);
+       $data       .= pack("v",  $rwT);
+       $data       .= pack("v",  $dyT);
+       $data       .= pack("v",  $colR);
+       $data       .= pack("v",  $dxR);
+       $data       .= pack("v",  $rwB);
+       $data       .= pack("v",  $dyB);
+       $data       .= pack("v",  $cbMacro);
+       $data       .= pack("V",  $Reserved1);
+       $data       .= pack("v",  $Reserved2);
+       $data       .= pack("C",  $icvBack);
+       $data       .= pack("C",  $icvFore);
+       $data       .= pack("C",  $fls);
+       $data       .= pack("C",  $fAuto);
+       $data       .= pack("C",  $icv);
+       $data       .= pack("C",  $lns);
+       $data       .= pack("C",  $lnw);
+       $data       .= pack("C",  $fAutoB);
+       $data       .= pack("v",  $frs);
+       $data       .= pack("V",  $cf);
+       $data       .= pack("v",  $Reserved3);
+       $data       .= pack("v",  $cbPictFmla);
+       $data       .= pack("v",  $Reserved4);
+       $data       .= pack("v",  $grbit2);
+       $data       .= pack("V",  $Reserved5);
+
+    $self->_append($header, $data);
+}
+
+
+###############################################################################
+#
+# _process_bitmap()
+#
+# Convert a 24 bit bitmap into the modified internal format used by Windows.
+# This is described in BITMAPCOREHEADER and BITMAPCOREINFO structures in the
+# MSDN library.
+#
+sub _process_bitmap {
+
+    my $self   = shift;
+    my $bitmap = shift;
+
+    # Open file and binmode the data in case the platform needs it.
+    my $fh = FileHandle->new($bitmap);
+    croak "Couldn't import $bitmap: $!" unless defined $fh;
+    binmode $fh;
+
+
+    # Slurp the file into a string.
+    my $data = do {local $/; <$fh>};
+
+    $fh->close;
+
+    # Check that the file is big enough to be a bitmap.
+    if (length $data <= 0x36) {
+        croak "$bitmap doesn't contain enough data.";
+    }
+
+
+    # The first 2 bytes are used to identify the bitmap.
+    if (unpack("A2", $data) ne "BM") {
+        croak "$bitmap doesn't appear to be a valid bitmap image.";
+    }
+
+
+    # Remove bitmap data: ID.
+    $data = substr $data, 2;
+
+
+    # Read and remove the bitmap size. This is more reliable than reading
+    # the data size at offset 0x22.
+    #
+    my $size   =  unpack "V", substr $data, 0, 4, "";
+       $size  -=  0x36;   # Subtract size of bitmap header.
+       $size  +=  0x0C;   # Add size of BIFF header.
+
+
+    # Remove bitmap data: reserved, offset, header length.
+    $data = substr $data, 12;
+
+
+    # Read and remove the bitmap width and height. Verify the sizes.
+    my ($width, $height) = unpack "V2", substr $data, 0, 8, "";
+
+    if ($width > 0xFFFF) {
+        croak "$bitmap: largest image width supported is 65k.";
+    }
+
+    if ($height > 0xFFFF) {
+        croak "$bitmap: largest image height supported is 65k.";
+    }
+
+    # Read and remove the bitmap planes and bpp data. Verify them.
+    my ($planes, $bitcount) = unpack "v2", substr $data, 0, 4, "";
+
+    if ($bitcount != 24) {
+        croak "$bitmap isn't a 24bit true color bitmap.";
+    }
+
+    if ($planes != 1) {
+        croak "$bitmap: only 1 plane supported in bitmap image.";
+    }
+
+
+    # Read and remove the bitmap compression. Verify compression.
+    my $compression = unpack "V", substr $data, 0, 4, "";
+
+    if ($compression != 0) {
+        croak "$bitmap: compression not supported in bitmap image.";
+    }
+
+    # Remove bitmap data: data size, hres, vres, colours, imp. colours.
+    $data = substr $data, 20;
+
+    # Add the BITMAPCOREHEADER data
+    my $header  = pack("Vvvvv", 0x000c, $width, $height, 0x01, 0x18);
+    $data       = $header . $data;
+
+    return ($width, $height, $size, $data);
+}
+
+
+###############################################################################
+#
+# _store_zoom($zoom)
+#
+#
+# Store the window zoom factor. This should be a reduced fraction but for
+# simplicity we will store all fractions with a numerator of 100.
+#
+sub _store_zoom {
+
+    my $self        = shift;
+
+    # If scale is 100 we don't need to write a record
+    return if $self->{_zoom} == 100;
+
+    my $record      = 0x00A0;               # Record identifier
+    my $length      = 0x0004;               # Bytes to follow
+
+    my $header      = pack("vv", $record, $length   );
+    my $data        = pack("vv", $self->{_zoom}, 100);
+
+    $self->_append($header, $data);
+}
+
+
+###############################################################################
+#
+# write_unicode ($row, $col, $string, $format)
+#
+# Write a Unicode string to the specified row and column (zero indexed).
+# $format is optional.
+# Returns  0 : normal termination
+#         -1 : insufficient number of arguments
+#         -2 : row or column out of range
+#         -3 : long string truncated to 255 chars
+#
+sub write_unicode {
+
+    my $self = shift;
+
+    # Check for a cell reference in A1 notation and substitute row and column
+    if ($_[0] =~ /^\D/) {
+        @_ = $self->_substitute_cellref(@_);
+    }
+
+    if (@_ < 3) { return -1 }                        # Check the number of args
+
+    my $record      = 0x00FD;                        # Record identifier
+    my $length      = 0x000A;                        # Bytes to follow
+
+    my $row         = $_[0];                         # Zero indexed row
+    my $col         = $_[1];                         # Zero indexed column
+    my $strlen      = length($_[2]);
+    my $str         = $_[2];
+    my $xf          = _XF($self, $row, $col, $_[3]); # The cell format
+    my $encoding    = 0x1;
+    my $str_error   = 0;
+
+    # Check that row and col are valid and store max and min values
+    return -2 if $self->_check_dimensions($row, $col);
+
+    # Limit the utf16 string to the max number of chars (not bytes).
+    if ($strlen > 32767* 2) {
+        $str       = substr($str, 0, 32767*2);
+        $str_error = -3;
+    }
+
+
+    my $num_bytes = length $str;
+    my $num_chars = int($num_bytes / 2);
+
+
+    # Check for a valid 2-byte char string.
+    croak "Uneven number of bytes in Unicode string" if $num_bytes % 2;
+
+
+    # Change from UTF16 big-endian to little endian
+    $str = pack "v*", unpack "n*", $str;
+
+
+    # Add the encoding and length header to the string.
+    my $str_header  = pack("vC", $num_chars, $encoding);
+    $str            = $str_header . $str;
+
+
+    if (not exists ${$self->{_str_table}}->{$str}) {
+        ${$self->{_str_table}}->{$str} = ${$self->{_str_unique}}++;
+    }
+
+
+    ${$self->{_str_total}}++;
+
+
+    my $header = pack("vv",   $record, $length);
+    my $data   = pack("vvvV", $row, $col, $xf, ${$self->{_str_table}}->{$str});
+
+    $self->_append($header, $data);
+
+    return $str_error;
+}
+
+
+
+###############################################################################
+#
+# write_unicode_le ($row, $col, $string, $format)
+#
+# Write a Unicode string to the specified row and column (zero indexed).
+# $format is optional.
+# Returns  0 : normal termination
+#         -1 : insufficient number of arguments
+#         -2 : row or column out of range
+#         -3 : long string truncated to 255 chars
+#
+# TODO Refactor. Too much code share with write_unicode().
+#
+sub write_unicode_le {
+
+    my $self = shift;
+
+    # Check for a cell reference in A1 notation and substitute row and column
+    if ($_[0] =~ /^\D/) {
+        @_ = $self->_substitute_cellref(@_);
+    }
+
+    if (@_ < 3) { return -1 }                        # Check the number of args
+
+    my $record      = 0x00FD;                        # Record identifier
+    my $length      = 0x000A;                        # Bytes to follow
+
+    my $row         = $_[0];                         # Zero indexed row
+    my $col         = $_[1];                         # Zero indexed column
+    my $strlen      = length($_[2]);
+    my $str         = $_[2];
+    my $xf          = _XF($self, $row, $col, $_[3]); # The cell format
+    my $encoding    = 0x1;
+    my $str_error   = 0;
+
+    # Check that row and col are valid and store max and min values
+    return -2 if $self->_check_dimensions($row, $col);
+
+    # Limit the utf16 string to the max number of chars (not bytes).
+    if ($strlen > 32767* 2) {
+        $str       = substr($str, 0, 32767*2);
+        $str_error = -3;
+    }
+
+
+    my $num_bytes = length $str;
+    my $num_chars = int($num_bytes / 2);
+
+
+    # Check for a valid 2-byte char string.
+    croak "Uneven number of bytes in Unicode string" if $num_bytes % 2;
+
+    # Add the encoding and length header to the string.
+    my $str_header  = pack("vC", $num_chars, $encoding);
+       $str         = $str_header . $str;
+
+
+    if (not exists ${$self->{_str_table}}->{$str}) {
+        ${$self->{_str_table}}->{$str} = ${$self->{_str_unique}}++;
+    }
+
+
+    ${$self->{_str_total}}++;
+
+
+    my $header = pack("vv",   $record, $length);
+    my $data   = pack("vvvV", $row, $col, $xf, ${$self->{_str_table}}->{$str});
+
+    $self->_append($header, $data);
+
+    return $str_error;
+}
+
+
+
+#
+# Methods related to comments and MSO objects.
+#
+
+###############################################################################
+#
+# _prepare_comments()
+#
+# Turn the HoH that stores the comments into an array for easier handling.
+#
+sub _prepare_comments {
+
+    my $self    = shift;
+
+    my $count   = 0;
+    my @comments;
+
+
+    # We sort the comments by row and column but that isn't strictly required.
+    #
+    my @rows = sort {$a <=> $b} keys %{$self->{_comments}};
+
+    for my $row (@rows) {
+        my @cols = sort {$a <=> $b} keys %{$self->{_comments}->{$row}};
+
+        for my $col (@cols) {
+            push @comments, $self->{_comments}->{$row}->{$col};
+            $count++;
+        }
+    }
+
+    $self->{_comments}       = {};
+    $self->{_comments_array} = [@comments];
+
+    return $count;
+}
+
+
+###############################################################################
+#
+# _store_comments()
+#
+# Store the collections of records that make up cell comments.
+#
+sub _store_comments {
+
+    my $self            = shift;
+
+    my $record          = 0x00EC;           # Record identifier
+    my $length          = 0x0000;           # Bytes to follow
+
+    my @ids             = @{$self->{_comments_ids}};
+    my @comments        = @{$self->{_comments_array}};
+    my $num_comments    = scalar @comments;
+    my $spid            = shift @ids;
+
+    return unless $num_comments;
+
+
+    for my $i (0 .. $num_comments-1) {
+
+        my $row         =   $comments[$i]->[0];
+        my $col         =   $comments[$i]->[1];
+        my $str         =   $comments[$i]->[2];
+        my $encoding    =   $comments[$i]->[3];
+        my $visible     =   $comments[$i]->[6];
+        my $color       =   $comments[$i]->[7];
+        my @vertices    = @{$comments[$i]->[8]};
+        my @anchor_data = ($row, $col, @vertices);
+        my $str_len     = length $str;
+           $str_len    /= 2 if $encoding; # Num of chars not bytes.
+        my $formats     = [[0, 0], [$str_len, 0]];
+
+
+        if ($i == 0) {
+            # Write the parent MSODRAWIING record.
+            my $dg_length   = 200 + 128*($num_comments -1);
+            my $spgr_length = 176 + 128*($num_comments -1);
+
+            my $data        = $self->_store_mso_dg_container($dg_length);
+               $data       .= $self->_store_mso_dg(@ids);
+               $data       .= $self->_store_mso_spgr_container($spgr_length);
+               $data       .= $self->_store_mso_sp_container(40);
+               $data       .= $self->_store_mso_spgr();
+               $data       .= $self->_store_mso_sp(0x0, $spid++, 0x0005);
+               $data       .= $self->_store_mso_sp_container(120);
+               $data       .= $self->_store_mso_sp(202, $spid++, 0x0A00);
+               $data       .= $self->_store_mso_opt(0x80, $visible, $color);
+               $data       .= $self->_store_mso_client_anchor(@anchor_data);
+               $data       .= $self->_store_mso_client_data();
+
+            $length         = length $data;
+            my $header      = pack("vv", $record, $length);
+            $self->_append($header, $data);
+
+        }
+        else {
+            # Write the child MSODRAWIING record.
+            my $data        = $self->_store_mso_sp_container(120);
+               $data       .= $self->_store_mso_sp(202, $spid++, 0x0A00);
+               $data       .= $self->_store_mso_opt(0x80, $visible,$color);
+               $data       .= $self->_store_mso_client_anchor(@anchor_data);
+               $data       .= $self->_store_mso_client_data();
+
+            $length         = length $data;
+            my $header      = pack("vv", $record, $length);
+            $self->_append($header, $data);
+
+
+        }
+
+        $self->_store_obj_comment($i+1);
+        $self->_store_mso_drawing_text_box();
+        $self->_store_txo($str_len);
+        $self->_store_txo_continue_1($str, $encoding);
+        $self->_store_txo_continue_2($formats);
+    }
+
+
+    # Write the NOTE records after MSODRAWIING records.
+    for my $i (0 .. $num_comments-1) {
+
+        my $row         = $comments[$i]->[0];
+        my $col         = $comments[$i]->[1];
+        my $author      = $comments[$i]->[4];
+        my $author_enc  = $comments[$i]->[5];
+        my $visible     = $comments[$i]->[6];
+
+        $self->_store_note($row, $col, $i+1, $author, $author_enc, $visible);
+    }
+}
+
+
+###############################################################################
+#
+# _store_mso_dg_container()
+#
+# Write the Escher DgContainer record that is part of MSODRAWING.
+#
+sub _store_mso_dg_container {
+
+    my $self        = shift;
+
+    my $type        = 0xF002;
+    my $version     = 15;
+    my $instance    = 0;
+    my $data        = '';
+    my $length      = $_[0];
+
+
+    return $self->_add_mso_generic($type, $version, $instance, $data, $length);
+}
+
+
+###############################################################################
+#
+# _store_mso_dg()
+#
+# Write the Escher Dg record that is part of MSODRAWING.
+#
+sub _store_mso_dg {
+
+    my $self        = shift;
+
+    my $type        = 0xF008;
+    my $version     = 0;
+    my $instance    = $_[0];
+    my $data        = '';
+    my $length      = 8;
+
+    my $num_shapes  = $_[1];
+    my $max_spid    = $_[2];
+
+    $data           = pack "VV", $num_shapes, $max_spid;
+
+    return $self->_add_mso_generic($type, $version, $instance, $data, $length);
+}
+
+
+###############################################################################
+#
+# _store_mso_spgr_container()
+#
+# Write the Escher SpgrContainer record that is part of MSODRAWING.
+#
+sub _store_mso_spgr_container {
+
+    my $self        = shift;
+
+    my $type        = 0xF003;
+    my $version     = 15;
+    my $instance    = 0;
+    my $data        = '';
+    my $length      = $_[0];
+
+
+    return $self->_add_mso_generic($type, $version, $instance, $data, $length);
+}
+
+
+###############################################################################
+#
+# _store_mso_sp_container()
+#
+# Write the Escher SpContainer record that is part of MSODRAWING.
+#
+sub _store_mso_sp_container {
+
+    my $self        = shift;
+
+    my $type        = 0xF004;
+    my $version     = 15;
+    my $instance    = 0;
+    my $data        = '';
+    my $length      = $_[0];
+
+
+    return $self->_add_mso_generic($type, $version, $instance, $data, $length);
+}
+
+
+###############################################################################
+#
+# _store_mso_spgr()
+#
+# Write the Escher Spgr record that is part of MSODRAWING.
+#
+sub _store_mso_spgr {
+
+    my $self        = shift;
+
+    my $type        = 0xF009;
+    my $version     = 1;
+    my $instance    = 0;
+    my $data        = pack "VVVV", 0, 0, 0, 0;
+    my $length      = 16;
+
+
+    return $self->_add_mso_generic($type, $version, $instance, $data, $length);
+}
+
+
+###############################################################################
+#
+# _store_mso_sp()
+#
+# Write the Escher Sp record that is part of MSODRAWING.
+#
+sub _store_mso_sp {
+
+    my $self        = shift;
+
+    my $type        = 0xF00A;
+    my $version     = 2;
+    my $instance    = $_[0];
+    my $data        = '';
+    my $length      = 8;
+
+    my $spid        = $_[1];
+    my $options     = $_[2];
+
+    $data           = pack "VV", $spid, $options;
+
+    return $self->_add_mso_generic($type, $version, $instance, $data, $length);
+}
+
+
+###############################################################################
+#
+# _store_mso_opt()
+#
+# Write the Escher Opt record that is part of MSODRAWING.
+#
+sub _store_mso_opt {
+
+    my $self        = shift;
+
+    my $type        = 0xF00B;
+    my $version     = 3;
+    my $instance    = 9;
+    my $data        = '';
+    my $length      = 54;
+
+    my $spid        = $_[0];
+    my $visible     = $_[1];
+    my $colour      = $_[2] || 0x50;
+
+
+    # Use the visible flag if set by the user or else use the worksheet value.
+    # Note that the value used is the opposite of _store_note().
+    #
+    if (defined $visible) {
+        $visible = $visible                   ? 0x0000 : 0x0002;
+    }
+    else {
+        $visible = $self->{_comments_visible} ? 0x0000 : 0x0002;
+    }
+
+
+    $data    = pack "V",  $spid;
+    $data   .= pack "H*", '0000BF00080008005801000000008101' ;
+    $data   .= pack "C",  $colour;
+    $data   .= pack "H*", '000008830150000008BF011000110001' .
+                          '02000000003F0203000300BF03';
+    $data   .= pack "v",  $visible;
+    $data   .= pack "H*", '0A00';
+
+
+    return $self->_add_mso_generic($type, $version, $instance, $data, $length);
+}
+
+
+###############################################################################
+#
+# _store_mso_client_anchor()
+#
+# Write the Escher ClientAnchor record that is part of MSODRAWING.
+#
+sub _store_mso_client_anchor {
+
+    my $self        = shift;
+
+    my $type        = 0xF010;
+    my $version     = 0;
+    my $instance    = 0;
+    my $data        = '';
+    my $length      = 18;
+
+    my $flag        = 3;
+    my $row         = $_[0];
+    my $col         = $_[1];
+
+
+    my $col_start   = $_[2];    # Col containing upper left corner of object
+    my $x1          = $_[3];    # Distance to left side of object
+
+    my $row_start   = $_[4];    # Row containing top left corner of object
+    my $y1          = $_[5];    # Distance to top of object
+
+    my $col_end     = $_[6];    # Col containing lower right corner of object
+    my $x2          = $_[7];    # Distance to right side of object
+
+    my $row_end     = $_[8];    # Row containing bottom right corner of object
+    my $y2          = $_[9];    # Distance to bottom of object
+
+    my $width       = $_[10];   # Width of image frame
+    my $height      = $_[11];   # Height of image frame
+
+
+    $data   = pack "v9",    $flag,
+                            $col_start, $x1,
+                            $row_start, $y1,
+                            $col_end,   $x2,
+                            $row_end,   $y2;
+
+
+
+    return $self->_add_mso_generic($type, $version, $instance, $data, $length);
+}
+
+
+###############################################################################
+#
+# _store_mso_client_data()
+#
+# Write the Escher ClientData record that is part of MSODRAWING.
+#
+sub _store_mso_client_data {
+
+    my $self        = shift;
+
+    my $type        = 0xF011;
+    my $version     = 0;
+    my $instance    = 0;
+    my $data        = '';
+    my $length      = 0;
+
+
+    return $self->_add_mso_generic($type, $version, $instance, $data, $length);
+}
+
+
+###############################################################################
+#
+# _store_obj_comment()
+#
+# Write the OBJ record that is part of cell comments.
+#
+sub _store_obj_comment {
+
+    my $self        = shift;
+
+    my $record      = 0x005D;   # Record identifier
+    my $length      = 0x0034;   # Bytes to follow
+
+    my $obj_id      = $_[0];    # Object ID number.
+    my $obj_type    = 0x0019;   # Object type (comment).
+    my $data        = '';       # Record data.
+
+    my $sub_record  = 0x0000;   # Sub-record identifier.
+    my $sub_length  = 0x0000;   # Length of sub-record.
+    my $sub_data    = '';       # Data of sub-record.
+    my $options     = 0x4011;
+    my $reserved    = 0x0000;
+
+    # Add ftCmo (common object data) subobject
+    $sub_record     = 0x0015;   # ftCmo
+    $sub_length     = 0x0012;
+    $sub_data       = pack "vvvVVV", $obj_type, $obj_id,   $options,
+                                     $reserved, $reserved, $reserved;
+    $data           = pack("vv",     $sub_record, $sub_length);
+    $data          .= $sub_data;
+
+
+    # Add ftNts (note structure) subobject
+    $sub_record     = 0x000D;   # ftNts
+    $sub_length     = 0x0016;
+    $sub_data       = pack "VVVVVv", ($reserved) x 5;
+    $data          .= pack("vv",     $sub_record, $sub_length);
+    $data          .= $sub_data;
+
+
+    # Add ftEnd (end of object) subobject
+    $sub_record     = 0x0000;   # ftNts
+    $sub_length     = 0x0000;
+    $data          .= pack("vv",     $sub_record, $sub_length);
+
+
+    # Pack the record.
+    my $header  = pack("vv",        $record, $length);
+
+    $self->_append($header, $data);
+
+}
+
+
+###############################################################################
+#
+# _store_mso_drawing_text_box()
+#
+# Write the MSODRAWING ClientTextbox record that is part of comments.
+#
+sub _store_mso_drawing_text_box {
+
+    my $self        = shift;
+
+    my $record      = 0x00EC;           # Record identifier
+    my $length      = 0x0008;           # Bytes to follow
+
+
+    my $data        = $self->_store_mso_client_text_box();
+    my $header      = pack("vv", $record, $length);
+
+    $self->_append($header, $data);
+}
+
+
+###############################################################################
+#
+# _store_mso_client_text_box()
+#
+# Write the Escher ClientTextbox record that is part of MSODRAWING.
+#
+sub _store_mso_client_text_box {
+
+    my $self        = shift;
+
+    my $type        = 0xF00D;
+    my $version     = 0;
+    my $instance    = 0;
+    my $data        = '';
+    my $length      = 0;
+
+
+    return $self->_add_mso_generic($type, $version, $instance, $data, $length);
+}
+
+
+###############################################################################
+#
+# _store_txo()
+#
+# Write the worksheet TXO record that is part of cell comments.
+#
+sub _store_txo {
+
+    my $self        = shift;
+
+    my $record      = 0x01B6;               # Record identifier
+    my $length      = 0x0012;               # Bytes to follow
+
+    my $string_len  = $_[0];                # Length of the note text.
+    my $format_len  = $_[1] || 16;          # Length of the format runs.
+    my $rotation    = $_[2] || 0;           # Options
+    my $grbit       = 0x0212;               # Options
+    my $reserved    = 0x0000;               # Options
+
+    # Pack the record.
+    my $header  = pack("vv",        $record, $length);
+    my $data    = pack("vvVvvvV",   $grbit, $rotation, $reserved, $reserved,
+                                    $string_len, $format_len, $reserved);
+
+    $self->_append($header, $data);
+
+}
+
+
+###############################################################################
+#
+# _store_txo_continue_1()
+#
+# Write the first CONTINUE record to follow the TXO record. It contains the
+# text data.
+#
+sub _store_txo_continue_1 {
+
+    my $self        = shift;
+
+    my $record      = 0x003C;               # Record identifier
+    my $length      = 0x0000;               # Bytes to follow
+
+    my $string      = $_[0];                # Comment string.
+    my $encoding    = $_[1] || 0;           # Encoding of the string.
+
+    # Pack the record.
+    my $data    = pack("C", $encoding) . $string;
+       $length  = length $data;
+    my $header  = pack("vv", $record, $length);
+
+    $self->_append($header, $data);
+
+}
+
+
+###############################################################################
+#
+# _store_txo_continue_2()
+#
+# Write the second CONTINUE record to follow the TXO record. It contains the
+# formatting information for the string.
+#
+sub _store_txo_continue_2 {
+
+    my $self        = shift;
+
+    my $record      = 0x003C;               # Record identifier
+    my $length      = 0x0000;               # Bytes to follow
+    my $formats     = $_[0];                # Formatting information
+
+
+    # Pack the record.
+    my $data = '';
+
+    for my $a_ref (@$formats) {
+        $data .= pack "vvV", $a_ref->[0], $a_ref->[1], 0x0;
+    }
+
+    $length     = length $data;
+    my $header  = pack("vv", $record, $length);
+
+
+    $self->_append($header, $data);
+
+}
+
+
+###############################################################################
+#
+# _store_note()
+#
+# Write the worksheet NOTE record that is part of cell comments.
+#
+sub _store_note {
+
+    my $self        = shift;
+
+    my $record      = 0x001C;               # Record identifier
+    my $length      = 0x000C;               # Bytes to follow
+
+    my $row         = $_[0];
+    my $col         = $_[1];
+    my $obj_id      = $_[2];
+    my $author      = $_[3] || $self->{_comments_author};
+    my $author_enc  = $_[4] || $self->{_comments_author_enc};
+    my $visible     = $_[5];
+
+
+    # Use the visible flag if set by the user or else use the worksheet value.
+    # The flag is also set in _store_mso_opt() but with the opposite value.
+    #
+    if (defined $visible) {
+        $visible = $visible                   ? 0x0002 : 0x0000;
+    }
+    else {
+        $visible = $self->{_comments_visible} ? 0x0002 : 0x0000;
+    }
+
+
+    # Get the number of chars in the author string (not bytes).
+    my $num_chars  = length $author;
+       $num_chars /= 2 if $author_enc;
+
+
+    # Null terminate the author string.
+    $author .= "\0";
+
+
+    # Pack the record.
+    my $data    = pack("vvvvvC", $row, $col, $visible, $obj_id,
+                                 $num_chars, $author_enc);
+
+    $length     = length($data) + length($author);
+    my $header  = pack("vv", $record, $length);
+
+    $self->_append($header, $data, $author);
+}
+
+
+###############################################################################
+#
+# _comment_params()
+#
+# This method handles the additional optional parameters to write_comment() as
+# well as calculating the comment object position and vertices.
+#
+sub _comment_params {
+
+    my $self    = shift;
+
+    my $row     = shift;
+    my $col     = shift;
+    my $string  = shift;
+
+    my %params  = (
+                    author          => '',
+                    author_encoding => 0,
+                    encoding        => 0,
+                    color           => undef,
+                    start_cell      => undef,
+                    start_col       => undef,
+                    start_row       => undef,
+                    visible         => undef,
+                    width           => 129,
+                    height          => 75,
+                    x_offset        => undef,
+                    x_scale         => 1,
+                    y_offset        => undef,
+                    y_scale         => 1,
+                  );
+
+
+    # Overwrite the defaults with any user supplied values. Incorrect or
+    # misspelled parameters are silently ignored.
+    %params     = (%params, @_);
+
+
+    # Ensure that a width and height have been set.
+    $params{width}  = 129 if not $params{width};
+    $params{height} = 75  if not $params{height};
+
+
+    # Check that utf16 strings have an even number of bytes.
+    if ($params{encoding}) {
+        croak "Uneven number of bytes in comment string"
+               if length($string) % 2;
+
+        # Change from UTF-16BE to UTF-16LE
+        $string = pack 'v*', unpack 'n*', $string;
+    }
+
+    if ($params{author_encoding}) {
+        croak "Uneven number of bytes in author string"
+                if length($params{author}) % 2;
+
+        # Change from UTF-16BE to UTF-16LE
+        $params{author} = pack 'v*', unpack 'n*', $params{author};
+    }
+
+
+    # Handle utf8 strings in perl 5.8.
+    if ($] >= 5.008) {
+        require Encode;
+
+        if (Encode::is_utf8($string)) {
+            $string = Encode::encode("UTF-16LE", $string);
+            $params{encoding} = 1;
+        }
+
+        if (Encode::is_utf8($params{author})) {
+            $params{author} = Encode::encode("UTF-16LE", $params{author});
+            $params{author_encoding} = 1;
+        }
+    }
+
+
+    # Limit the string to the max number of chars (not bytes).
+    my $max_len  = 32767;
+       $max_len *= 2 if $params{encoding};
+
+    if (length($string) > $max_len) {
+        $string       = substr($string, 0, $max_len);
+    }
+
+
+    # Set the comment background colour.
+    my $color       = $params{color};
+       $color       = &Spreadsheet::WriteExcel::Format::_get_color($color);
+       $color       = 0x50 if $color == 0x7FFF; # Default color.
+    $params{color}  = $color;
+
+
+    # Convert a cell reference to a row and column.
+    if (defined $params{start_cell}) {
+        my ($row, $col)    = $self->_substitute_cellref($params{start_cell});
+        $params{start_row} = $row;
+        $params{start_col} = $col;
+    }
+
+
+    # Set the default start cell and offsets for the comment. These are
+    # generally fixed in relation to the parent cell. However there are
+    # some edge cases for cells at the, er, edges.
+    #
+    if (not defined $params{start_row}) {
+
+        if    ($row == 0    ) {$params{start_row} = 0      }
+        elsif ($row == 65533) {$params{start_row} = 65529  }
+        elsif ($row == 65534) {$params{start_row} = 65530  }
+        elsif ($row == 65535) {$params{start_row} = 65531  }
+        else                  {$params{start_row} = $row -1}
+    }
+
+    if (not defined $params{y_offset}) {
+
+        if    ($row == 0    ) {$params{y_offset}  = 2      }
+        elsif ($row == 65533) {$params{y_offset}  = 4      }
+        elsif ($row == 65534) {$params{y_offset}  = 4      }
+        elsif ($row == 65535) {$params{y_offset}  = 2      }
+        else                  {$params{y_offset}  = 7      }
+    }
+
+    if (not defined $params{start_col}) {
+
+        if    ($col == 253  ) {$params{start_col} = 250    }
+        elsif ($col == 254  ) {$params{start_col} = 251    }
+        elsif ($col == 255  ) {$params{start_col} = 252    }
+        else                  {$params{start_col} = $col +1}
+    }
+
+    if (not defined $params{x_offset}) {
+
+        if    ($col == 253  ) {$params{x_offset}  = 49     }
+        elsif ($col == 254  ) {$params{x_offset}  = 49     }
+        elsif ($col == 255  ) {$params{x_offset}  = 49     }
+        else                  {$params{x_offset}  = 15     }
+    }
+
+
+    # Scale the size of the comment box if required. We scale the width and
+    # height using the relationship d2 =(d1 -1)*s +1, where d is dimension
+    # and s is scale. This gives values that match Excel's behaviour.
+    #
+    if ($params{x_scale}) {
+        $params{width}  = (($params{width}  -1) * $params{x_scale}) +1;
+    }
+
+    if ($params{y_scale}) {
+        $params{height} = (($params{height} -1) * $params{y_scale}) +1;
+    }
+
+
+    # Calculate the positions of comment object.
+    my @vertices = $self->_position_object( $params{start_col},
+                                            $params{start_row},
+                                            $params{x_offset},
+                                            $params{y_offset},
+                                            $params{width},
+                                            $params{height}
+                                          );
+
+    return(
+           $row,
+           $col,
+           $string,
+           $params{encoding},
+           $params{author},
+           $params{author_encoding},
+           $params{visible},
+           $params{color},
+           [@vertices]
+          );
+}
+
+
+
+
+1;
+
+
+__END__
+
+
+=head1 NAME
+
+Worksheet - A writer class for Excel Worksheets.
+
+=head1 SYNOPSIS
+
+See the documentation for Spreadsheet::WriteExcel
+
+=head1 DESCRIPTION
+
+This module is used in conjunction with Spreadsheet::WriteExcel.
+
+=head1 AUTHOR
+
+John McNamara jmcnamara at cpan.org
+
+=head1 COPYRIGHT
+
+© MM-MMVI, John McNamara.
+
+All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/lib/Spreadsheet/WriteExcel.pm
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/lib/Spreadsheet/WriteExcel.pm	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/lib/Spreadsheet/WriteExcel.pm	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,4099 +1,4349 @@
-package Spreadsheet::WriteExcel;
-
-###############################################################################
-#
-# WriteExcel.
-#
-# Spreadsheet::WriteExcel - Write to a cross-platform Excel binary file.
-#
-# Copyright 2000-2005, John McNamara, jmcnamara at cpan.org
-#
-# Documentation after __END__
-#
-
-use Exporter;
-
-use strict;
-use Spreadsheet::WriteExcel::Workbook;
-
-
-
-use vars qw($VERSION @ISA);
- at ISA = qw(Spreadsheet::WriteExcel::Workbook Exporter);
-
-$VERSION = '2.15'; # Heloísa Pinheiro
-
-
-
-###############################################################################
-#
-# new()
-#
-# Constructor. Wrapper for a Workbook object.
-# uses: Spreadsheet::WriteExcel::BIFFwriter
-#       Spreadsheet::WriteExcel::Chart
-#       Spreadsheet::WriteExcel::OLEwriter
-#       Spreadsheet::WriteExcel::Workbook
-#       Spreadsheet::WriteExcel::Worksheet
-#       Spreadsheet::WriteExcel::Format
-#       Spreadsheet::WriteExcel::Formula
-#
-sub new {
-
-    my $class = shift;
-    my $self  = Spreadsheet::WriteExcel::Workbook->new(@_);
-
-    # Check for file creation failures before re-blessing
-    bless  $self, $class if defined $self;
-
-    return $self;
-}
-
-
-1;
-
-
-__END__
-
-
-
-=head1 NAME
-
-Spreadsheet::WriteExcel - Write to a cross-platform Excel binary file.
-
-=head1 VERSION
-
-This document refers to version 2.15 of Spreadsheet::WriteExcel, released September 18, 2005.
-
-
-
-
-=head1 SYNOPSIS
-
-To write a string, a formatted string, a number and a formula to the first worksheet in an Excel workbook called perl.xls:
-
-    use Spreadsheet::WriteExcel;
-
-    # Create a new Excel workbook
-    my $workbook = Spreadsheet::WriteExcel->new("perl.xls");
-
-    # Add a worksheet
-    $worksheet = $workbook->add_worksheet();
-
-    #  Add and define a format
-    $format = $workbook->add_format(); # Add a format
-    $format->set_bold();
-    $format->set_color('red');
-    $format->set_align('center');
-
-    # Write a formatted and unformatted string, row and column notation.
-    $col = $row = 0;
-    $worksheet->write($row, $col, "Hi Excel!", $format);
-    $worksheet->write(1,    $col, "Hi Excel!");
-
-    # Write a number and a formula using A1 notation
-    $worksheet->write('A3', 1.2345);
-    $worksheet->write('A4', '=SIN(PI()/4)');
-
-
-
-
-=head1 DESCRIPTION
-
-The Spreadsheet::WriteExcel module can be used to create a cross-platform Excel binary file. Multiple worksheets can be added to a workbook and formatting can be applied to cells. Text, numbers, formulas, hyperlinks and images can be written to the cells.
-
-The Excel file produced by this module is compatible with 97, 2000, 2002 and 2003.
-
-The module will work on the majority of Windows, UNIX and Macintosh platforms. Generated files are also compatible with the Linux/UNIX spreadsheet applications Gnumeric and OpenOffice.org.
-
-This module cannot be used to write to an existing Excel file.
-
-
-
-
-=head1 QUICK START
-
-Spreadsheet::WriteExcel tries to provide an interface to as many of Excel's features as possible. As a result there is a lot of documentation to accompany the interface and it can be difficult at first glance to see what it important and what is not. So for those of you who prefer to assemble Ikea furniture first and then read the instructions, here are three easy steps:
-
-1. Create a new Excel I<workbook> (i.e. file) using C<new()>.
-
-2. Add a I<worksheet> to the new workbook using C<add_worksheet()>.
-
-3. Write to the worksheet using C<write()>.
-
-Like this:
-
-    use Spreadsheet::WriteExcel;                             # Step 0
-
-    my $workbook = Spreadsheet::WriteExcel->new("perl.xls"); # Step 1
-    $worksheet   = $workbook->add_worksheet();               # Step 2
-    $worksheet->write('A1', "Hi Excel!");                    # Step 3
-
-This will create an Excel file called C<perl.xls> with a single worksheet and the text C<"Hi Excel!"> in the relevant cell. And that's it. Okay, so there is actually a zeroth step as well, but C<use module> goes without saying. There are also more than 40 examples that come with the distribution and which you can use to get you started. See L<EXAMPLES>.
-
-Those of you who read the instructions first and assemble the furniture afterwards will know how to proceed. ;-)
-
-
-
-
-=head1 WORKBOOK METHODS
-
-The Spreadsheet::WriteExcel module provides an object oriented interface to a new Excel workbook. The following methods are available through a new workbook.
-
-    new()
-    close()
-    set_tempdir()
-    add_worksheet()
-    add_format()
-    set_custom_color()
-    sheets()
-    set_1904()
-    set_codepage()
-
-If you are unfamiliar with object oriented interfaces or the way that they are implemented in Perl have a look at C<perlobj> and C<perltoot> in the main Perl documentation.
-
-
-
-
-=head2 new()
-
-A new Excel workbook is created using the C<new()> constructor which accepts either a filename or a filehandle as a parameter. The following example creates a new Excel file based on a filename:
-
-    my $workbook  = Spreadsheet::WriteExcel->new('filename.xls');
-    my $worksheet = $workbook->add_worksheet();
-    $worksheet->write(0, 0, "Hi Excel!");
-
-Here are some other examples of using C<new()> with filenames:
-
-    my $workbook1 = Spreadsheet::WriteExcel->new($filename);
-    my $workbook2 = Spreadsheet::WriteExcel->new("/tmp/filename.xls");
-    my $workbook3 = Spreadsheet::WriteExcel->new("c:\\tmp\\filename.xls");
-    my $workbook4 = Spreadsheet::WriteExcel->new('c:\tmp\filename.xls');
-
-The last two examples demonstrates how to create a file on DOS or Windows where it is necessary to either escape the directory separator C<\> or to use single quotes to ensure that it isn't interpolated. For more information  see C<perlfaq5: Why can't I use "C:\temp\foo" in DOS paths?>.
-
-The C<new()> constructor returns a Spreadsheet::WriteExcel object that you can use to add worksheets and store data. It should be noted that although C<my> is not specifically required it defines the scope of the new workbook variable and, in the majority of cases, ensures that the workbook is closed properly without explicitly calling the C<close()> method.
-
-If the file cannot be created, due to file permissions or some other reason,  C<new> will return C<undef>. Therefore, it is good practice to check the return value of C<new> before proceeding. As usual the Perl variable C<$!> will be set if there is a file creation error. You will also see one of the warning messages detailed in L<DIAGNOSTICS>:
-
-    my $workbook  = Spreadsheet::WriteExcel->new('protected.xls');
-    die "Problems creating new Excel file: $!" unless defined $workbook;
-
-You can also pass a valid filehandle to the C<new()> constructor. For example in a CGI program you could do something like this:
-
-    binmode(STDOUT);
-    my $workbook  = Spreadsheet::WriteExcel->new(\*STDOUT);
-
-The requirement for C<binmode()> is explained below.
-
-For CGI programs you can also use the special Perl filename C<'-'> which will redirect the output to STDOUT:
-
-    my $workbook  = Spreadsheet::WriteExcel->new('-');
-
-See also, the C<cgi.pl> program in the C<examples> directory of the distro.
-
-However, this special case will not work in C<mod_perl> programs where you will have to do something like the following:
-
-    # mod_perl 1
-    ...
-    tie *XLS, 'Apache';
-    binmode(XLS);
-    my $workbook  = Spreadsheet::WriteExcel->new(\*XLS);
-    ...
-
-    # mod_perl 2
-    ...
-    tie *XLS => $r;  # Tie to the Apache::RequestRec object
-    binmode(*XLS);
-    my $workbook  = Spreadsheet::WriteExcel->new(\*XLS);
-    ...
-
-See also, the C<mod_perl1.pl> and C<mod_perl2.pl> programs in the C<examples> directory of the distro.
-
-Filehandles can also be useful if you want to stream an Excel file over a socket or if you want to store an Excel file in a scalar.
-
-For example here is a way to write an Excel file to a scalar with C<perl 5.8>:
-
-    #!/usr/bin/perl -w
-
-    use strict;
-    use Spreadsheet::WriteExcel;
-
-    # Requires perl 5.8 or later
-    open my $fh, '>', \my $str or die "Failed to open filehandle: $!";
-
-    my $workbook  = Spreadsheet::WriteExcel->new($fh);
-    my $worksheet = $workbook->add_worksheet();
-
-    $worksheet->write(0, 0,  "Hi Excel!");
-
-    $workbook->close();
-
-    # The Excel file in now in $str. Remember to binmode() the output
-    # filehandle before printing it.
-    binmode STDOUT;
-    print $str;
-
-See also the C<write_to_scalar.pl> and C<filehandle.pl> programs in the C<examples> directory of the distro.
-
-B<Note about the requirement for> C<binmode()>: An Excel file is comprised of binary data. Therefore, if you are using a filehandle you should ensure that you C<binmode()> it prior to passing it to C<new()>.You should do this regardless of whether you are on a Windows platform or not. This applies especially to users of perl 5.8 on systems where utf8 is likely to be in operation such as RedHat Linux 9. If your program, either intentionally or not, writes UTF8 data to a filehandle that is passed to C<new()> it will corrupt the Excel file that is created.
-
-You don't have to worry about C<binmode()> if you are using filenames instead of filehandles. Spreadsheet::WriteExcel performs the C<binmode()> internally when it converts the filename to a filehandle. For more information about C<binmode()> see C<perlfunc> and C<perlopentut> in the main Perl documentation.
-
-
-
-
-
-=head2 close()
-
-The C<close()> method can be used to explicitly close an Excel file.
-
-    $workbook->close();
-
-An explicit C<close()> is required if the file must be closed prior to performing some external action on it such as copying it, reading its size or attaching it to an email.
-
-In addition, C<close()> may be required to prevent perl's garbage collector from disposing of the Workbook, Worksheet and Format objects in the wrong order. Situations where this can occur are:
-
-=over 4
-
-=item *
-
-If C<my()> was not used to declare the scope of a workbook variable created using C<new()>.
-
-=item *
-
-If the C<new()>, C<add_worksheet()> or C<add_format()> methods are called in subroutines.
-
-=back
-
-The reason for this is that Spreadsheet::WriteExcel relies on Perl's C<DESTROY> mechanism to trigger destructor methods in a specific sequence. This may not happen in cases where the Workbook, Worksheet and Format variables are not lexically scoped or where they have different lexical scopes.
-
-In general, if you create a file with a size of 0 bytes or you fail to create a file you need to call C<close()>.
-
-The return value of C<close()> is the same as that returned by perl when it closes the file created by C<new()>. This allows you to handle error conditions in the usual way:
-
-    $workbook->close() or die "Error closing file: $!";
-
-
-
-
-=head2 set_tempdir()
-
-For speed and efficiency C<Spreadsheet::WriteExcel> stores worksheet data in temporary files prior to assembling the final workbook.
-
-If Spreadsheet::WriteExcel is unable to create these temporary files it will store the required data in memory. This can be slow for large files.
-
-The problem occurs mainly with IIS on Windows although it could feasibly occur on Unix systems as well. The problem generally occurs because the default temp file directory is defined as C<C:/> or some other directory that IIS doesn't provide write access to.
-
-To check if this might be a problem on a particular system you can run a simple test program with C<-w> or C<use warnings>. This will generate a warning if the module cannot create the required temporary files:
-
-    #!/usr/bin/perl -w
-
-    use Spreadsheet::WriteExcel;
-
-    my $workbook  = Spreadsheet::WriteExcel->new("test.xls");
-    my $worksheet = $workbook->add_worksheet();
-
-To avoid this problem the C<set_tempdir()> method can be used to specify a directory that is accessible for the creation of temporary files.
-
-The C<File::Temp> module is used to create the temporary files. File::Temp uses C<File::Spec> to determine an appropriate location for these files such as C</tmp> or C<c:\windows\temp>. You can find out which directory is used on your system as follows:
-
-    perl -MFile::Spec -le "print File::Spec->tmpdir"
-
-Even if the default temporary file directory is accessible you may wish to specify an alternative location for security or maintenance reasons:
-
-    $workbook->set_tempdir('/tmp/writeexcel');
-    $workbook->set_tempdir('c:\windows\temp\writeexcel');
-
-The directory for the temporary file must exist, C<set_tempdir()> will not create a new directory.
-
-One disadvantage of using the C<set_tempdir()> method is that on some Windows systems it will limit you to approximately 800 concurrent tempfiles. This means that a single program running on one of these systems will be limited to creating a total of 800 workbook and worksheet objects. You can run multiple, non-concurrent programs to work around this if necessary.
-
-
-
-
-
-=head2 add_worksheet($sheetname)
-
-At least one worksheet should be added to a new workbook. A worksheet is used to write data into cells:
-
-    $worksheet1 = $workbook->add_worksheet();           # Sheet1
-    $worksheet2 = $workbook->add_worksheet('Foglio2');  # Foglio2
-    $worksheet3 = $workbook->add_worksheet('Data');     # Data
-    $worksheet4 = $workbook->add_worksheet();           # Sheet4
-
-If C<$sheetname> is not specified the default Excel convention will be followed, i.e. Sheet1, Sheet2, etc.
-
-The worksheet name must be a valid Excel worksheet name, i.e. it cannot contain any of the following characters, C<[ ] : * ? / \> and it must be less than 32 characters. In addition, you cannot use the same, case insensitive, C<$sheetname> for more than one worksheet.
-
-On systems with C<perl 5.8> and later the C<add_worksheet()> method will also handle strings in Perl's C<utf8> format.
-
-    $worksheet5 = $workbook->add_worksheet("\x{263a}"); # Smiley
-
-
-=head2 add_chart_ext($chart_data, $chartname)
-
-This method is use to include externally generated charts in a Spreadsheet::WriteExcel file.
-
-    my $chart = $workbook->add_chart_ext('chart01.bin', 'Chart1');
-
-This feature is new and would be best described as experimental. Read C<charts.txt> in the charts directory of the distro for a full explanation.
-
-
-
-=head2 add_format(%properties)
-
-The C<add_format()> method can be used to create new Format objects which are used to apply formatting to a cell. You can either define the properties at creation time via a hash of property values or later via method calls.
-
-    $format1 = $workbook->add_format(%props); # Set properties at creation
-    $format2 = $workbook->add_format();       # Set properties later
-
-See the L<CELL FORMATTING> section for more details about Format properties and how to set them.
-
-
-
-
-=head2 set_custom_color($index, $red, $green, $blue)
-
-The C<set_custom_color()> method can be used to override one of the built-in palette values with a more suitable colour.
-
-The value for C<$index> should be in the range 8..63, see L<COLOURS IN EXCEL>.
-
-The default named colours use the following indices:
-
-     8   =>   black
-     9   =>   white
-    10   =>   red
-    11   =>   lime
-    12   =>   blue
-    13   =>   yellow
-    14   =>   magenta
-    15   =>   cyan
-    16   =>   brown
-    17   =>   green
-    18   =>   navy
-    20   =>   purple
-    22   =>   silver
-    23   =>   gray
-    53   =>   orange
-
-A new colour is set using its RGB (red green blue) components. The C<$red>, C<$green> and C<$blue> values must be in the range 0..255. You can determine the required values in Excel using the C<Tools-E<gt>Options-E<gt>Colors-E<gt>Modify> dialog.
-
-The C<set_custom_color()> workbook method can also be used with a HTML style C<#rrggbb> hex value:
-
-    $workbook->set_custom_color(40, 255,  102,  0   ); # Orange
-    $workbook->set_custom_color(40, 0xFF, 0x66, 0x00); # Same thing
-    $workbook->set_custom_color(40, '#FF6600'       ); # Same thing
-
-    my $font = $workbook->add_format(color => 40); # Use the modified colour
-
-The return value from C<set_custom_color()> is the index of the colour that was changed:
-
-    my $ferrari = $workbook->set_custom_color(40, 216, 12, 12);
-
-    my $format  = $workbook->add_format(
-                                        bg_color => $ferrari,
-                                        pattern  => 1,
-                                        border   => 1
-                                      );
-
-
-
-
-=head2 sheets(0, 1, ...)
-
-The C<sheets()> method returns a list, or a sliced list, of the worksheets in a workbook.
-
-If no arguments are passed the method returns a list of all the worksheets in the workbook. This is useful if you want to repeat an operation on each worksheet:
-
-    foreach $worksheet ($workbook->sheets()) {
-       print $worksheet->get_name();
-    }
-
-
-You can also specify a slice list to return one or more worksheet objects:
-
-    $worksheet = $workbook->sheets(0);
-    $worksheet->write('A1', "Hello");
-
-
-Or since return value from C<sheets()> is a reference to a worksheet object you can write the above example as:
-
-    $workbook->sheets(0)->write('A1', "Hello");
-
-
-The following example returns the first and last worksheet in a workbook:
-
-    foreach $worksheet ($workbook->sheets(0, -1)) {
-       # Do something
-    }
-
-
-Array slices are explained in the perldata manpage.
-
-
-
-
-=head2 set_1904()
-
-Excel stores dates as real numbers where the integer part stores the number of days since the epoch and the fractional part stores the percentage of the day. The epoch can be either 1900 or 1904. Excel for Windows uses 1900 and Excel for Macintosh uses 1904. However, Excel on either platform will convert automatically between one system and the other.
-
-Spreadsheet::WriteExcel stores dates in the 1900 format by default. If you wish to change this you can call the C<set_1904()> workbook method. You can query the current value by calling the C<get_1904()> workbook method. This returns 0 for 1900 and 1 for 1904.
-
-See also L<DATES IN EXCEL> for more information about working with Excel's date system.
-
-In general you probably won't need to use C<set_1904()>.
-
-
-
-
-=head2 set_codepage($codepage)
-
-The default code page or character set used by Spreadsheet::WriteExcel is ANSI. This is also the default used by Excel for Windows. Occasionally however it may be necessary to change the code page via the C<set_codepage()> method.
-
-Changing the code page may be required if your are using Spreadsheet::WriteExcel on the Macintosh and you are using characters outside the ASCII 128 character set:
-
-    $workbook->set_codepage(1); # ANSI, MS Windows
-    $workbook->set_codepage(2); # Apple Macintosh
-
-The C<set_codepage()> method is rarely required.
-
-
-
-
-=head1 WORKSHEET METHODS
-
-A new worksheet is created by calling the C<add_worksheet()> method from a workbook object:
-
-    $worksheet1 = $workbook->add_worksheet();
-    $worksheet2 = $workbook->add_worksheet();
-
-The following methods are available through a new worksheet:
-
-    write()
-    write_number()
-    write_string()
-    write_unicode()
-    write_unicode_le()
-    keep_leading_zeros()
-    write_blank()
-    write_row()
-    write_col()
-    write_url()
-    write_url_range()
-    write_formula()
-    store_formula()
-    repeat_formula()
-    add_write_handler()
-    insert_bitmap()
-    get_name()
-    activate()
-    select()
-    set_first_sheet()
-    protect()
-    set_selection()
-    set_row()
-    set_column()
-    outline_settings()
-    freeze_panes()
-    thaw_panes()
-    merge_range()
-    set_zoom()
-
-
-=head2 Cell notation
-
-Spreadsheet::WriteExcel supports two forms of notation to designate the position of cells: Row-column notation and A1 notation.
-
-Row-column notation uses a zero based index for both row and column while A1 notation uses the standard Excel alphanumeric sequence of column letter and 1-based row. For example:
-
-    (0, 0)      # The top left cell in row-column notation.
-    ('A1')      # The top left cell in A1 notation.
-
-    (1999, 29)  # Row-column notation.
-    ('AD2000')  # The same cell in A1 notation.
-
-Row-column notation is useful if you are referring to cells programmatically:
-
-    for my $i (0 .. 9) {
-        $worksheet->write($i, 0, 'Hello'); # Cells A1 to A10
-    }
-
-A1 notation is useful for setting up a worksheet manually and for working with formulas:
-
-    $worksheet->write('H1', 200);
-    $worksheet->write('H2', '=H1+1');
-
-In formulas and applicable methods you can also use the C<A:A> column notation:
-
-    $worksheet->write('A1', '=SUM(B:B)');
-
-The C<Spreadsheet::WriteExcel::Utility> module that is included in the distro contains helper functions for dealing with A1 notation, for example:
-
-    use Spreadsheet::WriteExcel::Utility;
-
-    ($row, $col)    = xl_cell_to_rowcol('C2');  # (1, 2)
-    $str            = xl_rowcol_to_cell(1, 2);  # C2
-
-For simplicity, the parameter lists for the worksheet method calls in the following sections are given in terms of row-column notation. In all cases it is also possible to use A1 notation.
-
-Note: in Excel it is also possible to use a R1C1 notation. This is not supported by Spreadsheet::WriteExcel.
-
-
-
-
-=head2 write($row, $column, $token, $format)
-
-Excel makes a distinction between data types such as strings, numbers, blanks, formulas and hyperlinks. To simplify the process of writing data the C<write()> method acts as a general alias for several more specific methods:
-
-    write_string()
-    write_number()
-    write_blank()
-    write_formula()
-    write_url()
-    write_row()
-    write_col()
-
-The general rule is that if the data looks like a I<something> then a I<something> is written. Here are some examples in both row-column and A1 notation:
-
-                                                      # Same as:
-    $worksheet->write(0, 0, "Hello"                ); # write_string()
-    $worksheet->write(1, 0, 'One'                  ); # write_string()
-    $worksheet->write(2, 0,  2                     ); # write_number()
-    $worksheet->write(3, 0,  3.00001               ); # write_number()
-    $worksheet->write(4, 0,  ""                    ); # write_blank()
-    $worksheet->write(5, 0,  ''                    ); # write_blank()
-    $worksheet->write(6, 0,  undef                 ); # write_blank()
-    $worksheet->write(7, 0                         ); # write_blank()
-    $worksheet->write(8, 0,  'http://www.perl.com/'); # write_url()
-    $worksheet->write('A9',  'ftp://ftp.cpan.org/' ); # write_url()
-    $worksheet->write('A10', 'internal:Sheet1!A1'  ); # write_url()
-    $worksheet->write('A11', 'external:c:\foo.xls' ); # write_url()
-    $worksheet->write('A12', '=A3 + 3*A4'          ); # write_formula()
-    $worksheet->write('A13', '=SIN(PI()/4)'        ); # write_formula()
-    $worksheet->write('A14', \@array               ); # write_row()
-    $worksheet->write('A15', [\@array]             ); # write_col()
-
-    # And if the keep_leading_zeros property is set:
-    $worksheet->write('A16,  2                     ); # write_number()
-    $worksheet->write('A17,  02                    ); # write_string()
-    $worksheet->write('A18,  00002                 ); # write_string()
-
-
-The "looks like" rule is defined by regular expressions:
-
-C<write_number()> if C<$token> is a number based on the following regex: C<$token =~ /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/>.
-
-C<write_string()> if C<keep_leading_zeros()> is set and C<$token> is an integer with leading zeros based on the following regex: C<$token =~ /^0\d+$/>.
-
-C<write_blank()> if C<$token> is undef or a blank string: C<undef>, C<""> or C<''>.
-
-C<write_url()> if C<$token> is a http, https, ftp or mailto URL based on the following regexes: C<$token =~ m|^[fh]tt?ps?://|> or  C<$token =~ m|^mailto:|>.
-
-C<write_url()> if C<$token> is an internal or external sheet reference based on the following regex: C<$token =~ m[^(in|ex)ternal:]>.
-
-C<write_formula()> if the first character of C<$token> is C<"=">.
-
-C<write_row()> if C<$token> is an array ref.
-
-C<write_col()> if C<$token> is an array ref of array refs.
-
-C<write_string()> if none of the previous conditions apply.
-
-The C<$format> parameter is optional. It should be a valid Format object, see L<CELL FORMATTING>:
-
-    my $format = $workbook->add_format();
-    $format->set_bold();
-    $format->set_color('red');
-    $format->set_align('center');
-
-    $worksheet->write(4, 0, "Hello", $format ); # Formatted string
-
-The write() method will ignore empty strings or C<undef> tokens unless a format is also supplied. As such you needn't worry about special handling for empty or C<undef> values in your data. See also the C<write_blank()> method.
-
-One problem with the C<write()> method is that occasionally data looks like a number but you don't want it treated as a number. For example, zip codes or ID numbers often start with a leading zero. If you write this data as a number then the leading zero(s) will be stripped. You can change this default behaviour by using the C<keep_leading_zeros()> method. While this property is in place any integers with leading zeros will be treated as strings and the zeros will be preserved. See the C<keep_leading_zeros()> section for a full discussion of this issue.
-
-You can also add your own data handlers to the C<write()> method using C<add_write_handler()>.
-
-On systems with C<perl 5.8> and later the C<write()> method will also handle Unicode strings in Perl's C<utf8> format.
-
-The C<write> methods return:
-
-    0 for success.
-   -1 for insufficient number of arguments.
-   -2 for row or column out of bounds.
-   -3 for string too long.
-
-
-
-
-=head2 write_number($row, $column, $number, $format)
-
-Write an integer or a float to the cell specified by C<$row> and C<$column>:
-
-    $worksheet->write_number(0, 0,  123456);
-    $worksheet->write_number('A2',  2.3451);
-
-See the note about L<Cell notation>. The C<$format> parameter is optional.
-
-In general it is sufficient to use the C<write()> method.
-
-
-
-
-=head2 write_string($row, $column, $string, $format)
-
-Write a string to the cell specified by C<$row> and C<$column>:
-
-    $worksheet->write_string(0, 0, "Your text here" );
-    $worksheet->write_string('A2', "or here" );
-
-The maximum string size is 32767 characters. However the maximum string segment that Excel can display in a cell is 1000. All 32767 characters can be displayed in the formula bar.
-
-The C<$format> parameter is optional.
-
-On systems with C<perl 5.8> and later the C<write()> method will also handle strings in Perl's C<utf8> format. With older perls you can also write Unicode in C<UTF16> format via the C<write_unicode()> method. See also the C<unicode_*.pl> programs in the examples directory of the distro.
-
-In general it is sufficient to use the C<write()> method. However, you may sometimes wish to use the C<write_string()> method to write data that looks like a number but that you don't want treated as a number. For example, zip codes or phone numbers:
-
-    # Write as a plain string
-    $worksheet->write_string('A1', '01209');
-
-However, if the user edits this string Excel may convert it back to a number. To get around this you can use the Excel text format C<@>:
-
-    # Format as a string. Doesn't change to a number when edited
-    my $format1 = $workbook->add_format(num_format => '@');
-    $worksheet->write_string('A2', '01209', $format1);
-
-See also the note about L<Cell notation>.
-
-
-
-
-=head2 write_unicode($row, $column, $string, $format)
-
-This method is used to write Unicode strings to a cell in Excel. It is functionally the same as the C<write_string()> method except that the string should be in UTF-16 Unicode format.
-
-B<Note>: on systems with C<perl 5.8> and later the C<write()> and C<write_string()>methods will also handle strings in Perl's C<utf8> format. With older perls you must use the C<write_unicode()> method.
-
-The Unicode format required by Excel is UTF-16. Additionally C<Spreadsheet::WriteExcel> requires that the 16-bit characters are in big-endian order. This is generally referred to as UTF-16BE. To write UTF-16 strings in little-endian format use the C<write_unicode_le()> method.
-
-
-The following is a simple example showing how to write some Unicode strings:
-
-    #!/usr/bin/perl -w
-
-
-    use strict;
-    use Spreadsheet::WriteExcel;
-    use Unicode::Map();
-
-    my $workbook  = Spreadsheet::WriteExcel->new('unicode.xls');
-    my $worksheet = $workbook->add_worksheet();
-
-    # Increase the column width for clarity
-    $worksheet->set_column('A:A', 25);
-
-
-    # Write a Unicode character
-    #
-    my $smiley = pack "n", 0x263a;
-
-    # Increase the font size for legibility.
-    my $big_font = $workbook->add_format(size => 72);
-
-    $worksheet->write_unicode('A3', $smiley, $big_font);
-
-
-
-    # Write a phrase in Cyrillic using a hex-encoded string
-    #
-    my $uni_str = pack "H*", "042d0442043e0020044404400430043704300020043d" .
-                             "043000200440044304410441043a043e043c0021";
-
-    $worksheet->write_unicode('A5', $uni_str);
-
-
-
-    # Map a string to UTF-16BE using an external module.
-    #
-    my $map   = Unicode::Map->new("ISO-8859-1");
-    my $utf16 = $map->to_unicode("Hello world!");
-
-    $worksheet->write_unicode('A7', $utf16);
-
-
-The following is an example of creating an Excel file with some Japanese text. You will need to have a Unicode font installed, such as C<Arial Unicode MS>, to view the results:
-
-
-    #!/usr/bin/perl -w
-
-
-    use strict;
-    use Spreadsheet::WriteExcel;
-
-
-    my $workbook  = Spreadsheet::WriteExcel->new('unicode.xls');
-    my $worksheet = $workbook->add_worksheet();
-
-
-    # It is only required to specify a Unicode font via add_format() if
-    # you are using Excel 97. For Excel 2000+ the text will display
-    # with the default font (if you have Unicode fonts installed).
-    #
-    my $uni_font  = $workbook->add_format(font => 'Arial Unicode MS');
-
-
-    my $kanji     = pack 'n*', 0x65e5, 0x672c;
-    my $katakana  = pack 'n*', 0xff86, 0xff8e, 0xff9d;
-    my $hiragana  = pack 'n*', 0x306b, 0x307b, 0x3093;
-
-
-    $worksheet->write_unicode('A1', $kanji,    $uni_font);
-    $worksheet->write_unicode('A2', $katakana, $uni_font);
-    $worksheet->write_unicode('A3', $hiragana, $uni_font);
-
-
-    $worksheet->write('B1', 'Kanji');
-    $worksheet->write('B2', 'Katakana');
-    $worksheet->write('B3', 'Hiragana');
-
-
-Note: You can convert ascii encodings to the required UTF-16BE format using one of the many Unicode modules on CPAN. For example C<Unicode::Map> and C<Unicode::String>: http://search.cpan.org/author/MSCHWARTZ/Unicode-Map-0.112/Map.pm and http://search.cpan.org/author/GAAS/Unicode-String-2.06/String.pm
-
-For a full list of the Perl Unicode modules see: http://search.cpan.org/search?query=unicode&mode=all
-
-See also the C<unicode_*.pl> programs in the examples directory of the distro.
-
-
-
-=head2 write_unicode_le($row, $column, $string, $format)
-
-This method is the same as C<write_unicode()> except that the string should be 16-bit characters in little-endian format. This is generally referred to as UTF-16LE.
-
-UTF-16 data can be changed from little-endian to big-endian format (and vice-versa) as follows:
-
-    $utf16 = pack "n*", unpack "v*", $utf16;
-
-Note, it is slightly faster to write little-endian data via write_unicode_le() than it is to write big-endian data via write_unicode().
-
-
-
-
-=head2 keep_leading_zeros()
-
-This method changes the default handling of integers with leading zeros when using the C<write()> method.
-
-The C<write()> method uses regular expressions to determine what type of data to write to an Excel worksheet. If the data looks like a number it writes a number using C<write_number()>. One problem with this approach is that occasionally data looks like a number but you don't want it treated as a number.
-
-Zip codes and ID numbers, for example, often start with a leading zero. If you write this data as a number then the leading zero(s) will be stripped. This is the also the default behaviour when you enter data manually in Excel.
-
-To get around this you can use one of three options. Write a formatted number, write the number as a string or use the C<keep_leading_zeros()> method to change the default behaviour of C<write()>:
-
-    # Implicitly write a number, the leading zero is removed: 1209
-    $worksheet->write('A1', '01209');
-
-    # Write a zero padded number using a format: 01209
-    my $format1 = $workbook->add_format(num_format => '00000');
-    $worksheet->write('A2', '01209', $format1);
-
-    # Write explicitly as a string: 01209
-    $worksheet->write_string('A3', '01209');
-
-    # Write implicitly as a string: 01209
-    $worksheet->keep_leading_zeros();
-    $worksheet->write('A4', '01209');
-
-
-The above code would generate a worksheet that looked like the following:
-
-     -----------------------------------------------------------
-    |   |     A     |     B     |     C     |     D     | ...
-     -----------------------------------------------------------
-    | 1 |      1209 |           |           |           | ...
-    | 2 |     01209 |           |           |           | ...
-    | 3 | 01209     |           |           |           | ...
-    | 4 | 01209     |           |           |           | ...
-
-
-The examples are on different sides of the cells due to the fact that Excel displays strings with a left justification and numbers with a right justification by default. You can change this by using a format to justify the data, see L<CELL FORMATTING>.
-
-It should be noted that if the user edits the data in examples C<A3> and C<A4> the strings will revert back to numbers. Again this is Excel's default behaviour. To avoid this you can use the text format C<@>:
-
-    # Format as a string (01209)
-    my $format2 = $workbook->add_format(num_format => '@');
-    $worksheet->write_string('A5', '01209', $format2);
-
-The C<keep_leading_zeros()> property is off by default. The C<keep_leading_zeros()> method takes 0 or 1 as an argument. It defaults to 1 if an argument isn't specified:
-
-    $worksheet->keep_leading_zeros();  # Set on
-    $worksheet->keep_leading_zeros(1); # Set on
-    $worksheet->keep_leading_zeros(0); # Set off
-
-See also the C<add_write_handler()> method.
-
-
-=head2 write_blank($row, $column, $format)
-
-Write a blank cell specified by C<$row> and C<$column>:
-
-    $worksheet->write_blank(0, 0, $format);
-
-This method is used to add formatting to a cell which doesn't contain a string or number value.
-
-Excel differentiates between an "Empty" cell and a "Blank" cell. An "Empty" cell is a cell which doesn't contain data whilst a "Blank" cell is a cell which doesn't contain data but does contain formatting. Excel stores "Blank" cells but ignores "Empty" cells.
-
-As such, if you write an empty cell without formatting it is ignored:
-
-    $worksheet->write('A1',  undef, $format); # write_blank()
-    $worksheet->write('A2',  undef         ); # Ignored
-
-This seemingly uninteresting fact means that you can write arrays of data without special treatment for undef or empty string values.
-
-See the note about L<Cell notation>.
-
-
-
-
-=head2 write_row($row, $column, $array_ref, $format)
-
-The C<write_row()> method can be used to write a 1D or 2D array of data in one go. This is useful for converting the results of a database query into an Excel worksheet. You must pass a reference to the array of data rather than the array itself. The C<write()> method is then called for each element of the data. For example:
-
-    @array      = ('awk', 'gawk', 'mawk');
-    $array_ref  = \@array;
-
-    $worksheet->write_row(0, 0, $array_ref);
-
-    # The above example is equivalent to:
-    $worksheet->write(0, 0, $array[0]);
-    $worksheet->write(0, 1, $array[1]);
-    $worksheet->write(0, 2, $array[2]);
-
-
-Note: For convenience the C<write()> method behaves in the same way as C<write_row()> if it is passed an array reference. Therefore the following two method calls are equivalent:
-
-    $worksheet->write_row('A1', $array_ref); # Write a row of data
-    $worksheet->write(    'A1', $array_ref); # Same thing
-
-As with all of the write methods the C<$format> parameter is optional. If a format is specified it is applied to all the elements of the data array.
-
-Array references within the data will be treated as columns. This allows you to write 2D arrays of data in one go. For example:
-
-    @eec =  (
-                ['maggie', 'milly', 'molly', 'may'  ],
-                [13,       14,      15,      16     ],
-                ['shell',  'star',  'crab',  'stone']
-            );
-
-    $worksheet->write_row('A1', \@eec);
-
-
-Would produce a worksheet as follows:
-
-     -----------------------------------------------------------
-    |   |    A    |    B    |    C    |    D    |    E    | ...
-     -----------------------------------------------------------
-    | 1 | maggie  | 13      | shell   | ...     |  ...    | ...
-    | 2 | milly   | 14      | star    | ...     |  ...    | ...
-    | 3 | molly   | 15      | crab    | ...     |  ...    | ...
-    | 4 | may     | 16      | stone   | ...     |  ...    | ...
-    | 5 | ...     | ...     | ...     | ...     |  ...    | ...
-    | 6 | ...     | ...     | ...     | ...     |  ...    | ...
-
-
-To write the data in a row-column order refer to the C<write_col()> method below.
-
-Any C<undef> values in the data will be ignored unless a format is applied to the data, in which case a formatted blank cell will be written. In either case the appropriate row or column value will still be incremented.
-
-To find out more about array references refer to C<perlref> and C<perlreftut> in the main Perl documentation. To find out more about 2D arrays or "lists of lists" refer to C<perllol>.
-
-The C<write_row()> method returns the first error encountered when writing the elements of the data or zero if no errors were encountered. See the return values described for the C<write()> method above.
-
-See also the C<write_arrays.pl> program in the C<examples> directory of the distro.
-
-The C<write_row()> method allows the following idiomatic conversion of a text file to an Excel file:
-
-    #!/usr/bin/perl -w
-
-    use strict;
-    use Spreadsheet::WriteExcel;
-
-    my $workbook  = Spreadsheet::WriteExcel->new('file.xls');
-    my $worksheet = $workbook->add_worksheet();
-
-    open INPUT, "file.txt" or die "Couldn't open file: $!";
-
-    $worksheet->write($.-1, 0, [split]) while <INPUT>;
-
-
-
-
-=head2 write_col($row, $column, $array_ref, $format)
-
-The C<write_col()> method can be used to write a 1D or 2D array of data in one go. This is useful for converting the results of a database query into an Excel worksheet. You must pass a reference to the array of data rather than the array itself. The C<write()> method is then called for each element of the data. For example:
-
-    @array      = ('awk', 'gawk', 'mawk');
-    $array_ref  = \@array;
-
-    $worksheet->write_col(0, 0, $array_ref);
-
-    # The above example is equivalent to:
-    $worksheet->write(0, 0, $array[0]);
-    $worksheet->write(1, 0, $array[1]);
-    $worksheet->write(2, 0, $array[2]);
-
-As with all of the write methods the C<$format> parameter is optional. If a format is specified it is applied to all the elements of the data array.
-
-Array references within the data will be treated as rows. This allows you to write 2D arrays of data in one go. For example:
-
-    @eec =  (
-                ['maggie', 'milly', 'molly', 'may'  ],
-                [13,       14,      15,      16     ],
-                ['shell',  'star',  'crab',  'stone']
-            );
-
-    $worksheet->write_col('A1', \@eec);
-
-
-Would produce a worksheet as follows:
-
-     -----------------------------------------------------------
-    |   |    A    |    B    |    C    |    D    |    E    | ...
-     -----------------------------------------------------------
-    | 1 | maggie  | milly   | molly   | may     |  ...    | ...
-    | 2 | 13      | 14      | 15      | 16      |  ...    | ...
-    | 3 | shell   | star    | crab    | stone   |  ...    | ...
-    | 4 | ...     | ...     | ...     | ...     |  ...    | ...
-    | 5 | ...     | ...     | ...     | ...     |  ...    | ...
-    | 6 | ...     | ...     | ...     | ...     |  ...    | ...
-
-
-To write the data in a column-row order refer to the C<write_row()> method above.
-
-Any C<undef> values in the data will be ignored unless a format is applied to the data, in which case a formatted blank cell will be written. In either case the appropriate row or column value will still be incremented.
-
-As noted above the C<write()> method can be used as a synonym for C<write_row()> and C<write_row()> handles nested array refs as columns. Therefore, the following two method calls are equivalent although the more explicit call to C<write_col()> would be preferable for maintainability:
-
-    $worksheet->write_col('A1', $array_ref    ); # Write a column of data
-    $worksheet->write(    'A1', [ $array_ref ]); # Same thing
-
-To find out more about array references refer to C<perlref> and C<perlreftut> in the main Perl documentation. To find out more about 2D arrays or "lists of lists" refer to C<perllol>.
-
-The C<write_col()> method returns the first error encountered when writing the elements of the data or zero if no errors were encountered. See the return values described for the C<write()> method above.
-
-See also the C<write_arrays.pl> program in the C<examples> directory of the distro.
-
-
-
-
-=head2 write_date_time($row, $col, $date_string, $format)
-
-The C<write_date_time()> method can be used to write a date or time to the cell specified by C<$row> and C<$column>:
-
-    $worksheet->write_date_time('A1', '2004-05-13T23:20', $date_format);
-
-The C<$date_string> should be in the following format:
-
-    yyyy-mm-ddThh:mm:ss.sss
-
-This conforms to am ISO8601 date but it should be noted that the full range of ISO8601 formats are not supported.
-
-The following variations on the C<$date_string> parameter are permitted:
-
-    yyyy-mm-ddThh:mm:ss.sss         # Standard format
-    yyyy-mm-ddT                     # No time
-              Thh:mm:ss.sss         # No date
-    yyyy-mm-ddThh:mm:ss.sssZ        # Additional Z (but not time zones)
-    yyyy-mm-ddThh:mm:ss             # No fractional seconds
-    yyyy-mm-ddThh:mm                # No seconds
-
-Note that the C<T> is required in all cases.
-
-A date should always have a C<$format>, otherwise it will appear as a number, see L<DATES IN EXCEL> and L<CELL FORMATTING>. Here is a typical example:
-
-    my $date_format = $workbook->add_format(num_format => 'mm/dd/yy');
-    $worksheet->write_date_time('A1', '2004-05-13T23:20', $date_format);
-
-Valid dates should be in the range 1900-01-01 to 9999-12-31, for the 1900 epoch and 1904-01-01 to 9999-12-31, for the 1904 epoch. As with Excel, dates outside these ranges will be written as a string.
-
-See also the date_time.pl program in the C<examples> directory of the distro.
-
-
-
-
-=head2 write_url($row, $col, $url, $string, $format)
-
-Write a hyperlink to a URL in the cell specified by C<$row> and C<$column>. The hyperlink is comprised of two elements: the visible label and the invisible link. The visible label is the same as the link unless an alternative string is specified. The parameters C<$string> and the C<$format> are optional and their position is interchangeable.
-
-The label is written using the C<write_string()> method. Therefore the 255 characters string limit applies to the label: the URL can be any length.
-
-There are four web style URI's supported: C<http://>, C<https://>, C<ftp://> and  C<mailto:>:
-
-    $worksheet->write_url(0, 0,  'ftp://www.perl.org/'                  );
-    $worksheet->write_url(1, 0,  'http://www.perl.com/', 'Perl home'    );
-    $worksheet->write_url('A3',  'http://www.perl.com/', $format        );
-    $worksheet->write_url('A4',  'http://www.perl.com/', 'Perl', $format);
-    $worksheet->write_url('A5',  'mailto:jmcnamara at cpan.org'            );
-
-There are two local URIs supported: C<internal:> and C<external:>. These are used for hyperlinks to internal worksheet references or external workbook and worksheet references:
-
-    $worksheet->write_url('A6',  'internal:Sheet2!A1'                   );
-    $worksheet->write_url('A7',  'internal:Sheet2!A1',   $format        );
-    $worksheet->write_url('A8',  'internal:Sheet2!A1:B2'                );
-    $worksheet->write_url('A9',  q{internal:'Sales Data'!A1}            );
-    $worksheet->write_url('A10', 'external:c:\temp\foo.xls'             );
-    $worksheet->write_url('A11', 'external:c:\temp\foo.xls#Sheet2!A1'   );
-    $worksheet->write_url('A12', 'external:..\..\..\foo.xls'            );
-    $worksheet->write_url('A13', 'external:..\..\..\foo.xls#Sheet2!A1'  );
-    $worksheet->write_url('A13', 'external:\\\\NETWORK\share\foo.xls'   );
-
-All of the these URI types are recognised by the C<write()> method, see above.
-
-Worksheet references are typically of the form C<Sheet1!A1>. You can also refer to a worksheet range using the standard Excel notation: C<Sheet1!A1:B2>.
-
-In external links the workbook and worksheet name must be separated by the C<#> character: C<external:Workbook.xls#Sheet1!A1'>.
-
-You can also link to a named range in the target worksheet. For example say you have a named range called C<my_name> in the workbook C<c:\temp\foo.xls> you could link to it as follows:
-
-    $worksheet->write_url('A14', 'external:c:\temp\foo.xls#my_name');
-
-Note, you cannot currently create named ranges with C<Spreadsheet::WriteExcel>.
-
-Excel requires that worksheet names containing spaces or non alphanumeric characters are single quoted as follows C<'Sales Data'!A1>. If you need to do this in a single quoted string then you can either escape the single quotes C<\'> or use the quote operator C<q{}> as described in C<perlop> in the main Perl documentation.
-
-Links to network files are also supported. MS/Novell Network files normally begin with two back slashes as follows C<\\NETWORK\etc>. In order to generate this in a single or double quoted string you will have to escape the backslashes,  C<'\\\\NETWORK\etc'>.
-
-If you are using double quote strings then you should be careful to escape anything that looks like a metacharacter. For more information  see C<perlfaq5: Why can't I use "C:\temp\foo" in DOS paths?>.
-
-Finally, you can avoid most of these quoting problems by using forward slashes. These are translated internally to backslashes:
-
-    $worksheet->write_url('A14', "external:c:/temp/foo.xls"             );
-    $worksheet->write_url('A15', 'external://NETWORK/share/foo.xls'     );
-
-See also, the note about L<Cell notation>.
-
-
-
-
-=head2 write_url_range($row1, $col1, $row2, $col2, $url, $string, $format)
-
-This method is essentially the same as the C<write_url()> method described above. The main difference is that you can specify a link for a range of cells:
-
-    $worksheet->write_url(0, 0, 0, 3, 'ftp://www.perl.org/'              );
-    $worksheet->write_url(1, 0, 0, 3, 'http://www.perl.com/', 'Perl home');
-    $worksheet->write_url('A3:D3',    'internal:Sheet2!A1'               );
-    $worksheet->write_url('A4:D4',    'external:c:\temp\foo.xls'         );
-
-
-This method is generally only required when used in conjunction with merged cells. See the C<merge_range()> method and the C<merge> property of a Format object, L<CELL FORMATTING>.
-
-There is no way to force this behaviour through the C<write()> method.
-
-The parameters C<$string> and the C<$format> are optional and their position is interchangeable. However, they are applied only to the first cell in the range.
-
-See also, the note about L<Cell notation>.
-
-
-
-
-=head2 write_formula($row, $column, $formula, $format, $value)
-
-Write a formula or function to the cell specified by C<$row> and C<$column>:
-
-    $worksheet->write_formula(0, 0, '=$B$3 + B4'  );
-    $worksheet->write_formula(1, 0, '=SIN(PI()/4)');
-    $worksheet->write_formula(2, 0, '=SUM(B1:B5)' );
-    $worksheet->write_formula('A4', '=IF(A3>1,"Yes", "No")'   );
-    $worksheet->write_formula('A5', '=AVERAGE(1, 2, 3, 4)'    );
-    $worksheet->write_formula('A6', '=DATEVALUE("1-Jan-2001")');
-
-See the note about L<Cell notation>. For more information about writing Excel formulas see L<FORMULAS AND FUNCTIONS IN EXCEL>
-
-See also the section "Improving performance when working with formulas" and the C<store_formula()> and C<repeat_formula()> methods.
-
-If required, it is also possible to specify the calculated value of the formula. This is occasionally necessary when working with non-Excel applications that don't calculated the value of the formula. The calculated C<$value> is added at the end of the argument list:
-
-    $worksheet->write('A1', '=2+2', $format, 4);
-
-However, this probably isn't something that will ever need to do. If you do use this feature then do so with care.
-
-
-
-
-=head2 store_formula($formula)
-
-The C<store_formula()> method is used in conjunction with C<repeat_formula()> to speed up the generation of repeated formulas. See "Improving performance when working with formulas" in L<FORMULAS AND FUNCTIONS IN EXCEL>.
-
-The C<store_formula()> method pre-parses a textual representation of a formula and stores it for use at a later stage by the C<repeat_formula()> method.
-
-C<store_formula()> carries the same speed penalty as C<write_formula()>. However, in practice it will be used less frequently.
-
-The return value of this method is a scalar that can be thought of as a reference to a formula.
-
-    my $sin = $worksheet->store_formula('=SIN(A1)');
-    my $cos = $worksheet->store_formula('=COS(A1)');
-
-    $worksheet->repeat_formula('B1', $sin, $format, 'A1', 'A2');
-    $worksheet->repeat_formula('C1', $cos, $format, 'A1', 'A2');
-
-Although C<store_formula()> is a worksheet method the return value can be used in any worksheet:
-
-    my $now = $worksheet->store_formula('=NOW()');
-
-    $worksheet1->repeat_formula('B1', $now);
-    $worksheet2->repeat_formula('B1', $now);
-    $worksheet3->repeat_formula('B1', $now);
-
-
-
-=head2 repeat_formula($row, $col, $formula, $format, ($pattern => $replace, ...))
-
-
-The C<repeat_formula()> method is used in conjunction with C<store_formula()> to speed up the generation of repeated formulas.  See "Improving performance when working with formulas" in L<FORMULAS AND FUNCTIONS IN EXCEL>.
-
-In many respects C<repeat_formula()> behaves like C<write_formula()> except that it is significantly faster.
-
-The C<repeat_formula()> method creates a new formula based on the pre-parsed tokens returned by C<store_formula()>. The new formula is generated by substituting C<$pattern>, C<$replace> pairs in the stored formula:
-
-    my $formula = $worksheet->store_formula('=A1 * 3 + 50');
-
-    for my $row (0..99) {
-        $worksheet->repeat_formula($row, 1, $formula, $format, 'A1', 'A'.($row +1));
-    }
-
-It should be noted that C<repeat_formula()> doesn't modify the tokens. In the above example the substitution is always made against the original token, C<A1>, which doesn't change.
-
-As usual, you can use C<undef> if you don't wish to specify a C<$format>:
-
-    $worksheet->repeat_formula('B2', $formula, $format, 'A1', 'A2');
-    $worksheet->repeat_formula('B3', $formula, undef,   'A1', 'A3');
-
-The substitutions are made from left to right and you can use as many C<$pattern>, C<$replace> pairs as you need. However, each substitution is made only once:
-
-    my $formula = $worksheet->store_formula('=A1 + A1');
-
-    # Gives '=B1 + A1'
-    $worksheet->repeat_formula('B1', $formula, undef, 'A1', 'B1');
-
-    # Gives '=B1 + B1'
-    $worksheet->repeat_formula('B2', $formula, undef, ('A1', 'B1') x 2);
-
-Since the C<$pattern> is interpolated each time that it is used it is worth using the C<qr> operator to quote the pattern. The C<qr> operator is explained in the C<perlop> man page.
-
-    $worksheet->repeat_formula('B1', $formula, $format, qr/A1/, 'A2');
-
-Care should be taken with the values that are substituted. The formula returned by C<repeat_formula()> contains several other tokens in addition to those in the formula and these might also match the  pattern that you are trying to replace. In particular you should avoid substituting a single 0, 1, 2 or 3.
-
-You should also be careful to avoid false matches. For example the following snippet is meant to change the stored formula in steps from C<=A1 + SIN(A1)> to C<=A10 + SIN(A10)>.
-
-    my $formula = $worksheet->store_formula('=A1 + SIN(A1)');
-
-    for my $row (1 .. 10) {
-        $worksheet->repeat_formula($row -1, 1, $formula, undef,
-                                    qw/A1/, 'A' . $row,   #! Bad.
-                                    qw/A1/, 'A' . $row    #! Bad.
-                                  );
-    }
-
-However it contains a bug. In the last iteration of the loop when C<$row> is 10 the following substitutions will occur:
-
-    s/A1/A10/;    changes    =A1 + SIN(A1)     to    =A10 + SIN(A1)
-    s/A1/A10/;    changes    =A10 + SIN(A1)    to    =A100 + SIN(A1) # !!
-
-The solution in this case is to use a more explicit match such as C<qw/^A1$/>:
-
-        $worksheet->repeat_formula($row -1, 1, $formula, undef,
-                                    qw/^A1$/, 'A' . $row,
-                                    qw/^A1$/, 'A' . $row
-                                  );
-
-Another similar problem occurs due to the fact that substitutions are made in order. For example the following snippet is meant to change the stored formula from C<=A10 + A11>  to C<=A11 + A12>:
-
-    my $formula = $worksheet->store_formula('=A10 + A11');
-
-    $worksheet->repeat_formula('A1', $formula, undef,
-                                qw/A10/, 'A11',   #! Bad.
-                                qw/A11/, 'A12'    #! Bad.
-                              );
-
-However, the actual substitution yields C<=A12 + A11>:
-
-    s/A10/A11/;    changes    =A10 + A11    to    =A11 + A11
-    s/A11/A12/;    changes    =A11 + A11    to    =A12 + A11 # !!
-
-The solution here would be to reverse the order of the substitutions or to start with a stored formula that won't yield a false match such as C<=X10 + Y11>:
-
-    my $formula = $worksheet->store_formula('=X10 + Y11');
-
-    $worksheet->repeat_formula('A1', $formula, undef,
-                                qw/X10/, 'A11',
-                                qw/Y11/, 'A12'
-                              );
-
-
-If you think that you have a problem related to a false match you can check the tokens that you are substituting against as follows.
-
-    my $formula = $worksheet->store_formula('=A1*5+4');
-    print "@$formula\n";
-
-See also the C<repeat.pl> program in the C<examples> directory of the distro.
-
-
-
-
-=head2 write_comment($row, $column, $string)
-
-B<NOTE: this method is not available in this release. Use the 1.xx versions of this module if you need this feature>.
-
-
-The C<write_comment()> method is used to add a comment to a cell. A cell comment is indicated in Excel by a small red triangle in the upper right-hand corner of the cell. Moving the cursor over the red triangle will cause the comment to appear.
-
-The following example shows how to add a comment to a cell:
-
-    $worksheet->write("C3", "Hello");
-    $worksheet->write_comment("C3", "This is a comment.");
-
-
-The cell comment can be up to 30,000 characters in length.
-
-
-
-
-=head2 add_write_handler($re, $code_ref)
-
-This method is used to extend the Spreadsheet::WriteExcel write() method to handle user defined data.
-
-If you refer to the section on C<write()> above you will see that it acts as an alias for several more specific C<write_*> methods. However, it doesn't always act in exactly the way that you would like it to.
-
-One solution is to filter the input data yourself and call the appropriate C<write_*> method. Another approach is to use the C<add_write_handler()> method to add your own automated behaviour to C<write()>.
-
-The C<add_write_handler()> method take two arguments, C<$re>, a regular expression to match incoming data and C<$code_ref> a callback function to handle the matched data:
-
-    $worksheet->add_write_handler(qr/^\d\d\d\d$/, \&my_write);
-
-(In the these examples the C<qr> operator is used to quote the regular expression strings, see L<perlop> for more details).
-
-The method is use as follows. say you wished to write 7 digit ID numbers as a string so that any leading zeros were preserved*, you could do something like the following:
-
-    $worksheet->add_write_handler(qr/^\d{7}$/, \&write_my_id);
-
-
-    sub write_my_id {
-        my $worksheet = shift;
-        return $worksheet->write_string(@_);
-    }
-
-* You could also use the C<keep_leading_zeros()> method for this.
-
-Then if you call C<write()> with an appropriate string it will be handled automatically:
-
-    # Writes 0000000. It would normally be written as a number; 0.
-    $worksheet->write('A1', '0000000');
-
-The callback function will receive a reference to the calling worksheet and all of the other arguments that were passed to C<write()>. The callback will see an C<@_> argument list that looks like the following:
-
-    $_[0]   A ref to the calling worksheet. *
-    $_[1]   Zero based row number.
-    $_[2]   Zero based column number.
-    $_[3]   A number or string or token.
-    $_[4]   A format ref if any.
-    $_[5]   Any other argruments.
-    ...
-
-    *  It is good style to shift this off the list so the @_ is the same
-       as the argument list seen by write().
-
-Your callback should C<return()> the return value of the C<write_*> method that was called or C<undef> to indicate that you rejected the match and want C<write()> to continue as normal.
-
-So for example if you wished to apply the previous filter only to ID values that occur in the first column you could modify your callback function as follows:
-
-
-    sub write_my_id {
-        my $worksheet = shift;
-        my $col       = $_[1];
-
-        if ($col == 0) {
-            return $worksheet->write_string(@_);
-        }
-        else {
-            # Reject the match and return control to write()
-            return undef;
-        }
-    }
-
-Now, you will get different behaviour for the first column and other columns:
-
-    $worksheet->write('A1', '0000000'); # Writes 0000000
-    $worksheet->write('B1', '0000000'); # Writes 0
-
-
-You may add more than one handler in which case they will be called in the order that they were added.
-
-Note, the C<add_write_handler()> method is particularly suited for handling dates.
-
-See the C<write_handler 1-4> programs in the C<examples> directory for further examples.
-
-
-
-
-=head2 insert_bitmap($row, $col, $filename, $x, $y, $scale_x, $scale_y)
-
-This method can be used to insert a bitmap into a worksheet. The bitmap must be a 24 bit, true colour, bitmap. No other format is supported. The C<$x>, C<$y>, C<$scale_x> and C<$scale_y> parameters are optional.
-
-    $worksheet1->insert_bitmap('A1', 'perl.bmp');
-    $worksheet2->insert_bitmap('A1', '../images/perl.bmp');
-    $worksheet3->insert_bitmap('A1', '.c:\images\perl.bmp');
-
-Note: you must call C<set_row()> or C<set_column()> before C<insert_bitmap()> if you wish to change the default dimensions of any of the rows or columns that the images occupies. The height of a row can also change if you use a font that is larger than the default. This in turn will affect the scaling of your image. To avoid this you should explicitly set the height of the row using C<set_row()> if it contains a font size that will change the row height.
-
-The parameters C<$x> and C<$y> can be used to specify an offset from the top left hand corner of the cell specified by C<$row> and C<$col>. The offset values are in pixels.
-
-    $worksheet1->insert_bitmap('A1', 'perl.bmp', 32, 10);
-
-The default width of a cell is 63 pixels. The default height of a cell is 17 pixels. The pixels offsets can be calculated using the following relationships:
-
-    Wp = int(12We)   if We <  1
-    Wp = int(7We +5) if We >= 1
-    Hp = int(4/3He)
-
-    where:
-    We is the cell width in Excels units
-    Wp is width in pixels
-    He is the cell height in Excels units
-    Hp is height in pixels
-
-The offsets can be greater than the width or height of the underlying cell. This can be occasionally useful if you wish to align two or more images relative to the same cell.
-
-The parameters C<$scale_x> and C<$scale_y> can be used to scale the inserted image horizontally and vertically:
-
-    # Scale the inserted image: width x 2.0, height x 0.8
-    $worksheet->insert_bitmap('A1', 'perl.bmp', 0, 0, 2, 0.8);
-
-Note: although Excel allows you to import several graphics formats such as gif, jpeg, png and eps these are converted internally into a proprietary format. One of the few non-proprietary formats that Excel supports is 24 bit, true colour, bitmaps. Therefore if you wish to use images in any other format you must first use an external application such as the ImageMagick I<convert> utility to convert them to 24 bit bitmaps.
-
-    convert test.png test.bmp
-
-A later release will support the use of file handles and pre-encoded bitmap strings.
-
-See also the C<images.pl> program in the C<examples> directory of the distro.
-
-
-
-
-=head2 get_name()
-
-The C<get_name()> method is used to retrieve the name of a worksheet. For example:
-
-    foreach my $sheet ($workbook->sheets()) {
-        print $sheet->get_name();
-    }
-
-
-
-
-=head2 activate()
-
-The C<activate()> method is used to specify which worksheet is initially visible in a multi-sheet workbook:
-
-    $worksheet1 = $workbook->add_worksheet('To');
-    $worksheet2 = $workbook->add_worksheet('the');
-    $worksheet3 = $workbook->add_worksheet('wind');
-
-    $worksheet3->activate();
-
-This is similar to the Excel VBA activate method. More than one worksheet can be selected via the C<select()> method, however only one worksheet can be active. The default value is the first worksheet.
-
-
-
-
-=head2 select()
-
-The C<select()> method is used to indicate that a worksheet is selected in a multi-sheet workbook:
-
-    $worksheet1->activate();
-    $worksheet2->select();
-    $worksheet3->select();
-
-A selected worksheet has its tab highlighted. Selecting worksheets is a way of grouping them together so that, for example, several worksheets could be printed in one go. A worksheet that has been activated via the C<activate()> method will also appear as selected. You probably won't need to use the C<select()> method very often.
-
-
-
-
-=head2 set_first_sheet()
-
-The C<activate()> method determines which worksheet is initially selected. However, if there are a large number of worksheets the selected worksheet may not appear on the screen. To avoid this you can select which is the leftmost visible worksheet using C<set_first_sheet()>:
-
-    for (1..20) {
-        $workbook->add_worksheet;
-    }
-
-    $worksheet21 = $workbook->add_worksheet();
-    $worksheet22 = $workbook->add_worksheet();
-
-    $worksheet21->set_first_sheet();
-    $worksheet22->activate();
-
-This method is not required very often. The default value is the first worksheet.
-
-
-
-
-=head2 protect($password)
-
-The C<protect()> method is used to protect a worksheet from modification:
-
-    $worksheet->protect();
-
-It can be turned off in Excel via the C<Tools-E<gt>Protection-E<gt>Unprotect Sheet> menu command.
-
-The C<protect()> method also has the effect of enabling a cell's C<locked> and C<hidden> properties if they have been set. A "locked" cell cannot be edited. A "hidden" cell will display the results of a formula but not the formula itself. In Excel a cell's locked property is on by default.
-
-    # Set some format properties
-    my $unlocked  = $workbook->add_format(locked => 0);
-    my $hidden    = $workbook->add_format(hidden => 1);
-
-    # Enable worksheet protection
-    $worksheet->protect();
-
-    # This cell cannot be edited, it is locked by default
-    $worksheet->write('A1', '=1+2');
-
-    # This cell can be edited
-    $worksheet->write('A2', '=1+2', $unlocked);
-
-    # The formula in this cell isn't visible
-    $worksheet->write('A3', '=1+2', $hidden);
-
-See also the C<set_locked> and C<set_hidden> format methods in L<CELL FORMATTING>.
-
-You can optionally add a password to the worksheet protection:
-
-    $worksheet->protect('drowssap');
-
-Note, the worksheet level password in Excel provides very weak protection. It does not encrypt your data in any way and it is very easy to deactivate. Therefore, do not use the above method if you wish to protect sensitive data or calculations. However, before you get worried, Excel's own workbook level password protection does provide strong encryption in Excel 97+. For technical reasons this will never be supported by C<Spreadsheet::WriteExcel>.
-
-
-
-
-=head2 set_selection($first_row, $first_col, $last_row, $last_col)
-
-This method can be used to specify which cell or cells are selected in a worksheet. The most common requirement is to select a single cell, in which case C<$last_row> and C<$last_col> can be omitted. The active cell within a selected range is determined by the order in which C<$first> and C<$last> are specified. It is also possible to specify a cell or a range using A1 notation. See the note about L<Cell notation>.
-
-Examples:
-
-    $worksheet1->set_selection(3, 3);       # 1. Cell D4.
-    $worksheet2->set_selection(3, 3, 6, 6); # 2. Cells D4 to G7.
-    $worksheet3->set_selection(6, 6, 3, 3); # 3. Cells G7 to D4.
-    $worksheet4->set_selection('D4');       # Same as 1.
-    $worksheet5->set_selection('D4:G7');    # Same as 2.
-    $worksheet6->set_selection('G7:D4');    # Same as 3.
-
-The default cell selections is (0, 0), 'A1'.
-
-
-
-
-=head2 set_row($row, $height, $format, $hidden, $level)
-
-This method can be used to change the default properties of a row. All parameters apart from C<$row> are optional.
-
-The most common use for this method is to change the height of a row:
-
-    $worksheet->set_row(0, 20); # Row 1 height set to 20
-
-If you wish to set the format without changing the height you can pass C<undef> as the height parameter:
-
-    $worksheet->set_row(0, undef, $format);
-
-The C<$format> parameter will be applied to any cells in the row that don't  have a format. For example
-
-    $worksheet->set_row(0, undef, $format1);    # Set the format for row 1
-    $worksheet->write('A1', "Hello");           # Defaults to $format1
-    $worksheet->write('B1', "Hello", $format2); # Keeps $format2
-
-If you wish to define a row format in this way you should call the method before any calls to C<write()>. Calling it afterwards will overwrite any format that was previously specified.
-
-The C<$hidden> parameter should be set to 1 if you wish to hide a row. This can be used, for example, to hide intermediary steps in a complicated calculation:
-
-    $worksheet->set_row(0, 20,    $format, 1);
-    $worksheet->set_row(1, undef, undef,   1);
-
-The C<$level> parameter is used to set the outline level of the row. Outlines are described in L<OUTLINES AND GROUPING IN EXCEL>. Adjacent rows with the same outline level are grouped together into a single outline.
-
-The following example sets an outline level of 1 for rows 1 and 2 (zero-indexed):
-
-    $worksheet->set_row(1, undef, undef, 0, 1);
-    $worksheet->set_row(2, undef, undef, 0, 1);
-
-The C<$hidden> parameter can also be used to collapse outlined rows when used in conjunction with the C<$level> parameter.
-
-    $worksheet->set_row(1, undef, undef, 1, 1);
-    $worksheet->set_row(2, undef, undef, 1, 1);
-
-Excel allows up to 7 outline levels. Therefore the C<$level> parameter should be in the range C<0 E<lt>= $level E<lt>= 7>.
-
-
-
-
-=head2 set_column($first_col, $last_col, $width, $format, $hidden, $level)
-
-This method can be used to change the default properties of a single column or a range of columns. All parameters apart from C<$first_col> and C<$last_col> are optional.
-
-If C<set_column()> is applied to a single column the value of C<$first_col> and C<$last_col> should be the same. It is also possible to specify a column range using the form of A1 notation used for columns. See the note about L<Cell notation>.
-
-Examples:
-
-    $worksheet->set_column(0, 0,  20); # Column  A   width set to 20
-    $worksheet->set_column(1, 3,  30); # Columns B-D width set to 30
-    $worksheet->set_column('E:E', 20); # Column  E   width set to 20
-    $worksheet->set_column('F:H', 30); # Columns F-H width set to 30
-
-The width corresponds to the column width value that is specified in Excel. It is approximately equal to the length of a string in the default font of Arial 10. Unfortunately, there is no way to specify "AutoFit" for a column in the Excel file format. This feature is only available at runtime from within Excel.
-
-As usual the C<$format> parameter is optional, for additional information, see L<CELL FORMATTING>. If you wish to set the format without changing the width you can pass C<undef> as the width parameter:
-
-    $worksheet->set_column(0, 0, undef, $format);
-
-The C<$format> parameter will be applied to any cells in the column that don't  have a format. For example
-
-    $worksheet->set_column('A:A', undef, $format1); # Set format for col 1
-    $worksheet->write('A1', "Hello");               # Defaults to $format1
-    $worksheet->write('A2', "Hello", $format2);     # Keeps $format2
-
-If you wish to define a column format in this way you should call the method before any calls to C<write()>. If you call it afterwards it won't have any effect.
-
-A default row format takes precedence over a default column format
-
-    $worksheet->set_row(0, undef,        $format1); # Set format for row 1
-    $worksheet->set_column('A:A', undef, $format2); # Set format for col 1
-    $worksheet->write('A1', "Hello");               # Defaults to $format1
-    $worksheet->write('A2', "Hello");               # Defaults to $format2
-
-The C<$hidden> parameter should be set to 1 if you wish to hide a column. This can be used, for example, to hide intermediary steps in a complicated calculation:
-
-    $worksheet->set_column('D:D', 20,    $format, 1);
-    $worksheet->set_column('E:E', undef, undef,   1);
-
-The C<$level> parameter is used to set the outline level of the column. Outlines are described in L<OUTLINES AND GROUPING IN EXCEL>. Adjacent columns with the same outline level are grouped together into a single outline.
-
-The following example sets an outline level of 1 for columns B to G:
-
-    $worksheet->set_column('B:G', undef, undef, 0, 1);
-
-The C<$hidden> parameter can also be used to collapse outlined columns when used in conjunction with the C<$level> parameter.
-
-    $worksheet->set_column('B:G', undef, undef, 1, 1);
-
-Excel allows up to 7 outline levels. Therefore the C<$level> parameter should be in the range C<0 E<lt>= $level E<lt>= 7>.
-
-
-
-
-=head2 outline_settings($visible, $symbols_below, $symbols_right, $auto_style)
-
-The C<outline_settings()> method is used to control the appearance of outlines in Excel. Outlines are described in L<OUTLINES AND GROUPING IN EXCEL>.
-
-The C<$visible> parameter is used to control whether or not outlines are visible. Setting this parameter to 0 will cause all outlines on the worksheet to be hidden. They can be unhidden in Excel by means of the "Show Outline Symbols" command button. The default setting is 1 for visible outlines.
-
-    $worksheet->outline_settings(0);
-
-The C<$symbols_below> parameter is used to control whether the row outline symbol will appear above or below the outline level bar. The default setting is 1 for symbols to appear below the outline level bar.
-
-The C<symbols_right> parameter is used to control whether the column outline symbol will appear to the left or the right of the outline level bar. The default setting is 1 for symbols to appear to the right of the outline level bar.
-
-The C<$auto_style> parameter is used to control whether the automatic outline generator in Excel uses automatic styles when creating an outline. This has no effect on a file generated by C<Spreadsheet::WriteExcel> but it does have an effect on how the worksheet behaves after it is created. The default setting is 0 for "Automatic Styles" to be turned off.
-
-The default settings for all of these parameters correspond to Excel's default parameters.
-
-
-The worksheet parameters controlled by C<outline_settings()> are rarely used.
-
-
-
-
-=head2 freeze_panes($row, $col, $top_row, $left_col)
-
-This method can be used to divide a worksheet into horizontal or vertical regions known as panes and to also "freeze" these panes so that the splitter bars are not visible. This is the same as the C<Window-E<gt>Freeze Panes> menu command in Excel
-
-The parameters C<$row> and C<$col> are used to specify the location of the split. It should be noted that the split is specified at the top or left of a cell and that the method uses zero based indexing. Therefore to freeze the first row of a worksheet it is necessary to specify the split at row 2 (which is 1 as the zero-based index). This might lead you to think that you are using a 1 based index but this is not the case.
-
-You can set one of the C<$row> and C<$col> parameters as zero if you do not want either a vertical or horizontal split.
-
-Examples:
-
-    $worksheet->freeze_panes(1, 0); # Freeze the first row
-    $worksheet->freeze_panes('A2'); # Same using A1 notation
-    $worksheet->freeze_panes(0, 1); # Freeze the first column
-    $worksheet->freeze_panes('B1'); # Same using A1 notation
-    $worksheet->freeze_panes(1, 2); # Freeze first row and first 2 columns
-    $worksheet->freeze_panes('C2'); # Same using A1 notation
-
-The parameters C<$top_row> and C<$left_col> are optional. They are used to specify the top-most or left-most visible row or column in the scrolling region of the panes. For example to freeze the first row and to have the scrolling region begin at row twenty:
-
-    $worksheet->freeze_panes(1, 0, 20, 0);
-
-You cannot use A1 notation for the C<$top_row> and C<$left_col> parameters.
-
-
-See also the C<panes.pl> program in the C<examples> directory of the distribution.
-
-
-
-
-=head2 thaw_panes($y, $x, $top_row, $left_col)
-
-This method can be used to divide a worksheet into horizontal or vertical regions known as panes. This method is different from the C<freeze_panes()> method in that the splits between the panes will be visible to the user and each pane will have its own scroll bars.
-
-The parameters C<$y> and C<$x> are used to specify the vertical and horizontal position of the split. The units for C<$y> and C<$x> are the same as those used by Excel to specify row height and column width. However, the vertical and horizontal units are different from each other. Therefore you must specify the C<$y> and C<$x> parameters in terms of the row heights and column widths that you have set or the default values which are C<12.75> for a row and  C<8.43> for a column.
-
-You can set one of the C<$y> and C<$x> parameters as zero if you do not want either a vertical or horizontal split. The parameters C<$top_row> and C<$left_col> are optional. They are used to specify the top-most or left-most visible row or column in the bottom-right pane.
-
-Example:
-
-    $worksheet->thaw_panes(12.75, 0,    1, 0); # First row
-    $worksheet->thaw_panes(0,     8.43, 0, 1); # First column
-    $worksheet->thaw_panes(12.75, 8.43, 1, 1); # First row and column
-
-You cannot use A1 notation with this method.
-
-See also the C<freeze_panes()> method and the C<panes.pl> program in the C<examples> directory of the distribution.
-
-
-
-
-=head2 merge_range($first_row, $first_col, $last_row, $last_col, $token, $format)
-
-Merging cells is generally achieved by setting the C<merge> property of a Format object, see L<CELL FORMATTING>. However, this only allows simple Excel5 style horizontal merging which Excel refers to as "center across selection".
-
-The C<merge_range()> method allows you to do Excel97+ style formatting where the cells can contain other types of alignment in addition to the merging:
-
-    my $format = $workbook->add_format(
-                                        border  => 6,
-                                        valign  => 'vcenter',
-                                        align   => 'center',
-                                      );
-
-    $worksheet->merge_range('B3:D4', 'Vertical and horizontal', $format);
-
-B<WARNING>. The format object that is used with a C<merge_range()> method call is marked internally as being associated with a merged range. It is a fatal error to use a merged format in a non-merged cell. Instead you should use separate formats for merged and non-merged cells. This restriction will be removed in a future release.
-
-C<merge_range()> writes its $token argument using the worksheet C<write()> method. Therefore it will handle numbers, strings, formulas or urls as required.
-
-Setting the C<merge> property of the format isn't required when you are using C<merge_range()>. In fact using it will exclude the use of any other horizontal alignment option.
-
-The full possibilities of this method are shown in the C<merge3.pl>, C<merge4.pl> and C<merge5.pl> programs in the C<examples> directory of the distribution.
-
-
-
-
-=head2 set_zoom($scale)
-
-Set the worksheet zoom factor in the range C<10 E<lt>= $scale E<lt>= 400>:
-
-    $worksheet1->set_zoom(50);
-    $worksheet2->set_zoom(75);
-    $worksheet3->set_zoom(300);
-    $worksheet4->set_zoom(400);
-
-The default zoom factor is 100. You cannot zoom to "Selection" because it is calculated by Excel at run-time.
-
-Note, C<set_zoom()> does not affect the scale of the printed page. For that you should use C<set_print_scale()>.
-
-
-
-
-=head1 PAGE SET-UP METHODS
-
-Page set-up methods affect the way that a worksheet looks when it is printed. They control features such as page headers and footers and margins. These methods are really just standard worksheet methods. They are documented here in a separate section for the sake of clarity.
-
-The following methods are available for page set-up:
-
-    set_landscape()
-    set_portrait()
-    set_paper()
-    center_horizontally()
-    center_vertically()
-    set_margins()
-    set_header()
-    set_footer()
-    repeat_rows()
-    repeat_columns()
-    hide_gridlines()
-    print_row_col_headers()
-    print_area()
-    fit_to_pages()
-    set_print_scale()
-    set_h_pagebreaks()
-    set_v_pagebreaks()
-
-
-A common requirement when working with Spreadsheet::WriteExcel is to apply the same page set-up features to all of the worksheets in a workbook. To do this you can use the C<sheets()> method of the C<workbook> class to access the array of worksheets in a workbook:
-
-    foreach $worksheet ($workbook->sheets()) {
-       $worksheet->set_landscape();
-    }
-
-
-
-
-=head2 set_landscape()
-
-This method is used to set the orientation of a worksheet's printed page to landscape:
-
-    $worksheet->set_landscape(); # Landscape mode
-
-
-
-
-=head2 set_portrait()
-
-This method is used to set the orientation of a worksheet's printed page to portrait. The default worksheet orientation is portrait, so you won't generally need to call this method.
-
-    $worksheet->set_portrait(); # Portrait mode
-
-
-
-=head2 set_paper($index)
-
-This method is used to set the paper format for the printed output of a worksheet. The following paper styles are available:
-
-    Index   Paper format            Paper size
-    =====   ============            ==========
-      0     Printer default         -
-      1     Letter                  8 1/2 x 11 in
-      2     Letter Small            8 1/2 x 11 in
-      3     Tabloid                 11 x 17 in
-      4     Ledger                  17 x 11 in
-      5     Legal                   8 1/2 x 14 in
-      6     Statement               5 1/2 x 8 1/2 in
-      7     Executive               7 1/4 x 10 1/2 in
-      8     A3                      297 x 420 mm
-      9     A4                      210 x 297 mm
-     10     A4 Small                210 x 297 mm
-     11     A5                      148 x 210 mm
-     12     B4                      250 x 354 mm
-     13     B5                      182 x 257 mm
-     14     Folio                   8 1/2 x 13 in
-     15     Quarto                  215 x 275 mm
-     16     -                       10x14 in
-     17     -                       11x17 in
-     18     Note                    8 1/2 x 11 in
-     19     Envelope  9             3 7/8 x 8 7/8
-     20     Envelope 10             4 1/8 x 9 1/2
-     21     Envelope 11             4 1/2 x 10 3/8
-     22     Envelope 12             4 3/4 x 11
-     23     Envelope 14             5 x 11 1/2
-     24     C size sheet            -
-     25     D size sheet            -
-     26     E size sheet            -
-     27     Envelope DL             110 x 220 mm
-     28     Envelope C3             324 x 458 mm
-     29     Envelope C4             229 x 324 mm
-     30     Envelope C5             162 x 229 mm
-     31     Envelope C6             114 x 162 mm
-     32     Envelope C65            114 x 229 mm
-     33     Envelope B4             250 x 353 mm
-     34     Envelope B5             176 x 250 mm
-     35     Envelope B6             176 x 125 mm
-     36     Envelope                110 x 230 mm
-     37     Monarch                 3.875 x 7.5 in
-     38     Envelope                3 5/8 x 6 1/2 in
-     39     Fanfold                 14 7/8 x 11 in
-     40     German Std Fanfold      8 1/2 x 12 in
-     41     German Legal Fanfold    8 1/2 x 13 in
-
-
-Note, it is likely that not all of these paper types will be available to the end user since it will depend on the paper formats that the user's printer supports. Therefore, it is best to stick to standard paper types.
-
-    $worksheet->set_paper(1); # US Letter
-    $worksheet->set_paper(9); # A4
-
-If you do not specify a paper type the worksheet will print using the printer's default paper.
-
-
-
-
-=head2 center_horizontally()
-
-Center the worksheet data horizontally between the margins on the printed page:
-
-    $worksheet->center_horizontally();
-
-
-
-
-=head2 center_vertically()
-
-Center the worksheet data vertically between the margins on the printed page:
-
-    $worksheet->center_vertically();
-
-
-
-
-=head2 set_margins($inches)
-
-There are several methods available for setting the worksheet margins on the printed page:
-
-    set_margins()        # Set all margins to the same value
-    set_margins_LR()     # Set left and right margins to the same value
-    set_margins_TB()     # Set top and bottom margins to the same value
-    set_margin_left();   # Set left margin
-    set_margin_right();  # Set right margin
-    set_margin_top();    # Set top margin
-    set_margin_bottom(); # Set bottom margin
-
-All of these methods take a distance in inches as a parameter. Note: 1 inch = 25.4mm. ;-) The default left and right margin is 0.75 inch. The default top and bottom margin is 1.00 inch.
-
-
-
-=head2 set_header($string, $margin)
-
-Headers and footers are generated using a C<$string> which is a combination of plain text and control characters. The C<$margin> parameter is optional.
-
-The available control character are:
-
-    Control             Category            Description
-    =======             ========            ===========
-    &L                  Justification       Left
-    &C                                      Center
-    &R                                      Right
-
-    &P                  Information         Page number
-    &N                                      Total number of pages
-    &D                                      Date
-    &T                                      Time
-    &F                                      File name
-    &A                                      Worksheet name
-    &Z                                      Workbook path
-
-    &fontsize           Font                Font size
-    &"font,style"                           Font name and style
-    &U                                      Single underline
-    &E                                      Double underline
-    &S                                      Strikethrough
-    &X                                      Superscript
-    &Y                                      Subscript
-
-    &&                  Miscellaneous       Literal ampersand &
-
-
-Text in headers and footers can be justified (aligned) to the left, center and right by prefixing the text with the control characters C<&L>, C<&C> and C<&R>.
-
-For example (with ASCII art representation of the results):
-
-    $worksheet->set_header('&LHello');
-
-     ---------------------------------------------------------------
-    |                                                               |
-    | Hello                                                         |
-    |                                                               |
-
-
-    $worksheet->set_header('&CHello');
-
-     ---------------------------------------------------------------
-    |                                                               |
-    |                          Hello                                |
-    |                                                               |
-
-
-    $worksheet->set_header('&RHello');
-
-     ---------------------------------------------------------------
-    |                                                               |
-    |                                                         Hello |
-    |                                                               |
-
-
-For simple text, if you do not specify any justification the text will be centred. However, you must prefix the text with C<&C> if you specify a font name or any other formatting:
-
-    $worksheet->set_header('Hello');
-
-     ---------------------------------------------------------------
-    |                                                               |
-    |                          Hello                                |
-    |                                                               |
-
-
-You can have text in each of the justification regions:
-
-    $worksheet->set_header('&LCiao&CBello&RCielo');
-
-     ---------------------------------------------------------------
-    |                                                               |
-    | Ciao                     Bello                          Cielo |
-    |                                                               |
-
-
-The information control characters act as variables that Excel will update as the workbook or worksheet changes. Times and dates are in the users default format:
-
-    $worksheet->set_header('&CPage &P of &N');
-
-     ---------------------------------------------------------------
-    |                                                               |
-    |                        Page 1 of 6                            |
-    |                                                               |
-
-
-    $worksheet->set_header('&CUpdated at &T');
-
-     ---------------------------------------------------------------
-    |                                                               |
-    |                    Updated at 12:30 PM                        |
-    |                                                               |
-
-
-
-You can specify the font size of a section of the text by prefixing it with the control character C<&n> where C<n> is the font size:
-
-    $worksheet1->set_header('&C&30Hello Big'  );
-    $worksheet2->set_header('&C&10Hello Small');
-
-You can specify the font of a section of the text by prefixing it with the control sequence C<&"font,style"> where C<fontname> is a font name such as "Courier New" or "Times New Roman" and C<style> is one of the standard Windows font descriptions: "Regular", "Italic", "Bold" or "Bold Italic":
-
-    $worksheet1->set_header('&C&"Courier New,Italic"Hello');
-    $worksheet2->set_header('&C&"Courier New,Bold Italic"Hello');
-    $worksheet3->set_header('&C&"Times New Roman,Regular"Hello');
-
-It is possible to combine all of these features together to create sophisticated headers and footers. As an aid to setting up complicated headers and footers you can record a page set-up as a macro in Excel and look at the format strings that VBA produces. Remember however that VBA uses two double quotes C<""> to indicate a single double quote. For the last example above the equivalent VBA code looks like this:
-
-    .LeftHeader   = ""
-    .CenterHeader = "&""Times New Roman,Regular""Hello"
-    .RightHeader  = ""
-
-
-To include a single literal ampersand C<&> in a header or footer you should use a double ampersand C<&&>:
-
-    $worksheet1->set_header('&CCuriouser && Curiouser - Attorneys at Law');
-
-As stated above the margin parameter is optional. As with the other margins the value should be in inches. The default header and footer margin is 0.50 inch. The header and footer margin size can be set as follows:
-
-    $worksheet->set_header('&CHello', 0.75);
-
-The header and footer margins are independent of the top and bottom margins.
-
-Note, the header or footer string must be less than 255 characters. Strings longer than this will not be written and a warning will be generated.
-
-On systems with C<perl 5.8> and later the C<set_header()> method can also handle Unicode strings in Perl's C<utf8> format.
-
-    $worksheet->set_header("&C\x{263a}")
-
-
-See, also the C<headers.pl> program in the C<examples> directory of the distribution.
-
-
-
-
-=head2 set_footer()
-
-The syntax of the C<set_footer()> method is the same as C<set_header()>,  see above.
-
-
-
-
-=head2 repeat_rows($first_row, $last_row)
-
-Set the number of rows to repeat at the top of each printed page.
-
-For large Excel documents it is often desirable to have the first row or rows of the worksheet print out at the top of each page. This can be achieved by using the C<repeat_rows()> method. The parameters C<$first_row> and C<$last_row> are zero based. The C<$last_row> parameter is optional if you only wish to specify one row:
-
-    $worksheet1->repeat_rows(0);    # Repeat the first row
-    $worksheet2->repeat_rows(0, 1); # Repeat the first two rows
-
-
-
-
-=head2 repeat_columns($first_col, $last_col)
-
-Set the columns to repeat at the left hand side of each printed page.
-
-For large Excel documents it is often desirable to have the first column or columns of the worksheet print out at the left hand side of each page. This can be achieved by using the C<repeat_columns()> method. The parameters C<$first_column> and C<$last_column> are zero based. The C<$last_column> parameter is optional if you only wish to specify one column. You can also specify the columns using A1 column notation, see the note about L<Cell notation>.
-
-    $worksheet1->repeat_columns(0);     # Repeat the first column
-    $worksheet2->repeat_columns(0, 1);  # Repeat the first two columns
-    $worksheet3->repeat_columns('A:A'); # Repeat the first column
-    $worksheet4->repeat_columns('A:B'); # Repeat the first two columns
-
-
-
-
-=head2 hide_gridlines($option)
-
-This method is used to hide the gridlines on the screen and printed page. Gridlines are the lines that divide the cells on a worksheet. Screen and printed gridlines are turned on by default in an Excel worksheet. If you have defined your own cell borders you may wish to hide the default gridlines.
-
-    $worksheet->hide_gridlines();
-
-The following values of C<$option> are valid:
-
-    0 : Don't hide gridlines
-    1 : Hide printed gridlines only
-    2 : Hide screen and printed gridlines
-
-If you don't supply an argument or use C<undef> the default option is 1, i.e. only the printed gridlines are hidden.
-
-
-
-
-=head2 print_row_col_headers()
-
-Set the option to print the row and column headers on the printed page.
-
-An Excel worksheet looks something like the following;
-
-     ------------------------------------------
-    |   |   A   |   B   |   C   |   D   |  ...
-     ------------------------------------------
-    | 1 |       |       |       |       |  ...
-    | 2 |       |       |       |       |  ...
-    | 3 |       |       |       |       |  ...
-    | 4 |       |       |       |       |  ...
-    |...|  ...  |  ...  |  ...  |  ...  |  ...
-
-The headers are the letters and numbers at the top and the left of the worksheet. Since these headers serve mainly as a indication of position on the worksheet they generally do not appear on the printed page. If you wish to have them printed you can use the C<print_row_col_headers()> method :
-
-    $worksheet->print_row_col_headers();
-
-Do not confuse these headers with page headers as described in the C<set_header()> section above.
-
-
-
-
-=head2 print_area($first_row, $first_col, $last_row, $last_col)
-
-This method is used to specify the area of the worksheet that will be printed. All four parameters must be specified. You can also use A1 notation, see the note about L<Cell notation>.
-
-
-    $worksheet1->print_area("A1:H20");    # Cells A1 to H20
-    $worksheet2->print_area(0, 0, 19, 7); # The same
-    $worksheet2->print_area('A:H');       # Columns A to H if rows have data
-
-
-
-=head2 fit_to_pages($width, $height)
-
-The C<fit_to_pages()> method is used to fit the printed area to a specific number of pages both vertically and horizontally. If the printed area exceeds the specified number of pages it will be scaled down to fit. This guarantees that the printed area will always appear on the specified number of pages even if the page size or margins change.
-
-    $worksheet1->fit_to_pages(1, 1); # Fit to 1x1 pages
-    $worksheet2->fit_to_pages(2, 1); # Fit to 2x1 pages
-    $worksheet3->fit_to_pages(1, 2); # Fit to 1x2 pages
-
-The print area can be defined using the C<print_area()> method as described above.
-
-A common requirement is to fit the printed output to I<n> pages wide but have the height be as long as necessary. To achieve this set the C<$height> to zero or leave it blank:
-
-    $worksheet1->fit_to_pages(1, 0); # 1 page wide and as long as necessary
-    $worksheet2->fit_to_pages(1);    # The same
-
-
-Note that although it is valid to use both C<fit_to_pages()> and C<set_print_scale()> on the same worksheet only one of these options can be active at a time. The last method call made will set the active option.
-
-Note that C<fit_to_pages()> will override any manual page breaks that are defined in the worksheet.
-
-
-
-
-=head2 set_print_scale($scale)
-
-Set the scale factor of the printed page. Scale factors in the range C<10 E<lt>= $scale E<lt>= 400> are valid:
-
-    $worksheet1->set_print_scale(50);
-    $worksheet2->set_print_scale(75);
-    $worksheet3->set_print_scale(300);
-    $worksheet4->set_print_scale(400);
-
-The default scale factor is 100. Note, C<set_print_scale()> does not affect the scale of the visible page in Excel. For that you should use C<set_zoom()>.
-
-Note also that although it is valid to use both C<fit_to_pages()> and C<set_print_scale()> on the same worksheet only one of these options can be active at a time. The last method call made will set the active option.
-
-
-
-
-=head2 set_h_pagebreaks(@breaks)
-
-Add horizontal page breaks to a worksheet. A page break causes all the data that follows it to be printed on the next page. Horizontal page breaks act between rows. To create a page break between rows 20 and 21 you must specify the break at row 21. However in zero index notation this is actually row 20. So you can pretend for a small while that you are using 1 index notation:
-
-    $worksheet1->set_h_pagebreaks(20); # Break between row 20 and 21
-
-The C<set_h_pagebreaks()> method will accept a list of page breaks and you can call it more than once:
-
-    $worksheet2->set_h_pagebreaks( 20,  40,  60,  80, 100); # Add breaks
-    $worksheet2->set_h_pagebreaks(120, 140, 160, 180, 200); # Add some more
-
-Note: If you specify the "fit to page" option via the C<fit_to_pages()> method it will override all manual page breaks.
-
-There is a silent limitation of about 1000 horizontal page breaks per worksheet in line with an Excel internal limitation.
-
-
-
-
-=head2 set_v_pagebreaks(@breaks)
-
-Add vertical page breaks to a worksheet. A page break causes all the data that follows it to be printed on the next page. Vertical page breaks act between columns. To create a page break between columns 20 and 21 you must specify the break at column 21. However in zero index notation this is actually column 20. So you can pretend for a small while that you are using 1 index notation:
-
-    $worksheet1->set_v_pagebreaks(20); # Break between column 20 and 21
-
-The C<set_v_pagebreaks()> method will accept a list of page breaks and you can call it more than once:
-
-    $worksheet2->set_v_pagebreaks( 20,  40,  60,  80, 100); # Add breaks
-    $worksheet2->set_v_pagebreaks(120, 140, 160, 180, 200); # Add some more
-
-Note: If you specify the "fit to page" option via the C<fit_to_pages()> method it will override all manual page breaks.
-
-
-
-
-=head1 CELL FORMATTING
-
-This section describes the methods and properties that are available for formatting cells in Excel. The properties of a cell that can be formatted include: fonts, colours, patterns, borders, alignment and number formatting.
-
-
-=head2 Creating and using a Format object
-
-Cell formatting is defined through a Format object. Format objects are created by calling the workbook C<add_format()> method as follows:
-
-    my $format1 = $workbook->add_format();       # Set properties later
-    my $format2 = $workbook->add_format(%props); # Set at creation
-
-The format object holds all the formatting properties that can be applied to a cell, a row or a column. The process of setting these properties is discussed in the next section.
-
-Once a Format object has been constructed and it properties have been set it can be passed as an argument to the worksheet C<write> methods as follows:
-
-    $worksheet->write(0, 0, "One", $format);
-    $worksheet->write_string(1, 0, "Two", $format);
-    $worksheet->write_number(2, 0, 3, $format);
-    $worksheet->write_blank(3, 0, $format);
-
-Formats can also be passed to the worksheet C<set_row()> and C<set_column()> methods to define the default property for a row or column.
-
-    $worksheet->set_row(0, 15, $format);
-    $worksheet->set_column(0, 0, 15, $format);
-
-
-
-
-=head2 Format methods and Format properties
-
-The following table shows the Excel format categories, the formatting properties that can be applied and the equivalent object method:
-
-
-    Category   Description       Property        Method Name
-    --------   -----------       --------        -----------
-    Font       Font type         font            set_font()
-               Font size         size            set_size()
-               Font color        color           set_color()
-               Bold              bold            set_bold()
-               Italic            italic          set_italic()
-               Underline         underline       set_underline()
-               Strikeout         font_strikeout  set_font_strikeout()
-               Super/Subscript   font_script     set_font_script()
-               Outline           font_outline    set_font_outline()
-               Shadow            font_shadow     set_font_shadow()
-
-    Number     Numeric format    num_format      set_num_format()
-
-    Protection Lock cells        locked          set_locked()
-               Hide formulas     hidden          set_hidden()
-
-    Alignment  Horizontal align  align           set_align()
-               Vertical align    valign          set_align()
-               Rotation          rotation        set_rotation()
-               Text wrap         text_wrap       set_text_wrap()
-               Justify last      text_justlast   set_text_justlast()
-               Center across     center_across   set_center_across()
-               Indentation       indent          set_indent()
-               Shrink to fit     shrink          set_shrink()
-
-    Pattern    Cell pattern      pattern         set_pattern()
-               Background color  bg_color        set_bg_color()
-               Foreground color  fg_color        set_fg_color()
-
-    Border     Cell border       border          set_border()
-               Bottom border     bottom          set_bottom()
-               Top border        top             set_top()
-               Left border       left            set_left()
-               Right border      right           set_right()
-               Border color      border_color    set_border_color()
-               Bottom color      bottom_color    set_bottom_color()
-               Top color         top_color       set_top_color()
-               Left color        left_color      set_left_color()
-               Right color       right_color     set_right_color()
-
-There are two ways of setting Format properties: by using the object method interface or by setting the property directly. For example, a typical use of the method interface would be as follows:
-
-    my $format = $workbook->add_format();
-    $format->set_bold();
-    $format->set_color('red');
-
-By comparison the properties can be set directly by passing a hash of properties to the Format constructor:
-
-    my $format = $workbook->add_format(bold => 1, color => 'red');
-
-or after the Format has been constructed by means of the C<set_properties()> method as follows:
-
-    my $format = $workbook->add_format();
-    $format->set_properties(bold => 1, color => 'red');
-
-You can also store the properties in one or more named hashes and pass them to the required method:
-
-    my %font    = (
-                    font  => 'Arial',
-                    size  => 12,
-                    color => 'blue',
-                    bold  => 1,
-                  );
-
-    my %shading = (
-                    bg_color => 'green',
-                    pattern  => 1,
-                  );
-
-
-    my $format1 = $workbook->add_format(%font);           # Font only
-    my $format2 = $workbook->add_format(%font, %shading); # Font and shading
-
-
-The provision of two ways of setting properties might lead you to wonder which is the best way. The answer depends on the amount of formatting that will be required in your program. Initially, Spreadsheet::WriteExcel only allowed individual Format properties to be set via the appropriate method. While this was sufficient for most circumstances it proved very cumbersome in programs that required a large amount of formatting. In addition the mechanism for reusing properties between Format objects was complicated.
-
-As a result the Perl/Tk style of adding properties was added to, hopefully, facilitate developers who need to define a lot of formatting. In fact the Tk style of defining properties is also supported:
-
-    my %font    = (
-                    -font      => 'Arial',
-                    -size      => 12,
-                    -color     => 'blue',
-                    -bold      => 1,
-                  );
-
-An additional advantage of working with hashes of properties is that it allows you to share formatting between workbook objects
-
-You can also create a format "on the fly" and pass it directly to a write method as follows:
-
-    $worksheet->write('A1', "Title", $workbook->add_format(bold => 1));
-
-This corresponds to an "anonymous" format in the Perl sense of anonymous data or subs.
-
-
-
-
-=head2 Working with formats
-
-The default format is Arial 10 with all other properties off.
-
-Each unique format in Spreadsheet::WriteExcel must have a corresponding Format object. It isn't possible to use a Format with a write() method and then redefine the Format for use at a later stage. This is because a Format is applied to a cell not in its current state but in its final state. Consider the following example:
-
-    my $format = $workbook->add_format();
-    $format->set_bold();
-    $format->set_color('red');
-    $worksheet->write('A1', "Cell A1", $format);
-    $format->set_color('green');
-    $worksheet->write('B1', "Cell B1", $format);
-
-Cell A1 is assigned the Format C<$format> which is initially set to the colour red. However, the colour is subsequently set to green. When Excel displays Cell A1 it will display the final state of the Format which in this case will be the colour green.
-
-In general a method call without an argument will turn a property on, for example:
-
-    my $format1 = $workbook->add_format();
-    $format1->set_bold();  # Turns bold on
-    $format1->set_bold(1); # Also turns bold on
-    $format1->set_bold(0); # Turns bold off
-
-
-
-
-=head1 FORMAT METHODS
-
-The Format object methods are described in more detail in the following sections. In addition, there is a Perl program called C<formats.pl> in the C<examples> directory of the WriteExcel distribution. This program creates an Excel workbook called C<formats.xls> which contains examples of almost all the format types.
-
-The following Format methods are available:
-
-    set_font()
-    set_size()
-    set_color()
-    set_bold()
-    set_italic()
-    set_underline()
-    set_font_strikeout()
-    set_font_script()
-    set_font_outline()
-    set_font_shadow()
-    set_num_format()
-    set_locked()
-    set_hidden()
-    set_align()
-    set_align()
-    set_rotation()
-    set_text_wrap()
-    set_text_justlast()
-    set_center_across()
-    set_indent()
-    set_shrink()
-    set_pattern()
-    set_bg_color()
-    set_fg_color()
-    set_border()
-    set_bottom()
-    set_top()
-    set_left()
-    set_right()
-    set_border_color()
-    set_bottom_color()
-    set_top_color()
-    set_left_color()
-    set_right_color()
-
-
-The above methods can also be applied directly as properties. For example C<$worksheet-E<gt>set_bold()> is equivalent to C<set_properties(bold =E<gt> 1)>.
-
-
-=head2 set_properties(%properties)
-
-The properties of an existing Format object can be set by means of C<set_properties()>:
-
-    my $format = $workbook->add_format();
-    $format->set_properties(bold => 1, color => 'red');
-
-You can also store the properties in one or more named hashes and pass them to the C<set_properties()> method:
-
-    my %font    = (
-                    font  => 'Arial',
-                    size  => 12,
-                    color => 'blue',
-                    bold  => 1,
-                  );
-
-    my $format = $workbook->set_properties(%font);
-
-This method can be used as an alternative to setting the properties with C<add_format()> or the specific format methods that are detailed in the following sections.
-
-
-
-
-=head2 set_font($fontname)
-
-    Default state:      Font is Arial
-    Default action:     None
-    Valid args:         Any valid font name
-
-Specify the font used:
-
-    $format->set_font('Times New Roman');
-
-Excel can only display fonts that are installed on the system that it is running on. Therefore it is best to use the fonts that come as standard such as 'Arial', 'Times New Roman' and 'Courier New'. See also the Fonts worksheet created by formats.pl
-
-
-
-
-=head2 set_size()
-
-    Default state:      Font size is 10
-    Default action:     Set font size to 1
-    Valid args:         Integer values from 1 to as big as your screen.
-
-
-Set the font size. Excel adjusts the height of a row to accommodate the largest font size in the row. You can also explicitly specify the height of a row using the set_row() worksheet method.
-
-    my $format = $workbook->add_format();
-    $format->set_size(30);
-
-
-
-
-
-=head2 set_color()
-
-    Default state:      Excels default color, usually black
-    Default action:     Set the default color
-    Valid args:         Integers from 8..63 or the following strings:
-                        'black'
-                        'blue'
-                        'brown'
-                        'cyan'
-                        'gray'
-                        'green'
-                        'lime'
-                        'magenta'
-                        'navy'
-                        'orange'
-                        'purple'
-                        'red'
-                        'silver'
-                        'white'
-                        'yellow'
-
-Set the font colour. The C<set_color()> method is used as follows:
-
-    my $format = $workbook->add_format();
-    $format->set_color('red');
-    $worksheet->write(0, 0, "wheelbarrow", $format);
-
-Note: The C<set_color()> method is used to set the colour of the font in a cell. To set the colour of a cell use the C<set_bg_color()> and C<set_pattern()> methods.
-
-For additional examples see the 'Named colors' and 'Standard colors' worksheets created by formats.pl in the examples directory.
-
-See also L<COLOURS IN EXCEL>.
-
-
-
-
-=head2 set_bold()
-
-    Default state:      bold is off
-    Default action:     Turn bold on
-    Valid args:         0, 1 [1]
-
-Set the bold property of the font:
-
-    $format->set_bold();  # Turn bold on
-
-[1] Actually, values in the range 100..1000 are also valid. 400 is normal, 700 is bold and 1000 is very bold indeed. It is probably best to set the value to 1 and use normal bold.
-
-
-
-
-=head2 set_italic()
-
-    Default state:      Italic is off
-    Default action:     Turn italic on
-    Valid args:         0, 1
-
-Set the italic property of the font:
-
-    $format->set_italic();  # Turn italic on
-
-
-
-
-=head2 set_underline()
-
-    Default state:      Underline is off
-    Default action:     Turn on single underline
-    Valid args:         0  = No underline
-                        1  = Single underline
-                        2  = Double underline
-                        33 = Single accounting underline
-                        34 = Double accounting underline
-
-Set the underline property of the font.
-
-    $format->set_underline();   # Single underline
-
-
-
-
-=head2 set_font_strikeout()
-
-    Default state:      Strikeout is off
-    Default action:     Turn strikeout on
-    Valid args:         0, 1
-
-Set the strikeout property of the font.
-
-
-
-
-=head2 set_font_script()
-
-    Default state:      Super/Subscript is off
-    Default action:     Turn Superscript on
-    Valid args:         0  = Normal
-                        1  = Superscript
-                        2  = Subscript
-
-Set the superscript/subscript property of the font. This format is currently not very useful.
-
-
-
-
-=head2 set_font_outline()
-
-    Default state:      Outline is off
-    Default action:     Turn outline on
-    Valid args:         0, 1
-
-Macintosh only.
-
-
-
-
-=head2 set_font_shadow()
-
-    Default state:      Shadow is off
-    Default action:     Turn shadow on
-    Valid args:         0, 1
-
-Macintosh only.
-
-
-
-
-=head2 set_num_format()
-
-    Default state:      General format
-    Default action:     Format index 1
-    Valid args:         See the following table
-
-This method is used to define the numerical format of a number in Excel. It controls whether a number is displayed as an integer, a floating point number, a date, a currency value or some other user defined format.
-
-The numerical format of a cell can be specified by using a format string or an index to one of Excel's built-in formats:
-
-    my $format1 = $workbook->add_format();
-    my $format2 = $workbook->add_format();
-    $format1->set_num_format('d mmm yyyy'); # Format string
-    $format2->set_num_format(0x0f);         # Format index
-
-    $worksheet->write(0, 0, 36892.521, $format1);      # 1 Jan 2001
-    $worksheet->write(0, 0, 36892.521, $format2);      # 1-Jan-01
-
-
-Using format strings you can define very sophisticated formatting of numbers.
-
-    $format01->set_num_format('0.000');
-    $worksheet->write(0,  0, 3.1415926, $format01);    # 3.142
-
-    $format02->set_num_format('#,##0');
-    $worksheet->write(1,  0, 1234.56,   $format02);    # 1,235
-
-    $format03->set_num_format('#,##0.00');
-    $worksheet->write(2,  0, 1234.56,   $format03);    # 1,234.56
-
-    $format04->set_num_format('$0.00');
-    $worksheet->write(3,  0, 49.99,     $format04);    # $49.99
-
-    $format05->set_num_format('£0.00');
-    $worksheet->write(4,  0, 49.99,     $format05);    # £49.99
-
-    $format06->set_num_format('¥0.00');
-    $worksheet->write(5,  0, 49.99,     $format06);    # ¥49.99
-
-    $format07->set_num_format('mm/dd/yy');
-    $worksheet->write(6,  0, 36892.521, $format07);    # 01/01/01
-
-    $format08->set_num_format('mmm d yyyy');
-    $worksheet->write(7,  0, 36892.521, $format08);    # Jan 1 2001
-
-    $format09->set_num_format('d mmmm yyyy');
-    $worksheet->write(8,  0, 36892.521, $format09);    # 1 January 2001
-
-    $format10->set_num_format('dd/mm/yyyy hh:mm AM/PM');
-    $worksheet->write(9,  0, 36892.521, $format10);    # 01/01/2001 12:30 AM
-
-    $format11->set_num_format('0 "dollar and" .00 "cents"');
-    $worksheet->write(10, 0, 1.87,      $format11);    # 1 dollar and .87 cents
-
-    # Conditional formatting
-    $format12->set_num_format('[Green]General;[Red]-General;General');
-    $worksheet->write(11, 0, 123,       $format12);    # > 0 Green
-    $worksheet->write(12, 0, -45,       $format12);    # < 0 Red
-    $worksheet->write(13, 0, 0,         $format12);    # = 0 Default colour
-
-    # Zip code
-    $format13->set_num_format('00000');
-    $worksheet->write(14, 0, '01209',   $format13);
-
-
-The number system used for dates is described in L<DATES IN EXCEL>.
-
-The colour format should have one of the following values:
-
-    [Black] [Blue] [Cyan] [Green] [Magenta] [Red] [White] [Yellow]
-
-Alternatively you can specify the colour based on a colour index as follows: C<[Color n]>, where n is a standard Excel colour index - 7. See the 'Standard colors' worksheet created by formats.pl.
-
-For more information refer to the documentation on formatting in the C<doc> directory of the Spreadsheet::WriteExcel distro, the Excel on-line help or http://office.microsoft.com/en-gb/assistance/HP051995001033.aspx
-
-You should ensure that the format string is valid in Excel prior to using it in WriteExcel.
-
-Excel's built-in formats are shown in the following table:
-
-    Index   Index   Format String
-    0       0x00    General
-    1       0x01    0
-    2       0x02    0.00
-    3       0x03    #,##0
-    4       0x04    #,##0.00
-    5       0x05    ($#,##0_);($#,##0)
-    6       0x06    ($#,##0_);[Red]($#,##0)
-    7       0x07    ($#,##0.00_);($#,##0.00)
-    8       0x08    ($#,##0.00_);[Red]($#,##0.00)
-    9       0x09    0%
-    10      0x0a    0.00%
-    11      0x0b    0.00E+00
-    12      0x0c    # ?/?
-    13      0x0d    # ??/??
-    14      0x0e    m/d/yy
-    15      0x0f    d-mmm-yy
-    16      0x10    d-mmm
-    17      0x11    mmm-yy
-    18      0x12    h:mm AM/PM
-    19      0x13    h:mm:ss AM/PM
-    20      0x14    h:mm
-    21      0x15    h:mm:ss
-    22      0x16    m/d/yy h:mm
-    ..      ....    ...........
-    37      0x25    (#,##0_);(#,##0)
-    38      0x26    (#,##0_);[Red](#,##0)
-    39      0x27    (#,##0.00_);(#,##0.00)
-    40      0x28    (#,##0.00_);[Red](#,##0.00)
-    41      0x29    _(* #,##0_);_(* (#,##0);_(* "-"_);_(@_)
-    42      0x2a    _($* #,##0_);_($* (#,##0);_($* "-"_);_(@_)
-    43      0x2b    _(* #,##0.00_);_(* (#,##0.00);_(* "-"??_);_(@_)
-    44      0x2c    _($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)
-    45      0x2d    mm:ss
-    46      0x2e    [h]:mm:ss
-    47      0x2f    mm:ss.0
-    48      0x30    ##0.0E+0
-    49      0x31    @
-
-
-For examples of these formatting codes see the 'Numerical formats' worksheet created by formats.pl. See also the number_formats1.html and the number_formats2.html documents in the C<doc> directory of the distro.
-
-Note 1. Numeric formats 23 to 36 are not documented by Microsoft and may differ in international versions.
-
-Note 2. In Excel 5 the dollar sign appears as a dollar sign. In Excel 97-2000 it appears as the defined local currency symbol.
-
-Note 3. The red negative numeric formats display slightly differently in Excel 5 and Excel 97-2000.
-
-
-
-
-=head2 set_locked()
-
-    Default state:      Cell locking is on
-    Default action:     Turn locking on
-    Valid args:         0, 1
-
-This property can be used to prevent modification of a cells contents. Following Excel's convention, cell locking is turned on by default. However, it only has an effect if the worksheet has been protected, see the worksheet C<protect()> method.
-
-    my $locked  = $workbook->add_format();
-    $locked->set_locked(1); # A non-op
-
-    my $unlocked = $workbook->add_format();
-    $locked->set_locked(0);
-
-    # Enable worksheet protection
-    $worksheet->protect();
-
-    # This cell cannot be edited.
-    $worksheet->write('A1', '=1+2', $locked);
-
-    # This cell can be edited.
-    $worksheet->write('A2', '=1+2', $unlocked);
-
-Note: This offers weak protection even with a password, see the note in relation to the C<protect()> method.
-
-
-
-
-=head2 set_hidden()
-
-    Default state:      Formula hiding is off
-    Default action:     Turn hiding on
-    Valid args:         0, 1
-
-This property is used to hide a formula while still displaying its result. This is generally used to hide complex calculations from end users who are only interested in the result. It only has an effect if the worksheet has been protected, see the worksheet C<protect()> method.
-
-    my $hidden = $workbook->add_format();
-    $hidden->set_hidden();
-
-    # Enable worksheet protection
-    $worksheet->protect();
-
-    # The formula in this cell isn't visible
-    $worksheet->write('A1', '=1+2', $hidden);
-
-
-Note: This offers weak protection even with a password, see the note in relation to the C<protect()> method.
-
-
-
-
-=head2 set_align()
-
-    Default state:      Alignment is off
-    Default action:     Left alignment
-    Valid args:         'left'              Horizontal
-                        'center'
-                        'right'
-                        'fill'
-                        'justify'
-                        'center_across'
-
-                        'top'               Vertical
-                        'vcenter'
-                        'bottom'
-                        'vjustify'
-
-This method is used to set the horizontal and vertical text alignment within a cell. Vertical and horizontal alignments can be combined. The method is used as follows:
-
-    my $format = $workbook->add_format();
-    $format->set_align('center');
-    $format->set_align('vcenter');
-    $worksheet->set_row(0, 30);
-    $worksheet->write(0, 0, "X", $format);
-
-Text can be aligned across two or more adjacent cells using the C<center_across> property. However, for genuine merged cells it is better to use the C<merge_range()> worksheet method.
-
-The C<vjustify> (vertical justify) option can be used to provide automatic text wrapping in a cell. The height of the cell will be adjusted to accommodate the wrapped text. To specify where the text wraps use the C<set_text_wrap()> method.
-
-
-For further examples see the 'Alignment' worksheet created by formats.pl.
-
-
-
-
-=head2 set_center_across()
-
-    Default state:      Center across selection is off
-    Default action:     Turn center across on
-    Valid args:         1
-
-Text can be aligned across two or more adjacent cells using the C<set_center_across()> method. This is an alias for the C<set_align('center_across')> method call.
-
-Only one cell should contain the text, the other cells should be blank:
-
-    my $format = $workbook->add_format();
-    $format->set_center_across();
-
-    $worksheet->write(1, 1, 'Center across selection', $format);
-    $worksheet->write_blank(1, 2, $format);
-
-See also the C<merge1.pl> to C<merge5.pl> programs in the C<examples> directory and the C<merge_range()> method.
-
-
-
-=head2 set_text_wrap()
-
-    Default state:      Text wrap is off
-    Default action:     Turn text wrap on
-    Valid args:         0, 1
-
-
-Here is an example using the text wrap property, the escape character C<\n> is used to indicate the end of line:
-
-    my $format = $workbook->add_format();
-    $format->set_text_wrap();
-    $worksheet->write(0, 0, "It's\na bum\nwrap", $format);
-
-Excel will adjust the height of the row to accommodate the wrapped text. A similar effect can be obtained without newlines using the C<set_align('vjustify')> method. See the C<textwrap.pl> program in the C<examples> directory.
-
-
-
-
-=head2 set_rotation()
-
-    Default state:      Text rotation is off
-    Default action:     None
-    Valid args:         Integers in the range -90 to 90 and 270
-
-Set the rotation of the text in a cell. The rotation can be any angle in the range -90 to 90 degrees.
-
-    my $format = $workbook->add_format();
-    $format->set_rotation(30);
-    $worksheet->write(0, 0, "This text is rotated", $format);
-
-
-The angle 270 is also supported. This indicates text where the letters run from top to bottom.
-
-
-
-=head2 set_indent()
-
-
-    Default state:      Text indentation is off
-    Default action:     Indent text 1 level
-    Valid args:         Positive integers
-
-
-This method can be used to indent text. The argument, which should be an integer, is taken as the level of indentation:
-
-
-    my $format = $workbook->add_format();
-    $format->set_indent(2);
-    $worksheet->write(0, 0, "This text is indented", $format);
-
-
-Indentation is a horizontal alignment property. It will override any other horizontal properties but it can be used in conjunction with vertical properties.
-
-
-
-
-=head2 set_shrink()
-
-
-    Default state:      Text shrinking is off
-    Default action:     Turn "shrink to fit" on
-    Valid args:         1
-
-
-This method can be used to shrink text so that it fits in a cell.
-
-
-    my $format = $workbook->add_format();
-    $format->set_shrink();
-    $worksheet->write(0, 0, "Honey, I shrunk the text!", $format);
-
-
-
-
-=head2 set_text_justlast()
-
-    Default state:      Justify last is off
-    Default action:     Turn justify last on
-    Valid args:         0, 1
-
-
-Only applies to Far Eastern versions of Excel.
-
-
-
-
-=head2 set_pattern()
-
-    Default state:      Pattern is off
-    Default action:     Solid fill is on
-    Valid args:         0 .. 18
-
-Set the background pattern of a cell.
-
-Examples of the available patterns are shown in the 'Patterns' worksheet created by formats.pl. However, it is unlikely that you will ever need anything other than Pattern 1 which is a solid fill of the background color.
-
-
-
-
-=head2 set_bg_color()
-
-    Default state:      Color is off
-    Default action:     Solid fill.
-    Valid args:         See set_color()
-
-The C<set_bg_color()> method can be used to set the background colour of a pattern. Patterns are defined via the C<set_pattern()> method. If a pattern hasn't been defined then a solid fill pattern is used as the default.
-
-Here is an example of how to set up a solid fill in a cell:
-
-    my $format = $workbook->add_format();
-
-    $format->set_pattern(); # This is optional when using a solid fill
-
-    $format->set_bg_color('green');
-    $worksheet->write('A1', 'Ray', $format);
-
-For further examples see the 'Patterns' worksheet created by formats.pl.
-
-
-
-
-=head2 set_fg_color()
-
-    Default state:      Color is off
-    Default action:     Solid fill.
-    Valid args:         See set_color()
-
-
-The C<set_fg_color()> method can be used to set the foreground colour of a pattern.
-
-For further examples see the 'Patterns' worksheet created by formats.pl.
-
-
-
-
-=head2 set_border()
-
-    Also applies to:    set_bottom()
-                        set_top()
-                        set_left()
-                        set_right()
-
-    Default state:      Border is off
-    Default action:     Set border type 1
-    Valid args:         0 No border
-                        1 Thin single border
-                        2 Medium single border
-                        3 Dashed border
-                        4 Dotted border
-                        5 Thick single border
-                        6 Double line border
-                        7 Hair border
-
-
-A cell border is comprised of a border on the bottom, top, left and right. These can be set to the same value using C<set_border()> or individually using the relevant method calls shown above. Examples of the available border styles are shown in the 'Borders' worksheet created by formats.pl.
-
-
-
-
-=head2 set_border_color()
-
-    Also applies to:    set_bottom_color()
-                        set_top_color()
-                        set_left_color()
-                        set_right_color()
-
-    Default state:      Color is off
-    Default action:     Undefined
-    Valid args:         See set_color()
-
-
-Set the colour of the cell borders. A cell border is comprised of a border on the bottom, top, left and right. These can be set to the same colour using C<set_border_color()> or individually using the relevant method calls shown above. Examples of the border styles and colours are shown in the 'Borders' worksheet created by formats.pl.
-
-
-
-
-
-=head2 copy($format)
-
-
-This method is used to copy all of the properties from one Format object to another:
-
-    my $lorry1 = $workbook->add_format();
-    $lorry1->set_bold();
-    $lorry1->set_italic();
-    $lorry1->set_color('red');    # lorry1 is bold, italic and red
-
-    my $lorry2 = $workbook->add_format();
-    $lorry2->copy($lorry1);
-    $lorry2->set_color('yellow'); # lorry2 is bold, italic and yellow
-
-The C<copy()> method is only useful if you are using the method interface to Format properties. It generally isn't required if you are setting Format properties directly using hashes.
-
-
-Note: this is not a copy constructor, both objects must exist prior to copying.
-
-
-
-
-=head1 COLOURS IN EXCEL
-
-Excel provides a colour palette of 56 colours. In Spreadsheet::WriteExcel these colours are accessed via their palette index in the range 8..63. This index is used to set the colour of fonts, cell patterns and cell borders. For example:
-
-    my $format = $workbook->add_format(
-                                        color => 12, # index for blue
-                                        font  => 'Arial',
-                                        size  => 12,
-                                        bold  => 1,
-                                     );
-
-The most commonly used colours can also be accessed by name. The name acts as a simple alias for the colour index:
-
-    black     =>    8
-    blue      =>   12
-    brown     =>   16
-    cyan      =>   15
-    gray      =>   23
-    green     =>   17
-    lime      =>   11
-    magenta   =>   14
-    navy      =>   18
-    orange    =>   53
-    purple    =>   20
-    red       =>   10
-    silver    =>   22
-    white     =>    9
-    yellow    =>   13
-
-For example:
-
-    my $font = $workbook->add_format(color => 'red');
-
-Users of VBA in Excel should note that the equivalent colour indices are in the range 1..56 instead of 8..63.
-
-If the default palette does not provide a required colour you can override one of the built-in values. This is achieved by using the C<set_custom_color()> workbook method to adjust the RGB (red green blue) components of the colour:
-
-    my $ferrari = $workbook->set_custom_color(40, 216, 12, 12);
-
-    my $format  = $workbook->add_format(
-                                        bg_color => $ferrari,
-                                        pattern  => 1,
-                                        border   => 1
-                                      );
-
-    $worksheet->write_blank('A1', $format);
-
-The default Excel 97 colour palette is shown in C<palette.html> in the C<doc> directory  of the distro. You can generate an Excel version of the palette using C<colors.pl> in the C<examples> directory.
-
-A comparison of the colour components in the Excel 5 and Excel 97+ colour palettes is shown in C<rgb5-97.txt> in the C<doc> directory.
-
-
-You may also find the following links helpful:
-
-A detailed look at Excel's colour palette: http://www.geocities.com/davemcritchie/excel/colors.htm
-
-A decimal RGB chart: http://www.hypersolutions.org/pages/rgbdec.html
-
-A hex RGB chart: : http://www.hypersolutions.org/pages/rgbhex.html
-
-
-
-=head1 DATES IN EXCEL
-
-
-Dates and times in Excel are represented by real numbers, for example "Jan 1 2001 12:30 AM" is represented by the number 36892.521.
-
-The integer part of the number stores the number of days since the epoch and the fractional part stores the percentage of the day.
-
-The epoch can be either 1900 or 1904. Excel for Windows uses 1900 and Excel for Macintosh uses 1904. The epochs are:
-
-    1900: 0 January 1900 i.e. 31 December 1899
-    1904: 1 January 1904
-
-By default Spreadsheet::WriteExcel uses the Windows/1900 format although it generally isn't an issue since Excel on Windows and the Macintosh will convert automatically between one system and the other. To use the 1904 epoch you must use the C<set_1904()> workbook method.
-
-There are two things to note about the 1900 date format. The first is that the epoch starts on 0 January 1900. The second is that the year 1900 is erroneously but deliberately treated as a leap year. Therefore you must add an extra day to dates after 28 February 1900. The reason for this anomaly is explained at http://support.microsoft.com/support/kb/articles/Q181/3/70.asp
-
-A date or time in Excel is like any other number. To display the number as a date you must apply a number format to it. Refer to the C<set_num_format()> method above:
-
-    $format->set_num_format('mmm d yyyy hh:mm AM/PM');
-    $worksheet->write('A1', 36892.521 , $format); # Jan 1 2001 12:30 AM
-
-You can also use the C<write_date_time()> worksheet method to write dates in  ISO8601 date format.
-
-    $worksheet->write_date_time('A2', '2001-01-01T12:20', format);
-
-See the C<write_date_time()> section of the documentation for more details.
-
-See also the C<Spreadsheet::WriteExcel::Utility> module that is included in the distro and which includes date handling functions and the DateTime::Format::Excel module, http://search.cpan.org/search?dist=DateTime-Format-Excel which is part of the DateTime project and which deals specifically with converting dates and times to and from Excel's format.
-
-
-
-
-=head1 OUTLINES AND GROUPING IN EXCEL
-
-
-Excel allows you to group rows or columns so that they can be hidden or displayed with a single mouse click. This feature is referred to as outlines.
-
-Outlines can reduce complex data down to a few salient sub-totals or summaries.
-
-This feature is best viewed in Excel but the following is an ASCII representation of what a worksheet with three outlines might look like. Rows 3-4 and rows 7-8 are grouped at level 2. Rows 2-9 are grouped at level 1. The lines at the left hand side are called outline level bars.
-
-
-            ------------------------------------------
-     1 2 3 |   |   A   |   B   |   C   |   D   |  ...
-            ------------------------------------------
-      _    | 1 |   A   |       |       |       |  ...
-     |  _  | 2 |   B   |       |       |       |  ...
-     | |   | 3 |  (C)  |       |       |       |  ...
-     | |   | 4 |  (D)  |       |       |       |  ...
-     | -   | 5 |   E   |       |       |       |  ...
-     |  _  | 6 |   F   |       |       |       |  ...
-     | |   | 7 |  (G)  |       |       |       |  ...
-     | |   | 8 |  (H)  |       |       |       |  ...
-     | -   | 9 |   I   |       |       |       |  ...
-     -     | . |  ...  |  ...  |  ...  |  ...  |  ...
-
-
-Clicking the minus sign on each of the level 2 outlines will collapse and hide the data as shown in the next figure. The minus sign changes to a plus sign to indicate that the data in the outline is hidden.
-
-            ------------------------------------------
-     1 2 3 |   |   A   |   B   |   C   |   D   |  ...
-            ------------------------------------------
-      _    | 1 |   A   |       |       |       |  ...
-     |     | 2 |   B   |       |       |       |  ...
-     | +   | 5 |   E   |       |       |       |  ...
-     |     | 6 |   F   |       |       |       |  ...
-     | +   | 9 |   I   |       |       |       |  ...
-     -     | . |  ...  |  ...  |  ...  |  ...  |  ...
-
-
-Clicking on the minus sign on the level 1 outline will collapse the remaining rows as follows:
-
-            ------------------------------------------
-     1 2 3 |   |   A   |   B   |   C   |   D   |  ...
-            ------------------------------------------
-           | 1 |   A   |       |       |       |  ...
-     +     | . |  ...  |  ...  |  ...  |  ...  |  ...
-
-
-Grouping in C<Spreadsheet::WriteExcel> is achieved by setting the outline level via the C<set_row()> and C<set_column()> worksheet methods:
-
-    set_row($row, $height, $format, $hidden, $level)
-    set_column($first_col, $last_col, $width, $format, $hidden, $level)
-
-The following example sets an outline level of 1 for rows 1 and 2 (zero-indexed) and columns B to G. The parameters C<$height> and C<$XF> are assigned default values since they are undefined:
-
-    $worksheet->set_row(1, undef, undef, 0, 1);
-    $worksheet->set_row(2, undef, undef, 0, 1);
-    $worksheet->set_column('B:G', undef, undef, 0, 1);
-
-Excel allows up to 7 outline levels. Therefore the C<$level> parameter should be in the range C<0 E<lt>= $level E<lt>= 7>.
-
-Rows and columns can be collapsed by setting the C<$hidden> flag:
-
-    $worksheet->set_row(1, undef, undef, 1, 1);
-    $worksheet->set_row(2, undef, undef, 1, 1);
-    $worksheet->set_column('B:G', undef, undef, 1, 1);
-
-For a more complete example see the C<outline.pl> program in the examples directory of the distro.
-
-Some additional outline properties can be set via the C<outline_settings()> worksheet method, see above.
-
-
-
-
-=head1 FORMULAS AND FUNCTIONS IN EXCEL
-
-
-=head2 Caveats
-
-The first thing to note is that there are still some outstanding issues with the implementation of formulas and functions:
-
-    1. Writing a formula is much slower than writing the equivalent string.
-    2. You cannot use array constants, i.e. {1;2;3}, in functions.
-    3. Unary minus isn't supported.
-    4. Whitespace is not preserved around operators.
-    5. Named ranges are not supported.
-    6. Array formulas are not supported.
-
-However, these constraints will be removed in future versions. They are here because of a trade-off between features and time. Also, it is possible to work around issue 1 using the C<store_formula()> and C<repeat_formula()> methods as described later in this section.
-
-
-
-=head2 Introduction
-
-The following is a brief introduction to formulas and functions in Excel and Spreadsheet::WriteExcel.
-
-A formula is a string that begins with an equals sign:
-
-    '=A1+B1'
-    '=AVERAGE(1, 2, 3)'
-
-The formula can contain numbers, strings, boolean values, cell references, cell ranges and functions. Named ranges are not supported. Formulas should be written as they appear in Excel, that is cells and functions must be in uppercase.
-
-Cells in Excel are referenced using the A1 notation system where the column is designated by a letter and the row by a number. Columns range from A to IV i.e. 0 to 255, rows range from 1 to 65536. The C<Spreadsheet::WriteExcel::Utility> module that is included in the distro contains helper functions for dealing with A1 notation, for example:
-
-    use Spreadsheet::WriteExcel::Utility;
-
-    ($row, $col) = xl_cell_to_rowcol('C2');  # (1, 2)
-    $str         = xl_rowcol_to_cell(1, 2);  # C2
-
-The Excel C<$> notation in cell references is also supported. This allows you to specify whether a row or column is relative or absolute. This only has an effect if the cell is copied. The following examples show relative and absolute values.
-
-    '=A1'   # Column and row are relative
-    '=$A1'  # Column is absolute and row is relative
-    '=A$1'  # Column is relative and row is absolute
-    '=$A$1' # Column and row are absolute
-
-Formulas can also refer to cells in other worksheets of the current workbook. For example:
-
-    '=Sheet2!A1'
-    '=Sheet2!A1:A5'
-    '=Sheet2:Sheet3!A1'
-    '=Sheet2:Sheet3!A1:A5'
-    q{='Test Data'!A1}
-    q{='Test Data1:Test Data2'!A1}
-
-The sheet reference and the cell reference are separated by  C<!> the exclamation mark symbol. If worksheet names contain spaces, commas o parentheses then Excel requires that the name is enclosed in single quotes as shown in the last two examples above. In order to avoid using a lot of escape characters you can use the quote operator C<q{}> to protect the quotes. See C<perlop> in the main Perl documentation. Only valid sheet names that have been added using the C<add_worksheet()> method can be used in formulas. You cannot reference external workbooks.
-
-
-The following table lists the operators that are available in Excel's formulas. The majority of the operators are the same as Perl's, differences are indicated:
-
-    Arithmetic operators:
-    =====================
-    Operator  Meaning                   Example
-       +      Addition                  1+2
-       -      Subtraction               2-1
-       *      Multiplication            2*3
-       /      Division                  1/4
-       ^      Exponentiation            2^3      # Equivalent to **
-       -      Unary minus               -(1+2)   # Not yet supported
-       %      Percent (Not modulus)     13%      # Not supported, [1]
-
-
-    Comparison operators:
-    =====================
-    Operator  Meaning                   Example
-        =     Equal to                  A1 =  B1 # Equivalent to ==
-        <>    Not equal to              A1 <> B1 # Equivalent to !=
-        >     Greater than              A1 >  B1
-        <     Less than                 A1 <  B1
-        >=    Greater than or equal to  A1 >= B1
-        <=    Less than or equal to     A1 <= B1
-
-
-    String operator:
-    ================
-    Operator  Meaning                   Example
-        &     Concatenation             "Hello " & "World!" # [2]
-
-
-    Reference operators:
-    ====================
-    Operator  Meaning                   Example
-        :     Range operator            A1:A4               # [3]
-        ,     Union operator            SUM(1, 2+2, B3)     # [4]
-
-
-    Notes:
-    [1]: You can get a percentage with formatting and modulus with MOD().
-    [2]: Equivalent to ("Hello " . "World!") in Perl.
-    [3]: This range is equivalent to cells A1, A2, A3 and A4.
-    [4]: The comma behaves like the list separator in Perl.
-
-The range and comma operators can have different symbols in non-English versions of Excel. These will be supported in a later version of Spreadsheet::WriteExcel. European users of Excel take note:
-
-    $worksheet->write('A1', '=SUM(1; 2; 3)'); # Wrong!!
-    $worksheet->write('A1', '=SUM(1, 2, 3)'); # Okay
-
-The following table lists all of the core functions supported by Excel 5 and Spreadsheet::WriteExcel. Any additional functions that are available through the "Analysis ToolPak" or other add-ins are not supported. These functions have all been tested to verify that they work.
-
-    ABS           DB            INDIRECT      NORMINV       SLN
-    ACOS          DCOUNT        INFO          NORMSDIST     SLOPE
-    ACOSH         DCOUNTA       INT           NORMSINV      SMALL
-    ADDRESS       DDB           INTERCEPT     NOT           SQRT
-    AND           DEGREES       IPMT          NOW           STANDARDIZE
-    AREAS         DEVSQ         IRR           NPER          STDEV
-    ASIN          DGET          ISBLANK       NPV           STDEVP
-    ASINH         DMAX          ISERR         ODD           STEYX
-    ATAN          DMIN          ISERROR       OFFSET        SUBSTITUTE
-    ATAN2         DOLLAR        ISLOGICAL     OR            SUBTOTAL
-    ATANH         DPRODUCT      ISNA          PEARSON       SUM
-    AVEDEV        DSTDEV        ISNONTEXT     PERCENTILE    SUMIF
-    AVERAGE       DSTDEVP       ISNUMBER      PERCENTRANK   SUMPRODUCT
-    BETADIST      DSUM          ISREF         PERMUT        SUMSQ
-    BETAINV       DVAR          ISTEXT        PI            SUMX2MY2
-    BINOMDIST     DVARP         KURT          PMT           SUMX2PY2
-    CALL          ERROR.TYPE    LARGE         POISSON       SUMXMY2
-    CEILING       EVEN          LEFT          POWER         SYD
-    CELL          EXACT         LEN           PPMT          T
-    CHAR          EXP           LINEST        PROB          TAN
-    CHIDIST       EXPONDIST     LN            PRODUCT       TANH
-    CHIINV        FACT          LOG           PROPER        TDIST
-    CHITEST       FALSE         LOG10         PV            TEXT
-    CHOOSE        FDIST         LOGEST        QUARTILE      TIME
-    CLEAN         FIND          LOGINV        RADIANS       TIMEVALUE
-    CODE          FINV          LOGNORMDIST   RAND          TINV
-    COLUMN        FISHER        LOOKUP        RANK          TODAY
-    COLUMNS       FISHERINV     LOWER         RATE          TRANSPOSE
-    COMBIN        FIXED         MATCH         REGISTER.ID   TREND
-    CONCATENATE   FLOOR         MAX           REPLACE       TRIM
-    CONFIDENCE    FORECAST      MDETERM       REPT          TRIMMEAN
-    CORREL        FREQUENCY     MEDIAN        RIGHT         TRUE
-    COS           FTEST         MID           ROMAN         TRUNC
-    COSH          FV            MIN           ROUND         TTEST
-    COUNT         GAMMADIST     MINUTE        ROUNDDOWN     TYPE
-    COUNTA        GAMMAINV      MINVERSE      ROUNDUP       UPPER
-    COUNTBLANK    GAMMALN       MIRR          ROW           VALUE
-    COUNTIF       GEOMEAN       MMULT         ROWS          VAR
-    COVAR         GROWTH        MOD           RSQ           VARP
-    CRITBINOM     HARMEAN       MODE          SEARCH        VDB
-    DATE          HLOOKUP       MONTH         SECOND        VLOOKUP
-    DATEVALUE     HOUR          N             SIGN          WEEKDAY
-    DAVERAGE      HYPGEOMDIST   NA            SIN           WEIBULL
-    DAY           IF            NEGBINOMDIST  SINH          YEAR
-    DAYS360       INDEX         NORMDIST      SKEW          ZTEST
-
-You can also modify the module to support function names in the following languages: German, French, Spanish, Portuguese, Dutch, Finnish, Italian and Swedish. See the C<function_locale.pl> program in the C<examples> directory of the distro.
-
-For a general introduction to Excel's formulas and an explanation of the syntax of the function refer to the Excel help files or the following links: http://msdn.microsoft.com/library/default.asp?URL=/library/officedev/office97/s88f2.htm and http://msdn.microsoft.com/library/default.asp?URL=/library/en-us/office97/s992f.htm
-
-
-If your formula doesn't work in Spreadsheet::WriteExcel try the following:
-
-    1. Verify that the formula works in Excel (or Gnumeric or OpenOffice.org).
-    2. Ensure that it isn't on the Caveats list shown above.
-    3. Ensure that cell references and formula names are in uppercase.
-    4. Ensure that you are using ':' as the range operator, A1:A4.
-    5. Ensure that you are using ',' as the union operator, SUM(1,2,3).
-    6. Ensure that the function is in the above table.
-
-If you go through steps 1-6 and you still have a problem, mail me.
-
-
-
-
-=head2 Improving performance when working with formulas
-
-Writing a large number of formulas with Spreadsheet::WriteExcel can be slow. This is due to the fact that each formula has to be parsed and with the current implementation this is computationally expensive.
-
-However, in a lot of cases the formulas that you write will be quite similar, for example:
-
-    $worksheet->write_formula('B1',    '=A1 * 3 + 50',    $format);
-    $worksheet->write_formula('B2',    '=A2 * 3 + 50',    $format);
-    ...
-    ...
-    $worksheet->write_formula('B99',   '=A999 * 3 + 50',  $format);
-    $worksheet->write_formula('B1000', '=A1000 * 3 + 50', $format);
-
-In this example the cell reference changes in iterations from C<A1> to C<A1000>. The parser treats this variable as a I<token> and arranges it according to predefined rules. However, since the parser is oblivious to the value of the token, it is essentially performing the same calculation 1000 times. This is inefficient.
-
-The way to avoid this inefficiency and thereby speed up the writing of formulas is to parse the formula once and then repeatedly substitute similar tokens.
-
-A formula can be parsed and stored via the C<store_formula()> worksheet method. You can then use the C<repeat_formula()> method to substitute C<$pattern>, C<$replace> pairs in the stored formula:
-
-    my $formula = $worksheet->store_formula('=A1 * 3 + 50');
-
-    for my $row (0..999) {
-        $worksheet->repeat_formula($row, 1, $formula, $format, 'A1', 'A'.($row +1));
-    }
-
-On an arbitrary test machine this method was 10 times faster than the brute force method shown above.
-
-For more information about how Spreadsheet::WriteExcel parses and stores formulas see the C<Spreadsheet::WriteExcel::Formula> man page.
-
-It should be noted however that the overall speed of direct formula parsing will be improved in a future version.
-
-
-
-
-=head1 EXAMPLES
-
-
-
-
-=head2 Example 1
-
-The following example shows some of the basic features of Spreadsheet::WriteExcel.
-
-
-    #!/usr/bin/perl -w
-
-    use strict;
-    use Spreadsheet::WriteExcel;
-
-    # Create a new workbook called simple.xls and add a worksheet
-    my $workbook  = Spreadsheet::WriteExcel->new("simple.xls");
-    my $worksheet = $workbook->add_worksheet();
-
-    # The general syntax is write($row, $column, $token). Note that row and
-    # column are zero indexed
-
-    # Write some text
-    $worksheet->write(0, 0,  "Hi Excel!");
-
-
-    # Write some numbers
-    $worksheet->write(2, 0,  3);          # Writes 3
-    $worksheet->write(3, 0,  3.00000);    # Writes 3
-    $worksheet->write(4, 0,  3.00001);    # Writes 3.00001
-    $worksheet->write(5, 0,  3.14159);    # TeX revision no.?
-
-
-    # Write some formulas
-    $worksheet->write(7, 0,  '=A3 + A6');
-    $worksheet->write(8, 0,  '=IF(A5>3,"Yes", "No")');
-
-
-    # Write a hyperlink
-    $worksheet->write(10, 0, 'http://www.perl.com/');
-
-
-
-
-=head2 Example 2
-
-The following is a general example which demonstrates some features of working with multiple worksheets.
-
-    #!/usr/bin/perl -w
-
-    use strict;
-    use Spreadsheet::WriteExcel;
-
-    # Create a new Excel workbook
-    my $workbook = Spreadsheet::WriteExcel->new("regions.xls");
-
-    # Add some worksheets
-    my $north = $workbook->add_worksheet("North");
-    my $south = $workbook->add_worksheet("South");
-    my $east  = $workbook->add_worksheet("East");
-    my $west  = $workbook->add_worksheet("West");
-
-    # Add a Format
-    my $format = $workbook->add_format();
-    $format->set_bold();
-    $format->set_color('blue');
-
-    # Add a caption to each worksheet
-    foreach my $worksheet ($workbook->sheets()) {
-        $worksheet->write(0, 0, "Sales", $format);
-    }
-
-    # Write some data
-    $north->write(0, 1, 200000);
-    $south->write(0, 1, 100000);
-    $east->write (0, 1, 150000);
-    $west->write (0, 1, 100000);
-
-    # Set the active worksheet
-    $south->activate();
-
-    # Set the width of the first column
-    $south->set_column(0, 0, 20);
-
-    # Set the active cell
-    $south->set_selection(0, 1);
-
-
-
-
-=head2 Example 3
-
-This example shows how to use a conditional numerical format with colours to indicate if a share price has gone up or down.
-
-    use strict;
-    use Spreadsheet::WriteExcel;
-
-    # Create a new workbook and add a worksheet
-    my $workbook  = Spreadsheet::WriteExcel->new("stocks.xls");
-    my $worksheet = $workbook->add_worksheet();
-
-    # Set the column width for columns 1, 2, 3 and 4
-    $worksheet->set_column(0, 3, 15);
-
-
-    # Create a format for the column headings
-    my $header = $workbook->add_format();
-    $header->set_bold();
-    $header->set_size(12);
-    $header->set_color('blue');
-
-
-    # Create a format for the stock price
-    my $f_price = $workbook->add_format();
-    $f_price->set_align('left');
-    $f_price->set_num_format('$0.00');
-
-
-    # Create a format for the stock volume
-    my $f_volume = $workbook->add_format();
-    $f_volume->set_align('left');
-    $f_volume->set_num_format('#,##0');
-
-
-    # Create a format for the price change. This is an example of a
-    # conditional format. The number is formatted as a percentage. If it is
-    # positive it is formatted in green, if it is negative it is formatted
-    # in red and if it is zero it is formatted as the default font colour
-    # (in this case black). Note: the [Green] format produces an unappealing
-    # lime green. Try [Color 10] instead for a dark green.
-    #
-    my $f_change = $workbook->add_format();
-    $f_change->set_align('left');
-    $f_change->set_num_format('[Green]0.0%;[Red]-0.0%;0.0%');
-
-
-    # Write out the data
-    $worksheet->write(0, 0, 'Company',$header);
-    $worksheet->write(0, 1, 'Price',  $header);
-    $worksheet->write(0, 2, 'Volume', $header);
-    $worksheet->write(0, 3, 'Change', $header);
-
-    $worksheet->write(1, 0, 'Damage Inc.'       );
-    $worksheet->write(1, 1, 30.25,    $f_price ); # $30.25
-    $worksheet->write(1, 2, 1234567,  $f_volume); # 1,234,567
-    $worksheet->write(1, 3, 0.085,    $f_change); # 8.5% in green
-
-    $worksheet->write(2, 0, 'Dump Corp.'        );
-    $worksheet->write(2, 1, 1.56,     $f_price ); # $1.56
-    $worksheet->write(2, 2, 7564,     $f_volume); # 7,564
-    $worksheet->write(2, 3, -0.015,   $f_change); # -1.5% in red
-
-    $worksheet->write(3, 0, 'Rev Ltd.'          );
-    $worksheet->write(3, 1, 0.13,     $f_price ); # $0.13
-    $worksheet->write(3, 2, 321,      $f_volume); # 321
-    $worksheet->write(3, 3, 0,        $f_change); # 0 in the font color (black)
-
-
-
-
-=head2 Example 4
-
-The following is a simple example of using functions.
-
-    #!/usr/bin/perl -w
-
-    use strict;
-    use Spreadsheet::WriteExcel;
-
-    # Create a new workbook and add a worksheet
-    my $workbook  = Spreadsheet::WriteExcel->new("stats.xls");
-    my $worksheet = $workbook->add_worksheet('Test data');
-
-    # Set the column width for columns 1
-    $worksheet->set_column(0, 0, 20);
-
-
-    # Create a format for the headings
-    my $format = $workbook->add_format();
-    $format->set_bold();
-
-
-    # Write the sample data
-    $worksheet->write(0, 0, 'Sample', $format);
-    $worksheet->write(0, 1, 1);
-    $worksheet->write(0, 2, 2);
-    $worksheet->write(0, 3, 3);
-    $worksheet->write(0, 4, 4);
-    $worksheet->write(0, 5, 5);
-    $worksheet->write(0, 6, 6);
-    $worksheet->write(0, 7, 7);
-    $worksheet->write(0, 8, 8);
-
-    $worksheet->write(1, 0, 'Length', $format);
-    $worksheet->write(1, 1, 25.4);
-    $worksheet->write(1, 2, 25.4);
-    $worksheet->write(1, 3, 24.8);
-    $worksheet->write(1, 4, 25.0);
-    $worksheet->write(1, 5, 25.3);
-    $worksheet->write(1, 6, 24.9);
-    $worksheet->write(1, 7, 25.2);
-    $worksheet->write(1, 8, 24.8);
-
-    # Write some statistical functions
-    $worksheet->write(4,  0, 'Count', $format);
-    $worksheet->write(4,  1, '=COUNT(B1:I1)');
-
-    $worksheet->write(5,  0, 'Sum', $format);
-    $worksheet->write(5,  1, '=SUM(B2:I2)');
-
-    $worksheet->write(6,  0, 'Average', $format);
-    $worksheet->write(6,  1, '=AVERAGE(B2:I2)');
-
-    $worksheet->write(7,  0, 'Min', $format);
-    $worksheet->write(7,  1, '=MIN(B2:I2)');
-
-    $worksheet->write(8,  0, 'Max', $format);
-    $worksheet->write(8,  1, '=MAX(B2:I2)');
-
-    $worksheet->write(9,  0, 'Standard Deviation', $format);
-    $worksheet->write(9,  1, '=STDEV(B2:I2)');
-
-    $worksheet->write(10, 0, 'Kurtosis', $format);
-    $worksheet->write(10, 1, '=KURT(B2:I2)');
-
-
-
-=head2 Example 5
-
-The following example converts a tab separated file called C<tab.txt> into an Excel file called C<tab.xls>.
-
-    #!/usr/bin/perl -w
-
-    use strict;
-    use Spreadsheet::WriteExcel;
-
-    open (TABFILE, "tab.txt") or die "tab.txt: $!";
-
-    my $workbook  = Spreadsheet::WriteExcel->new("tab.xls");
-    my $worksheet = $workbook->add_worksheet();
-
-    # Row and column are zero indexed
-    my $row = 0;
-
-    while (<TABFILE>) {
-        chomp;
-        # Split on single tab
-        my @Fld = split('\t', $_);
-
-        my $col = 0;
-        foreach my $token (@Fld) {
-            $worksheet->write($row, $col, $token);
-            $col++;
-        }
-        $row++;
-    }
-
-
-=head2 Additional Examples
-
-If you performed a normal installation the following examples files should have been copied to your C<~site/Spreadsheet/WriteExcel/examples> directory:
-
-The following is a description of the example files that are provided
-with Spreadsheet::WriteExcel. They are intended to demonstrate the
-different features and options of the module.
-
-
-    Getting started
-    ===============
-    bug_report.pl           A template for submitting bug reports.
-    demo.pl                 Creates a demo of some of the features.
-    formats.pl              Creates a demo of the available formatting.
-    regions.pl              Demonstrates multiple worksheets.
-    simple.pl               An example of some of the basic features.
-    stats.pl                Basic formulas and functions.
-
-    Advanced
-    ========
-    bigfile.pl              Write past the 7MB limit with OLE::Storage_Lite.
-    cgi.pl                  A simple CGI program.
-    chess.pl                An example of formatting using properties.
-    colors.pl               Demo of the colour palette and named colours.
-    copyformat.pl           Example of copying a cell format.
-    diag_border.pl          A simple example of diagonal cell borders.
-    easter_egg.pl           Expose the Excel97 flight simulator. A must see.
-    filehandle.pl           Examples of working with filehandles.
-    formula_result.pl       Formulas with user specified results.
-    headers.pl              Examples of worksheet headers and footers.
-    hyperlink1.pl           Shows how to create web hyperlinks.
-    hyperlink2.pl           Examples of internal and external hyperlinks.
-    images.pl               Adding bitmap images to worksheets.
-    indent.pl               An example of cell indentation.
-    merge1.pl               A simple example of cell merging.
-    merge2.pl               A simple example of cell merging with formatting.
-    merge3.pl               Add hyperlinks to merged cells.
-    merge4.pl               An advanced example of merging with formatting.
-    merge5.pl               An advanced example of merging with formatting.
-    mod_perl1.pl            A simple mod_perl 1 program.
-    mod_perl2.pl            A simple mod_perl 2 program.
-    outline.pl              An example of outlines and grouping.
-    panes.pl                An examples of how to create panes.
-    protection.pl           Example of cell locking and formula hiding.
-    hide_sheet.pl           Simple example of hiding a worksheet.
-    repeat.pl               Example of writing repeated formulas.
-    sales.pl                An example of a simple sales spreadsheet.
-    sendmail.pl             Send an Excel email attachment using Mail::Sender.
-    stats_ext.pl            Same as stats.pl with external references.
-    stocks.pl               Demonstrates conditional formatting.
-    textwrap.pl             Demonstrates text wrapping options.
-    win32ole.pl             A sample Win32::OLE example for comparison.
-    write_arrays.pl         Example of writing 1D or 2D arrays of data.
-    write_to_scalar.pl      Example of writing an Excel file to a Perl scalar.
-    write_handler1.pl       Example of extending the write() method. Step 1.
-    write_handler2.pl       Example of extending the write() method. Step 2.
-    write_handler3.pl       Example of extending the write() method. Step 3.
-    write_handler4.pl       Example of extending the write() method. Step 4.
-
-
-    Unicode
-    =======
-    unicode.pl              Simple example of using Unicode UTF16 strings.
-    unicode_japan.pl        Write Japanese Unicode strings using UTF16.
-    unicode_cyrillic.pl     Write Russian cyrillic strings using UTF8.
-    unicode_list.pl         List the chars in a Unicode font.
-    unicode_2022_jp.pl      Japanese: ISO-2022-JP to utf8 in perl 5.8.
-    unicode_8859_11.pl      Thai:     ISO-8859_11 to utf8 in perl 5.8.
-    unicode_8859_7.pl       Greek:    ISO-8859_7  to utf8 in perl 5.8.
-    unicode_big5.pl         Chinese:  BIG5        to utf8 in perl 5.8.
-    unicode_cp1251.pl       Russian:  CP1251      to utf8 in perl 5.8.
-    unicode_cp1256.pl       Arabic:   CP1256      to utf8 in perl 5.8.
-    unicode_koi8r.pl        Russian:  KOI8-R      to utf8 in perl 5.8.
-    unicode_polish_utf8.pl  Polish :  UTF8        to utf8 in perl 5.8.
-    unicode_shift_jis.pl    Japanese: Shift JIS   to utf8 in perl 5.8.
-
-
-    Utility
-    =======
-    csv2xls.pl              Program to convert a CSV file to an Excel file.
-    datecalc1.pl            Convert Unix/Perl time to Excel time.
-    datecalc2.pl            Calculate an Excel date using Date::Calc.
-    lecxe.pl                Convert Excel to WriteExcel using Win32::OLE.
-    tab2xls.pl              Program to convert a tab separated file to xls.
-
-
-    Developer
-    =========
-    convertA1.pl            Helper functions for dealing with A1 notation.
-    function_locale.pl      Add non-English function names to Formula.pm.
-    writeA1.pl              Example of how to extend the module.
-
-
-
-
-
-=head1 LIMITATIONS
-
-The following limits are imposed by Excel:
-
-    Description                          Limit
-    -----------------------------------  ------
-    Maximum number of chars in a string  32767
-    Maximum number of columns            256
-    Maximum number of rows               65536
-    Maximum chars in a sheet name        31
-    Maximum chars in a header/footer     254
-
-
-The minimum file size is 6K due to the OLE overhead. The maximum file size is approximately 7MB (7087104 bytes) of BIFF data. This can be extended by using Takanori Kawai's OLE::Storage_Lite module http://search.cpan.org/search?dist=OLE-Storage_Lite see the C<bigfile.pl> example in the C<examples> directory of the distro.
-
-
-
-
-=head1 DOWNLOADING
-
-The latest version of this module is always available at: http://search.cpan.org/search?dist=Spreadsheet-WriteExcel/
-
-
-
-
-=head1 REQUIREMENTS
-
-This module requires Perl 5.005 (or later), Parse::RecDescent and File::Temp:
-
-    http://search.cpan.org/search?dist=Parse-RecDescent/
-    http://search.cpan.org/search?dist=File-Temp/
-
-
-
-
-=head1 INSTALLATION
-
-See the INSTALL or install.html docs that come with the distribution or:
-
-http://search.cpan.org/doc/JMCNAMARA/Spreadsheet-WriteExcel-2.11/WriteExcel/doc/install.html
-
-
-
-
-=head1 PORTABILITY
-
-Spreadsheet::WriteExcel will work on the majority of Windows, UNIX and Macintosh platforms. Specifically, the module will work on any system where perl packs floats in the 64 bit IEEE format. The float must also be in little-endian format but it will be reversed if necessary. Thus:
-
-    print join(" ", map { sprintf "%#02x", $_ } unpack("C*", pack "d", 1.2345)), "\n";
-
-should give (or in reverse order):
-
-    0x8d 0x97 0x6e 0x12 0x83 0xc0 0xf3 0x3f
-
-In general, if you don't know whether your system supports a 64 bit IEEE float or not, it probably does. If your system doesn't, WriteExcel will C<croak()> with the message given in the L<DIAGNOSTICS> section. You can check which platforms the module has been tested on at the CPAN testers site: http://testers.cpan.org/search?request=dist&dist=Spreadsheet-WriteExcel
-
-
-
-
-=head1 DIAGNOSTICS
-
-
-=over 4
-
-=item Filename required by Spreadsheet::WriteExcel->new()
-
-A filename must be given in the constructor.
-
-=item Can't open filename. It may be in use or protected.
-
-The file cannot be opened for writing. The directory that you are writing to  may be protected or the file may be in use by another program.
-
-=item Unable to create tmp files via File::Temp::tempfile()...
-
-This is a C<-w> warning. You will see it if you are using Spreadsheet::WriteExcel in an environment where temporary files cannot be created, in which case all data will be stored in memory. The warning is for information only: it does not affect creation but it will affect the speed of execution for large files. See the C<set_tempdir> workbook method.
-
-
-=item Maximum file size, 7087104, exceeded.
-
-The current OLE implementation only supports a maximum BIFF file of this size. This limit can be extended, see the L<LIMITATIONS> section.
-
-=item Can't locate Parse/RecDescent.pm in @INC ...
-
-Spreadsheet::WriteExcel requires the Parse::RecDescent module. Download it from CPAN: http://search.cpan.org/search?dist=Parse-RecDescent
-
-=item Couldn't parse formula ...
-
-There are a large number of warnings which relate to badly formed formulas and functions. See the L<FORMULAS AND FUNCTIONS IN EXCEL> section for suggestions on how to avoid these errors. You should also check the formula in Excel to ensure that it is valid.
-
-=item Required floating point format not supported on this platform.
-
-Operating system doesn't support 64 bit IEEE float or it is byte-ordered in a way unknown to WriteExcel.
-
-
-=item 'file.xls' cannot be accessed. The file may be read-only ...
-
-You may sometimes encounter the following error when trying to open a file in Excel: "file.xls cannot be accessed. The file may be read-only, or you may be trying to access a read-only location. Or, the server the document is stored on may not be responding."
-
-This error generally means that the Excel file has been corrupted. There are two likely causes of this: the file was FTPed in ASCII mode instead of binary mode or else the file was created with UTF8 data returned by an XML parser. See L<WORKING WITH XML> for further details.
-
-=back
-
-
-
-
-=head1 THE EXCEL BINARY FORMAT
-
-The following is some general information about the Excel binary format for anyone who may be interested.
-
-Excel data is stored in the "Binary Interchange File Format" (BIFF) file format. Details of this format are given in the Excel SDK, the "Excel Developer's Kit" from Microsoft Press. It is also included in the MSDN CD library but is no longer available on the MSDN website. Versions of the BIFF documentation are available at www.wotsit.org, http://www.wotsit.org/search.asp?page=2&s=database
-
-Charles Wybble has collected together almost all of the available information about the Excel file format. See "The Chicago Project" at http://chicago.sourceforge.net/devel/
-
-Daniel Rentz of OpenOffice.org has also written a detailed description of the Excel workbook records, see http://sc.openoffice.org/excelfileformat.pdf
-
-The BIFF portion of the Excel file is comprised of contiguous binary records that have different functions and that hold different types of data. Each BIFF record is comprised of the following three parts:
-
-        Record name;   Hex identifier, length = 2 bytes
-        Record length; Length of following data, length = 2 bytes
-        Record data;   Data, length = variable
-
-The BIFF data is stored along with other data in an OLE Compound File. This is a structured storage which acts like a file system within a file. A Compound File is comprised of storages and streams which, to follow the file system analogy, are like directories and files.
-
-The documentation for the OLE::Storage module, http://user.cs.tu-berlin.de/~schwartz/pmh/guide.html , contains one of the few descriptions of the OLE Compound File in the public domain. The Digital Imaging Group have also detailed the OLE format in the JPEG2000 specification: see Appendix A of http://www.i3a.org/pdf/wg1n1017.pdf
-
-For a open source implementation of the OLE library see the 'cole' library at http://atena.com/libole2.php
-
-The source code for the Excel plugin of the Gnumeric spreadsheet also contains information relevant to the Excel BIFF format and the OLE container, http://www.gnome.org/projects/gnumeric/ and ftp://ftp.ximian.com/pub/ximian-source/
-
-In addition the source code for OpenOffice.org is available at http://www.openoffice.org/
-
-An article describing Spreadsheet::WriteExcel and how it works appears in Issue #19 of The Perl Journal, http://www.samag.com/documents/s=1272/sam05030004/ It is reproduced, by kind permission, in the C<doc> directory of the distro.
-
-
-Please note that the provision of this information does not constitute an invitation to start hacking at the BIFF or OLE file formats. There are more interesting ways to waste your time. ;-)
-
-
-
-
-=head1 WRITING EXCEL FILES
-
-Depending on your requirements, background and general sensibilities you may prefer one of the following methods of getting data into Excel:
-
-=over 4
-
-=item * Win32::OLE module and office automation
-
-This requires a Windows platform and an installed copy of Excel. This is the most powerful and complete method for interfacing with Excel. See http://www.activestate.com/ASPN/Reference/Products/ActivePerl-5.6/faq/Windows/ActivePerl-Winfaq12.html and http://www.activestate.com/ASPN/Reference/Products/ActivePerl-5.6/site/lib/Win32/OLE.html If your main platform is UNIX but you have the resources to set up a separate Win32/MSOffice server, you can convert office documents to text, postscript or PDF using Win32::OLE. For a demonstration of how to do this using Perl see Docserver: http://search.cpan.org/search?mode=module&query=docserver
-
-=item * CSV, comma separated variables or text
-
-If the file extension is C<csv>, Excel will open and convert this format automatically. Generating a valid CSV file isn't as easy as it seems. Have a look at the DBD::RAM, DBD::CSV, Text::xSV and Text::CSV_XS modules.
-
-=item * DBI with DBD::ADO or DBD::ODBC
-
-Excel files contain an internal index table that allows them to act like a database file. Using one of the standard Perl database modules you can connect to an Excel file as a database.
-
-=item * DBD::Excel
-
-You can also access Spreadsheet::WriteExcel using the standard DBI interface via Takanori Kawai's DBD::Excel module http://search.cpan.org/dist/DBD-Excel
-
-=item * Spreadsheet::WriteExcelXML
-
-This module allows you to create an Excel XML file using the same interface as Spreadsheet::WriteExcel. See: http://search.cpan.org/dist/Spreadsheet-WriteExcelXML
-
-=item * Excel::Template
-
-This module allows you to create an Excel file from an XML template in a manner similar to HTML::Template. See http://search.cpan.org/dist/Excel-Template/
-
-=item * Spreadsheet::WriteExcel::FromXML
-
-This module allows you to turn a simple XML file into an Excel file using Spreadsheet::WriteExcel as a backend. The format of the XML file is defined by a supplied DTD: http://search.cpan.org/dist/Spreadsheet-WriteExcel-FromXML
-
-=item * Spreadsheet::WriteExcel::Simple
-
-This provides an easier interface to Spreadsheet::WriteExcel: http://search.cpan.org/dist/Spreadsheet-WriteExcel-Simple
-
-=item * Spreadsheet::WriteExcel::FromDB
-
-This is a useful module for creating Excel files directly from a DB table: http://search.cpan.org/dist/Spreadsheet-WriteExcel-FromDB
-
-=item * HTML tables
-
-This is an easy way of adding formatting via a text based format.
-
-=item * XML or HTML
-
-The Excel XML and HTML file specification are available from http://msdn.microsoft.com/library/officedev/ofxml2k/ofxml2k.htm
-
-=back
-
-For other Perl-Excel modules try the following search: http://search.cpan.org/search?mode=module&query=excel
-
-
-
-
-=head1 READING EXCEL FILES
-
-To read data from Excel files try:
-
-=over 4
-
-=item * Spreadsheet::ParseExcel
-
-This uses the OLE::Storage-Lite module to extract data from an Excel file. http://search.cpan.org/dist/Spreadsheet-ParseExcel
-
-=item * Spreadsheet::ParseExcel_XLHTML
-
-This module uses Spreadsheet::ParseExcel's interface but uses xlHtml (see below) to do the conversion: http://search.cpan.org/dist/Spreadsheet-ParseExcel_XLHTML
-Spreadsheet::ParseExcel_XLHTML
-
-=item * xlHtml
-
-This is an open source "Excel to HTML Converter" C/C++ project at http://www.xlhtml.org/ See also, the OLE Filters Project at http://atena.com/libole2.php
-
-=item * DBD::Excel (reading)
-
-You can also access Spreadsheet::ParseExcel using the standard DBI interface via  Takanori Kawai's DBD::Excel module http://search.cpan.org/dist/DBD-Excel
-
-=item * Win32::OLE module and office automation (reading)
-
-See, the section L<WRITING EXCEL FILES>.
-
-=item * HTML tables (reading)
-
-If the files are saved from Excel in a HTML format the data can be accessed using HTML::TableExtract http://search.cpan.org/dist/HTML-TableExtract
-
-=item * DBI with DBD::ADO or DBD::ODBC.
-
-See, the section L<WRITING EXCEL FILES>.
-
-=item * XML::Excel
-
-Converts Excel files to XML using Spreadsheet::ParseExcel http://search.cpan.org/dist/XML-Excel.
-
-=item * OLE::Storage, aka LAOLA
-
-This is a Perl interface to OLE file formats. In particular, the distro contains an Excel to HTML converter called Herbert, http://user.cs.tu-berlin.de/~schwartz/pmh/ This has been superseded by the Spreadsheet::ParseExcel module.
-
-=back
-
-
-For other Perl-Excel modules try the following search: http://search.cpan.org/search?mode=module&query=excel
-
-If you wish to view Excel files on a UNIX/Linux platform check out the excellent Gnumeric spreadsheet application at http://www.gnome.org/projects/gnumeric/ or OpenOffice.org at http://www.openoffice.org/
-
-If you wish to view Excel files on a Windows platform which doesn't have Excel installed you can use the free Microsoft Excel Viewer http://office.microsoft.com/downloads/2000/xlviewer.aspx
-
-
-
-
-=head1 Warning about XML::Parser and Perl 5.6
-
-You must be careful when using Spreadsheet::WriteExcel in conjunction with Perl 5.6 and XML::Parser (and other XML parsers) due to the fact that the data returned by the parser is generally in UTF8 format.
-
-When UTF8 strings are added to Spreadsheet::WriteExcel's internal data it causes the generated Excel file to become corrupt.
-
-Note, this doesn't affect Perl 5.005 (which doesn't try to handle UTF8) or 5.8 (which handles it correctly).
-
-To avoid this problem you should upgrade to Perl 5.8, if possible, or else you should convert the output data from XML::Parser to ASCII or ISO-8859-1 using one of the following methods:
-
-    $new_str = pack 'C*', unpack 'U*', $utf8_str;
-
-
-    use Unicode::MapUTF8 'from_utf8';
-    $new_str = from_utf8({-str => $utf8_str, -charset => 'ISO-8859-1'});
-
-
-
-
-=head1 BUGS
-
-Formulas are formulae.
-
-This version of the module doesn't support the write_comment() method. This will be fixed soon.
-
-XML and UTF8 data on Perl 5.6 can cause Excel files created by Spreadsheet::WriteExcel to become corrupt. See L<Warning about XML::Parser and Perl 5.6> for further details.
-
-The format object that is used with a C<merge_range()> method call is marked internally as being associated with a merged range.It is a fatal error to use a merged format in a non-merged cell. The current workaround is to use separate formats for merged and non-merged cell. This restriction will be removed in a future release.
-
-Nested formulas sometimes aren't parsed correctly and give a result of "#VALUE". If you come across a formula that parses like this, let me know.
-
-Spreadsheet::ParseExcel: All formulas created by Spreadsheet::WriteExcel are read as having a value of zero. This is because Spreadsheet::WriteExcel only stores the formula and not the calculated result.
-
-OpenOffice.org: Some formatting is not displayed correctly.
-
-Gnumeric: Some formatting is not displayed correctly. URLs are not displayed as links. Page setup can cause Gnumeric to crash.
-
-The lack of a portable way of writing a little-endian 64 bit IEEE float. There is beta code available to fix this. Let me know if you wish to test it on your platform.
-
-If you wish to submit a bug report run the C<bug_report.pl> program in the C<examples> directory of the distro.
-
-
-
-
-=head1 TO DO
-
-The roadmap is as follows:
-
-=over 4
-
-=item * Add write_comment().
-
-=item * Add AutoFilters.
-
-
-=back
-
-Also, here are some of the most requested features that probably won't get added:
-
-=over 4
-
-=item * Macros.
-
-This would solve some other problems neatly. However, the format of Excel macros isn't documented.
-
-=item * Some feature that you really need. ;-)
-
-
-=back
-
-If there is some feature of an Excel file that you really, really need then you should use Win32::OLE with Excel on Windows. If you are on Unix you could consider connecting to a Windows server via Docserver or SOAP, see L<WRITING EXCEL FILES>.
-
-
-
-
-=head1 MAILING LIST
-
-There is a Google group for discussing and asking questions about Spreadsheet::WriteExcel:  http://groups-beta.google.com/group/spreadsheet-writeexcel/
-
-Alternatively you can keep up to date with future releases by subscribing at:
-http://freshmeat.net/projects/writeexcel/
-
-
-
-
-=head1 DONATATIONS
-
-If you'd care to donate to the Spreadsheet::WriteExcel project, you can do so via PayPal: http://tinyurl.com/7ayes
-
-
-
-
-=head1 SEE ALSO
-
-Spreadsheet::ParseExcel: http://search.cpan.org/dist/Spreadsheet-ParseExcel
-
-Spreadsheet-WriteExcel-FromXML: http://search.cpan.org/dist/Spreadsheet-WriteExcel-FromXML
-
-Spreadsheet::WriteExcel::FromDB: http://search.cpan.org/dist/Spreadsheet-WriteExcel-FromDB
-
-Excel::Template: http://search.cpan.org/~rkinyon/Excel-Template/
-
-DateTime::Format::Excel: http://search.cpan.org/dist/DateTime-Format-Excel
-
-"Reading and writing Excel files with Perl" by Teodor Zlatanov, atIBM developerWorks: http://www-106.ibm.com/developerworks/library/l-pexcel/
-
-"Excel-Dateien mit Perl erstellen - Controller im Glück" by Peter Dintelmann and Christian Kirsch in the German Unix/web journal iX: http://www.heise.de/ix/artikel/2001/06/175/
-
-"Spreadsheet::WriteExcel" in The Perl Journal: http://www.samag.com/documents/s=1272/sam05030004/
-
-Spreadsheet::WriteExcel documentation in Japanese by Takanori Kawai. http://member.nifty.ne.jp/hippo2000/perltips/Spreadsheet/WriteExcel.htm
-
-Oesterly user brushes with fame:
-http://oesterly.com/releases/12102000.html
-
-
-=head1 ACKNOWLEDGEMENTS
-
-
-The following people contributed to the debugging and testing of Spreadsheet::WriteExcel:
-
-Alexander Farber, Andre de Bruin, Arthur at ais, Artur Silveira da Cunha, Borgar Olsen, Brian White, Bob Mackay, Cedric Bouvier, Chad Johnson, CPAN testers, Damyan Ivanov, Daniel Berger, Daniel Gardner, Dmitry Kochurov, Eric Frazier, Ernesto Baschny, Felipe Pérez Galiana, Gordon Simpson, Hanc Pavel, Harold Bamford, James Holmes, James Wilkinson, Johan Ekenberg, Johann Hanne, Jonathan Scott Duff, J.C. Wren, Kenneth Stacey, Keith Miller, Kyle Krom, Marc Rosenthal, Markus Schmitz, Michael Braig, Michael Buschauer, Mike Blazer, Michael Erickson, Michael W J West, Ning Xie, Paul J. Falbe, Paul Medynski, Peter Dintelmann, Pierre Laplante, Praveen Kotha, Reto Badertscher, Rich Sorden, Shane Ashby, Shenyu Zheng, Stephan Loescher, Steve Sapovits, Sven Passig, Svetoslav Marinov, Tamas Gulacsi, Troy Daniels, Vahe Sarkissian.
-
-The following people contributed patches, examples or Excel information:
-
-Andrew Benham, Bill Young, Cedric Bouvier, Charles Wybble, Daniel Rentz, David Robins, Franco Venturi, Guy Albertelli, Ian Penman, John Heitmann, Jon Guy, Kyle R. Burton, Pierre-Jean Vouette, Rubio, Marco Geri, Mark Fowler, Matisse Enzer, Sam Kington, Takanori Kawai, Tom O'Sullivan.
-
-Many thanks to Ron McKelvey, Ronzo Consulting for Siemens, who sponsored the development of the formula caching routines.
-
-Additional thanks to Takanori Kawai for translating the documentation into Japanese.
-
-Gunnar Wolf maintains the Debian distro.
-
-Thanks to Damian Conway for the excellent Parse::RecDescent.
-
-Thanks to Tim Jenness for File::Temp.
-
-Thanks to Michael Meeks and Jody Goldberg for their work on Gnumeric.
-
-
-
-
-=head1 AUTHOR
-
-John McNamara jmcnamara at cpan.org
-
-    Olha que coisa mais linda
-    Mais cheia de graça. É ela menina
-    Que vem e que passa
-    Num doce balanço a caminho do mar
-
-        -- Vinicius de Moraes
-
-
-=head1 COPYRIGHT
-
-© MM-MMV, John McNamara.
-
-All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.
-
+package Spreadsheet::WriteExcel;
+
+###############################################################################
+#
+# WriteExcel.
+#
+# Spreadsheet::WriteExcel - Write to a cross-platform Excel binary file.
+#
+# Copyright 2000-2006, John McNamara, jmcnamara at cpan.org
+#
+# Documentation after __END__
+#
+
+use Exporter;
+
+use strict;
+use Spreadsheet::WriteExcel::Workbook;
+
+
+
+use vars qw($VERSION @ISA);
+ at ISA = qw(Spreadsheet::WriteExcel::Workbook Exporter);
+
+$VERSION = '2.16'; # Howl at 50
+
+
+
+###############################################################################
+#
+# new()
+#
+# Constructor. Wrapper for a Workbook object.
+# uses: Spreadsheet::WriteExcel::BIFFwriter
+#       Spreadsheet::WriteExcel::Chart
+#       Spreadsheet::WriteExcel::OLEwriter
+#       Spreadsheet::WriteExcel::Workbook
+#       Spreadsheet::WriteExcel::Worksheet
+#       Spreadsheet::WriteExcel::Format
+#       Spreadsheet::WriteExcel::Formula
+#
+sub new {
+
+    my $class = shift;
+    my $self  = Spreadsheet::WriteExcel::Workbook->new(@_);
+
+    # Check for file creation failures before re-blessing
+    bless  $self, $class if defined $self;
+
+    return $self;
+}
+
+
+1;
+
+
+__END__
+
+
+
+=head1 NAME
+
+Spreadsheet::WriteExcel - Write to a cross-platform Excel binary file.
+
+=head1 VERSION
+
+This document refers to version 2.16 of Spreadsheet::WriteExcel, released January 6, 2006.
+
+
+
+
+=head1 SYNOPSIS
+
+To write a string, a formatted string, a number and a formula to the first worksheet in an Excel workbook called perl.xls:
+
+    use Spreadsheet::WriteExcel;
+
+    # Create a new Excel workbook
+    my $workbook = Spreadsheet::WriteExcel->new("perl.xls");
+
+    # Add a worksheet
+    $worksheet = $workbook->add_worksheet();
+
+    #  Add and define a format
+    $format = $workbook->add_format(); # Add a format
+    $format->set_bold();
+    $format->set_color('red');
+    $format->set_align('center');
+
+    # Write a formatted and unformatted string, row and column notation.
+    $col = $row = 0;
+    $worksheet->write($row, $col, "Hi Excel!", $format);
+    $worksheet->write(1,    $col, "Hi Excel!");
+
+    # Write a number and a formula using A1 notation
+    $worksheet->write('A3', 1.2345);
+    $worksheet->write('A4', '=SIN(PI()/4)');
+
+
+
+
+=head1 DESCRIPTION
+
+The Spreadsheet::WriteExcel module can be used to create a cross-platform Excel binary file. Multiple worksheets can be added to a workbook and formatting can be applied to cells. Text, numbers, formulas, hyperlinks and images can be written to the cells.
+
+The Excel file produced by this module is compatible with 97, 2000, 2002 and 2003.
+
+The module will work on the majority of Windows, UNIX and Macintosh platforms. Generated files are also compatible with the Linux/UNIX spreadsheet applications Gnumeric and OpenOffice.org.
+
+This module cannot be used to write to an existing Excel file.
+
+
+
+
+=head1 QUICK START
+
+Spreadsheet::WriteExcel tries to provide an interface to as many of Excel's features as possible. As a result there is a lot of documentation to accompany the interface and it can be difficult at first glance to see what it important and what is not. So for those of you who prefer to assemble Ikea furniture first and then read the instructions, here are three easy steps:
+
+1. Create a new Excel I<workbook> (i.e. file) using C<new()>.
+
+2. Add a I<worksheet> to the new workbook using C<add_worksheet()>.
+
+3. Write to the worksheet using C<write()>.
+
+Like this:
+
+    use Spreadsheet::WriteExcel;                             # Step 0
+
+    my $workbook = Spreadsheet::WriteExcel->new("perl.xls"); # Step 1
+    $worksheet   = $workbook->add_worksheet();               # Step 2
+    $worksheet->write('A1', "Hi Excel!");                    # Step 3
+
+This will create an Excel file called C<perl.xls> with a single worksheet and the text C<"Hi Excel!"> in the relevant cell. And that's it. Okay, so there is actually a zeroth step as well, but C<use module> goes without saying. There are also more than 60 examples that come with the distribution and which you can use to get you started. See L<EXAMPLES>.
+
+Those of you who read the instructions first and assemble the furniture afterwards will know how to proceed. ;-)
+
+
+
+
+=head1 WORKBOOK METHODS
+
+The Spreadsheet::WriteExcel module provides an object oriented interface to a new Excel workbook. The following methods are available through a new workbook.
+
+    new()
+    close()
+    set_tempdir()
+    add_worksheet()
+    add_chart_ext()
+    add_format()
+    set_custom_color()
+    sheets()
+    set_1904()
+    set_codepage()
+
+If you are unfamiliar with object oriented interfaces or the way that they are implemented in Perl have a look at C<perlobj> and C<perltoot> in the main Perl documentation.
+
+
+
+
+=head2 new()
+
+A new Excel workbook is created using the C<new()> constructor which accepts either a filename or a filehandle as a parameter. The following example creates a new Excel file based on a filename:
+
+    my $workbook  = Spreadsheet::WriteExcel->new('filename.xls');
+    my $worksheet = $workbook->add_worksheet();
+    $worksheet->write(0, 0, "Hi Excel!");
+
+Here are some other examples of using C<new()> with filenames:
+
+    my $workbook1 = Spreadsheet::WriteExcel->new($filename);
+    my $workbook2 = Spreadsheet::WriteExcel->new("/tmp/filename.xls");
+    my $workbook3 = Spreadsheet::WriteExcel->new("c:\\tmp\\filename.xls");
+    my $workbook4 = Spreadsheet::WriteExcel->new('c:\tmp\filename.xls');
+
+The last two examples demonstrates how to create a file on DOS or Windows where it is necessary to either escape the directory separator C<\> or to use single quotes to ensure that it isn't interpolated. For more information  see C<perlfaq5: Why can't I use "C:\temp\foo" in DOS paths?>.
+
+The C<new()> constructor returns a Spreadsheet::WriteExcel object that you can use to add worksheets and store data. It should be noted that although C<my> is not specifically required it defines the scope of the new workbook variable and, in the majority of cases, ensures that the workbook is closed properly without explicitly calling the C<close()> method.
+
+If the file cannot be created, due to file permissions or some other reason,  C<new> will return C<undef>. Therefore, it is good practice to check the return value of C<new> before proceeding. As usual the Perl variable C<$!> will be set if there is a file creation error. You will also see one of the warning messages detailed in L<DIAGNOSTICS>:
+
+    my $workbook  = Spreadsheet::WriteExcel->new('protected.xls');
+    die "Problems creating new Excel file: $!" unless defined $workbook;
+
+You can also pass a valid filehandle to the C<new()> constructor. For example in a CGI program you could do something like this:
+
+    binmode(STDOUT);
+    my $workbook  = Spreadsheet::WriteExcel->new(\*STDOUT);
+
+The requirement for C<binmode()> is explained below.
+
+For CGI programs you can also use the special Perl filename C<'-'> which will redirect the output to STDOUT:
+
+    my $workbook  = Spreadsheet::WriteExcel->new('-');
+
+See also, the C<cgi.pl> program in the C<examples> directory of the distro.
+
+However, this special case will not work in C<mod_perl> programs where you will have to do something like the following:
+
+    # mod_perl 1
+    ...
+    tie *XLS, 'Apache';
+    binmode(XLS);
+    my $workbook  = Spreadsheet::WriteExcel->new(\*XLS);
+    ...
+
+    # mod_perl 2
+    ...
+    tie *XLS => $r;  # Tie to the Apache::RequestRec object
+    binmode(*XLS);
+    my $workbook  = Spreadsheet::WriteExcel->new(\*XLS);
+    ...
+
+See also, the C<mod_perl1.pl> and C<mod_perl2.pl> programs in the C<examples> directory of the distro.
+
+Filehandles can also be useful if you want to stream an Excel file over a socket or if you want to store an Excel file in a scalar.
+
+For example here is a way to write an Excel file to a scalar with C<perl 5.8>:
+
+    #!/usr/bin/perl -w
+
+    use strict;
+    use Spreadsheet::WriteExcel;
+
+    # Requires perl 5.8 or later
+    open my $fh, '>', \my $str or die "Failed to open filehandle: $!";
+
+    my $workbook  = Spreadsheet::WriteExcel->new($fh);
+    my $worksheet = $workbook->add_worksheet();
+
+    $worksheet->write(0, 0,  "Hi Excel!");
+
+    $workbook->close();
+
+    # The Excel file in now in $str. Remember to binmode() the output
+    # filehandle before printing it.
+    binmode STDOUT;
+    print $str;
+
+See also the C<write_to_scalar.pl> and C<filehandle.pl> programs in the C<examples> directory of the distro.
+
+B<Note about the requirement for> C<binmode()>: An Excel file is comprised of binary data. Therefore, if you are using a filehandle you should ensure that you C<binmode()> it prior to passing it to C<new()>.You should do this regardless of whether you are on a Windows platform or not. This applies especially to users of perl 5.8 on systems where utf8 is likely to be in operation such as RedHat Linux 9. If your program, either intentionally or not, writes UTF8 data to a filehandle that is passed to C<new()> it will corrupt the Excel file that is created.
+
+You don't have to worry about C<binmode()> if you are using filenames instead of filehandles. Spreadsheet::WriteExcel performs the C<binmode()> internally when it converts the filename to a filehandle. For more information about C<binmode()> see C<perlfunc> and C<perlopentut> in the main Perl documentation.
+
+
+
+
+
+=head2 close()
+
+The C<close()> method can be used to explicitly close an Excel file.
+
+    $workbook->close();
+
+An explicit C<close()> is required if the file must be closed prior to performing some external action on it such as copying it, reading its size or attaching it to an email.
+
+In addition, C<close()> may be required to prevent perl's garbage collector from disposing of the Workbook, Worksheet and Format objects in the wrong order. Situations where this can occur are:
+
+=over 4
+
+=item *
+
+If C<my()> was not used to declare the scope of a workbook variable created using C<new()>.
+
+=item *
+
+If the C<new()>, C<add_worksheet()> or C<add_format()> methods are called in subroutines.
+
+=back
+
+The reason for this is that Spreadsheet::WriteExcel relies on Perl's C<DESTROY> mechanism to trigger destructor methods in a specific sequence. This may not happen in cases where the Workbook, Worksheet and Format variables are not lexically scoped or where they have different lexical scopes.
+
+In general, if you create a file with a size of 0 bytes or you fail to create a file you need to call C<close()>.
+
+The return value of C<close()> is the same as that returned by perl when it closes the file created by C<new()>. This allows you to handle error conditions in the usual way:
+
+    $workbook->close() or die "Error closing file: $!";
+
+
+
+
+=head2 set_tempdir()
+
+For speed and efficiency C<Spreadsheet::WriteExcel> stores worksheet data in temporary files prior to assembling the final workbook.
+
+If Spreadsheet::WriteExcel is unable to create these temporary files it will store the required data in memory. This can be slow for large files.
+
+The problem occurs mainly with IIS on Windows although it could feasibly occur on Unix systems as well. The problem generally occurs because the default temp file directory is defined as C<C:/> or some other directory that IIS doesn't provide write access to.
+
+To check if this might be a problem on a particular system you can run a simple test program with C<-w> or C<use warnings>. This will generate a warning if the module cannot create the required temporary files:
+
+    #!/usr/bin/perl -w
+
+    use Spreadsheet::WriteExcel;
+
+    my $workbook  = Spreadsheet::WriteExcel->new("test.xls");
+    my $worksheet = $workbook->add_worksheet();
+
+To avoid this problem the C<set_tempdir()> method can be used to specify a directory that is accessible for the creation of temporary files.
+
+The C<File::Temp> module is used to create the temporary files. File::Temp uses C<File::Spec> to determine an appropriate location for these files such as C</tmp> or C<c:\windows\temp>. You can find out which directory is used on your system as follows:
+
+    perl -MFile::Spec -le "print File::Spec->tmpdir"
+
+Even if the default temporary file directory is accessible you may wish to specify an alternative location for security or maintenance reasons:
+
+    $workbook->set_tempdir('/tmp/writeexcel');
+    $workbook->set_tempdir('c:\windows\temp\writeexcel');
+
+The directory for the temporary file must exist, C<set_tempdir()> will not create a new directory.
+
+One disadvantage of using the C<set_tempdir()> method is that on some Windows systems it will limit you to approximately 800 concurrent tempfiles. This means that a single program running on one of these systems will be limited to creating a total of 800 workbook and worksheet objects. You can run multiple, non-concurrent programs to work around this if necessary.
+
+
+
+
+=head2 add_worksheet($sheetname, $encoding)
+
+At least one worksheet should be added to a new workbook. A worksheet is used to write data into cells:
+
+    $worksheet1 = $workbook->add_worksheet();           # Sheet1
+    $worksheet2 = $workbook->add_worksheet('Foglio2');  # Foglio2
+    $worksheet3 = $workbook->add_worksheet('Data');     # Data
+    $worksheet4 = $workbook->add_worksheet();           # Sheet4
+
+If C<$sheetname> is not specified the default Excel convention will be followed, i.e. Sheet1, Sheet2, etc. The C<$encoding> parameter is optional, see below.
+
+The worksheet name must be a valid Excel worksheet name, i.e. it cannot contain any of the following characters, C<[ ] : * ? / \> and it must be less than 32 characters. In addition, you cannot use the same, case insensitive, C<$sheetname> for more than one worksheet.
+
+On systems with C<perl 5.8> and later the C<add_worksheet()> method will also handle strings in Perl's C<utf8> format.
+
+    $worksheet = $workbook->add_worksheet("\x{263a}"); # Smiley
+
+On earlier Perl systems your can specify UTF-16BE worksheet names using an additional encoding parameter:
+
+    my $name = pack "n", 0x263a;
+    $worksheet = $workbook->add_worksheet($name, 1);   # Smiley
+
+
+
+
+=head2 add_chart_ext($chart_data, $chartname)
+
+This method is use to include externally generated charts in a Spreadsheet::WriteExcel file.
+
+    my $chart = $workbook->add_chart_ext('chart01.bin', 'Chart1');
+
+This feature is new and would be best described as experimental. Read C<charts.txt> in the charts directory of the distro for a full explanation.
+
+
+
+=head2 add_format(%properties)
+
+The C<add_format()> method can be used to create new Format objects which are used to apply formatting to a cell. You can either define the properties at creation time via a hash of property values or later via method calls.
+
+    $format1 = $workbook->add_format(%props); # Set properties at creation
+    $format2 = $workbook->add_format();       # Set properties later
+
+See the L<CELL FORMATTING> section for more details about Format properties and how to set them.
+
+
+
+
+=head2 set_custom_color($index, $red, $green, $blue)
+
+The C<set_custom_color()> method can be used to override one of the built-in palette values with a more suitable colour.
+
+The value for C<$index> should be in the range 8..63, see L<COLOURS IN EXCEL>.
+
+The default named colours use the following indices:
+
+     8   =>   black
+     9   =>   white
+    10   =>   red
+    11   =>   lime
+    12   =>   blue
+    13   =>   yellow
+    14   =>   magenta
+    15   =>   cyan
+    16   =>   brown
+    17   =>   green
+    18   =>   navy
+    20   =>   purple
+    22   =>   silver
+    23   =>   gray
+    33   =>   pink
+    53   =>   orange
+
+A new colour is set using its RGB (red green blue) components. The C<$red>, C<$green> and C<$blue> values must be in the range 0..255. You can determine the required values in Excel using the C<Tools-E<gt>Options-E<gt>Colors-E<gt>Modify> dialog.
+
+The C<set_custom_color()> workbook method can also be used with a HTML style C<#rrggbb> hex value:
+
+    $workbook->set_custom_color(40, 255,  102,  0   ); # Orange
+    $workbook->set_custom_color(40, 0xFF, 0x66, 0x00); # Same thing
+    $workbook->set_custom_color(40, '#FF6600'       ); # Same thing
+
+    my $font = $workbook->add_format(color => 40); # Use the modified colour
+
+The return value from C<set_custom_color()> is the index of the colour that was changed:
+
+    my $ferrari = $workbook->set_custom_color(40, 216, 12, 12);
+
+    my $format  = $workbook->add_format(
+                                        bg_color => $ferrari,
+                                        pattern  => 1,
+                                        border   => 1
+                                      );
+
+
+
+
+=head2 sheets(0, 1, ...)
+
+The C<sheets()> method returns a list, or a sliced list, of the worksheets in a workbook.
+
+If no arguments are passed the method returns a list of all the worksheets in the workbook. This is useful if you want to repeat an operation on each worksheet:
+
+    foreach $worksheet ($workbook->sheets()) {
+       print $worksheet->get_name();
+    }
+
+
+You can also specify a slice list to return one or more worksheet objects:
+
+    $worksheet = $workbook->sheets(0);
+    $worksheet->write('A1', "Hello");
+
+
+Or since return value from C<sheets()> is a reference to a worksheet object you can write the above example as:
+
+    $workbook->sheets(0)->write('A1', "Hello");
+
+
+The following example returns the first and last worksheet in a workbook:
+
+    foreach $worksheet ($workbook->sheets(0, -1)) {
+       # Do something
+    }
+
+
+Array slices are explained in the perldata manpage.
+
+
+
+
+=head2 set_1904()
+
+Excel stores dates as real numbers where the integer part stores the number of days since the epoch and the fractional part stores the percentage of the day. The epoch can be either 1900 or 1904. Excel for Windows uses 1900 and Excel for Macintosh uses 1904. However, Excel on either platform will convert automatically between one system and the other.
+
+Spreadsheet::WriteExcel stores dates in the 1900 format by default. If you wish to change this you can call the C<set_1904()> workbook method. You can query the current value by calling the C<get_1904()> workbook method. This returns 0 for 1900 and 1 for 1904.
+
+See also L<DATES IN EXCEL> for more information about working with Excel's date system.
+
+In general you probably won't need to use C<set_1904()>.
+
+
+
+
+=head2 set_codepage($codepage)
+
+The default code page or character set used by Spreadsheet::WriteExcel is ANSI. This is also the default used by Excel for Windows. Occasionally however it may be necessary to change the code page via the C<set_codepage()> method.
+
+Changing the code page may be required if your are using Spreadsheet::WriteExcel on the Macintosh and you are using characters outside the ASCII 128 character set:
+
+    $workbook->set_codepage(1); # ANSI, MS Windows
+    $workbook->set_codepage(2); # Apple Macintosh
+
+The C<set_codepage()> method is rarely required.
+
+
+
+
+=head1 WORKSHEET METHODS
+
+A new worksheet is created by calling the C<add_worksheet()> method from a workbook object:
+
+    $worksheet1 = $workbook->add_worksheet();
+    $worksheet2 = $workbook->add_worksheet();
+
+The following methods are available through a new worksheet:
+
+    write()
+    write_number()
+    write_string()
+    write_unicode()
+    write_unicode_le()
+    keep_leading_zeros()
+    write_blank()
+    write_row()
+    write_col()
+    write_date_time()
+    write_url()
+    write_url_range()
+    write_formula()
+    store_formula()
+    repeat_formula()
+    write_comment()
+    show_comments()
+    add_write_handler()
+    insert_bitmap()
+    get_name()
+    activate()
+    select()
+    hide()
+    set_first_sheet()
+    protect()
+    set_selection()
+    set_row()
+    set_column()
+    outline_settings()
+    freeze_panes()
+    thaw_panes()
+    merge_range()
+    set_zoom()
+    right_to_left()
+    hide_zero()
+
+
+=head2 Cell notation
+
+Spreadsheet::WriteExcel supports two forms of notation to designate the position of cells: Row-column notation and A1 notation.
+
+Row-column notation uses a zero based index for both row and column while A1 notation uses the standard Excel alphanumeric sequence of column letter and 1-based row. For example:
+
+    (0, 0)      # The top left cell in row-column notation.
+    ('A1')      # The top left cell in A1 notation.
+
+    (1999, 29)  # Row-column notation.
+    ('AD2000')  # The same cell in A1 notation.
+
+Row-column notation is useful if you are referring to cells programmatically:
+
+    for my $i (0 .. 9) {
+        $worksheet->write($i, 0, 'Hello'); # Cells A1 to A10
+    }
+
+A1 notation is useful for setting up a worksheet manually and for working with formulas:
+
+    $worksheet->write('H1', 200);
+    $worksheet->write('H2', '=H1+1');
+
+In formulas and applicable methods you can also use the C<A:A> column notation:
+
+    $worksheet->write('A1', '=SUM(B:B)');
+
+The C<Spreadsheet::WriteExcel::Utility> module that is included in the distro contains helper functions for dealing with A1 notation, for example:
+
+    use Spreadsheet::WriteExcel::Utility;
+
+    ($row, $col)    = xl_cell_to_rowcol('C2');  # (1, 2)
+    $str            = xl_rowcol_to_cell(1, 2);  # C2
+
+For simplicity, the parameter lists for the worksheet method calls in the following sections are given in terms of row-column notation. In all cases it is also possible to use A1 notation.
+
+Note: in Excel it is also possible to use a R1C1 notation. This is not supported by Spreadsheet::WriteExcel.
+
+
+
+
+=head2 write($row, $column, $token, $format)
+
+Excel makes a distinction between data types such as strings, numbers, blanks, formulas and hyperlinks. To simplify the process of writing data the C<write()> method acts as a general alias for several more specific methods:
+
+    write_string()
+    write_number()
+    write_blank()
+    write_formula()
+    write_url()
+    write_row()
+    write_col()
+
+The general rule is that if the data looks like a I<something> then a I<something> is written. Here are some examples in both row-column and A1 notation:
+
+                                                      # Same as:
+    $worksheet->write(0, 0, "Hello"                ); # write_string()
+    $worksheet->write(1, 0, 'One'                  ); # write_string()
+    $worksheet->write(2, 0,  2                     ); # write_number()
+    $worksheet->write(3, 0,  3.00001               ); # write_number()
+    $worksheet->write(4, 0,  ""                    ); # write_blank()
+    $worksheet->write(5, 0,  ''                    ); # write_blank()
+    $worksheet->write(6, 0,  undef                 ); # write_blank()
+    $worksheet->write(7, 0                         ); # write_blank()
+    $worksheet->write(8, 0,  'http://www.perl.com/'); # write_url()
+    $worksheet->write('A9',  'ftp://ftp.cpan.org/' ); # write_url()
+    $worksheet->write('A10', 'internal:Sheet1!A1'  ); # write_url()
+    $worksheet->write('A11', 'external:c:\foo.xls' ); # write_url()
+    $worksheet->write('A12', '=A3 + 3*A4'          ); # write_formula()
+    $worksheet->write('A13', '=SIN(PI()/4)'        ); # write_formula()
+    $worksheet->write('A14', \@array               ); # write_row()
+    $worksheet->write('A15', [\@array]             ); # write_col()
+
+    # And if the keep_leading_zeros property is set:
+    $worksheet->write('A16,  2                     ); # write_number()
+    $worksheet->write('A17,  02                    ); # write_string()
+    $worksheet->write('A18,  00002                 ); # write_string()
+
+
+The "looks like" rule is defined by regular expressions:
+
+C<write_number()> if C<$token> is a number based on the following regex: C<$token =~ /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/>.
+
+C<write_string()> if C<keep_leading_zeros()> is set and C<$token> is an integer with leading zeros based on the following regex: C<$token =~ /^0\d+$/>.
+
+C<write_blank()> if C<$token> is undef or a blank string: C<undef>, C<""> or C<''>.
+
+C<write_url()> if C<$token> is a http, https, ftp or mailto URL based on the following regexes: C<$token =~ m|^[fh]tt?ps?://|> or  C<$token =~ m|^mailto:|>.
+
+C<write_url()> if C<$token> is an internal or external sheet reference based on the following regex: C<$token =~ m[^(in|ex)ternal:]>.
+
+C<write_formula()> if the first character of C<$token> is C<"=">.
+
+C<write_row()> if C<$token> is an array ref.
+
+C<write_col()> if C<$token> is an array ref of array refs.
+
+C<write_string()> if none of the previous conditions apply.
+
+The C<$format> parameter is optional. It should be a valid Format object, see L<CELL FORMATTING>:
+
+    my $format = $workbook->add_format();
+    $format->set_bold();
+    $format->set_color('red');
+    $format->set_align('center');
+
+    $worksheet->write(4, 0, "Hello", $format ); # Formatted string
+
+The write() method will ignore empty strings or C<undef> tokens unless a format is also supplied. As such you needn't worry about special handling for empty or C<undef> values in your data. See also the C<write_blank()> method.
+
+One problem with the C<write()> method is that occasionally data looks like a number but you don't want it treated as a number. For example, zip codes or ID numbers often start with a leading zero. If you write this data as a number then the leading zero(s) will be stripped. You can change this default behaviour by using the C<keep_leading_zeros()> method. While this property is in place any integers with leading zeros will be treated as strings and the zeros will be preserved. See the C<keep_leading_zeros()> section for a full discussion of this issue.
+
+You can also add your own data handlers to the C<write()> method using C<add_write_handler()>.
+
+On systems with C<perl 5.8> and later the C<write()> method will also handle Unicode strings in Perl's C<utf8> format.
+
+The C<write> methods return:
+
+    0 for success.
+   -1 for insufficient number of arguments.
+   -2 for row or column out of bounds.
+   -3 for string too long.
+
+
+
+
+=head2 write_number($row, $column, $number, $format)
+
+Write an integer or a float to the cell specified by C<$row> and C<$column>:
+
+    $worksheet->write_number(0, 0,  123456);
+    $worksheet->write_number('A2',  2.3451);
+
+See the note about L<Cell notation>. The C<$format> parameter is optional.
+
+In general it is sufficient to use the C<write()> method.
+
+
+
+
+=head2 write_string($row, $column, $string, $format)
+
+Write a string to the cell specified by C<$row> and C<$column>:
+
+    $worksheet->write_string(0, 0, "Your text here" );
+    $worksheet->write_string('A2', "or here" );
+
+The maximum string size is 32767 characters. However the maximum string segment that Excel can display in a cell is 1000. All 32767 characters can be displayed in the formula bar.
+
+The C<$format> parameter is optional.
+
+On systems with C<perl 5.8> and later the C<write()> method will also handle strings in Perl's C<utf8> format. With older perls you can also write Unicode in C<UTF16> format via the C<write_unicode()> method. See also the C<unicode_*.pl> programs in the examples directory of the distro.
+
+In general it is sufficient to use the C<write()> method. However, you may sometimes wish to use the C<write_string()> method to write data that looks like a number but that you don't want treated as a number. For example, zip codes or phone numbers:
+
+    # Write as a plain string
+    $worksheet->write_string('A1', '01209');
+
+However, if the user edits this string Excel may convert it back to a number. To get around this you can use the Excel text format C<@>:
+
+    # Format as a string. Doesn't change to a number when edited
+    my $format1 = $workbook->add_format(num_format => '@');
+    $worksheet->write_string('A2', '01209', $format1);
+
+See also the note about L<Cell notation>.
+
+
+
+
+=head2 write_unicode($row, $column, $string, $format)
+
+This method is used to write Unicode strings to a cell in Excel. It is functionally the same as the C<write_string()> method except that the string should be in UTF-16 Unicode format.
+
+B<Note>: on systems with C<perl 5.8> and later the C<write()> and C<write_string()>methods will also handle strings in Perl's C<utf8> format. With older perls you must use the C<write_unicode()> method.
+
+The Unicode format required by Excel is UTF-16. Additionally C<Spreadsheet::WriteExcel> requires that the 16-bit characters are in big-endian order. This is generally referred to as UTF-16BE. To write UTF-16 strings in little-endian format use the C<write_unicode_le()> method.
+
+
+The following is a simple example showing how to write some Unicode strings:
+
+    #!/usr/bin/perl -w
+
+
+    use strict;
+    use Spreadsheet::WriteExcel;
+    use Unicode::Map();
+
+    my $workbook  = Spreadsheet::WriteExcel->new('unicode.xls');
+    my $worksheet = $workbook->add_worksheet();
+
+    # Increase the column width for clarity
+    $worksheet->set_column('A:A', 25);
+
+
+    # Write a Unicode character
+    #
+    my $smiley = pack "n", 0x263a;
+
+    # Increase the font size for legibility.
+    my $big_font = $workbook->add_format(size => 72);
+
+    $worksheet->write_unicode('A3', $smiley, $big_font);
+
+
+
+    # Write a phrase in Cyrillic using a hex-encoded string
+    #
+    my $uni_str = pack "H*", "042d0442043e0020044404400430043704300020043d" .
+                             "043000200440044304410441043a043e043c0021";
+
+    $worksheet->write_unicode('A5', $uni_str);
+
+
+
+    # Map a string to UTF-16BE using an external module.
+    #
+    my $map   = Unicode::Map->new("ISO-8859-1");
+    my $utf16 = $map->to_unicode("Hello world!");
+
+    $worksheet->write_unicode('A7', $utf16);
+
+
+The following is an example of creating an Excel file with some Japanese text. You will need to have a Unicode font installed, such as C<Arial Unicode MS>, to view the results:
+
+
+    #!/usr/bin/perl -w
+
+
+    use strict;
+    use Spreadsheet::WriteExcel;
+
+
+    my $workbook  = Spreadsheet::WriteExcel->new('unicode.xls');
+    my $worksheet = $workbook->add_worksheet();
+
+
+    # It is only required to specify a Unicode font via add_format() if
+    # you are using Excel 97. For Excel 2000+ the text will display
+    # with the default font (if you have Unicode fonts installed).
+    #
+    my $uni_font  = $workbook->add_format(font => 'Arial Unicode MS');
+
+
+    my $kanji     = pack 'n*', 0x65e5, 0x672c;
+    my $katakana  = pack 'n*', 0xff86, 0xff8e, 0xff9d;
+    my $hiragana  = pack 'n*', 0x306b, 0x307b, 0x3093;
+
+
+    $worksheet->write_unicode('A1', $kanji,    $uni_font);
+    $worksheet->write_unicode('A2', $katakana, $uni_font);
+    $worksheet->write_unicode('A3', $hiragana, $uni_font);
+
+
+    $worksheet->write('B1', 'Kanji');
+    $worksheet->write('B2', 'Katakana');
+    $worksheet->write('B3', 'Hiragana');
+
+
+Note: You can convert ascii encodings to the required UTF-16BE format using one of the many Unicode modules on CPAN. For example C<Unicode::Map> and C<Unicode::String>: http://search.cpan.org/author/MSCHWARTZ/Unicode-Map/Map.pm and http://search.cpan.org/author/GAAS/Unicode-String/String.pm
+
+For a full list of the Perl Unicode modules see: http://search.cpan.org/search?query=unicode&mode=all
+
+See also the C<unicode_*.pl> programs in the examples directory of the distro.
+
+
+
+=head2 write_unicode_le($row, $column, $string, $format)
+
+This method is the same as C<write_unicode()> except that the string should be 16-bit characters in little-endian format. This is generally referred to as UTF-16LE.
+
+UTF-16 data can be changed from little-endian to big-endian format (and vice-versa) as follows:
+
+    $utf16 = pack "n*", unpack "v*", $utf16;
+
+Note, it is slightly faster to write little-endian data via write_unicode_le() than it is to write big-endian data via write_unicode().
+
+
+
+
+=head2 keep_leading_zeros()
+
+This method changes the default handling of integers with leading zeros when using the C<write()> method.
+
+The C<write()> method uses regular expressions to determine what type of data to write to an Excel worksheet. If the data looks like a number it writes a number using C<write_number()>. One problem with this approach is that occasionally data looks like a number but you don't want it treated as a number.
+
+Zip codes and ID numbers, for example, often start with a leading zero. If you write this data as a number then the leading zero(s) will be stripped. This is the also the default behaviour when you enter data manually in Excel.
+
+To get around this you can use one of three options. Write a formatted number, write the number as a string or use the C<keep_leading_zeros()> method to change the default behaviour of C<write()>:
+
+    # Implicitly write a number, the leading zero is removed: 1209
+    $worksheet->write('A1', '01209');
+
+    # Write a zero padded number using a format: 01209
+    my $format1 = $workbook->add_format(num_format => '00000');
+    $worksheet->write('A2', '01209', $format1);
+
+    # Write explicitly as a string: 01209
+    $worksheet->write_string('A3', '01209');
+
+    # Write implicitly as a string: 01209
+    $worksheet->keep_leading_zeros();
+    $worksheet->write('A4', '01209');
+
+
+The above code would generate a worksheet that looked like the following:
+
+     -----------------------------------------------------------
+    |   |     A     |     B     |     C     |     D     | ...
+     -----------------------------------------------------------
+    | 1 |      1209 |           |           |           | ...
+    | 2 |     01209 |           |           |           | ...
+    | 3 | 01209     |           |           |           | ...
+    | 4 | 01209     |           |           |           | ...
+
+
+The examples are on different sides of the cells due to the fact that Excel displays strings with a left justification and numbers with a right justification by default. You can change this by using a format to justify the data, see L<CELL FORMATTING>.
+
+It should be noted that if the user edits the data in examples C<A3> and C<A4> the strings will revert back to numbers. Again this is Excel's default behaviour. To avoid this you can use the text format C<@>:
+
+    # Format as a string (01209)
+    my $format2 = $workbook->add_format(num_format => '@');
+    $worksheet->write_string('A5', '01209', $format2);
+
+The C<keep_leading_zeros()> property is off by default. The C<keep_leading_zeros()> method takes 0 or 1 as an argument. It defaults to 1 if an argument isn't specified:
+
+    $worksheet->keep_leading_zeros();  # Set on
+    $worksheet->keep_leading_zeros(1); # Set on
+    $worksheet->keep_leading_zeros(0); # Set off
+
+See also the C<add_write_handler()> method.
+
+
+=head2 write_blank($row, $column, $format)
+
+Write a blank cell specified by C<$row> and C<$column>:
+
+    $worksheet->write_blank(0, 0, $format);
+
+This method is used to add formatting to a cell which doesn't contain a string or number value.
+
+Excel differentiates between an "Empty" cell and a "Blank" cell. An "Empty" cell is a cell which doesn't contain data whilst a "Blank" cell is a cell which doesn't contain data but does contain formatting. Excel stores "Blank" cells but ignores "Empty" cells.
+
+As such, if you write an empty cell without formatting it is ignored:
+
+    $worksheet->write('A1',  undef, $format); # write_blank()
+    $worksheet->write('A2',  undef         ); # Ignored
+
+This seemingly uninteresting fact means that you can write arrays of data without special treatment for undef or empty string values.
+
+See the note about L<Cell notation>.
+
+
+
+
+=head2 write_row($row, $column, $array_ref, $format)
+
+The C<write_row()> method can be used to write a 1D or 2D array of data in one go. This is useful for converting the results of a database query into an Excel worksheet. You must pass a reference to the array of data rather than the array itself. The C<write()> method is then called for each element of the data. For example:
+
+    @array      = ('awk', 'gawk', 'mawk');
+    $array_ref  = \@array;
+
+    $worksheet->write_row(0, 0, $array_ref);
+
+    # The above example is equivalent to:
+    $worksheet->write(0, 0, $array[0]);
+    $worksheet->write(0, 1, $array[1]);
+    $worksheet->write(0, 2, $array[2]);
+
+
+Note: For convenience the C<write()> method behaves in the same way as C<write_row()> if it is passed an array reference. Therefore the following two method calls are equivalent:
+
+    $worksheet->write_row('A1', $array_ref); # Write a row of data
+    $worksheet->write(    'A1', $array_ref); # Same thing
+
+As with all of the write methods the C<$format> parameter is optional. If a format is specified it is applied to all the elements of the data array.
+
+Array references within the data will be treated as columns. This allows you to write 2D arrays of data in one go. For example:
+
+    @eec =  (
+                ['maggie', 'milly', 'molly', 'may'  ],
+                [13,       14,      15,      16     ],
+                ['shell',  'star',  'crab',  'stone']
+            );
+
+    $worksheet->write_row('A1', \@eec);
+
+
+Would produce a worksheet as follows:
+
+     -----------------------------------------------------------
+    |   |    A    |    B    |    C    |    D    |    E    | ...
+     -----------------------------------------------------------
+    | 1 | maggie  | 13      | shell   | ...     |  ...    | ...
+    | 2 | milly   | 14      | star    | ...     |  ...    | ...
+    | 3 | molly   | 15      | crab    | ...     |  ...    | ...
+    | 4 | may     | 16      | stone   | ...     |  ...    | ...
+    | 5 | ...     | ...     | ...     | ...     |  ...    | ...
+    | 6 | ...     | ...     | ...     | ...     |  ...    | ...
+
+
+To write the data in a row-column order refer to the C<write_col()> method below.
+
+Any C<undef> values in the data will be ignored unless a format is applied to the data, in which case a formatted blank cell will be written. In either case the appropriate row or column value will still be incremented.
+
+To find out more about array references refer to C<perlref> and C<perlreftut> in the main Perl documentation. To find out more about 2D arrays or "lists of lists" refer to C<perllol>.
+
+The C<write_row()> method returns the first error encountered when writing the elements of the data or zero if no errors were encountered. See the return values described for the C<write()> method above.
+
+See also the C<write_arrays.pl> program in the C<examples> directory of the distro.
+
+The C<write_row()> method allows the following idiomatic conversion of a text file to an Excel file:
+
+    #!/usr/bin/perl -w
+
+    use strict;
+    use Spreadsheet::WriteExcel;
+
+    my $workbook  = Spreadsheet::WriteExcel->new('file.xls');
+    my $worksheet = $workbook->add_worksheet();
+
+    open INPUT, "file.txt" or die "Couldn't open file: $!";
+
+    $worksheet->write($.-1, 0, [split]) while <INPUT>;
+
+
+
+
+=head2 write_col($row, $column, $array_ref, $format)
+
+The C<write_col()> method can be used to write a 1D or 2D array of data in one go. This is useful for converting the results of a database query into an Excel worksheet. You must pass a reference to the array of data rather than the array itself. The C<write()> method is then called for each element of the data. For example:
+
+    @array      = ('awk', 'gawk', 'mawk');
+    $array_ref  = \@array;
+
+    $worksheet->write_col(0, 0, $array_ref);
+
+    # The above example is equivalent to:
+    $worksheet->write(0, 0, $array[0]);
+    $worksheet->write(1, 0, $array[1]);
+    $worksheet->write(2, 0, $array[2]);
+
+As with all of the write methods the C<$format> parameter is optional. If a format is specified it is applied to all the elements of the data array.
+
+Array references within the data will be treated as rows. This allows you to write 2D arrays of data in one go. For example:
+
+    @eec =  (
+                ['maggie', 'milly', 'molly', 'may'  ],
+                [13,       14,      15,      16     ],
+                ['shell',  'star',  'crab',  'stone']
+            );
+
+    $worksheet->write_col('A1', \@eec);
+
+
+Would produce a worksheet as follows:
+
+     -----------------------------------------------------------
+    |   |    A    |    B    |    C    |    D    |    E    | ...
+     -----------------------------------------------------------
+    | 1 | maggie  | milly   | molly   | may     |  ...    | ...
+    | 2 | 13      | 14      | 15      | 16      |  ...    | ...
+    | 3 | shell   | star    | crab    | stone   |  ...    | ...
+    | 4 | ...     | ...     | ...     | ...     |  ...    | ...
+    | 5 | ...     | ...     | ...     | ...     |  ...    | ...
+    | 6 | ...     | ...     | ...     | ...     |  ...    | ...
+
+
+To write the data in a column-row order refer to the C<write_row()> method above.
+
+Any C<undef> values in the data will be ignored unless a format is applied to the data, in which case a formatted blank cell will be written. In either case the appropriate row or column value will still be incremented.
+
+As noted above the C<write()> method can be used as a synonym for C<write_row()> and C<write_row()> handles nested array refs as columns. Therefore, the following two method calls are equivalent although the more explicit call to C<write_col()> would be preferable for maintainability:
+
+    $worksheet->write_col('A1', $array_ref    ); # Write a column of data
+    $worksheet->write(    'A1', [ $array_ref ]); # Same thing
+
+To find out more about array references refer to C<perlref> and C<perlreftut> in the main Perl documentation. To find out more about 2D arrays or "lists of lists" refer to C<perllol>.
+
+The C<write_col()> method returns the first error encountered when writing the elements of the data or zero if no errors were encountered. See the return values described for the C<write()> method above.
+
+See also the C<write_arrays.pl> program in the C<examples> directory of the distro.
+
+
+
+
+=head2 write_date_time($row, $col, $date_string, $format)
+
+The C<write_date_time()> method can be used to write a date or time to the cell specified by C<$row> and C<$column>:
+
+    $worksheet->write_date_time('A1', '2004-05-13T23:20', $date_format);
+
+The C<$date_string> should be in the following format:
+
+    yyyy-mm-ddThh:mm:ss.sss
+
+This conforms to am ISO8601 date but it should be noted that the full range of ISO8601 formats are not supported.
+
+The following variations on the C<$date_string> parameter are permitted:
+
+    yyyy-mm-ddThh:mm:ss.sss         # Standard format
+    yyyy-mm-ddT                     # No time
+              Thh:mm:ss.sss         # No date
+    yyyy-mm-ddThh:mm:ss.sssZ        # Additional Z (but not time zones)
+    yyyy-mm-ddThh:mm:ss             # No fractional seconds
+    yyyy-mm-ddThh:mm                # No seconds
+
+Note that the C<T> is required in all cases.
+
+A date should always have a C<$format>, otherwise it will appear as a number, see L<DATES IN EXCEL> and L<CELL FORMATTING>. Here is a typical example:
+
+    my $date_format = $workbook->add_format(num_format => 'mm/dd/yy');
+    $worksheet->write_date_time('A1', '2004-05-13T23:20', $date_format);
+
+Valid dates should be in the range 1900-01-01 to 9999-12-31, for the 1900 epoch and 1904-01-01 to 9999-12-31, for the 1904 epoch. As with Excel, dates outside these ranges will be written as a string.
+
+See also the date_time.pl program in the C<examples> directory of the distro.
+
+
+
+
+=head2 write_url($row, $col, $url, $label, $format)
+
+Write a hyperlink to a URL in the cell specified by C<$row> and C<$column>. The hyperlink is comprised of two elements: the visible label and the invisible link. The visible label is the same as the link unless an alternative label is specified. The parameters C<$label> and the C<$format> are optional and their position is interchangeable.
+
+The label is written using the C<write()> method. Therefore it is possible to write strings, numbers or formulas as labels.
+
+There are four web style URI's supported: C<http://>, C<https://>, C<ftp://> and  C<mailto:>:
+
+    $worksheet->write_url(0, 0,  'ftp://www.perl.org/'                  );
+    $worksheet->write_url(1, 0,  'http://www.perl.com/', 'Perl home'    );
+    $worksheet->write_url('A3',  'http://www.perl.com/', $format        );
+    $worksheet->write_url('A4',  'http://www.perl.com/', 'Perl', $format);
+    $worksheet->write_url('A5',  'mailto:jmcnamara at cpan.org'            );
+
+There are two local URIs supported: C<internal:> and C<external:>. These are used for hyperlinks to internal worksheet references or external workbook and worksheet references:
+
+    $worksheet->write_url('A6',  'internal:Sheet2!A1'                   );
+    $worksheet->write_url('A7',  'internal:Sheet2!A1',   $format        );
+    $worksheet->write_url('A8',  'internal:Sheet2!A1:B2'                );
+    $worksheet->write_url('A9',  q{internal:'Sales Data'!A1}            );
+    $worksheet->write_url('A10', 'external:c:\temp\foo.xls'             );
+    $worksheet->write_url('A11', 'external:c:\temp\foo.xls#Sheet2!A1'   );
+    $worksheet->write_url('A12', 'external:..\..\..\foo.xls'            );
+    $worksheet->write_url('A13', 'external:..\..\..\foo.xls#Sheet2!A1'  );
+    $worksheet->write_url('A13', 'external:\\\\NETWORK\share\foo.xls'   );
+
+All of the these URI types are recognised by the C<write()> method, see above.
+
+Worksheet references are typically of the form C<Sheet1!A1>. You can also refer to a worksheet range using the standard Excel notation: C<Sheet1!A1:B2>.
+
+In external links the workbook and worksheet name must be separated by the C<#> character: C<external:Workbook.xls#Sheet1!A1'>.
+
+You can also link to a named range in the target worksheet. For example say you have a named range called C<my_name> in the workbook C<c:\temp\foo.xls> you could link to it as follows:
+
+    $worksheet->write_url('A14', 'external:c:\temp\foo.xls#my_name');
+
+Note, you cannot currently create named ranges with C<Spreadsheet::WriteExcel>.
+
+Excel requires that worksheet names containing spaces or non alphanumeric characters are single quoted as follows C<'Sales Data'!A1>. If you need to do this in a single quoted string then you can either escape the single quotes C<\'> or use the quote operator C<q{}> as described in C<perlop> in the main Perl documentation.
+
+Links to network files are also supported. MS/Novell Network files normally begin with two back slashes as follows C<\\NETWORK\etc>. In order to generate this in a single or double quoted string you will have to escape the backslashes,  C<'\\\\NETWORK\etc'>.
+
+If you are using double quote strings then you should be careful to escape anything that looks like a metacharacter. For more information  see C<perlfaq5: Why can't I use "C:\temp\foo" in DOS paths?>.
+
+Finally, you can avoid most of these quoting problems by using forward slashes. These are translated internally to backslashes:
+
+    $worksheet->write_url('A14', "external:c:/temp/foo.xls"             );
+    $worksheet->write_url('A15', 'external://NETWORK/share/foo.xls'     );
+
+See also, the note about L<Cell notation>.
+
+
+
+
+=head2 write_url_range($row1, $col1, $row2, $col2, $url, $string, $format)
+
+This method is essentially the same as the C<write_url()> method described above. The main difference is that you can specify a link for a range of cells:
+
+    $worksheet->write_url(0, 0, 0, 3, 'ftp://www.perl.org/'              );
+    $worksheet->write_url(1, 0, 0, 3, 'http://www.perl.com/', 'Perl home');
+    $worksheet->write_url('A3:D3',    'internal:Sheet2!A1'               );
+    $worksheet->write_url('A4:D4',    'external:c:\temp\foo.xls'         );
+
+
+This method is generally only required when used in conjunction with merged cells. See the C<merge_range()> method and the C<merge> property of a Format object, L<CELL FORMATTING>.
+
+There is no way to force this behaviour through the C<write()> method.
+
+The parameters C<$string> and the C<$format> are optional and their position is interchangeable. However, they are applied only to the first cell in the range.
+
+See also, the note about L<Cell notation>.
+
+
+
+
+=head2 write_formula($row, $column, $formula, $format, $value)
+
+Write a formula or function to the cell specified by C<$row> and C<$column>:
+
+    $worksheet->write_formula(0, 0, '=$B$3 + B4'  );
+    $worksheet->write_formula(1, 0, '=SIN(PI()/4)');
+    $worksheet->write_formula(2, 0, '=SUM(B1:B5)' );
+    $worksheet->write_formula('A4', '=IF(A3>1,"Yes", "No")'   );
+    $worksheet->write_formula('A5', '=AVERAGE(1, 2, 3, 4)'    );
+    $worksheet->write_formula('A6', '=DATEVALUE("1-Jan-2001")');
+
+See the note about L<Cell notation>. For more information about writing Excel formulas see L<FORMULAS AND FUNCTIONS IN EXCEL>
+
+See also the section "Improving performance when working with formulas" and the C<store_formula()> and C<repeat_formula()> methods.
+
+If required, it is also possible to specify the calculated value of the formula. This is occasionally necessary when working with non-Excel applications that don't calculated the value of the formula. The calculated C<$value> is added at the end of the argument list:
+
+    $worksheet->write('A1', '=2+2', $format, 4);
+
+However, this probably isn't something that will ever need to do. If you do use this feature then do so with care.
+
+
+
+
+=head2 store_formula($formula)
+
+The C<store_formula()> method is used in conjunction with C<repeat_formula()> to speed up the generation of repeated formulas. See "Improving performance when working with formulas" in L<FORMULAS AND FUNCTIONS IN EXCEL>.
+
+The C<store_formula()> method pre-parses a textual representation of a formula and stores it for use at a later stage by the C<repeat_formula()> method.
+
+C<store_formula()> carries the same speed penalty as C<write_formula()>. However, in practice it will be used less frequently.
+
+The return value of this method is a scalar that can be thought of as a reference to a formula.
+
+    my $sin = $worksheet->store_formula('=SIN(A1)');
+    my $cos = $worksheet->store_formula('=COS(A1)');
+
+    $worksheet->repeat_formula('B1', $sin, $format, 'A1', 'A2');
+    $worksheet->repeat_formula('C1', $cos, $format, 'A1', 'A2');
+
+Although C<store_formula()> is a worksheet method the return value can be used in any worksheet:
+
+    my $now = $worksheet->store_formula('=NOW()');
+
+    $worksheet1->repeat_formula('B1', $now);
+    $worksheet2->repeat_formula('B1', $now);
+    $worksheet3->repeat_formula('B1', $now);
+
+
+
+=head2 repeat_formula($row, $col, $formula, $format, ($pattern => $replace, ...))
+
+
+The C<repeat_formula()> method is used in conjunction with C<store_formula()> to speed up the generation of repeated formulas.  See "Improving performance when working with formulas" in L<FORMULAS AND FUNCTIONS IN EXCEL>.
+
+In many respects C<repeat_formula()> behaves like C<write_formula()> except that it is significantly faster.
+
+The C<repeat_formula()> method creates a new formula based on the pre-parsed tokens returned by C<store_formula()>. The new formula is generated by substituting C<$pattern>, C<$replace> pairs in the stored formula:
+
+    my $formula = $worksheet->store_formula('=A1 * 3 + 50');
+
+    for my $row (0..99) {
+        $worksheet->repeat_formula($row, 1, $formula, $format, 'A1', 'A'.($row +1));
+    }
+
+It should be noted that C<repeat_formula()> doesn't modify the tokens. In the above example the substitution is always made against the original token, C<A1>, which doesn't change.
+
+As usual, you can use C<undef> if you don't wish to specify a C<$format>:
+
+    $worksheet->repeat_formula('B2', $formula, $format, 'A1', 'A2');
+    $worksheet->repeat_formula('B3', $formula, undef,   'A1', 'A3');
+
+The substitutions are made from left to right and you can use as many C<$pattern>, C<$replace> pairs as you need. However, each substitution is made only once:
+
+    my $formula = $worksheet->store_formula('=A1 + A1');
+
+    # Gives '=B1 + A1'
+    $worksheet->repeat_formula('B1', $formula, undef, 'A1', 'B1');
+
+    # Gives '=B1 + B1'
+    $worksheet->repeat_formula('B2', $formula, undef, ('A1', 'B1') x 2);
+
+Since the C<$pattern> is interpolated each time that it is used it is worth using the C<qr> operator to quote the pattern. The C<qr> operator is explained in the C<perlop> man page.
+
+    $worksheet->repeat_formula('B1', $formula, $format, qr/A1/, 'A2');
+
+Care should be taken with the values that are substituted. The formula returned by C<repeat_formula()> contains several other tokens in addition to those in the formula and these might also match the  pattern that you are trying to replace. In particular you should avoid substituting a single 0, 1, 2 or 3.
+
+You should also be careful to avoid false matches. For example the following snippet is meant to change the stored formula in steps from C<=A1 + SIN(A1)> to C<=A10 + SIN(A10)>.
+
+    my $formula = $worksheet->store_formula('=A1 + SIN(A1)');
+
+    for my $row (1 .. 10) {
+        $worksheet->repeat_formula($row -1, 1, $formula, undef,
+                                    qw/A1/, 'A' . $row,   #! Bad.
+                                    qw/A1/, 'A' . $row    #! Bad.
+                                  );
+    }
+
+However it contains a bug. In the last iteration of the loop when C<$row> is 10 the following substitutions will occur:
+
+    s/A1/A10/;    changes    =A1 + SIN(A1)     to    =A10 + SIN(A1)
+    s/A1/A10/;    changes    =A10 + SIN(A1)    to    =A100 + SIN(A1) # !!
+
+The solution in this case is to use a more explicit match such as C<qw/^A1$/>:
+
+        $worksheet->repeat_formula($row -1, 1, $formula, undef,
+                                    qw/^A1$/, 'A' . $row,
+                                    qw/^A1$/, 'A' . $row
+                                  );
+
+Another similar problem occurs due to the fact that substitutions are made in order. For example the following snippet is meant to change the stored formula from C<=A10 + A11>  to C<=A11 + A12>:
+
+    my $formula = $worksheet->store_formula('=A10 + A11');
+
+    $worksheet->repeat_formula('A1', $formula, undef,
+                                qw/A10/, 'A11',   #! Bad.
+                                qw/A11/, 'A12'    #! Bad.
+                              );
+
+However, the actual substitution yields C<=A12 + A11>:
+
+    s/A10/A11/;    changes    =A10 + A11    to    =A11 + A11
+    s/A11/A12/;    changes    =A11 + A11    to    =A12 + A11 # !!
+
+The solution here would be to reverse the order of the substitutions or to start with a stored formula that won't yield a false match such as C<=X10 + Y11>:
+
+    my $formula = $worksheet->store_formula('=X10 + Y11');
+
+    $worksheet->repeat_formula('A1', $formula, undef,
+                                qw/X10/, 'A11',
+                                qw/Y11/, 'A12'
+                              );
+
+
+If you think that you have a problem related to a false match you can check the tokens that you are substituting against as follows.
+
+    my $formula = $worksheet->store_formula('=A1*5+4');
+    print "@$formula\n";
+
+See also the C<repeat.pl> program in the C<examples> directory of the distro.
+
+
+
+
+=head2 write_comment($row, $column, $string, ...)
+
+B<NOTE:> This method is currently incompatible with C<insert_bitmap()>. You can use either method but not both in the same workbook. This will be fixed soon.
+
+The C<write_comment()> method is used to add a comment to a cell. A cell comment is indicated in Excel by a small red triangle in the upper right-hand corner of the cell. Moving the cursor over the red triangle will reveal the comment.
+
+The following example shows how to add a comment to a cell:
+
+    $worksheet->write        (2, 2, 'Hello');
+    $worksheet->write_comment(2, 2, 'This is a comment.');
+
+As usual you can replace the C<$row> and C<$column> parameters with an C<A1> cell reference. See the note about L<Cell notation>.
+
+    $worksheet->write        ('C3', 'Hello');
+    $worksheet->write_comment('C3', 'This is a comment.');
+
+On systems with C<perl 5.8> and later the C<write_comment()> method will also handle strings in Perl's C<utf8> format.
+
+    $worksheet->write_comment('C3', "\x{263a}");       # Smiley
+    $worksheet->write_comment('C4', 'Comment ça va?');
+
+In addition to the basic 3 argument form of C<write_comment()> you can pass in several optional key/value pairs to control the format of the comment. For example:
+
+    $worksheet->write_comment('C3', 'Hello', visible => 1, author => 'Perl');
+
+Most of these options are quite specific and in general the default comment behaviour will be all that you need. However, should you need greater control over the format of the cell comment the following options are available:
+
+    encoding
+    author
+    author_encoding
+    visible
+    x_scale
+    width
+    y_scale
+    height
+    color
+    start_cell
+    start_row
+    start_col
+    x_offset
+    y_offset
+
+
+=over 4
+
+=item Option: encoding
+
+This option is used to indicate that the comment string is encoded as UTF-16BE.
+
+    my $comment = pack "n", 0x263a; # UTF-16BE Smiley symbol
+
+    $worksheet->write_comment('C3', $comment, encoding => 1);
+
+If you wish to use Unicode characters in the comment string then the preferred method is to use perl 5.8 and UTF-8 strings.
+
+
+=item Option: author
+
+This option is used to indicate who the author of the comment is. Excel displays the author of the comment in the status bar at the bottom of the worksheet. This is usually of interest in corporate environments where several people might review and provide comments to a workbook.
+
+    $worksheet->write_comment('C3', 'Atonement', author => 'Ian McEwan');
+
+
+=item Option: author_encoding
+
+This option is used to indicate that the author string is encoded as UTF-16BE.
+
+
+=item Option: visible
+
+This option is used to make a cell comment visible when the worksheet is opened. The default behaviour in Excel is that comments are initially hidden. However, it is also possible in Excel to make individual or all comments visible. In Spreadsheet::WriteExcel individual comments can be made visible as follows:
+
+    $worksheet->write_comment('C3', 'Hello', visible => 1);
+
+It is possible to make all comments in a worksheet visible using the C<show_comments()> worksheet method (see below). Alternatively, if all of the cell comments have been made visible you can hide individual comments:
+
+    $worksheet->write_comment('C3', 'Hello', visible => 0);
+
+
+=item Option: x_scale
+
+This option is used to set the width of the cell comment box as a factor of the default width.
+
+    $worksheet->write_comment('C3', 'Hello', x_scale => 2);
+    $worksheet->write_comment('C4', 'Hello', x_scale => 4.2);
+
+
+=item Option: width
+
+This option is used to set the width of the cell comment box explicitly in pixels.
+
+    $worksheet->write_comment('C3', 'Hello', width => 200);
+
+
+=item Option: y_scale
+
+This option is used to set the height of the cell comment box as a factor of the default height.
+
+    $worksheet->write_comment('C3', 'Hello', y_scale => 2);
+    $worksheet->write_comment('C4', 'Hello', y_scale => 4.2);
+
+
+=item Option: height
+
+This option is used to set the height of the cell comment box explicitly in pixels.
+
+    $worksheet->write_comment('C3', 'Hello', height => 200);
+
+
+=item Option: color
+
+This option is used to set the background colour of cell comment box. You can use one of the named colours recognised by Spreadsheet::WriteExcel or a colour index. See L<COLOURS IN EXCEL>.
+
+    $worksheet->write_comment('C3', 'Hello', color => 'green');
+    $worksheet->write_comment('C4', 'Hello', color => 0x35);    # Orange
+
+
+=item Option: start_cell
+
+This option is used to set the cell in which the comment will appear. By default Excel displays comments one cell to the right and one cell above the cell to which the comment relates. However, you can change this behaviour if you wish. In the following example the comment which would appear by default in cell C<D2> is moved to C<E2>.
+
+    $worksheet->write_comment('C3', 'Hello', start_cell => 'E2');
+
+
+=item Option: start_row
+
+This option is used to set the row in which the comment will appear. See the C<start_cell> option above. The row is zero indexed.
+
+    $worksheet->write_comment('C3', 'Hello', start_row => 0);
+
+
+=item Option: start_col
+
+This option is used to set the column in which the comment will appear. See the C<start_cell> option above. The column is zero indexed.
+
+    $worksheet->write_comment('C3', 'Hello', start_col => 4);
+
+
+=item Option: x_offset
+
+This option is used to change the x offset, in pixels, of a comment within a cell:
+
+    $worksheet->write_comment('C3', $comment, x_offset => 30);
+
+
+=item Option: y_offset
+
+This option is used to change the y offset, in pixels, of a comment within a cell:
+
+    $worksheet->write_comment('C3', $comment, x_offset => 30);
+
+
+=back
+
+You can apply as many of these options as you require.
+
+B<Note about row height and comments>. If you specify the height of a row that contains a comment then Spreadsheet::WriteExcel will adjust the height of the comment to maintain the default or user specified dimensions. However, the height of a row can also be adjusted automatically by Excel if the text wrap property is set or large fonts are used in the cell. This means that the height of the row is unknown to WriteExcel at run time and thus the comment box is stretched with the row. Use the C<set_row()> method to specify the row height explicitly and avoid this problem.
+
+
+=head2 show_comments()
+
+This method is used to make all cell comments visible when a worksheet is opened.
+
+Individual comments can be made visible using the C<visible> parameter of the C<write_comment> method (see above):
+
+    $worksheet->write_comment('C3', 'Hello', visible => 1);
+
+If all of the cell comments have been made visible you can hide individual comments as follows:
+
+    $worksheet->write_comment('C3', 'Hello', visible => 0);
+
+
+
+
+=head2 add_write_handler($re, $code_ref)
+
+This method is used to extend the Spreadsheet::WriteExcel write() method to handle user defined data.
+
+If you refer to the section on C<write()> above you will see that it acts as an alias for several more specific C<write_*> methods. However, it doesn't always act in exactly the way that you would like it to.
+
+One solution is to filter the input data yourself and call the appropriate C<write_*> method. Another approach is to use the C<add_write_handler()> method to add your own automated behaviour to C<write()>.
+
+The C<add_write_handler()> method take two arguments, C<$re>, a regular expression to match incoming data and C<$code_ref> a callback function to handle the matched data:
+
+    $worksheet->add_write_handler(qr/^\d\d\d\d$/, \&my_write);
+
+(In the these examples the C<qr> operator is used to quote the regular expression strings, see L<perlop> for more details).
+
+The method is use as follows. say you wished to write 7 digit ID numbers as a string so that any leading zeros were preserved*, you could do something like the following:
+
+    $worksheet->add_write_handler(qr/^\d{7}$/, \&write_my_id);
+
+
+    sub write_my_id {
+        my $worksheet = shift;
+        return $worksheet->write_string(@_);
+    }
+
+* You could also use the C<keep_leading_zeros()> method for this.
+
+Then if you call C<write()> with an appropriate string it will be handled automatically:
+
+    # Writes 0000000. It would normally be written as a number; 0.
+    $worksheet->write('A1', '0000000');
+
+The callback function will receive a reference to the calling worksheet and all of the other arguments that were passed to C<write()>. The callback will see an C<@_> argument list that looks like the following:
+
+    $_[0]   A ref to the calling worksheet. *
+    $_[1]   Zero based row number.
+    $_[2]   Zero based column number.
+    $_[3]   A number or string or token.
+    $_[4]   A format ref if any.
+    $_[5]   Any other arguments.
+    ...
+
+    *  It is good style to shift this off the list so the @_ is the same
+       as the argument list seen by write().
+
+Your callback should C<return()> the return value of the C<write_*> method that was called or C<undef> to indicate that you rejected the match and want C<write()> to continue as normal.
+
+So for example if you wished to apply the previous filter only to ID values that occur in the first column you could modify your callback function as follows:
+
+
+    sub write_my_id {
+        my $worksheet = shift;
+        my $col       = $_[1];
+
+        if ($col == 0) {
+            return $worksheet->write_string(@_);
+        }
+        else {
+            # Reject the match and return control to write()
+            return undef;
+        }
+    }
+
+Now, you will get different behaviour for the first column and other columns:
+
+    $worksheet->write('A1', '0000000'); # Writes 0000000
+    $worksheet->write('B1', '0000000'); # Writes 0
+
+
+You may add more than one handler in which case they will be called in the order that they were added.
+
+Note, the C<add_write_handler()> method is particularly suited for handling dates.
+
+See the C<write_handler 1-4> programs in the C<examples> directory for further examples.
+
+
+
+
+=head2 insert_bitmap($row, $col, $filename, $x, $y, $scale_x, $scale_y)
+
+B<NOTE:> This method is currently incompatible with C<write_comment()>. You can use either method but not both in the same workbook. This will be fixed soon.
+
+B<NOTE:> The images inserted using this method do not display in OpenOffice.org or Gnumeric. This is related to the previous note and will also be fixed soon.
+
+
+This method can be used to insert a bitmap into a worksheet. The bitmap must be a 24 bit, true colour, bitmap. No other format is supported. The C<$x>, C<$y>, C<$scale_x> and C<$scale_y> parameters are optional.
+
+    $worksheet1->insert_bitmap('A1', 'perl.bmp');
+    $worksheet2->insert_bitmap('A1', '../images/perl.bmp');
+    $worksheet3->insert_bitmap('A1', '.c:\images\perl.bmp');
+
+Note: you must call C<set_row()> or C<set_column()> before C<insert_bitmap()> if you wish to change the default dimensions of any of the rows or columns that the images occupies. The height of a row can also change if you use a font that is larger than the default. This in turn will affect the scaling of your image. To avoid this you should explicitly set the height of the row using C<set_row()> if it contains a font size that will change the row height.
+
+The parameters C<$x> and C<$y> can be used to specify an offset from the top left hand corner of the cell specified by C<$row> and C<$col>. The offset values are in pixels.
+
+    $worksheet1->insert_bitmap('A1', 'perl.bmp', 32, 10);
+
+The default width of a cell is 63 pixels. The default height of a cell is 17 pixels. The pixels offsets can be calculated using the following relationships:
+
+    Wp = int(12We)   if We <  1
+    Wp = int(7We +5) if We >= 1
+    Hp = int(4/3He)
+
+    where:
+    We is the cell width in Excels units
+    Wp is width in pixels
+    He is the cell height in Excels units
+    Hp is height in pixels
+
+The offsets can be greater than the width or height of the underlying cell. This can be occasionally useful if you wish to align two or more images relative to the same cell.
+
+The parameters C<$scale_x> and C<$scale_y> can be used to scale the inserted image horizontally and vertically:
+
+    # Scale the inserted image: width x 2.0, height x 0.8
+    $worksheet->insert_bitmap('A1', 'perl.bmp', 0, 0, 2, 0.8);
+
+Note: although Excel allows you to import several graphics formats such as gif, jpeg, png and eps these are converted internally into a proprietary format. One of the few non-proprietary formats that Excel supports is 24 bit, true colour, bitmaps. Therefore if you wish to use images in any other format you must first use an external application such as the ImageMagick I<convert> utility to convert them to 24 bit bitmaps.
+
+    convert test.png test.bmp
+
+A later release will support the use of file handles and pre-encoded bitmap strings.
+
+See also the C<images.pl> program in the C<examples> directory of the distro.
+
+
+
+
+=head2 get_name()
+
+The C<get_name()> method is used to retrieve the name of a worksheet. For example:
+
+    foreach my $sheet ($workbook->sheets()) {
+        print $sheet->get_name();
+    }
+
+
+
+
+=head2 activate()
+
+The C<activate()> method is used to specify which worksheet is initially visible in a multi-sheet workbook:
+
+    $worksheet1 = $workbook->add_worksheet('To');
+    $worksheet2 = $workbook->add_worksheet('the');
+    $worksheet3 = $workbook->add_worksheet('wind');
+
+    $worksheet3->activate();
+
+This is similar to the Excel VBA activate method. More than one worksheet can be selected via the C<select()> method, however only one worksheet can be active. The default value is the first worksheet.
+
+
+
+
+=head2 select()
+
+The C<select()> method is used to indicate that a worksheet is selected in a multi-sheet workbook:
+
+    $worksheet1->activate();
+    $worksheet2->select();
+    $worksheet3->select();
+
+A selected worksheet has its tab highlighted. Selecting worksheets is a way of grouping them together so that, for example, several worksheets could be printed in one go. A worksheet that has been activated via the C<activate()> method will also appear as selected. You probably won't need to use the C<select()> method very often.
+
+
+
+
+=head2 hide()
+
+The C<hide()> method is used to hide a worksheet:
+
+    $worksheet->hide();
+
+You may wish to hide a worksheet in order to avoid confusing a user with intermediate data or calculations.
+
+A hidden worksheet can not be activated or selected so this method is mutually exclusive with the C<activate()> and C<select()> methods.
+
+
+
+
+=head2 set_first_sheet()
+
+The C<activate()> method determines which worksheet is initially selected. However, if there are a large number of worksheets the selected worksheet may not appear on the screen. To avoid this you can select which is the leftmost visible worksheet using C<set_first_sheet()>:
+
+    for (1..20) {
+        $workbook->add_worksheet;
+    }
+
+    $worksheet21 = $workbook->add_worksheet();
+    $worksheet22 = $workbook->add_worksheet();
+
+    $worksheet21->set_first_sheet();
+    $worksheet22->activate();
+
+This method is not required very often. The default value is the first worksheet.
+
+
+
+
+=head2 protect($password)
+
+The C<protect()> method is used to protect a worksheet from modification:
+
+    $worksheet->protect();
+
+It can be turned off in Excel via the C<Tools-E<gt>Protection-E<gt>Unprotect Sheet> menu command.
+
+The C<protect()> method also has the effect of enabling a cell's C<locked> and C<hidden> properties if they have been set. A "locked" cell cannot be edited. A "hidden" cell will display the results of a formula but not the formula itself. In Excel a cell's locked property is on by default.
+
+    # Set some format properties
+    my $unlocked  = $workbook->add_format(locked => 0);
+    my $hidden    = $workbook->add_format(hidden => 1);
+
+    # Enable worksheet protection
+    $worksheet->protect();
+
+    # This cell cannot be edited, it is locked by default
+    $worksheet->write('A1', '=1+2');
+
+    # This cell can be edited
+    $worksheet->write('A2', '=1+2', $unlocked);
+
+    # The formula in this cell isn't visible
+    $worksheet->write('A3', '=1+2', $hidden);
+
+See also the C<set_locked> and C<set_hidden> format methods in L<CELL FORMATTING>.
+
+You can optionally add a password to the worksheet protection:
+
+    $worksheet->protect('drowssap');
+
+Note, the worksheet level password in Excel provides very weak protection. It does not encrypt your data in any way and it is very easy to deactivate. Therefore, do not use the above method if you wish to protect sensitive data or calculations. However, before you get worried, Excel's own workbook level password protection does provide strong encryption in Excel 97+. For technical reasons this will never be supported by C<Spreadsheet::WriteExcel>.
+
+
+
+
+=head2 set_selection($first_row, $first_col, $last_row, $last_col)
+
+This method can be used to specify which cell or cells are selected in a worksheet. The most common requirement is to select a single cell, in which case C<$last_row> and C<$last_col> can be omitted. The active cell within a selected range is determined by the order in which C<$first> and C<$last> are specified. It is also possible to specify a cell or a range using A1 notation. See the note about L<Cell notation>.
+
+Examples:
+
+    $worksheet1->set_selection(3, 3);       # 1. Cell D4.
+    $worksheet2->set_selection(3, 3, 6, 6); # 2. Cells D4 to G7.
+    $worksheet3->set_selection(6, 6, 3, 3); # 3. Cells G7 to D4.
+    $worksheet4->set_selection('D4');       # Same as 1.
+    $worksheet5->set_selection('D4:G7');    # Same as 2.
+    $worksheet6->set_selection('G7:D4');    # Same as 3.
+
+The default cell selections is (0, 0), 'A1'.
+
+
+
+
+=head2 set_row($row, $height, $format, $hidden, $level)
+
+This method can be used to change the default properties of a row. All parameters apart from C<$row> are optional.
+
+The most common use for this method is to change the height of a row:
+
+    $worksheet->set_row(0, 20); # Row 1 height set to 20
+
+If you wish to set the format without changing the height you can pass C<undef> as the height parameter:
+
+    $worksheet->set_row(0, undef, $format);
+
+The C<$format> parameter will be applied to any cells in the row that don't  have a format. For example
+
+    $worksheet->set_row(0, undef, $format1);    # Set the format for row 1
+    $worksheet->write('A1', "Hello");           # Defaults to $format1
+    $worksheet->write('B1', "Hello", $format2); # Keeps $format2
+
+If you wish to define a row format in this way you should call the method before any calls to C<write()>. Calling it afterwards will overwrite any format that was previously specified.
+
+The C<$hidden> parameter should be set to 1 if you wish to hide a row. This can be used, for example, to hide intermediary steps in a complicated calculation:
+
+    $worksheet->set_row(0, 20,    $format, 1);
+    $worksheet->set_row(1, undef, undef,   1);
+
+The C<$level> parameter is used to set the outline level of the row. Outlines are described in L<OUTLINES AND GROUPING IN EXCEL>. Adjacent rows with the same outline level are grouped together into a single outline.
+
+The following example sets an outline level of 1 for rows 1 and 2 (zero-indexed):
+
+    $worksheet->set_row(1, undef, undef, 0, 1);
+    $worksheet->set_row(2, undef, undef, 0, 1);
+
+The C<$hidden> parameter can also be used to collapse outlined rows when used in conjunction with the C<$level> parameter.
+
+    $worksheet->set_row(1, undef, undef, 1, 1);
+    $worksheet->set_row(2, undef, undef, 1, 1);
+
+Excel allows up to 7 outline levels. Therefore the C<$level> parameter should be in the range C<0 E<lt>= $level E<lt>= 7>.
+
+
+
+
+=head2 set_column($first_col, $last_col, $width, $format, $hidden, $level)
+
+This method can be used to change the default properties of a single column or a range of columns. All parameters apart from C<$first_col> and C<$last_col> are optional.
+
+If C<set_column()> is applied to a single column the value of C<$first_col> and C<$last_col> should be the same. It is also possible to specify a column range using the form of A1 notation used for columns. See the note about L<Cell notation>.
+
+Examples:
+
+    $worksheet->set_column(0, 0,  20); # Column  A   width set to 20
+    $worksheet->set_column(1, 3,  30); # Columns B-D width set to 30
+    $worksheet->set_column('E:E', 20); # Column  E   width set to 20
+    $worksheet->set_column('F:H', 30); # Columns F-H width set to 30
+
+The width corresponds to the column width value that is specified in Excel. It is approximately equal to the length of a string in the default font of Arial 10. Unfortunately, there is no way to specify "AutoFit" for a column in the Excel file format. This feature is only available at runtime from within Excel.
+
+As usual the C<$format> parameter is optional, for additional information, see L<CELL FORMATTING>. If you wish to set the format without changing the width you can pass C<undef> as the width parameter:
+
+    $worksheet->set_column(0, 0, undef, $format);
+
+The C<$format> parameter will be applied to any cells in the column that don't  have a format. For example
+
+    $worksheet->set_column('A:A', undef, $format1); # Set format for col 1
+    $worksheet->write('A1', "Hello");               # Defaults to $format1
+    $worksheet->write('A2', "Hello", $format2);     # Keeps $format2
+
+If you wish to define a column format in this way you should call the method before any calls to C<write()>. If you call it afterwards it won't have any effect.
+
+A default row format takes precedence over a default column format
+
+    $worksheet->set_row(0, undef,        $format1); # Set format for row 1
+    $worksheet->set_column('A:A', undef, $format2); # Set format for col 1
+    $worksheet->write('A1', "Hello");               # Defaults to $format1
+    $worksheet->write('A2', "Hello");               # Defaults to $format2
+
+The C<$hidden> parameter should be set to 1 if you wish to hide a column. This can be used, for example, to hide intermediary steps in a complicated calculation:
+
+    $worksheet->set_column('D:D', 20,    $format, 1);
+    $worksheet->set_column('E:E', undef, undef,   1);
+
+The C<$level> parameter is used to set the outline level of the column. Outlines are described in L<OUTLINES AND GROUPING IN EXCEL>. Adjacent columns with the same outline level are grouped together into a single outline.
+
+The following example sets an outline level of 1 for columns B to G:
+
+    $worksheet->set_column('B:G', undef, undef, 0, 1);
+
+The C<$hidden> parameter can also be used to collapse outlined columns when used in conjunction with the C<$level> parameter.
+
+    $worksheet->set_column('B:G', undef, undef, 1, 1);
+
+Excel allows up to 7 outline levels. Therefore the C<$level> parameter should be in the range C<0 E<lt>= $level E<lt>= 7>.
+
+
+
+
+=head2 outline_settings($visible, $symbols_below, $symbols_right, $auto_style)
+
+The C<outline_settings()> method is used to control the appearance of outlines in Excel. Outlines are described in L<OUTLINES AND GROUPING IN EXCEL>.
+
+The C<$visible> parameter is used to control whether or not outlines are visible. Setting this parameter to 0 will cause all outlines on the worksheet to be hidden. They can be unhidden in Excel by means of the "Show Outline Symbols" command button. The default setting is 1 for visible outlines.
+
+    $worksheet->outline_settings(0);
+
+The C<$symbols_below> parameter is used to control whether the row outline symbol will appear above or below the outline level bar. The default setting is 1 for symbols to appear below the outline level bar.
+
+The C<symbols_right> parameter is used to control whether the column outline symbol will appear to the left or the right of the outline level bar. The default setting is 1 for symbols to appear to the right of the outline level bar.
+
+The C<$auto_style> parameter is used to control whether the automatic outline generator in Excel uses automatic styles when creating an outline. This has no effect on a file generated by C<Spreadsheet::WriteExcel> but it does have an effect on how the worksheet behaves after it is created. The default setting is 0 for "Automatic Styles" to be turned off.
+
+The default settings for all of these parameters correspond to Excel's default parameters.
+
+
+The worksheet parameters controlled by C<outline_settings()> are rarely used.
+
+
+
+
+=head2 freeze_panes($row, $col, $top_row, $left_col)
+
+This method can be used to divide a worksheet into horizontal or vertical regions known as panes and to also "freeze" these panes so that the splitter bars are not visible. This is the same as the C<Window-E<gt>Freeze Panes> menu command in Excel
+
+The parameters C<$row> and C<$col> are used to specify the location of the split. It should be noted that the split is specified at the top or left of a cell and that the method uses zero based indexing. Therefore to freeze the first row of a worksheet it is necessary to specify the split at row 2 (which is 1 as the zero-based index). This might lead you to think that you are using a 1 based index but this is not the case.
+
+You can set one of the C<$row> and C<$col> parameters as zero if you do not want either a vertical or horizontal split.
+
+Examples:
+
+    $worksheet->freeze_panes(1, 0); # Freeze the first row
+    $worksheet->freeze_panes('A2'); # Same using A1 notation
+    $worksheet->freeze_panes(0, 1); # Freeze the first column
+    $worksheet->freeze_panes('B1'); # Same using A1 notation
+    $worksheet->freeze_panes(1, 2); # Freeze first row and first 2 columns
+    $worksheet->freeze_panes('C2'); # Same using A1 notation
+
+The parameters C<$top_row> and C<$left_col> are optional. They are used to specify the top-most or left-most visible row or column in the scrolling region of the panes. For example to freeze the first row and to have the scrolling region begin at row twenty:
+
+    $worksheet->freeze_panes(1, 0, 20, 0);
+
+You cannot use A1 notation for the C<$top_row> and C<$left_col> parameters.
+
+
+See also the C<panes.pl> program in the C<examples> directory of the distribution.
+
+
+
+
+=head2 thaw_panes($y, $x, $top_row, $left_col)
+
+This method can be used to divide a worksheet into horizontal or vertical regions known as panes. This method is different from the C<freeze_panes()> method in that the splits between the panes will be visible to the user and each pane will have its own scroll bars.
+
+The parameters C<$y> and C<$x> are used to specify the vertical and horizontal position of the split. The units for C<$y> and C<$x> are the same as those used by Excel to specify row height and column width. However, the vertical and horizontal units are different from each other. Therefore you must specify the C<$y> and C<$x> parameters in terms of the row heights and column widths that you have set or the default values which are C<12.75> for a row and  C<8.43> for a column.
+
+You can set one of the C<$y> and C<$x> parameters as zero if you do not want either a vertical or horizontal split. The parameters C<$top_row> and C<$left_col> are optional. They are used to specify the top-most or left-most visible row or column in the bottom-right pane.
+
+Example:
+
+    $worksheet->thaw_panes(12.75, 0,    1, 0); # First row
+    $worksheet->thaw_panes(0,     8.43, 0, 1); # First column
+    $worksheet->thaw_panes(12.75, 8.43, 1, 1); # First row and column
+
+You cannot use A1 notation with this method.
+
+See also the C<freeze_panes()> method and the C<panes.pl> program in the C<examples> directory of the distribution.
+
+
+
+
+=head2 merge_range($first_row, $first_col, $last_row, $last_col, $token, $format, $encoding)
+
+Merging cells can be achieved by setting the C<merge> property of a Format object, see L<CELL FORMATTING>. However, this only allows simple Excel5 style horizontal merging which Excel refers to as "center across selection".
+
+The C<merge_range()> method allows you to do Excel97+ style formatting where the cells can contain other types of alignment in addition to the merging:
+
+    my $format = $workbook->add_format(
+                                        border  => 6,
+                                        valign  => 'vcenter',
+                                        align   => 'center',
+                                      );
+
+    $worksheet->merge_range('B3:D4', 'Vertical and horizontal', $format);
+
+B<WARNING>. The format object that is used with a C<merge_range()> method call is marked internally as being associated with a merged range. It is a fatal error to use a merged format in a non-merged cell. Instead you should use separate formats for merged and non-merged cells. This restriction will be removed in a future release.
+
+The C<$encoding> parameter is optional, see below.
+
+C<merge_range()> writes its C<$token> argument using the worksheet C<write()> method. Therefore it will handle numbers, strings, formulas or urls as required.
+
+Setting the C<merge> property of the format isn't required when you are using C<merge_range()>. In fact using it will exclude the use of any other horizontal alignment option.
+
+On systems with C<perl 5.8> and later the C<merge_range()> method will also handle strings in Perl's C<utf8> format.
+
+    $worksheet->merge_range('B3:D4', "\x{263a}", $format); # Smiley
+
+On earlier Perl systems your can specify UTF-16BE worksheet names using an additional encoding parameter:
+
+    my $str = pack "n", 0x263a;
+    $worksheet->merge_range('B3:D4', $str, $format, 1); # Smiley
+
+The full possibilities of this method are shown in the C<merge3.pl> to C<merge6.pl> programs in the C<examples> directory of the distribution.
+
+
+
+
+=head2 set_zoom($scale)
+
+Set the worksheet zoom factor in the range C<10 E<lt>= $scale E<lt>= 400>:
+
+    $worksheet1->set_zoom(50);
+    $worksheet2->set_zoom(75);
+    $worksheet3->set_zoom(300);
+    $worksheet4->set_zoom(400);
+
+The default zoom factor is 100. You cannot zoom to "Selection" because it is calculated by Excel at run-time.
+
+Note, C<set_zoom()> does not affect the scale of the printed page. For that you should use C<set_print_scale()>.
+
+
+
+
+=head2 right_to_left()
+
+The C<right_to_left()> method is used to change the default direction of the worksheet from left-to-right, with the A1 cell in the top left, to right-to-left, with the he A1 cell in the top right.
+
+    $worksheet->right_to_left();
+
+This is useful when creating Arabic, Hebrew or other near or far eastern worksheets that use right-to-left as the default direction.
+
+
+
+
+=head2 hide_zero()
+
+The C<hide_zero()> method is used to hide any zero values that appear in cells.
+
+    $worksheet->right_to_left();
+
+In Excel this option is found under Tools->Options->View.
+
+
+
+
+=head1 PAGE SET-UP METHODS
+
+Page set-up methods affect the way that a worksheet looks when it is printed. They control features such as page headers and footers and margins. These methods are really just standard worksheet methods. They are documented here in a separate section for the sake of clarity.
+
+The following methods are available for page set-up:
+
+    set_landscape()
+    set_portrait()
+    set_paper()
+    center_horizontally()
+    center_vertically()
+    set_margins()
+    set_header()
+    set_footer()
+    repeat_rows()
+    repeat_columns()
+    hide_gridlines()
+    print_row_col_headers()
+    print_area()
+    print_across()
+    fit_to_pages()
+    set_print_scale()
+    set_h_pagebreaks()
+    set_v_pagebreaks()
+
+
+A common requirement when working with Spreadsheet::WriteExcel is to apply the same page set-up features to all of the worksheets in a workbook. To do this you can use the C<sheets()> method of the C<workbook> class to access the array of worksheets in a workbook:
+
+    foreach $worksheet ($workbook->sheets()) {
+       $worksheet->set_landscape();
+    }
+
+
+
+
+=head2 set_landscape()
+
+This method is used to set the orientation of a worksheet's printed page to landscape:
+
+    $worksheet->set_landscape(); # Landscape mode
+
+
+
+
+=head2 set_portrait()
+
+This method is used to set the orientation of a worksheet's printed page to portrait. The default worksheet orientation is portrait, so you won't generally need to call this method.
+
+    $worksheet->set_portrait(); # Portrait mode
+
+
+
+=head2 set_paper($index)
+
+This method is used to set the paper format for the printed output of a worksheet. The following paper styles are available:
+
+    Index   Paper format            Paper size
+    =====   ============            ==========
+      0     Printer default         -
+      1     Letter                  8 1/2 x 11 in
+      2     Letter Small            8 1/2 x 11 in
+      3     Tabloid                 11 x 17 in
+      4     Ledger                  17 x 11 in
+      5     Legal                   8 1/2 x 14 in
+      6     Statement               5 1/2 x 8 1/2 in
+      7     Executive               7 1/4 x 10 1/2 in
+      8     A3                      297 x 420 mm
+      9     A4                      210 x 297 mm
+     10     A4 Small                210 x 297 mm
+     11     A5                      148 x 210 mm
+     12     B4                      250 x 354 mm
+     13     B5                      182 x 257 mm
+     14     Folio                   8 1/2 x 13 in
+     15     Quarto                  215 x 275 mm
+     16     -                       10x14 in
+     17     -                       11x17 in
+     18     Note                    8 1/2 x 11 in
+     19     Envelope  9             3 7/8 x 8 7/8
+     20     Envelope 10             4 1/8 x 9 1/2
+     21     Envelope 11             4 1/2 x 10 3/8
+     22     Envelope 12             4 3/4 x 11
+     23     Envelope 14             5 x 11 1/2
+     24     C size sheet            -
+     25     D size sheet            -
+     26     E size sheet            -
+     27     Envelope DL             110 x 220 mm
+     28     Envelope C3             324 x 458 mm
+     29     Envelope C4             229 x 324 mm
+     30     Envelope C5             162 x 229 mm
+     31     Envelope C6             114 x 162 mm
+     32     Envelope C65            114 x 229 mm
+     33     Envelope B4             250 x 353 mm
+     34     Envelope B5             176 x 250 mm
+     35     Envelope B6             176 x 125 mm
+     36     Envelope                110 x 230 mm
+     37     Monarch                 3.875 x 7.5 in
+     38     Envelope                3 5/8 x 6 1/2 in
+     39     Fanfold                 14 7/8 x 11 in
+     40     German Std Fanfold      8 1/2 x 12 in
+     41     German Legal Fanfold    8 1/2 x 13 in
+
+
+Note, it is likely that not all of these paper types will be available to the end user since it will depend on the paper formats that the user's printer supports. Therefore, it is best to stick to standard paper types.
+
+    $worksheet->set_paper(1); # US Letter
+    $worksheet->set_paper(9); # A4
+
+If you do not specify a paper type the worksheet will print using the printer's default paper.
+
+
+
+
+=head2 center_horizontally()
+
+Center the worksheet data horizontally between the margins on the printed page:
+
+    $worksheet->center_horizontally();
+
+
+
+
+=head2 center_vertically()
+
+Center the worksheet data vertically between the margins on the printed page:
+
+    $worksheet->center_vertically();
+
+
+
+
+=head2 set_margins($inches)
+
+There are several methods available for setting the worksheet margins on the printed page:
+
+    set_margins()        # Set all margins to the same value
+    set_margins_LR()     # Set left and right margins to the same value
+    set_margins_TB()     # Set top and bottom margins to the same value
+    set_margin_left();   # Set left margin
+    set_margin_right();  # Set right margin
+    set_margin_top();    # Set top margin
+    set_margin_bottom(); # Set bottom margin
+
+All of these methods take a distance in inches as a parameter. Note: 1 inch = 25.4mm. ;-) The default left and right margin is 0.75 inch. The default top and bottom margin is 1.00 inch.
+
+
+
+=head2 set_header($string, $margin)
+
+Headers and footers are generated using a C<$string> which is a combination of plain text and control characters. The C<$margin> parameter is optional.
+
+The available control character are:
+
+    Control             Category            Description
+    =======             ========            ===========
+    &L                  Justification       Left
+    &C                                      Center
+    &R                                      Right
+
+    &P                  Information         Page number
+    &N                                      Total number of pages
+    &D                                      Date
+    &T                                      Time
+    &F                                      File name
+    &A                                      Worksheet name
+    &Z                                      Workbook path
+
+    &fontsize           Font                Font size
+    &"font,style"                           Font name and style
+    &U                                      Single underline
+    &E                                      Double underline
+    &S                                      Strikethrough
+    &X                                      Superscript
+    &Y                                      Subscript
+
+    &&                  Miscellaneous       Literal ampersand &
+
+
+Text in headers and footers can be justified (aligned) to the left, center and right by prefixing the text with the control characters C<&L>, C<&C> and C<&R>.
+
+For example (with ASCII art representation of the results):
+
+    $worksheet->set_header('&LHello');
+
+     ---------------------------------------------------------------
+    |                                                               |
+    | Hello                                                         |
+    |                                                               |
+
+
+    $worksheet->set_header('&CHello');
+
+     ---------------------------------------------------------------
+    |                                                               |
+    |                          Hello                                |
+    |                                                               |
+
+
+    $worksheet->set_header('&RHello');
+
+     ---------------------------------------------------------------
+    |                                                               |
+    |                                                         Hello |
+    |                                                               |
+
+
+For simple text, if you do not specify any justification the text will be centred. However, you must prefix the text with C<&C> if you specify a font name or any other formatting:
+
+    $worksheet->set_header('Hello');
+
+     ---------------------------------------------------------------
+    |                                                               |
+    |                          Hello                                |
+    |                                                               |
+
+
+You can have text in each of the justification regions:
+
+    $worksheet->set_header('&LCiao&CBello&RCielo');
+
+     ---------------------------------------------------------------
+    |                                                               |
+    | Ciao                     Bello                          Cielo |
+    |                                                               |
+
+
+The information control characters act as variables that Excel will update as the workbook or worksheet changes. Times and dates are in the users default format:
+
+    $worksheet->set_header('&CPage &P of &N');
+
+     ---------------------------------------------------------------
+    |                                                               |
+    |                        Page 1 of 6                            |
+    |                                                               |
+
+
+    $worksheet->set_header('&CUpdated at &T');
+
+     ---------------------------------------------------------------
+    |                                                               |
+    |                    Updated at 12:30 PM                        |
+    |                                                               |
+
+
+
+You can specify the font size of a section of the text by prefixing it with the control character C<&n> where C<n> is the font size:
+
+    $worksheet1->set_header('&C&30Hello Big'  );
+    $worksheet2->set_header('&C&10Hello Small');
+
+You can specify the font of a section of the text by prefixing it with the control sequence C<&"font,style"> where C<fontname> is a font name such as "Courier New" or "Times New Roman" and C<style> is one of the standard Windows font descriptions: "Regular", "Italic", "Bold" or "Bold Italic":
+
+    $worksheet1->set_header('&C&"Courier New,Italic"Hello');
+    $worksheet2->set_header('&C&"Courier New,Bold Italic"Hello');
+    $worksheet3->set_header('&C&"Times New Roman,Regular"Hello');
+
+It is possible to combine all of these features together to create sophisticated headers and footers. As an aid to setting up complicated headers and footers you can record a page set-up as a macro in Excel and look at the format strings that VBA produces. Remember however that VBA uses two double quotes C<""> to indicate a single double quote. For the last example above the equivalent VBA code looks like this:
+
+    .LeftHeader   = ""
+    .CenterHeader = "&""Times New Roman,Regular""Hello"
+    .RightHeader  = ""
+
+
+To include a single literal ampersand C<&> in a header or footer you should use a double ampersand C<&&>:
+
+    $worksheet1->set_header('&CCuriouser && Curiouser - Attorneys at Law');
+
+As stated above the margin parameter is optional. As with the other margins the value should be in inches. The default header and footer margin is 0.50 inch. The header and footer margin size can be set as follows:
+
+    $worksheet->set_header('&CHello', 0.75);
+
+The header and footer margins are independent of the top and bottom margins.
+
+Note, the header or footer string must be less than 255 characters. Strings longer than this will not be written and a warning will be generated.
+
+On systems with C<perl 5.8> and later the C<set_header()> method can also handle Unicode strings in Perl's C<utf8> format.
+
+    $worksheet->set_header("&C\x{263a}")
+
+
+See, also the C<headers.pl> program in the C<examples> directory of the distribution.
+
+
+
+
+=head2 set_footer()
+
+The syntax of the C<set_footer()> method is the same as C<set_header()>,  see above.
+
+
+
+
+=head2 repeat_rows($first_row, $last_row)
+
+Set the number of rows to repeat at the top of each printed page.
+
+For large Excel documents it is often desirable to have the first row or rows of the worksheet print out at the top of each page. This can be achieved by using the C<repeat_rows()> method. The parameters C<$first_row> and C<$last_row> are zero based. The C<$last_row> parameter is optional if you only wish to specify one row:
+
+    $worksheet1->repeat_rows(0);    # Repeat the first row
+    $worksheet2->repeat_rows(0, 1); # Repeat the first two rows
+
+
+
+
+=head2 repeat_columns($first_col, $last_col)
+
+Set the columns to repeat at the left hand side of each printed page.
+
+For large Excel documents it is often desirable to have the first column or columns of the worksheet print out at the left hand side of each page. This can be achieved by using the C<repeat_columns()> method. The parameters C<$first_column> and C<$last_column> are zero based. The C<$last_column> parameter is optional if you only wish to specify one column. You can also specify the columns using A1 column notation, see the note about L<Cell notation>.
+
+    $worksheet1->repeat_columns(0);     # Repeat the first column
+    $worksheet2->repeat_columns(0, 1);  # Repeat the first two columns
+    $worksheet3->repeat_columns('A:A'); # Repeat the first column
+    $worksheet4->repeat_columns('A:B'); # Repeat the first two columns
+
+
+
+
+=head2 hide_gridlines($option)
+
+This method is used to hide the gridlines on the screen and printed page. Gridlines are the lines that divide the cells on a worksheet. Screen and printed gridlines are turned on by default in an Excel worksheet. If you have defined your own cell borders you may wish to hide the default gridlines.
+
+    $worksheet->hide_gridlines();
+
+The following values of C<$option> are valid:
+
+    0 : Don't hide gridlines
+    1 : Hide printed gridlines only
+    2 : Hide screen and printed gridlines
+
+If you don't supply an argument or use C<undef> the default option is 1, i.e. only the printed gridlines are hidden.
+
+
+
+
+=head2 print_row_col_headers()
+
+Set the option to print the row and column headers on the printed page.
+
+An Excel worksheet looks something like the following;
+
+     ------------------------------------------
+    |   |   A   |   B   |   C   |   D   |  ...
+     ------------------------------------------
+    | 1 |       |       |       |       |  ...
+    | 2 |       |       |       |       |  ...
+    | 3 |       |       |       |       |  ...
+    | 4 |       |       |       |       |  ...
+    |...|  ...  |  ...  |  ...  |  ...  |  ...
+
+The headers are the letters and numbers at the top and the left of the worksheet. Since these headers serve mainly as a indication of position on the worksheet they generally do not appear on the printed page. If you wish to have them printed you can use the C<print_row_col_headers()> method :
+
+    $worksheet->print_row_col_headers();
+
+Do not confuse these headers with page headers as described in the C<set_header()> section above.
+
+
+
+
+=head2 print_area($first_row, $first_col, $last_row, $last_col)
+
+This method is used to specify the area of the worksheet that will be printed. All four parameters must be specified. You can also use A1 notation, see the note about L<Cell notation>.
+
+
+    $worksheet1->print_area("A1:H20");    # Cells A1 to H20
+    $worksheet2->print_area(0, 0, 19, 7); # The same
+    $worksheet2->print_area('A:H');       # Columns A to H if rows have data
+
+
+
+
+=head2 print_across()
+
+The C<print_across> method is used to change the default print direction. This is referred to by Excel as the sheet "page order".
+
+    $worksheet->print_across();
+
+The default page order is shown below for a worksheet that extends over 4 pages. The order is called "down then across":
+
+    [1] [3]
+    [2] [4]
+
+However, by using the C<print_across> method the print order will be changed to "across then down":
+
+    [1] [2]
+    [3] [4]
+
+
+
+
+=head2 fit_to_pages($width, $height)
+
+The C<fit_to_pages()> method is used to fit the printed area to a specific number of pages both vertically and horizontally. If the printed area exceeds the specified number of pages it will be scaled down to fit. This guarantees that the printed area will always appear on the specified number of pages even if the page size or margins change.
+
+    $worksheet1->fit_to_pages(1, 1); # Fit to 1x1 pages
+    $worksheet2->fit_to_pages(2, 1); # Fit to 2x1 pages
+    $worksheet3->fit_to_pages(1, 2); # Fit to 1x2 pages
+
+The print area can be defined using the C<print_area()> method as described above.
+
+A common requirement is to fit the printed output to I<n> pages wide but have the height be as long as necessary. To achieve this set the C<$height> to zero or leave it blank:
+
+    $worksheet1->fit_to_pages(1, 0); # 1 page wide and as long as necessary
+    $worksheet2->fit_to_pages(1);    # The same
+
+
+Note that although it is valid to use both C<fit_to_pages()> and C<set_print_scale()> on the same worksheet only one of these options can be active at a time. The last method call made will set the active option.
+
+Note that C<fit_to_pages()> will override any manual page breaks that are defined in the worksheet.
+
+
+
+
+=head2 set_print_scale($scale)
+
+Set the scale factor of the printed page. Scale factors in the range C<10 E<lt>= $scale E<lt>= 400> are valid:
+
+    $worksheet1->set_print_scale(50);
+    $worksheet2->set_print_scale(75);
+    $worksheet3->set_print_scale(300);
+    $worksheet4->set_print_scale(400);
+
+The default scale factor is 100. Note, C<set_print_scale()> does not affect the scale of the visible page in Excel. For that you should use C<set_zoom()>.
+
+Note also that although it is valid to use both C<fit_to_pages()> and C<set_print_scale()> on the same worksheet only one of these options can be active at a time. The last method call made will set the active option.
+
+
+
+
+=head2 set_h_pagebreaks(@breaks)
+
+Add horizontal page breaks to a worksheet. A page break causes all the data that follows it to be printed on the next page. Horizontal page breaks act between rows. To create a page break between rows 20 and 21 you must specify the break at row 21. However in zero index notation this is actually row 20. So you can pretend for a small while that you are using 1 index notation:
+
+    $worksheet1->set_h_pagebreaks(20); # Break between row 20 and 21
+
+The C<set_h_pagebreaks()> method will accept a list of page breaks and you can call it more than once:
+
+    $worksheet2->set_h_pagebreaks( 20,  40,  60,  80, 100); # Add breaks
+    $worksheet2->set_h_pagebreaks(120, 140, 160, 180, 200); # Add some more
+
+Note: If you specify the "fit to page" option via the C<fit_to_pages()> method it will override all manual page breaks.
+
+There is a silent limitation of about 1000 horizontal page breaks per worksheet in line with an Excel internal limitation.
+
+
+
+
+=head2 set_v_pagebreaks(@breaks)
+
+Add vertical page breaks to a worksheet. A page break causes all the data that follows it to be printed on the next page. Vertical page breaks act between columns. To create a page break between columns 20 and 21 you must specify the break at column 21. However in zero index notation this is actually column 20. So you can pretend for a small while that you are using 1 index notation:
+
+    $worksheet1->set_v_pagebreaks(20); # Break between column 20 and 21
+
+The C<set_v_pagebreaks()> method will accept a list of page breaks and you can call it more than once:
+
+    $worksheet2->set_v_pagebreaks( 20,  40,  60,  80, 100); # Add breaks
+    $worksheet2->set_v_pagebreaks(120, 140, 160, 180, 200); # Add some more
+
+Note: If you specify the "fit to page" option via the C<fit_to_pages()> method it will override all manual page breaks.
+
+
+
+
+=head1 CELL FORMATTING
+
+This section describes the methods and properties that are available for formatting cells in Excel. The properties of a cell that can be formatted include: fonts, colours, patterns, borders, alignment and number formatting.
+
+
+=head2 Creating and using a Format object
+
+Cell formatting is defined through a Format object. Format objects are created by calling the workbook C<add_format()> method as follows:
+
+    my $format1 = $workbook->add_format();       # Set properties later
+    my $format2 = $workbook->add_format(%props); # Set at creation
+
+The format object holds all the formatting properties that can be applied to a cell, a row or a column. The process of setting these properties is discussed in the next section.
+
+Once a Format object has been constructed and it properties have been set it can be passed as an argument to the worksheet C<write> methods as follows:
+
+    $worksheet->write(0, 0, "One", $format);
+    $worksheet->write_string(1, 0, "Two", $format);
+    $worksheet->write_number(2, 0, 3, $format);
+    $worksheet->write_blank(3, 0, $format);
+
+Formats can also be passed to the worksheet C<set_row()> and C<set_column()> methods to define the default property for a row or column.
+
+    $worksheet->set_row(0, 15, $format);
+    $worksheet->set_column(0, 0, 15, $format);
+
+
+
+
+=head2 Format methods and Format properties
+
+The following table shows the Excel format categories, the formatting properties that can be applied and the equivalent object method:
+
+
+    Category   Description       Property        Method Name
+    --------   -----------       --------        -----------
+    Font       Font type         font            set_font()
+               Font size         size            set_size()
+               Font color        color           set_color()
+               Bold              bold            set_bold()
+               Italic            italic          set_italic()
+               Underline         underline       set_underline()
+               Strikeout         font_strikeout  set_font_strikeout()
+               Super/Subscript   font_script     set_font_script()
+               Outline           font_outline    set_font_outline()
+               Shadow            font_shadow     set_font_shadow()
+
+    Number     Numeric format    num_format      set_num_format()
+
+    Protection Lock cells        locked          set_locked()
+               Hide formulas     hidden          set_hidden()
+
+    Alignment  Horizontal align  align           set_align()
+               Vertical align    valign          set_align()
+               Rotation          rotation        set_rotation()
+               Text wrap         text_wrap       set_text_wrap()
+               Justify last      text_justlast   set_text_justlast()
+               Center across     center_across   set_center_across()
+               Indentation       indent          set_indent()
+               Shrink to fit     shrink          set_shrink()
+
+    Pattern    Cell pattern      pattern         set_pattern()
+               Background color  bg_color        set_bg_color()
+               Foreground color  fg_color        set_fg_color()
+
+    Border     Cell border       border          set_border()
+               Bottom border     bottom          set_bottom()
+               Top border        top             set_top()
+               Left border       left            set_left()
+               Right border      right           set_right()
+               Border color      border_color    set_border_color()
+               Bottom color      bottom_color    set_bottom_color()
+               Top color         top_color       set_top_color()
+               Left color        left_color      set_left_color()
+               Right color       right_color     set_right_color()
+
+There are two ways of setting Format properties: by using the object method interface or by setting the property directly. For example, a typical use of the method interface would be as follows:
+
+    my $format = $workbook->add_format();
+    $format->set_bold();
+    $format->set_color('red');
+
+By comparison the properties can be set directly by passing a hash of properties to the Format constructor:
+
+    my $format = $workbook->add_format(bold => 1, color => 'red');
+
+or after the Format has been constructed by means of the C<set_properties()> method as follows:
+
+    my $format = $workbook->add_format();
+    $format->set_properties(bold => 1, color => 'red');
+
+You can also store the properties in one or more named hashes and pass them to the required method:
+
+    my %font    = (
+                    font  => 'Arial',
+                    size  => 12,
+                    color => 'blue',
+                    bold  => 1,
+                  );
+
+    my %shading = (
+                    bg_color => 'green',
+                    pattern  => 1,
+                  );
+
+
+    my $format1 = $workbook->add_format(%font);           # Font only
+    my $format2 = $workbook->add_format(%font, %shading); # Font and shading
+
+
+The provision of two ways of setting properties might lead you to wonder which is the best way. The answer depends on the amount of formatting that will be required in your program. Initially, Spreadsheet::WriteExcel only allowed individual Format properties to be set via the appropriate method. While this was sufficient for most circumstances it proved very cumbersome in programs that required a large amount of formatting. In addition the mechanism for reusing properties between Format objects was complicated.
+
+As a result the Perl/Tk style of adding properties was added to, hopefully, facilitate developers who need to define a lot of formatting. In fact the Tk style of defining properties is also supported:
+
+    my %font    = (
+                    -font      => 'Arial',
+                    -size      => 12,
+                    -color     => 'blue',
+                    -bold      => 1,
+                  );
+
+An additional advantage of working with hashes of properties is that it allows you to share formatting between workbook objects
+
+You can also create a format "on the fly" and pass it directly to a write method as follows:
+
+    $worksheet->write('A1', "Title", $workbook->add_format(bold => 1));
+
+This corresponds to an "anonymous" format in the Perl sense of anonymous data or subs.
+
+
+
+
+=head2 Working with formats
+
+The default format is Arial 10 with all other properties off.
+
+Each unique format in Spreadsheet::WriteExcel must have a corresponding Format object. It isn't possible to use a Format with a write() method and then redefine the Format for use at a later stage. This is because a Format is applied to a cell not in its current state but in its final state. Consider the following example:
+
+    my $format = $workbook->add_format();
+    $format->set_bold();
+    $format->set_color('red');
+    $worksheet->write('A1', "Cell A1", $format);
+    $format->set_color('green');
+    $worksheet->write('B1', "Cell B1", $format);
+
+Cell A1 is assigned the Format C<$format> which is initially set to the colour red. However, the colour is subsequently set to green. When Excel displays Cell A1 it will display the final state of the Format which in this case will be the colour green.
+
+In general a method call without an argument will turn a property on, for example:
+
+    my $format1 = $workbook->add_format();
+    $format1->set_bold();  # Turns bold on
+    $format1->set_bold(1); # Also turns bold on
+    $format1->set_bold(0); # Turns bold off
+
+
+
+
+=head1 FORMAT METHODS
+
+The Format object methods are described in more detail in the following sections. In addition, there is a Perl program called C<formats.pl> in the C<examples> directory of the WriteExcel distribution. This program creates an Excel workbook called C<formats.xls> which contains examples of almost all the format types.
+
+The following Format methods are available:
+
+    set_font()
+    set_size()
+    set_color()
+    set_bold()
+    set_italic()
+    set_underline()
+    set_font_strikeout()
+    set_font_script()
+    set_font_outline()
+    set_font_shadow()
+    set_num_format()
+    set_locked()
+    set_hidden()
+    set_align()
+    set_align()
+    set_rotation()
+    set_text_wrap()
+    set_text_justlast()
+    set_center_across()
+    set_indent()
+    set_shrink()
+    set_pattern()
+    set_bg_color()
+    set_fg_color()
+    set_border()
+    set_bottom()
+    set_top()
+    set_left()
+    set_right()
+    set_border_color()
+    set_bottom_color()
+    set_top_color()
+    set_left_color()
+    set_right_color()
+
+
+The above methods can also be applied directly as properties. For example C<$worksheet-E<gt>set_bold()> is equivalent to C<set_properties(bold =E<gt> 1)>.
+
+
+=head2 set_properties(%properties)
+
+The properties of an existing Format object can be set by means of C<set_properties()>:
+
+    my $format = $workbook->add_format();
+    $format->set_properties(bold => 1, color => 'red');
+
+You can also store the properties in one or more named hashes and pass them to the C<set_properties()> method:
+
+    my %font    = (
+                    font  => 'Arial',
+                    size  => 12,
+                    color => 'blue',
+                    bold  => 1,
+                  );
+
+    my $format = $workbook->set_properties(%font);
+
+This method can be used as an alternative to setting the properties with C<add_format()> or the specific format methods that are detailed in the following sections.
+
+
+
+
+=head2 set_font($fontname)
+
+    Default state:      Font is Arial
+    Default action:     None
+    Valid args:         Any valid font name
+
+Specify the font used:
+
+    $format->set_font('Times New Roman');
+
+Excel can only display fonts that are installed on the system that it is running on. Therefore it is best to use the fonts that come as standard such as 'Arial', 'Times New Roman' and 'Courier New'. See also the Fonts worksheet created by formats.pl
+
+
+
+
+=head2 set_size()
+
+    Default state:      Font size is 10
+    Default action:     Set font size to 1
+    Valid args:         Integer values from 1 to as big as your screen.
+
+
+Set the font size. Excel adjusts the height of a row to accommodate the largest font size in the row. You can also explicitly specify the height of a row using the set_row() worksheet method.
+
+    my $format = $workbook->add_format();
+    $format->set_size(30);
+
+
+
+
+
+=head2 set_color()
+
+    Default state:      Excels default color, usually black
+    Default action:     Set the default color
+    Valid args:         Integers from 8..63 or the following strings:
+                        'black'
+                        'blue'
+                        'brown'
+                        'cyan'
+                        'gray'
+                        'green'
+                        'lime'
+                        'magenta'
+                        'navy'
+                        'orange'
+                        'pink'
+                        'purple'
+                        'red'
+                        'silver'
+                        'white'
+                        'yellow'
+
+Set the font colour. The C<set_color()> method is used as follows:
+
+    my $format = $workbook->add_format();
+    $format->set_color('red');
+    $worksheet->write(0, 0, "wheelbarrow", $format);
+
+Note: The C<set_color()> method is used to set the colour of the font in a cell. To set the colour of a cell use the C<set_bg_color()> and C<set_pattern()> methods.
+
+For additional examples see the 'Named colors' and 'Standard colors' worksheets created by formats.pl in the examples directory.
+
+See also L<COLOURS IN EXCEL>.
+
+
+
+
+=head2 set_bold()
+
+    Default state:      bold is off
+    Default action:     Turn bold on
+    Valid args:         0, 1 [1]
+
+Set the bold property of the font:
+
+    $format->set_bold();  # Turn bold on
+
+[1] Actually, values in the range 100..1000 are also valid. 400 is normal, 700 is bold and 1000 is very bold indeed. It is probably best to set the value to 1 and use normal bold.
+
+
+
+
+=head2 set_italic()
+
+    Default state:      Italic is off
+    Default action:     Turn italic on
+    Valid args:         0, 1
+
+Set the italic property of the font:
+
+    $format->set_italic();  # Turn italic on
+
+
+
+
+=head2 set_underline()
+
+    Default state:      Underline is off
+    Default action:     Turn on single underline
+    Valid args:         0  = No underline
+                        1  = Single underline
+                        2  = Double underline
+                        33 = Single accounting underline
+                        34 = Double accounting underline
+
+Set the underline property of the font.
+
+    $format->set_underline();   # Single underline
+
+
+
+
+=head2 set_font_strikeout()
+
+    Default state:      Strikeout is off
+    Default action:     Turn strikeout on
+    Valid args:         0, 1
+
+Set the strikeout property of the font.
+
+
+
+
+=head2 set_font_script()
+
+    Default state:      Super/Subscript is off
+    Default action:     Turn Superscript on
+    Valid args:         0  = Normal
+                        1  = Superscript
+                        2  = Subscript
+
+Set the superscript/subscript property of the font. This format is currently not very useful.
+
+
+
+
+=head2 set_font_outline()
+
+    Default state:      Outline is off
+    Default action:     Turn outline on
+    Valid args:         0, 1
+
+Macintosh only.
+
+
+
+
+=head2 set_font_shadow()
+
+    Default state:      Shadow is off
+    Default action:     Turn shadow on
+    Valid args:         0, 1
+
+Macintosh only.
+
+
+
+
+=head2 set_num_format()
+
+    Default state:      General format
+    Default action:     Format index 1
+    Valid args:         See the following table
+
+This method is used to define the numerical format of a number in Excel. It controls whether a number is displayed as an integer, a floating point number, a date, a currency value or some other user defined format.
+
+The numerical format of a cell can be specified by using a format string or an index to one of Excel's built-in formats:
+
+    my $format1 = $workbook->add_format();
+    my $format2 = $workbook->add_format();
+    $format1->set_num_format('d mmm yyyy'); # Format string
+    $format2->set_num_format(0x0f);         # Format index
+
+    $worksheet->write(0, 0, 36892.521, $format1);      # 1 Jan 2001
+    $worksheet->write(0, 0, 36892.521, $format2);      # 1-Jan-01
+
+
+Using format strings you can define very sophisticated formatting of numbers.
+
+    $format01->set_num_format('0.000');
+    $worksheet->write(0,  0, 3.1415926, $format01);    # 3.142
+
+    $format02->set_num_format('#,##0');
+    $worksheet->write(1,  0, 1234.56,   $format02);    # 1,235
+
+    $format03->set_num_format('#,##0.00');
+    $worksheet->write(2,  0, 1234.56,   $format03);    # 1,234.56
+
+    $format04->set_num_format('$0.00');
+    $worksheet->write(3,  0, 49.99,     $format04);    # $49.99
+
+    $format05->set_num_format('£0.00');
+    $worksheet->write(4,  0, 49.99,     $format05);    # £49.99
+
+    $format06->set_num_format('¥0.00');
+    $worksheet->write(5,  0, 49.99,     $format06);    # ¥49.99
+
+    $format07->set_num_format('mm/dd/yy');
+    $worksheet->write(6,  0, 36892.521, $format07);    # 01/01/01
+
+    $format08->set_num_format('mmm d yyyy');
+    $worksheet->write(7,  0, 36892.521, $format08);    # Jan 1 2001
+
+    $format09->set_num_format('d mmmm yyyy');
+    $worksheet->write(8,  0, 36892.521, $format09);    # 1 January 2001
+
+    $format10->set_num_format('dd/mm/yyyy hh:mm AM/PM');
+    $worksheet->write(9,  0, 36892.521, $format10);    # 01/01/2001 12:30 AM
+
+    $format11->set_num_format('0 "dollar and" .00 "cents"');
+    $worksheet->write(10, 0, 1.87,      $format11);    # 1 dollar and .87 cents
+
+    # Conditional formatting
+    $format12->set_num_format('[Green]General;[Red]-General;General');
+    $worksheet->write(11, 0, 123,       $format12);    # > 0 Green
+    $worksheet->write(12, 0, -45,       $format12);    # < 0 Red
+    $worksheet->write(13, 0, 0,         $format12);    # = 0 Default colour
+
+    # Zip code
+    $format13->set_num_format('00000');
+    $worksheet->write(14, 0, '01209',   $format13);
+
+
+The number system used for dates is described in L<DATES IN EXCEL>.
+
+The colour format should have one of the following values:
+
+    [Black] [Blue] [Cyan] [Green] [Magenta] [Red] [White] [Yellow]
+
+Alternatively you can specify the colour based on a colour index as follows: C<[Color n]>, where n is a standard Excel colour index - 7. See the 'Standard colors' worksheet created by formats.pl.
+
+For more information refer to the documentation on formatting in the C<doc> directory of the Spreadsheet::WriteExcel distro, the Excel on-line help or http://office.microsoft.com/en-gb/assistance/HP051995001033.aspx
+
+You should ensure that the format string is valid in Excel prior to using it in WriteExcel.
+
+Excel's built-in formats are shown in the following table:
+
+    Index   Index   Format String
+    0       0x00    General
+    1       0x01    0
+    2       0x02    0.00
+    3       0x03    #,##0
+    4       0x04    #,##0.00
+    5       0x05    ($#,##0_);($#,##0)
+    6       0x06    ($#,##0_);[Red]($#,##0)
+    7       0x07    ($#,##0.00_);($#,##0.00)
+    8       0x08    ($#,##0.00_);[Red]($#,##0.00)
+    9       0x09    0%
+    10      0x0a    0.00%
+    11      0x0b    0.00E+00
+    12      0x0c    # ?/?
+    13      0x0d    # ??/??
+    14      0x0e    m/d/yy
+    15      0x0f    d-mmm-yy
+    16      0x10    d-mmm
+    17      0x11    mmm-yy
+    18      0x12    h:mm AM/PM
+    19      0x13    h:mm:ss AM/PM
+    20      0x14    h:mm
+    21      0x15    h:mm:ss
+    22      0x16    m/d/yy h:mm
+    ..      ....    ...........
+    37      0x25    (#,##0_);(#,##0)
+    38      0x26    (#,##0_);[Red](#,##0)
+    39      0x27    (#,##0.00_);(#,##0.00)
+    40      0x28    (#,##0.00_);[Red](#,##0.00)
+    41      0x29    _(* #,##0_);_(* (#,##0);_(* "-"_);_(@_)
+    42      0x2a    _($* #,##0_);_($* (#,##0);_($* "-"_);_(@_)
+    43      0x2b    _(* #,##0.00_);_(* (#,##0.00);_(* "-"??_);_(@_)
+    44      0x2c    _($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)
+    45      0x2d    mm:ss
+    46      0x2e    [h]:mm:ss
+    47      0x2f    mm:ss.0
+    48      0x30    ##0.0E+0
+    49      0x31    @
+
+
+For examples of these formatting codes see the 'Numerical formats' worksheet created by formats.pl. See also the number_formats1.html and the number_formats2.html documents in the C<doc> directory of the distro.
+
+Note 1. Numeric formats 23 to 36 are not documented by Microsoft and may differ in international versions.
+
+Note 2. In Excel 5 the dollar sign appears as a dollar sign. In Excel 97-2000 it appears as the defined local currency symbol.
+
+Note 3. The red negative numeric formats display slightly differently in Excel 5 and Excel 97-2000.
+
+
+
+
+=head2 set_locked()
+
+    Default state:      Cell locking is on
+    Default action:     Turn locking on
+    Valid args:         0, 1
+
+This property can be used to prevent modification of a cells contents. Following Excel's convention, cell locking is turned on by default. However, it only has an effect if the worksheet has been protected, see the worksheet C<protect()> method.
+
+    my $locked  = $workbook->add_format();
+    $locked->set_locked(1); # A non-op
+
+    my $unlocked = $workbook->add_format();
+    $locked->set_locked(0);
+
+    # Enable worksheet protection
+    $worksheet->protect();
+
+    # This cell cannot be edited.
+    $worksheet->write('A1', '=1+2', $locked);
+
+    # This cell can be edited.
+    $worksheet->write('A2', '=1+2', $unlocked);
+
+Note: This offers weak protection even with a password, see the note in relation to the C<protect()> method.
+
+
+
+
+=head2 set_hidden()
+
+    Default state:      Formula hiding is off
+    Default action:     Turn hiding on
+    Valid args:         0, 1
+
+This property is used to hide a formula while still displaying its result. This is generally used to hide complex calculations from end users who are only interested in the result. It only has an effect if the worksheet has been protected, see the worksheet C<protect()> method.
+
+    my $hidden = $workbook->add_format();
+    $hidden->set_hidden();
+
+    # Enable worksheet protection
+    $worksheet->protect();
+
+    # The formula in this cell isn't visible
+    $worksheet->write('A1', '=1+2', $hidden);
+
+
+Note: This offers weak protection even with a password, see the note in relation to the C<protect()> method.
+
+
+
+
+=head2 set_align()
+
+    Default state:      Alignment is off
+    Default action:     Left alignment
+    Valid args:         'left'              Horizontal
+                        'center'
+                        'right'
+                        'fill'
+                        'justify'
+                        'center_across'
+
+                        'top'               Vertical
+                        'vcenter'
+                        'bottom'
+                        'vjustify'
+
+This method is used to set the horizontal and vertical text alignment within a cell. Vertical and horizontal alignments can be combined. The method is used as follows:
+
+    my $format = $workbook->add_format();
+    $format->set_align('center');
+    $format->set_align('vcenter');
+    $worksheet->set_row(0, 30);
+    $worksheet->write(0, 0, "X", $format);
+
+Text can be aligned across two or more adjacent cells using the C<center_across> property. However, for genuine merged cells it is better to use the C<merge_range()> worksheet method.
+
+The C<vjustify> (vertical justify) option can be used to provide automatic text wrapping in a cell. The height of the cell will be adjusted to accommodate the wrapped text. To specify where the text wraps use the C<set_text_wrap()> method.
+
+
+For further examples see the 'Alignment' worksheet created by formats.pl.
+
+
+
+
+=head2 set_center_across()
+
+    Default state:      Center across selection is off
+    Default action:     Turn center across on
+    Valid args:         1
+
+Text can be aligned across two or more adjacent cells using the C<set_center_across()> method. This is an alias for the C<set_align('center_across')> method call.
+
+Only one cell should contain the text, the other cells should be blank:
+
+    my $format = $workbook->add_format();
+    $format->set_center_across();
+
+    $worksheet->write(1, 1, 'Center across selection', $format);
+    $worksheet->write_blank(1, 2, $format);
+
+See also the C<merge1.pl> to C<merge6.pl> programs in the C<examples> directory and the C<merge_range()> method.
+
+
+
+=head2 set_text_wrap()
+
+    Default state:      Text wrap is off
+    Default action:     Turn text wrap on
+    Valid args:         0, 1
+
+
+Here is an example using the text wrap property, the escape character C<\n> is used to indicate the end of line:
+
+    my $format = $workbook->add_format();
+    $format->set_text_wrap();
+    $worksheet->write(0, 0, "It's\na bum\nwrap", $format);
+
+Excel will adjust the height of the row to accommodate the wrapped text. A similar effect can be obtained without newlines using the C<set_align('vjustify')> method. See the C<textwrap.pl> program in the C<examples> directory.
+
+
+
+
+=head2 set_rotation()
+
+    Default state:      Text rotation is off
+    Default action:     None
+    Valid args:         Integers in the range -90 to 90 and 270
+
+Set the rotation of the text in a cell. The rotation can be any angle in the range -90 to 90 degrees.
+
+    my $format = $workbook->add_format();
+    $format->set_rotation(30);
+    $worksheet->write(0, 0, "This text is rotated", $format);
+
+
+The angle 270 is also supported. This indicates text where the letters run from top to bottom.
+
+
+
+=head2 set_indent()
+
+
+    Default state:      Text indentation is off
+    Default action:     Indent text 1 level
+    Valid args:         Positive integers
+
+
+This method can be used to indent text. The argument, which should be an integer, is taken as the level of indentation:
+
+
+    my $format = $workbook->add_format();
+    $format->set_indent(2);
+    $worksheet->write(0, 0, "This text is indented", $format);
+
+
+Indentation is a horizontal alignment property. It will override any other horizontal properties but it can be used in conjunction with vertical properties.
+
+
+
+
+=head2 set_shrink()
+
+
+    Default state:      Text shrinking is off
+    Default action:     Turn "shrink to fit" on
+    Valid args:         1
+
+
+This method can be used to shrink text so that it fits in a cell.
+
+
+    my $format = $workbook->add_format();
+    $format->set_shrink();
+    $worksheet->write(0, 0, "Honey, I shrunk the text!", $format);
+
+
+
+
+=head2 set_text_justlast()
+
+    Default state:      Justify last is off
+    Default action:     Turn justify last on
+    Valid args:         0, 1
+
+
+Only applies to Far Eastern versions of Excel.
+
+
+
+
+=head2 set_pattern()
+
+    Default state:      Pattern is off
+    Default action:     Solid fill is on
+    Valid args:         0 .. 18
+
+Set the background pattern of a cell.
+
+Examples of the available patterns are shown in the 'Patterns' worksheet created by formats.pl. However, it is unlikely that you will ever need anything other than Pattern 1 which is a solid fill of the background color.
+
+
+
+
+=head2 set_bg_color()
+
+    Default state:      Color is off
+    Default action:     Solid fill.
+    Valid args:         See set_color()
+
+The C<set_bg_color()> method can be used to set the background colour of a pattern. Patterns are defined via the C<set_pattern()> method. If a pattern hasn't been defined then a solid fill pattern is used as the default.
+
+Here is an example of how to set up a solid fill in a cell:
+
+    my $format = $workbook->add_format();
+
+    $format->set_pattern(); # This is optional when using a solid fill
+
+    $format->set_bg_color('green');
+    $worksheet->write('A1', 'Ray', $format);
+
+For further examples see the 'Patterns' worksheet created by formats.pl.
+
+
+
+
+=head2 set_fg_color()
+
+    Default state:      Color is off
+    Default action:     Solid fill.
+    Valid args:         See set_color()
+
+
+The C<set_fg_color()> method can be used to set the foreground colour of a pattern.
+
+For further examples see the 'Patterns' worksheet created by formats.pl.
+
+
+
+
+=head2 set_border()
+
+    Also applies to:    set_bottom()
+                        set_top()
+                        set_left()
+                        set_right()
+
+    Default state:      Border is off
+    Default action:     Set border type 1
+    Valid args:         0 No border
+                        1 Thin single border
+                        2 Medium single border
+                        3 Dashed border
+                        4 Dotted border
+                        5 Thick single border
+                        6 Double line border
+                        7 Hair border
+
+
+A cell border is comprised of a border on the bottom, top, left and right. These can be set to the same value using C<set_border()> or individually using the relevant method calls shown above. Examples of the available border styles are shown in the 'Borders' worksheet created by formats.pl.
+
+
+
+
+=head2 set_border_color()
+
+    Also applies to:    set_bottom_color()
+                        set_top_color()
+                        set_left_color()
+                        set_right_color()
+
+    Default state:      Color is off
+    Default action:     Undefined
+    Valid args:         See set_color()
+
+
+Set the colour of the cell borders. A cell border is comprised of a border on the bottom, top, left and right. These can be set to the same colour using C<set_border_color()> or individually using the relevant method calls shown above. Examples of the border styles and colours are shown in the 'Borders' worksheet created by formats.pl.
+
+
+
+
+
+=head2 copy($format)
+
+
+This method is used to copy all of the properties from one Format object to another:
+
+    my $lorry1 = $workbook->add_format();
+    $lorry1->set_bold();
+    $lorry1->set_italic();
+    $lorry1->set_color('red');    # lorry1 is bold, italic and red
+
+    my $lorry2 = $workbook->add_format();
+    $lorry2->copy($lorry1);
+    $lorry2->set_color('yellow'); # lorry2 is bold, italic and yellow
+
+The C<copy()> method is only useful if you are using the method interface to Format properties. It generally isn't required if you are setting Format properties directly using hashes.
+
+
+Note: this is not a copy constructor, both objects must exist prior to copying.
+
+
+
+
+=head1 COLOURS IN EXCEL
+
+Excel provides a colour palette of 56 colours. In Spreadsheet::WriteExcel these colours are accessed via their palette index in the range 8..63. This index is used to set the colour of fonts, cell patterns and cell borders. For example:
+
+    my $format = $workbook->add_format(
+                                        color => 12, # index for blue
+                                        font  => 'Arial',
+                                        size  => 12,
+                                        bold  => 1,
+                                     );
+
+The most commonly used colours can also be accessed by name. The name acts as a simple alias for the colour index:
+
+    black     =>    8
+    blue      =>   12
+    brown     =>   16
+    cyan      =>   15
+    gray      =>   23
+    green     =>   17
+    lime      =>   11
+    magenta   =>   14
+    navy      =>   18
+    orange    =>   53
+    pink      =>   33
+    purple    =>   20
+    red       =>   10
+    silver    =>   22
+    white     =>    9
+    yellow    =>   13
+
+For example:
+
+    my $font = $workbook->add_format(color => 'red');
+
+Users of VBA in Excel should note that the equivalent colour indices are in the range 1..56 instead of 8..63.
+
+If the default palette does not provide a required colour you can override one of the built-in values. This is achieved by using the C<set_custom_color()> workbook method to adjust the RGB (red green blue) components of the colour:
+
+    my $ferrari = $workbook->set_custom_color(40, 216, 12, 12);
+
+    my $format  = $workbook->add_format(
+                                        bg_color => $ferrari,
+                                        pattern  => 1,
+                                        border   => 1
+                                      );
+
+    $worksheet->write_blank('A1', $format);
+
+The default Excel 97 colour palette is shown in C<palette.html> in the C<doc> directory  of the distro. You can generate an Excel version of the palette using C<colors.pl> in the C<examples> directory.
+
+A comparison of the colour components in the Excel 5 and Excel 97+ colour palettes is shown in C<rgb5-97.txt> in the C<doc> directory.
+
+
+You may also find the following links helpful:
+
+A detailed look at Excel's colour palette: http://www.mvps.org/dmcritchie/excel/colors.htm
+
+A decimal RGB chart: http://www.hypersolutions.org/pages/rgbdec.html
+
+A hex RGB chart: : http://www.hypersolutions.org/pages/rgbhex.html
+
+
+
+=head1 DATES IN EXCEL
+
+
+Dates and times in Excel are represented by real numbers, for example "Jan 1 2001 12:30 AM" is represented by the number 36892.521.
+
+The integer part of the number stores the number of days since the epoch and the fractional part stores the percentage of the day.
+
+The epoch can be either 1900 or 1904. Excel for Windows uses 1900 and Excel for Macintosh uses 1904. The epochs are:
+
+    1900: 0 January 1900 i.e. 31 December 1899
+    1904: 1 January 1904
+
+By default Spreadsheet::WriteExcel uses the Windows/1900 format although it generally isn't an issue since Excel on Windows and the Macintosh will convert automatically between one system and the other. To use the 1904 epoch you must use the C<set_1904()> workbook method.
+
+There are two things to note about the 1900 date format. The first is that the epoch starts on 0 January 1900. The second is that the year 1900 is erroneously but deliberately treated as a leap year. Therefore you must add an extra day to dates after 28 February 1900. The reason for this anomaly is explained in Microsoft Knowledge Base article Q181370.
+
+A date or time in Excel is like any other number. To display the number as a date you must apply a number format to it. Refer to the C<set_num_format()> method above:
+
+    $format->set_num_format('mmm d yyyy hh:mm AM/PM');
+    $worksheet->write('A1', 36892.521 , $format); # Jan 1 2001 12:30 AM
+
+You can also use the C<write_date_time()> worksheet method to write dates in  ISO8601 date format.
+
+    $worksheet->write_date_time('A2', '2001-01-01T12:20', format);
+
+See the C<write_date_time()> section of the documentation for more details.
+
+See also the C<Spreadsheet::WriteExcel::Utility> module that is included in the distro and which includes date handling functions and the DateTime::Format::Excel module, http://search.cpan.org/search?dist=DateTime-Format-Excel which is part of the DateTime project and which deals specifically with converting dates and times to and from Excel's format.
+
+
+
+
+=head1 OUTLINES AND GROUPING IN EXCEL
+
+
+Excel allows you to group rows or columns so that they can be hidden or displayed with a single mouse click. This feature is referred to as outlines.
+
+Outlines can reduce complex data down to a few salient sub-totals or summaries.
+
+This feature is best viewed in Excel but the following is an ASCII representation of what a worksheet with three outlines might look like. Rows 3-4 and rows 7-8 are grouped at level 2. Rows 2-9 are grouped at level 1. The lines at the left hand side are called outline level bars.
+
+
+            ------------------------------------------
+     1 2 3 |   |   A   |   B   |   C   |   D   |  ...
+            ------------------------------------------
+      _    | 1 |   A   |       |       |       |  ...
+     |  _  | 2 |   B   |       |       |       |  ...
+     | |   | 3 |  (C)  |       |       |       |  ...
+     | |   | 4 |  (D)  |       |       |       |  ...
+     | -   | 5 |   E   |       |       |       |  ...
+     |  _  | 6 |   F   |       |       |       |  ...
+     | |   | 7 |  (G)  |       |       |       |  ...
+     | |   | 8 |  (H)  |       |       |       |  ...
+     | -   | 9 |   I   |       |       |       |  ...
+     -     | . |  ...  |  ...  |  ...  |  ...  |  ...
+
+
+Clicking the minus sign on each of the level 2 outlines will collapse and hide the data as shown in the next figure. The minus sign changes to a plus sign to indicate that the data in the outline is hidden.
+
+            ------------------------------------------
+     1 2 3 |   |   A   |   B   |   C   |   D   |  ...
+            ------------------------------------------
+      _    | 1 |   A   |       |       |       |  ...
+     |     | 2 |   B   |       |       |       |  ...
+     | +   | 5 |   E   |       |       |       |  ...
+     |     | 6 |   F   |       |       |       |  ...
+     | +   | 9 |   I   |       |       |       |  ...
+     -     | . |  ...  |  ...  |  ...  |  ...  |  ...
+
+
+Clicking on the minus sign on the level 1 outline will collapse the remaining rows as follows:
+
+            ------------------------------------------
+     1 2 3 |   |   A   |   B   |   C   |   D   |  ...
+            ------------------------------------------
+           | 1 |   A   |       |       |       |  ...
+     +     | . |  ...  |  ...  |  ...  |  ...  |  ...
+
+
+Grouping in C<Spreadsheet::WriteExcel> is achieved by setting the outline level via the C<set_row()> and C<set_column()> worksheet methods:
+
+    set_row($row, $height, $format, $hidden, $level)
+    set_column($first_col, $last_col, $width, $format, $hidden, $level)
+
+The following example sets an outline level of 1 for rows 1 and 2 (zero-indexed) and columns B to G. The parameters C<$height> and C<$XF> are assigned default values since they are undefined:
+
+    $worksheet->set_row(1, undef, undef, 0, 1);
+    $worksheet->set_row(2, undef, undef, 0, 1);
+    $worksheet->set_column('B:G', undef, undef, 0, 1);
+
+Excel allows up to 7 outline levels. Therefore the C<$level> parameter should be in the range C<0 E<lt>= $level E<lt>= 7>.
+
+Rows and columns can be collapsed by setting the C<$hidden> flag:
+
+    $worksheet->set_row(1, undef, undef, 1, 1);
+    $worksheet->set_row(2, undef, undef, 1, 1);
+    $worksheet->set_column('B:G', undef, undef, 1, 1);
+
+For a more complete example see the C<outline.pl> program in the examples directory of the distro.
+
+Some additional outline properties can be set via the C<outline_settings()> worksheet method, see above.
+
+
+
+
+=head1 FORMULAS AND FUNCTIONS IN EXCEL
+
+
+=head2 Caveats
+
+The first thing to note is that there are still some outstanding issues with the implementation of formulas and functions:
+
+    1. Writing a formula is much slower than writing the equivalent string.
+    2. You cannot use array constants, i.e. {1;2;3}, in functions.
+    3. Unary minus isn't supported.
+    4. Whitespace is not preserved around operators.
+    5. Named ranges are not supported.
+    6. Array formulas are not supported.
+
+However, these constraints will be removed in future versions. They are here because of a trade-off between features and time. Also, it is possible to work around issue 1 using the C<store_formula()> and C<repeat_formula()> methods as described later in this section.
+
+
+
+=head2 Introduction
+
+The following is a brief introduction to formulas and functions in Excel and Spreadsheet::WriteExcel.
+
+A formula is a string that begins with an equals sign:
+
+    '=A1+B1'
+    '=AVERAGE(1, 2, 3)'
+
+The formula can contain numbers, strings, boolean values, cell references, cell ranges and functions. Named ranges are not supported. Formulas should be written as they appear in Excel, that is cells and functions must be in uppercase.
+
+Cells in Excel are referenced using the A1 notation system where the column is designated by a letter and the row by a number. Columns range from A to IV i.e. 0 to 255, rows range from 1 to 65536. The C<Spreadsheet::WriteExcel::Utility> module that is included in the distro contains helper functions for dealing with A1 notation, for example:
+
+    use Spreadsheet::WriteExcel::Utility;
+
+    ($row, $col) = xl_cell_to_rowcol('C2');  # (1, 2)
+    $str         = xl_rowcol_to_cell(1, 2);  # C2
+
+The Excel C<$> notation in cell references is also supported. This allows you to specify whether a row or column is relative or absolute. This only has an effect if the cell is copied. The following examples show relative and absolute values.
+
+    '=A1'   # Column and row are relative
+    '=$A1'  # Column is absolute and row is relative
+    '=A$1'  # Column is relative and row is absolute
+    '=$A$1' # Column and row are absolute
+
+Formulas can also refer to cells in other worksheets of the current workbook. For example:
+
+    '=Sheet2!A1'
+    '=Sheet2!A1:A5'
+    '=Sheet2:Sheet3!A1'
+    '=Sheet2:Sheet3!A1:A5'
+    q{='Test Data'!A1}
+    q{='Test Data1:Test Data2'!A1}
+
+The sheet reference and the cell reference are separated by  C<!> the exclamation mark symbol. If worksheet names contain spaces, commas o parentheses then Excel requires that the name is enclosed in single quotes as shown in the last two examples above. In order to avoid using a lot of escape characters you can use the quote operator C<q{}> to protect the quotes. See C<perlop> in the main Perl documentation. Only valid sheet names that have been added using the C<add_worksheet()> method can be used in formulas. You cannot reference external workbooks.
+
+
+The following table lists the operators that are available in Excel's formulas. The majority of the operators are the same as Perl's, differences are indicated:
+
+    Arithmetic operators:
+    =====================
+    Operator  Meaning                   Example
+       +      Addition                  1+2
+       -      Subtraction               2-1
+       *      Multiplication            2*3
+       /      Division                  1/4
+       ^      Exponentiation            2^3      # Equivalent to **
+       -      Unary minus               -(1+2)   # Not yet supported
+       %      Percent (Not modulus)     13%      # Not supported, [1]
+
+
+    Comparison operators:
+    =====================
+    Operator  Meaning                   Example
+        =     Equal to                  A1 =  B1 # Equivalent to ==
+        <>    Not equal to              A1 <> B1 # Equivalent to !=
+        >     Greater than              A1 >  B1
+        <     Less than                 A1 <  B1
+        >=    Greater than or equal to  A1 >= B1
+        <=    Less than or equal to     A1 <= B1
+
+
+    String operator:
+    ================
+    Operator  Meaning                   Example
+        &     Concatenation             "Hello " & "World!" # [2]
+
+
+    Reference operators:
+    ====================
+    Operator  Meaning                   Example
+        :     Range operator            A1:A4               # [3]
+        ,     Union operator            SUM(1, 2+2, B3)     # [4]
+
+
+    Notes:
+    [1]: You can get a percentage with formatting and modulus with MOD().
+    [2]: Equivalent to ("Hello " . "World!") in Perl.
+    [3]: This range is equivalent to cells A1, A2, A3 and A4.
+    [4]: The comma behaves like the list separator in Perl.
+
+The range and comma operators can have different symbols in non-English versions of Excel. These will be supported in a later version of Spreadsheet::WriteExcel. European users of Excel take note:
+
+    $worksheet->write('A1', '=SUM(1; 2; 3)'); # Wrong!!
+    $worksheet->write('A1', '=SUM(1, 2, 3)'); # Okay
+
+The following table lists all of the core functions supported by Excel 5 and Spreadsheet::WriteExcel. Any additional functions that are available through the "Analysis ToolPak" or other add-ins are not supported. These functions have all been tested to verify that they work.
+
+    ABS           DB            INDIRECT      NORMINV       SLN
+    ACOS          DCOUNT        INFO          NORMSDIST     SLOPE
+    ACOSH         DCOUNTA       INT           NORMSINV      SMALL
+    ADDRESS       DDB           INTERCEPT     NOT           SQRT
+    AND           DEGREES       IPMT          NOW           STANDARDIZE
+    AREAS         DEVSQ         IRR           NPER          STDEV
+    ASIN          DGET          ISBLANK       NPV           STDEVP
+    ASINH         DMAX          ISERR         ODD           STEYX
+    ATAN          DMIN          ISERROR       OFFSET        SUBSTITUTE
+    ATAN2         DOLLAR        ISLOGICAL     OR            SUBTOTAL
+    ATANH         DPRODUCT      ISNA          PEARSON       SUM
+    AVEDEV        DSTDEV        ISNONTEXT     PERCENTILE    SUMIF
+    AVERAGE       DSTDEVP       ISNUMBER      PERCENTRANK   SUMPRODUCT
+    BETADIST      DSUM          ISREF         PERMUT        SUMSQ
+    BETAINV       DVAR          ISTEXT        PI            SUMX2MY2
+    BINOMDIST     DVARP         KURT          PMT           SUMX2PY2
+    CALL          ERROR.TYPE    LARGE         POISSON       SUMXMY2
+    CEILING       EVEN          LEFT          POWER         SYD
+    CELL          EXACT         LEN           PPMT          T
+    CHAR          EXP           LINEST        PROB          TAN
+    CHIDIST       EXPONDIST     LN            PRODUCT       TANH
+    CHIINV        FACT          LOG           PROPER        TDIST
+    CHITEST       FALSE         LOG10         PV            TEXT
+    CHOOSE        FDIST         LOGEST        QUARTILE      TIME
+    CLEAN         FIND          LOGINV        RADIANS       TIMEVALUE
+    CODE          FINV          LOGNORMDIST   RAND          TINV
+    COLUMN        FISHER        LOOKUP        RANK          TODAY
+    COLUMNS       FISHERINV     LOWER         RATE          TRANSPOSE
+    COMBIN        FIXED         MATCH         REGISTER.ID   TREND
+    CONCATENATE   FLOOR         MAX           REPLACE       TRIM
+    CONFIDENCE    FORECAST      MDETERM       REPT          TRIMMEAN
+    CORREL        FREQUENCY     MEDIAN        RIGHT         TRUE
+    COS           FTEST         MID           ROMAN         TRUNC
+    COSH          FV            MIN           ROUND         TTEST
+    COUNT         GAMMADIST     MINUTE        ROUNDDOWN     TYPE
+    COUNTA        GAMMAINV      MINVERSE      ROUNDUP       UPPER
+    COUNTBLANK    GAMMALN       MIRR          ROW           VALUE
+    COUNTIF       GEOMEAN       MMULT         ROWS          VAR
+    COVAR         GROWTH        MOD           RSQ           VARP
+    CRITBINOM     HARMEAN       MODE          SEARCH        VDB
+    DATE          HLOOKUP       MONTH         SECOND        VLOOKUP
+    DATEVALUE     HOUR          N             SIGN          WEEKDAY
+    DAVERAGE      HYPGEOMDIST   NA            SIN           WEIBULL
+    DAY           IF            NEGBINOMDIST  SINH          YEAR
+    DAYS360       INDEX         NORMDIST      SKEW          ZTEST
+
+You can also modify the module to support function names in the following languages: German, French, Spanish, Portuguese, Dutch, Finnish, Italian and Swedish. See the C<function_locale.pl> program in the C<examples> directory of the distro.
+
+For a general introduction to Excel's formulas and an explanation of the syntax of the function refer to the Excel help files or the following: http://office.microsoft.com/en-us/assistance/CH062528031033.aspx
+
+If your formula doesn't work in Spreadsheet::WriteExcel try the following:
+
+    1. Verify that the formula works in Excel (or Gnumeric or OpenOffice.org).
+    2. Ensure that it isn't on the Caveats list shown above.
+    3. Ensure that cell references and formula names are in uppercase.
+    4. Ensure that you are using ':' as the range operator, A1:A4.
+    5. Ensure that you are using ',' as the union operator, SUM(1,2,3).
+    6. Ensure that the function is in the above table.
+
+If you go through steps 1-6 and you still have a problem, mail me.
+
+
+
+
+=head2 Improving performance when working with formulas
+
+Writing a large number of formulas with Spreadsheet::WriteExcel can be slow. This is due to the fact that each formula has to be parsed and with the current implementation this is computationally expensive.
+
+However, in a lot of cases the formulas that you write will be quite similar, for example:
+
+    $worksheet->write_formula('B1',    '=A1 * 3 + 50',    $format);
+    $worksheet->write_formula('B2',    '=A2 * 3 + 50',    $format);
+    ...
+    ...
+    $worksheet->write_formula('B99',   '=A999 * 3 + 50',  $format);
+    $worksheet->write_formula('B1000', '=A1000 * 3 + 50', $format);
+
+In this example the cell reference changes in iterations from C<A1> to C<A1000>. The parser treats this variable as a I<token> and arranges it according to predefined rules. However, since the parser is oblivious to the value of the token, it is essentially performing the same calculation 1000 times. This is inefficient.
+
+The way to avoid this inefficiency and thereby speed up the writing of formulas is to parse the formula once and then repeatedly substitute similar tokens.
+
+A formula can be parsed and stored via the C<store_formula()> worksheet method. You can then use the C<repeat_formula()> method to substitute C<$pattern>, C<$replace> pairs in the stored formula:
+
+    my $formula = $worksheet->store_formula('=A1 * 3 + 50');
+
+    for my $row (0..999) {
+        $worksheet->repeat_formula($row, 1, $formula, $format, 'A1', 'A'.($row +1));
+    }
+
+On an arbitrary test machine this method was 10 times faster than the brute force method shown above.
+
+For more information about how Spreadsheet::WriteExcel parses and stores formulas see the C<Spreadsheet::WriteExcel::Formula> man page.
+
+It should be noted however that the overall speed of direct formula parsing will be improved in a future version.
+
+
+
+
+=head1 EXAMPLES
+
+
+
+
+=head2 Example 1
+
+The following example shows some of the basic features of Spreadsheet::WriteExcel.
+
+
+    #!/usr/bin/perl -w
+
+    use strict;
+    use Spreadsheet::WriteExcel;
+
+    # Create a new workbook called simple.xls and add a worksheet
+    my $workbook  = Spreadsheet::WriteExcel->new("simple.xls");
+    my $worksheet = $workbook->add_worksheet();
+
+    # The general syntax is write($row, $column, $token). Note that row and
+    # column are zero indexed
+
+    # Write some text
+    $worksheet->write(0, 0,  "Hi Excel!");
+
+
+    # Write some numbers
+    $worksheet->write(2, 0,  3);          # Writes 3
+    $worksheet->write(3, 0,  3.00000);    # Writes 3
+    $worksheet->write(4, 0,  3.00001);    # Writes 3.00001
+    $worksheet->write(5, 0,  3.14159);    # TeX revision no.?
+
+
+    # Write some formulas
+    $worksheet->write(7, 0,  '=A3 + A6');
+    $worksheet->write(8, 0,  '=IF(A5>3,"Yes", "No")');
+
+
+    # Write a hyperlink
+    $worksheet->write(10, 0, 'http://www.perl.com/');
+
+
+
+
+=head2 Example 2
+
+The following is a general example which demonstrates some features of working with multiple worksheets.
+
+    #!/usr/bin/perl -w
+
+    use strict;
+    use Spreadsheet::WriteExcel;
+
+    # Create a new Excel workbook
+    my $workbook = Spreadsheet::WriteExcel->new("regions.xls");
+
+    # Add some worksheets
+    my $north = $workbook->add_worksheet("North");
+    my $south = $workbook->add_worksheet("South");
+    my $east  = $workbook->add_worksheet("East");
+    my $west  = $workbook->add_worksheet("West");
+
+    # Add a Format
+    my $format = $workbook->add_format();
+    $format->set_bold();
+    $format->set_color('blue');
+
+    # Add a caption to each worksheet
+    foreach my $worksheet ($workbook->sheets()) {
+        $worksheet->write(0, 0, "Sales", $format);
+    }
+
+    # Write some data
+    $north->write(0, 1, 200000);
+    $south->write(0, 1, 100000);
+    $east->write (0, 1, 150000);
+    $west->write (0, 1, 100000);
+
+    # Set the active worksheet
+    $south->activate();
+
+    # Set the width of the first column
+    $south->set_column(0, 0, 20);
+
+    # Set the active cell
+    $south->set_selection(0, 1);
+
+
+
+
+=head2 Example 3
+
+This example shows how to use a conditional numerical format with colours to indicate if a share price has gone up or down.
+
+    use strict;
+    use Spreadsheet::WriteExcel;
+
+    # Create a new workbook and add a worksheet
+    my $workbook  = Spreadsheet::WriteExcel->new("stocks.xls");
+    my $worksheet = $workbook->add_worksheet();
+
+    # Set the column width for columns 1, 2, 3 and 4
+    $worksheet->set_column(0, 3, 15);
+
+
+    # Create a format for the column headings
+    my $header = $workbook->add_format();
+    $header->set_bold();
+    $header->set_size(12);
+    $header->set_color('blue');
+
+
+    # Create a format for the stock price
+    my $f_price = $workbook->add_format();
+    $f_price->set_align('left');
+    $f_price->set_num_format('$0.00');
+
+
+    # Create a format for the stock volume
+    my $f_volume = $workbook->add_format();
+    $f_volume->set_align('left');
+    $f_volume->set_num_format('#,##0');
+
+
+    # Create a format for the price change. This is an example of a
+    # conditional format. The number is formatted as a percentage. If it is
+    # positive it is formatted in green, if it is negative it is formatted
+    # in red and if it is zero it is formatted as the default font colour
+    # (in this case black). Note: the [Green] format produces an unappealing
+    # lime green. Try [Color 10] instead for a dark green.
+    #
+    my $f_change = $workbook->add_format();
+    $f_change->set_align('left');
+    $f_change->set_num_format('[Green]0.0%;[Red]-0.0%;0.0%');
+
+
+    # Write out the data
+    $worksheet->write(0, 0, 'Company',$header);
+    $worksheet->write(0, 1, 'Price',  $header);
+    $worksheet->write(0, 2, 'Volume', $header);
+    $worksheet->write(0, 3, 'Change', $header);
+
+    $worksheet->write(1, 0, 'Damage Inc.'       );
+    $worksheet->write(1, 1, 30.25,    $f_price ); # $30.25
+    $worksheet->write(1, 2, 1234567,  $f_volume); # 1,234,567
+    $worksheet->write(1, 3, 0.085,    $f_change); # 8.5% in green
+
+    $worksheet->write(2, 0, 'Dump Corp.'        );
+    $worksheet->write(2, 1, 1.56,     $f_price ); # $1.56
+    $worksheet->write(2, 2, 7564,     $f_volume); # 7,564
+    $worksheet->write(2, 3, -0.015,   $f_change); # -1.5% in red
+
+    $worksheet->write(3, 0, 'Rev Ltd.'          );
+    $worksheet->write(3, 1, 0.13,     $f_price ); # $0.13
+    $worksheet->write(3, 2, 321,      $f_volume); # 321
+    $worksheet->write(3, 3, 0,        $f_change); # 0 in the font color (black)
+
+
+
+
+=head2 Example 4
+
+The following is a simple example of using functions.
+
+    #!/usr/bin/perl -w
+
+    use strict;
+    use Spreadsheet::WriteExcel;
+
+    # Create a new workbook and add a worksheet
+    my $workbook  = Spreadsheet::WriteExcel->new("stats.xls");
+    my $worksheet = $workbook->add_worksheet('Test data');
+
+    # Set the column width for columns 1
+    $worksheet->set_column(0, 0, 20);
+
+
+    # Create a format for the headings
+    my $format = $workbook->add_format();
+    $format->set_bold();
+
+
+    # Write the sample data
+    $worksheet->write(0, 0, 'Sample', $format);
+    $worksheet->write(0, 1, 1);
+    $worksheet->write(0, 2, 2);
+    $worksheet->write(0, 3, 3);
+    $worksheet->write(0, 4, 4);
+    $worksheet->write(0, 5, 5);
+    $worksheet->write(0, 6, 6);
+    $worksheet->write(0, 7, 7);
+    $worksheet->write(0, 8, 8);
+
+    $worksheet->write(1, 0, 'Length', $format);
+    $worksheet->write(1, 1, 25.4);
+    $worksheet->write(1, 2, 25.4);
+    $worksheet->write(1, 3, 24.8);
+    $worksheet->write(1, 4, 25.0);
+    $worksheet->write(1, 5, 25.3);
+    $worksheet->write(1, 6, 24.9);
+    $worksheet->write(1, 7, 25.2);
+    $worksheet->write(1, 8, 24.8);
+
+    # Write some statistical functions
+    $worksheet->write(4,  0, 'Count', $format);
+    $worksheet->write(4,  1, '=COUNT(B1:I1)');
+
+    $worksheet->write(5,  0, 'Sum', $format);
+    $worksheet->write(5,  1, '=SUM(B2:I2)');
+
+    $worksheet->write(6,  0, 'Average', $format);
+    $worksheet->write(6,  1, '=AVERAGE(B2:I2)');
+
+    $worksheet->write(7,  0, 'Min', $format);
+    $worksheet->write(7,  1, '=MIN(B2:I2)');
+
+    $worksheet->write(8,  0, 'Max', $format);
+    $worksheet->write(8,  1, '=MAX(B2:I2)');
+
+    $worksheet->write(9,  0, 'Standard Deviation', $format);
+    $worksheet->write(9,  1, '=STDEV(B2:I2)');
+
+    $worksheet->write(10, 0, 'Kurtosis', $format);
+    $worksheet->write(10, 1, '=KURT(B2:I2)');
+
+
+
+=head2 Example 5
+
+The following example converts a tab separated file called C<tab.txt> into an Excel file called C<tab.xls>.
+
+    #!/usr/bin/perl -w
+
+    use strict;
+    use Spreadsheet::WriteExcel;
+
+    open (TABFILE, "tab.txt") or die "tab.txt: $!";
+
+    my $workbook  = Spreadsheet::WriteExcel->new("tab.xls");
+    my $worksheet = $workbook->add_worksheet();
+
+    # Row and column are zero indexed
+    my $row = 0;
+
+    while (<TABFILE>) {
+        chomp;
+        # Split on single tab
+        my @Fld = split('\t', $_);
+
+        my $col = 0;
+        foreach my $token (@Fld) {
+            $worksheet->write($row, $col, $token);
+            $col++;
+        }
+        $row++;
+    }
+
+
+=head2 Additional Examples
+
+If you performed a normal installation the following examples files should have been copied to your C<~site/Spreadsheet/WriteExcel/examples> directory:
+
+The following is a description of the example files that are provided
+with Spreadsheet::WriteExcel. They are intended to demonstrate the
+different features and options of the module.
+
+
+    Getting started
+    ===============
+    bug_report.pl           A template for submitting bug reports.
+    demo.pl                 Creates a demo of some of the features.
+    formats.pl              Creates a demo of the available formatting.
+    regions.pl              Demonstrates multiple worksheets.
+    simple.pl               An example of some of the basic features.
+    stats.pl                Basic formulas and functions.
+
+    Advanced
+    ========
+    bigfile.pl              Write past the 7MB limit with OLE::Storage_Lite.
+    cgi.pl                  A simple CGI program.
+    chess.pl                An example of formatting using properties.
+    colors.pl               Demo of the colour palette and named colours.
+    comments1.pl            Add comments to worksheet cells.
+    comments2.pl            Add comments with advanced options.
+    copyformat.pl           Example of copying a cell format.
+    diag_border.pl          A simple example of diagonal cell borders.
+    easter_egg.pl           Expose the Excel97 flight simulator. A must see.
+    filehandle.pl           Examples of working with filehandles.
+    formula_result.pl       Formulas with user specified results.
+    headers.pl              Examples of worksheet headers and footers.
+    hyperlink1.pl           Shows how to create web hyperlinks.
+    hyperlink2.pl           Examples of internal and external hyperlinks.
+    images.pl               Adding bitmap images to worksheets.
+    indent.pl               An example of cell indentation.
+    merge1.pl               A simple example of cell merging.
+    merge2.pl               A simple example of cell merging with formatting.
+    merge3.pl               Add hyperlinks to merged cells.
+    merge4.pl               An advanced example of merging with formatting.
+    merge5.pl               An advanced example of merging with formatting.
+    merge6.pl               An example of merging with Unicode strings.
+    mod_perl1.pl            A simple mod_perl 1 program.
+    mod_perl2.pl            A simple mod_perl 2 program.
+    outline.pl              An example of outlines and grouping.
+    panes.pl                An examples of how to create panes.
+    protection.pl           Example of cell locking and formula hiding.
+    hide_sheet.pl           Simple example of hiding a worksheet.
+    repeat.pl               Example of writing repeated formulas.
+    right_to_left.pl        Change default sheet direction to right to left.
+    sales.pl                An example of a simple sales spreadsheet.
+    sendmail.pl             Send an Excel email attachment using Mail::Sender.
+    stats_ext.pl            Same as stats.pl with external references.
+    stocks.pl               Demonstrates conditional formatting.
+    textwrap.pl             Demonstrates text wrapping options.
+    win32ole.pl             A sample Win32::OLE example for comparison.
+    write_arrays.pl         Example of writing 1D or 2D arrays of data.
+    write_to_scalar.pl      Example of writing an Excel file to a Perl scalar.
+    write_handler1.pl       Example of extending the write() method. Step 1.
+    write_handler2.pl       Example of extending the write() method. Step 2.
+    write_handler3.pl       Example of extending the write() method. Step 3.
+    write_handler4.pl       Example of extending the write() method. Step 4.
+
+
+    Unicode
+    =======
+    unicode.pl              Simple example of using Unicode UTF16 strings.
+    unicode_japan.pl        Write Japanese Unicode strings using UTF16.
+    unicode_cyrillic.pl     Write Russian cyrillic strings using UTF8.
+    unicode_list.pl         List the chars in a Unicode font.
+    unicode_2022_jp.pl      Japanese: ISO-2022-JP to utf8 in perl 5.8.
+    unicode_8859_11.pl      Thai:     ISO-8859_11 to utf8 in perl 5.8.
+    unicode_8859_7.pl       Greek:    ISO-8859_7  to utf8 in perl 5.8.
+    unicode_big5.pl         Chinese:  BIG5        to utf8 in perl 5.8.
+    unicode_cp1251.pl       Russian:  CP1251      to utf8 in perl 5.8.
+    unicode_cp1256.pl       Arabic:   CP1256      to utf8 in perl 5.8.
+    unicode_koi8r.pl        Russian:  KOI8-R      to utf8 in perl 5.8.
+    unicode_polish_utf8.pl  Polish :  UTF8        to utf8 in perl 5.8.
+    unicode_shift_jis.pl    Japanese: Shift JIS   to utf8 in perl 5.8.
+
+
+    Utility
+    =======
+    csv2xls.pl              Program to convert a CSV file to an Excel file.
+    datecalc1.pl            Convert Unix/Perl time to Excel time.
+    datecalc2.pl            Calculate an Excel date using Date::Calc.
+    lecxe.pl                Convert Excel to WriteExcel using Win32::OLE.
+    tab2xls.pl              Program to convert a tab separated file to xls.
+
+
+    Developer
+    =========
+    convertA1.pl            Helper functions for dealing with A1 notation.
+    function_locale.pl      Add non-English function names to Formula.pm.
+    writeA1.pl              Example of how to extend the module.
+
+
+
+
+
+=head1 LIMITATIONS
+
+The following limits are imposed by Excel:
+
+    Description                          Limit
+    -----------------------------------  ------
+    Maximum number of chars in a string  32767
+    Maximum number of columns            256
+    Maximum number of rows               65536
+    Maximum chars in a sheet name        31
+    Maximum chars in a header/footer     254
+
+
+The minimum file size is 6K due to the OLE overhead. The maximum file size is approximately 7MB (7087104 bytes) of BIFF data. This can be extended by using Takanori Kawai's OLE::Storage_Lite module http://search.cpan.org/search?dist=OLE-Storage_Lite see the C<bigfile.pl> example in the C<examples> directory of the distro.
+
+
+
+
+=head1 DOWNLOADING
+
+The latest version of this module is always available at: http://search.cpan.org/search?dist=Spreadsheet-WriteExcel/
+
+
+
+
+=head1 REQUIREMENTS
+
+This module requires Perl 5.005 (or later), Parse::RecDescent and File::Temp:
+
+    http://search.cpan.org/search?dist=Parse-RecDescent/
+    http://search.cpan.org/search?dist=File-Temp/
+
+
+
+
+=head1 INSTALLATION
+
+See the INSTALL or install.html docs that come with the distribution or:
+
+http://search.cpan.org/src/JMCNAMARA/Spreadsheet-WriteExcel-2.16/INSTALL
+
+
+
+
+=head1 PORTABILITY
+
+Spreadsheet::WriteExcel will work on the majority of Windows, UNIX and Macintosh platforms. Specifically, the module will work on any system where perl packs floats in the 64 bit IEEE format. The float must also be in little-endian format but it will be reversed if necessary. Thus:
+
+    print join(" ", map { sprintf "%#02x", $_ } unpack("C*", pack "d", 1.2345)), "\n";
+
+should give (or in reverse order):
+
+    0x8d 0x97 0x6e 0x12 0x83 0xc0 0xf3 0x3f
+
+In general, if you don't know whether your system supports a 64 bit IEEE float or not, it probably does. If your system doesn't, WriteExcel will C<croak()> with the message given in the L<DIAGNOSTICS> section. You can check which platforms the module has been tested on at the CPAN testers site: http://testers.cpan.org/search?request=dist&dist=Spreadsheet-WriteExcel
+
+
+
+
+=head1 DIAGNOSTICS
+
+
+=over 4
+
+=item Filename required by Spreadsheet::WriteExcel->new()
+
+A filename must be given in the constructor.
+
+=item Can't open filename. It may be in use or protected.
+
+The file cannot be opened for writing. The directory that you are writing to  may be protected or the file may be in use by another program.
+
+=item Unable to create tmp files via File::Temp::tempfile()...
+
+This is a C<-w> warning. You will see it if you are using Spreadsheet::WriteExcel in an environment where temporary files cannot be created, in which case all data will be stored in memory. The warning is for information only: it does not affect creation but it will affect the speed of execution for large files. See the C<set_tempdir> workbook method.
+
+
+=item Maximum file size, 7087104, exceeded.
+
+The current OLE implementation only supports a maximum BIFF file of this size. This limit can be extended, see the L<LIMITATIONS> section.
+
+=item Can't locate Parse/RecDescent.pm in @INC ...
+
+Spreadsheet::WriteExcel requires the Parse::RecDescent module. Download it from CPAN: http://search.cpan.org/search?dist=Parse-RecDescent
+
+=item Couldn't parse formula ...
+
+There are a large number of warnings which relate to badly formed formulas and functions. See the L<FORMULAS AND FUNCTIONS IN EXCEL> section for suggestions on how to avoid these errors. You should also check the formula in Excel to ensure that it is valid.
+
+=item Required floating point format not supported on this platform.
+
+Operating system doesn't support 64 bit IEEE float or it is byte-ordered in a way unknown to WriteExcel.
+
+
+=item 'file.xls' cannot be accessed. The file may be read-only ...
+
+You may sometimes encounter the following error when trying to open a file in Excel: "file.xls cannot be accessed. The file may be read-only, or you may be trying to access a read-only location. Or, the server the document is stored on may not be responding."
+
+This error generally means that the Excel file has been corrupted. There are two likely causes of this: the file was FTPed in ASCII mode instead of binary mode or else the file was created with UTF8 data returned by an XML parser. See L<WORKING WITH XML> for further details.
+
+=back
+
+
+
+
+=head1 THE EXCEL BINARY FORMAT
+
+The following is some general information about the Excel binary format for anyone who may be interested.
+
+Excel data is stored in the "Binary Interchange File Format" (BIFF) file format. Details of this format are given in the Excel SDK, the "Excel Developer's Kit" from Microsoft Press. It is also included in the MSDN CD library but is no longer available on the MSDN website. Versions of the BIFF documentation are available at www.wotsit.org, http://www.wotsit.org/search.asp?page=2&s=database
+
+Charles Wybble has collected together almost all of the available information about the Excel file format. See "The Chicago Project" at http://chicago.sourceforge.net/devel/
+
+Daniel Rentz of OpenOffice.org has also written a detailed description of the Excel workbook records, see http://sc.openoffice.org/excelfileformat.pdf
+
+The BIFF portion of the Excel file is comprised of contiguous binary records that have different functions and that hold different types of data. Each BIFF record is comprised of the following three parts:
+
+        Record name;   Hex identifier, length = 2 bytes
+        Record length; Length of following data, length = 2 bytes
+        Record data;   Data, length = variable
+
+The BIFF data is stored along with other data in an OLE Compound File. This is a structured storage which acts like a file system within a file. A Compound File is comprised of storages and streams which, to follow the file system analogy, are like directories and files.
+
+The documentation for the OLE::Storage module, http://user.cs.tu-berlin.de/~schwartz/pmh/guide.html , contains one of the few descriptions of the OLE Compound File in the public domain. The Digital Imaging Group have also detailed the OLE format in the JPEG2000 specification: see Appendix A of http://www.i3a.org/pdf/wg1n1017.pdf
+
+The source code for the Excel plugin of the Gnumeric spreadsheet also contains information relevant to the Excel BIFF format and the OLE container, http://www.gnome.org/projects/gnumeric/
+
+In addition the source code for OpenOffice.org is available at http://www.openoffice.org/
+
+An article describing Spreadsheet::WriteExcel and how it works appeared in Issue 19 of The Perl Journal. It is reproduced, by kind permission, in the C<doc> directory of the distro.
+
+
+Please note that the provision of this information does not constitute an invitation to start hacking at the BIFF or OLE file formats. There are more interesting ways to waste your time. ;-)
+
+
+
+
+=head1 WRITING EXCEL FILES
+
+Depending on your requirements, background and general sensibilities you may prefer one of the following methods of getting data into Excel:
+
+=over 4
+
+=item * Win32::OLE module and office automation
+
+This requires a Windows platform and an installed copy of Excel. This is the most powerful and complete method for interfacing with Excel. See http://www.activestate.com/ASPN/Reference/Products/ActivePerl-5.6/faq/Windows/ActivePerl-Winfaq12.html and http://www.activestate.com/ASPN/Reference/Products/ActivePerl-5.6/site/lib/Win32/OLE.html If your main platform is UNIX but you have the resources to set up a separate Win32/MSOffice server, you can convert office documents to text, postscript or PDF using Win32::OLE. For a demonstration of how to do this using Perl see Docserver: http://search.cpan.org/search?mode=module&query=docserver
+
+=item * CSV, comma separated variables or text
+
+If the file extension is C<csv>, Excel will open and convert this format automatically. Generating a valid CSV file isn't as easy as it seems. Have a look at the DBD::RAM, DBD::CSV, Text::xSV and Text::CSV_XS modules.
+
+=item * DBI with DBD::ADO or DBD::ODBC
+
+Excel files contain an internal index table that allows them to act like a database file. Using one of the standard Perl database modules you can connect to an Excel file as a database.
+
+=item * DBD::Excel
+
+You can also access Spreadsheet::WriteExcel using the standard DBI interface via Takanori Kawai's DBD::Excel module http://search.cpan.org/dist/DBD-Excel
+
+=item * Spreadsheet::WriteExcelXML
+
+This module allows you to create an Excel XML file using the same interface as Spreadsheet::WriteExcel. See: http://search.cpan.org/dist/Spreadsheet-WriteExcelXML
+
+=item * Excel::Template
+
+This module allows you to create an Excel file from an XML template in a manner similar to HTML::Template. See http://search.cpan.org/dist/Excel-Template/
+
+=item * Spreadsheet::WriteExcel::FromXML
+
+This module allows you to turn a simple XML file into an Excel file using Spreadsheet::WriteExcel as a backend. The format of the XML file is defined by a supplied DTD: http://search.cpan.org/dist/Spreadsheet-WriteExcel-FromXML
+
+=item * Spreadsheet::WriteExcel::Simple
+
+This provides an easier interface to Spreadsheet::WriteExcel: http://search.cpan.org/dist/Spreadsheet-WriteExcel-Simple
+
+=item * Spreadsheet::WriteExcel::FromDB
+
+This is a useful module for creating Excel files directly from a DB table: http://search.cpan.org/dist/Spreadsheet-WriteExcel-FromDB
+
+=item * HTML tables
+
+This is an easy way of adding formatting via a text based format.
+
+=item * XML or HTML
+
+The Excel XML and HTML file specification are available from http://msdn.microsoft.com/library/officedev/ofxml2k/ofxml2k.htm
+
+=back
+
+For other Perl-Excel modules try the following search: http://search.cpan.org/search?mode=module&query=excel
+
+
+
+
+=head1 READING EXCEL FILES
+
+To read data from Excel files try:
+
+=over 4
+
+=item * Spreadsheet::ParseExcel
+
+This uses the OLE::Storage-Lite module to extract data from an Excel file. http://search.cpan.org/dist/Spreadsheet-ParseExcel
+
+=item * Spreadsheet::ParseExcel_XLHTML
+
+This module uses Spreadsheet::ParseExcel's interface but uses xlHtml (see below) to do the conversion: http://search.cpan.org/dist/Spreadsheet-ParseExcel_XLHTML
+Spreadsheet::ParseExcel_XLHTML
+
+=item * xlHtml
+
+This is an open source "Excel to HTML Converter" C/C++ project at http://chicago.sourceforge.net/xlhtml/
+
+=item * DBD::Excel (reading)
+
+You can also access Spreadsheet::ParseExcel using the standard DBI interface via  Takanori Kawai's DBD::Excel module http://search.cpan.org/dist/DBD-Excel
+
+=item * Win32::OLE module and office automation (reading)
+
+See, the section L<WRITING EXCEL FILES>.
+
+=item * HTML tables (reading)
+
+If the files are saved from Excel in a HTML format the data can be accessed using HTML::TableExtract http://search.cpan.org/dist/HTML-TableExtract
+
+=item * DBI with DBD::ADO or DBD::ODBC.
+
+See, the section L<WRITING EXCEL FILES>.
+
+=item * XML::Excel
+
+Converts Excel files to XML using Spreadsheet::ParseExcel http://search.cpan.org/dist/XML-Excel.
+
+=item * OLE::Storage, aka LAOLA
+
+This is a Perl interface to OLE file formats. In particular, the distro contains an Excel to HTML converter called Herbert, http://user.cs.tu-berlin.de/~schwartz/pmh/ This has been superseded by the Spreadsheet::ParseExcel module.
+
+=back
+
+
+For other Perl-Excel modules try the following search: http://search.cpan.org/search?mode=module&query=excel
+
+If you wish to view Excel files on a UNIX/Linux platform check out the excellent Gnumeric spreadsheet application at http://www.gnome.org/projects/gnumeric/ or OpenOffice.org at http://www.openoffice.org/
+
+If you wish to view Excel files on a Windows platform which doesn't have Excel installed you can use the free Microsoft Excel Viewer http://office.microsoft.com/downloads/2000/xlviewer.aspx
+
+
+
+
+=head1 Warning about XML::Parser and Perl 5.6
+
+You must be careful when using Spreadsheet::WriteExcel in conjunction with Perl 5.6 and XML::Parser (and other XML parsers) due to the fact that the data returned by the parser is generally in UTF8 format.
+
+When UTF8 strings are added to Spreadsheet::WriteExcel's internal data it causes the generated Excel file to become corrupt.
+
+Note, this doesn't affect Perl 5.005 (which doesn't try to handle UTF8) or 5.8 (which handles it correctly).
+
+To avoid this problem you should upgrade to Perl 5.8, if possible, or else you should convert the output data from XML::Parser to ASCII or ISO-8859-1 using one of the following methods:
+
+    $new_str = pack 'C*', unpack 'U*', $utf8_str;
+
+
+    use Unicode::MapUTF8 'from_utf8';
+    $new_str = from_utf8({-str => $utf8_str, -charset => 'ISO-8859-1'});
+
+
+
+
+=head1 BUGS
+
+Formulas are formulae.
+
+XML and UTF8 data on Perl 5.6 can cause Excel files created by Spreadsheet::WriteExcel to become corrupt. See L<Warning about XML::Parser and Perl 5.6> for further details.
+
+The format object that is used with a C<merge_range()> method call is marked internally as being associated with a merged range.It is a fatal error to use a merged format in a non-merged cell. The current workaround is to use separate formats for merged and non-merged cell. This restriction will be removed in a future release.
+
+Nested formulas sometimes aren't parsed correctly and give a result of "#VALUE". If you come across a formula that parses like this, let me know.
+
+Spreadsheet::ParseExcel: All formulas created by Spreadsheet::WriteExcel are read as having a value of zero. This is because Spreadsheet::WriteExcel only stores the formula and not the calculated result.
+
+OpenOffice.org: Images are not displayed. Some formatting is not displayed correctly.
+
+Gnumeric: Images are not displayed. Some formatting is not displayed correctly. URLs are not displayed as links. Page setup may cause Gnumeric to crash.
+
+The lack of a portable way of writing a little-endian 64 bit IEEE float. There is beta code available to fix this. Let me know if you wish to test it on your platform.
+
+If you wish to submit a bug report run the C<bug_report.pl> program in the C<examples> directory of the distro.
+
+
+
+
+=head1 TO DO
+
+The roadmap is as follows:
+
+=over 4
+
+=item * Fix insert_bitmap to work with write_comment(), OpenOffice.org and Gnumeric.
+
+=item * Add AutoFilters.
+
+=item * Add better defaults for Excel on the Mac.
+
+
+=back
+
+Also, here are some of the most requested features that probably won't get added:
+
+=over 4
+
+=item * Macros.
+
+This would solve some other problems neatly. However, the format of Excel macros isn't documented.
+
+=item * Some feature that you really need. ;-)
+
+
+=back
+
+If there is some feature of an Excel file that you really, really need then you should use Win32::OLE with Excel on Windows. If you are on Unix you could consider connecting to a Windows server via Docserver or SOAP, see L<WRITING EXCEL FILES>.
+
+
+
+
+=head1 MAILING LIST
+
+There is a Google group for discussing and asking questions about Spreadsheet::WriteExcel:  http://groups-beta.google.com/group/spreadsheet-writeexcel/
+
+Alternatively you can keep up to date with future releases by subscribing at:
+http://freshmeat.net/projects/writeexcel/
+
+
+
+
+=head1 DONATATIONS
+
+If you'd care to donate to the Spreadsheet::WriteExcel project, you can do so via PayPal: http://tinyurl.com/7ayes
+
+
+
+
+=head1 SEE ALSO
+
+Spreadsheet::ParseExcel: http://search.cpan.org/dist/Spreadsheet-ParseExcel
+
+Spreadsheet-WriteExcel-FromXML: http://search.cpan.org/dist/Spreadsheet-WriteExcel-FromXML
+
+Spreadsheet::WriteExcel::FromDB: http://search.cpan.org/dist/Spreadsheet-WriteExcel-FromDB
+
+Excel::Template: http://search.cpan.org/~rkinyon/Excel-Template/
+
+DateTime::Format::Excel: http://search.cpan.org/dist/DateTime-Format-Excel
+
+"Reading and writing Excel files with Perl" by Teodor Zlatanov, atIBM developerWorks: http://www-106.ibm.com/developerworks/library/l-pexcel/
+
+"Excel-Dateien mit Perl erstellen - Controller im Glück" by Peter Dintelmann and Christian Kirsch in the German Unix/web journal iX: http://www.heise.de/ix/artikel/2001/06/175/
+
+Spreadsheet::WriteExcel documentation in Japanese by Takanori Kawai. http://member.nifty.ne.jp/hippo2000/perltips/Spreadsheet/WriteExcel.htm
+
+Oesterly user brushes with fame:
+http://oesterly.com/releases/12102000.html
+
+
+=head1 ACKNOWLEDGEMENTS
+
+
+The following people contributed to the debugging and testing of Spreadsheet::WriteExcel:
+
+Alexander Farber, Andre de Bruin, Arthur at ais, Artur Silveira da Cunha, Borgar Olsen, Brian White, Bob Mackay, Cedric Bouvier, Chad Johnson, CPAN testers, Damyan Ivanov, Daniel Berger, Daniel Gardner, Dmitry Kochurov, Eric Frazier, Ernesto Baschny, Felipe Pérez Galiana, Gordon Simpson, Hanc Pavel, Harold Bamford, James Holmes, James Wilkinson, Johan Ekenberg, Johann Hanne, Jonathan Scott Duff, J.C. Wren, Kenneth Stacey, Keith Miller, Kyle Krom, Marc Rosenthal, Markus Schmitz, Michael Braig, Michael Buschauer, Mike Blazer, Michael Erickson, Michael W J West, Ning Xie, Paul J. Falbe, Paul Medynski, Peter Dintelmann, Pierre Laplante, Praveen Kotha, Reto Badertscher, Rich Sorden, Shane Ashby, Shenyu Zheng, Stephan Loescher, Steve Sapovits, Sven Passig, Svetoslav Marinov, Tamas Gulacsi, Troy Daniels, Vahe Sarkissian.
+
+The following people contributed patches, examples or Excel information:
+
+Andrew Benham, Bill Young, Cedric Bouvier, Charles Wybble, Daniel Rentz, David Robins, Franco Venturi, Guy Albertelli, Ian Penman, John Heitmann, Jon Guy, Kyle R. Burton, Pierre-Jean Vouette, Rubio, Marco Geri, Mark Fowler, Matisse Enzer, Sam Kington, Takanori Kawai, Tom O'Sullivan.
+
+Many thanks to Ron McKelvey, Ronzo Consulting for Siemens, who sponsored the development of the formula caching routines.
+
+Additional thanks to Takanori Kawai for translating the documentation into Japanese.
+
+Gunnar Wolf maintains the Debian distro.
+
+Thanks to Damian Conway for the excellent Parse::RecDescent.
+
+Thanks to Tim Jenness for File::Temp.
+
+Thanks to Michael Meeks and Jody Goldberg for their work on Gnumeric.
+
+
+
+
+=head1 AUTHOR
+
+John McNamara jmcnamara at cpan.org
+
+    I saw the best minds of my generation destroyed by
+          madness, starving hysterical naked,
+    dragging themselves through the negro streets at dawn
+          looking for an angry fix,
+    angelheaded hipsters burning for the ancient heavenly
+          connection to the starry dynamo in the machin-
+          ery of night,
+    who poverty and tatters and hollow-eyed and high sat
+          up smoking in the supernatural darkness of
+          cold-water flats floating across the tops of cities
+          contemplating jazz,
+
+        -- Allen Ginsberg
+
+
+=head1 COPYRIGHT
+
+© MM-MMVI, John McNamara.
+
+All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/t/00_IEEE_double.t
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/t/00_IEEE_double.t	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/t/00_IEEE_double.t	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,34 +1,34 @@
-
-#####################################################
-# We start with some black magic to print on failure.
-
-BEGIN { $| = 1; print "1..2\n"; }
-END {print "not ok 1\n" unless $loaded;}
-use Spreadsheet::WriteExcel;
-$loaded = 1;
-print "ok 1\n";
-
-#####################################################
-# End of black magic.
-
-
-
-# TEST 2
-#
-# Check if "pack" gives the required IEEE 64bit float
-my $teststr = pack "d", 1.2345;
-my @hexdata = (0x8D, 0x97, 0x6E, 0x12, 0x83, 0xC0, 0xF3, 0x3F);
-my $number  = pack "C8", @hexdata;
-
-if ($number eq $teststr) {
-    # Little Endian
-    print "ok 2\n";
-}
-elsif ($number eq reverse($teststr)){
-    # Big Endian
-    print "ok 2\n";
-}
-else {
-    # Give up. I'll fix this in a later version.
-    print "not ok 2\n";
-}
+
+#####################################################
+# We start with some black magic to print on failure.
+
+BEGIN { $| = 1; print "1..2\n"; }
+END {print "not ok 1\n" unless $loaded;}
+use Spreadsheet::WriteExcel;
+$loaded = 1;
+print "ok 1\n";
+
+#####################################################
+# End of black magic.
+
+
+
+# TEST 2
+#
+# Check if "pack" gives the required IEEE 64bit float
+my $teststr = pack "d", 1.2345;
+my @hexdata = (0x8D, 0x97, 0x6E, 0x12, 0x83, 0xC0, 0xF3, 0x3F);
+my $number  = pack "C8", @hexdata;
+
+if ($number eq $teststr) {
+    # Little Endian
+    print "ok 2\n";
+}
+elsif ($number eq reverse($teststr)){
+    # Big Endian
+    print "ok 2\n";
+}
+else {
+    # Give up. I'll fix this in a later version.
+    print "not ok 2\n";
+}

Modified: packages/libspreadsheet-writeexcel-perl/trunk/t/01_add_worksheet.t
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/t/01_add_worksheet.t	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/t/01_add_worksheet.t	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,206 +1,206 @@
-#!/usr/bin/perl -wl
-
-###############################################################################
-#
-# A test for Spreadsheet::WriteExcel.
-#
-# Tests for valid worksheet name handling.
-#
-# reverse('©'), March 2005, John McNamara, jmcnamara at cpan.org
-#
-
-
-use strict;
-
-use Spreadsheet::WriteExcel;
-use Test::More tests => 69;
-
-
-# Tests for valid and invalid worksheet names
-my @tests1  = (
-                # Tests for valid names
-                [ 'PASS', undef,      'No worksheet name'           ],
-                [ 'PASS', '',         'Blank worksheet name'        ],
-                [ 'PASS', 'Sheet10',  'Valid worksheet name'        ],
-                [ 'PASS', 'a' x 31,   'Valid 31 char name'          ],
-
-                # Tests for invalid names
-                [ 'FAIL', 'Sheet1',   'Caught duplicate name'       ],
-                [ 'FAIL', 'Sheet2',   'Caught duplicate name'       ],
-                [ 'FAIL', 'Sheet3',   'Caught duplicate name'       ],
-                [ 'FAIL', 'sheet1',   'Caught case-insensitive name'],
-                [ 'FAIL', 'SHEET1',   'Caught case-insensitive name'],
-                [ 'FAIL', 'sheetz',   'Caught case-insensitive name'],
-                [ 'FAIL', 'SHEETZ',   'Caught case-insensitive name'],
-                [ 'FAIL', 'a' x 32,   'Caught long name'            ],
-                [ 'FAIL', '[',        'Caught invalid char'         ],
-                [ 'FAIL', ']',        'Caught invalid char'         ],
-                [ 'FAIL', ':',        'Caught invalid char'         ],
-                [ 'FAIL', '*',        'Caught invalid char'         ],
-                [ 'FAIL', '?',        'Caught invalid char'         ],
-                [ 'FAIL', '/',        'Caught invalid char'         ],
-                [ 'FAIL', '\\',       'Caught invalid char'         ],
-
-             );
-
-
-
-
-###############################################################################
-#
-# Tests 1. ASCII tests
-#
-my $test_file  = "temp_test_file.xml";
-my $workbook   = Spreadsheet::WriteExcel->new($test_file);
-my $worksheet1 = $workbook->add_worksheet();        # Implicit name 'Sheet1'
-my $worksheet2 = $workbook->add_worksheet();        # Implicit name 'Sheet2'
-my $worksheet3 = $workbook->add_worksheet('Sheet3');
-my $worksheet4 = $workbook->add_worksheet('Sheetz');
-
-for my $test_ref (@tests1) {
-
-    my $target    = $test_ref->[0];
-    my $sheetname = $test_ref->[1];
-    my $caption   = $test_ref->[2];
-
-    eval {$workbook->_check_sheetname($sheetname)};
-
-    my $result = $@ ? 'FAIL' : 'PASS';
-
-    $sheetname = 'undef' unless defined $sheetname;
-
-    is($result, $target, sprintf " \t%-7s %-28s: %s",
-                                 'ASCII:', $caption, $sheetname);
-}
-
-$workbook->close();
-
-
-###############################################################################
-#
-# Tests 2. UTF16-BE tests
-#
-
-$workbook   = Spreadsheet::WriteExcel->new($test_file);
-$worksheet1 = $workbook->add_worksheet();        # Implicit name 'Sheet1'
-$worksheet2 = $workbook->add_worksheet();        # Implicit name 'Sheet2'
-$worksheet3 = $workbook->add_worksheet('Sheet3');
-$worksheet4 = $workbook->add_worksheet("\0S\0h\0e\0e\0t\0z", 1);
-
-for my $test_ref (@tests1) {
-
-    my $target    = $test_ref->[0];
-    my $sheetname = $test_ref->[1];
-    my $caption   = $test_ref->[2];
-
-    # Convert ASCII to UTF16-BE if not blank or undef
-    $sheetname = pack "n*", unpack "C*", $sheetname if $sheetname;
-
-    eval {$workbook->_check_sheetname($sheetname, 1)};
-
-    my $result = $@ ? 'FAIL' : 'PASS';
-
-    $sheetname = 'undef' unless defined $sheetname;
-
-    # Change null byte to \0 for printing
-    $sheetname =~ s/\0/\\0/g;
-
-    is($result, $target, sprintf " \t%-7s %-28s: %s",
-                                 'UTF-16:', $caption, $sheetname);
-}
-
-$workbook->close();
-
-
-
-###############################################################################
-#
-# Tests 3. UTF-8 tests
-#
-
-SKIP: {
-
-
-my $uni = chr 0x263A;
-my @tests2  = (
-                # Tests for valid names
-                [ 'PASS', $uni,      'Unicode char'                 ],
-                [ 'PASS', $uni x 31,   'Valid 31 char name'         ],
-
-                # Tests for invalid names
-                [ 'FAIL', chr 0x0438, 'Caught duplicate name'       ],
-                [ 'FAIL', chr 0x0418, 'Caught case-insensitive name'],
-                [ 'FAIL', $uni x 32,  'Caught long name'            ],
-                [ 'FAIL', '[' . $uni, 'Caught invalid char'         ],
-                [ 'FAIL', ']' . $uni, 'Caught invalid char'         ],
-                [ 'FAIL', ':' . $uni, 'Caught invalid char'         ],
-                [ 'FAIL', '*' . $uni, 'Caught invalid char'         ],
-                [ 'FAIL', '?' . $uni, 'Caught invalid char'         ],
-                [ 'FAIL', '/' . $uni, 'Caught invalid char'         ],
-                [ 'FAIL', '\\'. $uni, 'Caught invalid char'         ],
-
-             );
-
-skip "\tskipped tests requires Perl 5.8 Unicode support", 0 + @tests1 + @tests2 if $] < 5.008;
-
-
-$workbook   = Spreadsheet::WriteExcel->new($test_file);
-$worksheet1 = $workbook->add_worksheet();        # Implicit name 'Sheet1'
-$worksheet2 = $workbook->add_worksheet();        # Implicit name 'Sheet2'
-$worksheet3 = $workbook->add_worksheet('Sheet3');
-$worksheet4 = $workbook->add_worksheet("\0S\0h\0e\0e\0t\0z", 1);
-my $worksheet5 = $workbook->add_worksheet(chr 0x0438);
-
-
-for my $test_ref (@tests1) {
-
-    my $target    = $test_ref->[0];
-    my $sheetname = $test_ref->[1];
-    my $caption   = $test_ref->[2];
-
-    require Encode;
-    $sheetname = Encode::encode_utf8($sheetname) if $sheetname;
-
-    eval {$workbook->_check_sheetname($sheetname)};
-
-    my $result = $@ ? 'FAIL' : 'PASS';
-
-    $sheetname = 'undef' unless defined $sheetname;
-
-    # Change null byte to \0 for printing
-    $sheetname =~ s/\0/\\0/g;
-
-    is($result, $target, sprintf " \t%-7s %-28s: %s",
-                                 'UTF-8:', $caption, $sheetname);
-}
-
-
-for my $test_ref (@tests2) {
-
-    my $target    = $test_ref->[0];
-    my $sheetname = $test_ref->[1];
-    my $caption   = $test_ref->[2];
-
-    eval {$workbook->_check_sheetname($sheetname)};
-
-    my $result = $@ ? 'FAIL' : 'PASS';
-
-    $sheetname = 'undef' unless defined $sheetname;
-
-    is($result, $target, sprintf " \t%-7s %-28s: %s",
-                                 'UTF-8:', $caption, '');
-}
-
-
-$workbook->close();
-
-
-}
-
-unlink $test_file;
-
-
-__END__
-
-
-
+#!/usr/bin/perl -wl
+
+###############################################################################
+#
+# A test for Spreadsheet::WriteExcel.
+#
+# Tests for valid worksheet name handling.
+#
+# reverse('©'), March 2005, John McNamara, jmcnamara at cpan.org
+#
+
+
+use strict;
+
+use Spreadsheet::WriteExcel;
+use Test::More tests => 69;
+
+
+# Tests for valid and invalid worksheet names
+my @tests1  = (
+                # Tests for valid names
+                [ 'PASS', undef,      'No worksheet name'           ],
+                [ 'PASS', '',         'Blank worksheet name'        ],
+                [ 'PASS', 'Sheet10',  'Valid worksheet name'        ],
+                [ 'PASS', 'a' x 31,   'Valid 31 char name'          ],
+
+                # Tests for invalid names
+                [ 'FAIL', 'Sheet1',   'Caught duplicate name'       ],
+                [ 'FAIL', 'Sheet2',   'Caught duplicate name'       ],
+                [ 'FAIL', 'Sheet3',   'Caught duplicate name'       ],
+                [ 'FAIL', 'sheet1',   'Caught case-insensitive name'],
+                [ 'FAIL', 'SHEET1',   'Caught case-insensitive name'],
+                [ 'FAIL', 'sheetz',   'Caught case-insensitive name'],
+                [ 'FAIL', 'SHEETZ',   'Caught case-insensitive name'],
+                [ 'FAIL', 'a' x 32,   'Caught long name'            ],
+                [ 'FAIL', '[',        'Caught invalid char'         ],
+                [ 'FAIL', ']',        'Caught invalid char'         ],
+                [ 'FAIL', ':',        'Caught invalid char'         ],
+                [ 'FAIL', '*',        'Caught invalid char'         ],
+                [ 'FAIL', '?',        'Caught invalid char'         ],
+                [ 'FAIL', '/',        'Caught invalid char'         ],
+                [ 'FAIL', '\\',       'Caught invalid char'         ],
+
+             );
+
+
+
+
+###############################################################################
+#
+# Tests 1. ASCII tests
+#
+my $test_file  = "temp_test_file.xml";
+my $workbook   = Spreadsheet::WriteExcel->new($test_file);
+my $worksheet1 = $workbook->add_worksheet();        # Implicit name 'Sheet1'
+my $worksheet2 = $workbook->add_worksheet();        # Implicit name 'Sheet2'
+my $worksheet3 = $workbook->add_worksheet('Sheet3');
+my $worksheet4 = $workbook->add_worksheet('Sheetz');
+
+for my $test_ref (@tests1) {
+
+    my $target    = $test_ref->[0];
+    my $sheetname = $test_ref->[1];
+    my $caption   = $test_ref->[2];
+
+    eval {$workbook->_check_sheetname($sheetname)};
+
+    my $result = $@ ? 'FAIL' : 'PASS';
+
+    $sheetname = 'undef' unless defined $sheetname;
+
+    is($result, $target, sprintf " \t%-7s %-28s: %s",
+                                 'ASCII:', $caption, $sheetname);
+}
+
+$workbook->close();
+
+
+###############################################################################
+#
+# Tests 2. UTF16-BE tests
+#
+
+$workbook   = Spreadsheet::WriteExcel->new($test_file);
+$worksheet1 = $workbook->add_worksheet();        # Implicit name 'Sheet1'
+$worksheet2 = $workbook->add_worksheet();        # Implicit name 'Sheet2'
+$worksheet3 = $workbook->add_worksheet('Sheet3');
+$worksheet4 = $workbook->add_worksheet("\0S\0h\0e\0e\0t\0z", 1);
+
+for my $test_ref (@tests1) {
+
+    my $target    = $test_ref->[0];
+    my $sheetname = $test_ref->[1];
+    my $caption   = $test_ref->[2];
+
+    # Convert ASCII to UTF16-BE if not blank or undef
+    $sheetname = pack "n*", unpack "C*", $sheetname if $sheetname;
+
+    eval {$workbook->_check_sheetname($sheetname, 1)};
+
+    my $result = $@ ? 'FAIL' : 'PASS';
+
+    $sheetname = 'undef' unless defined $sheetname;
+
+    # Change null byte to \0 for printing
+    $sheetname =~ s/\0/\\0/g;
+
+    is($result, $target, sprintf " \t%-7s %-28s: %s",
+                                 'UTF-16:', $caption, $sheetname);
+}
+
+$workbook->close();
+
+
+
+###############################################################################
+#
+# Tests 3. UTF-8 tests
+#
+
+SKIP: {
+
+
+my $uni = chr 0x263A;
+my @tests2  = (
+                # Tests for valid names
+                [ 'PASS', $uni,      'Unicode char'                 ],
+                [ 'PASS', $uni x 31,   'Valid 31 char name'         ],
+
+                # Tests for invalid names
+                [ 'FAIL', chr 0x0438, 'Caught duplicate name'       ],
+                [ 'FAIL', chr 0x0418, 'Caught case-insensitive name'],
+                [ 'FAIL', $uni x 32,  'Caught long name'            ],
+                [ 'FAIL', '[' . $uni, 'Caught invalid char'         ],
+                [ 'FAIL', ']' . $uni, 'Caught invalid char'         ],
+                [ 'FAIL', ':' . $uni, 'Caught invalid char'         ],
+                [ 'FAIL', '*' . $uni, 'Caught invalid char'         ],
+                [ 'FAIL', '?' . $uni, 'Caught invalid char'         ],
+                [ 'FAIL', '/' . $uni, 'Caught invalid char'         ],
+                [ 'FAIL', '\\'. $uni, 'Caught invalid char'         ],
+
+             );
+
+skip "\tskipped tests requires Perl 5.8 Unicode support", 0 + @tests1 + @tests2 if $] < 5.008;
+
+
+$workbook   = Spreadsheet::WriteExcel->new($test_file);
+$worksheet1 = $workbook->add_worksheet();        # Implicit name 'Sheet1'
+$worksheet2 = $workbook->add_worksheet();        # Implicit name 'Sheet2'
+$worksheet3 = $workbook->add_worksheet('Sheet3');
+$worksheet4 = $workbook->add_worksheet("\0S\0h\0e\0e\0t\0z", 1);
+my $worksheet5 = $workbook->add_worksheet(chr 0x0438);
+
+
+for my $test_ref (@tests1) {
+
+    my $target    = $test_ref->[0];
+    my $sheetname = $test_ref->[1];
+    my $caption   = $test_ref->[2];
+
+    require Encode;
+    $sheetname = Encode::encode_utf8($sheetname) if $sheetname;
+
+    eval {$workbook->_check_sheetname($sheetname)};
+
+    my $result = $@ ? 'FAIL' : 'PASS';
+
+    $sheetname = 'undef' unless defined $sheetname;
+
+    # Change null byte to \0 for printing
+    $sheetname =~ s/\0/\\0/g;
+
+    is($result, $target, sprintf " \t%-7s %-28s: %s",
+                                 'UTF-8:', $caption, $sheetname);
+}
+
+
+for my $test_ref (@tests2) {
+
+    my $target    = $test_ref->[0];
+    my $sheetname = $test_ref->[1];
+    my $caption   = $test_ref->[2];
+
+    eval {$workbook->_check_sheetname($sheetname)};
+
+    my $result = $@ ? 'FAIL' : 'PASS';
+
+    $sheetname = 'undef' unless defined $sheetname;
+
+    is($result, $target, sprintf " \t%-7s %-28s: %s",
+                                 'UTF-8:', $caption, '');
+}
+
+
+$workbook->close();
+
+
+}
+
+unlink $test_file;
+
+
+__END__
+
+
+

Deleted: packages/libspreadsheet-writeexcel-perl/trunk/t/01_merge_formats.t
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/t/01_merge_formats.t	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/t/01_merge_formats.t	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,125 +0,0 @@
-#!/usr/bin/perl -w
-
-###############################################################################
-#
-# A test for Spreadsheet::WriteExcel.
-#
-# Tests to ensure merge formats aren't used in non-merged cells and
-# vice-versa. This is temporary feature to prevent users from inadvertently
-# making this error.
-#
-# reverse('©'), April 2005, John McNamara, jmcnamara at cpan.org
-#
-
-
-use strict;
-
-use Spreadsheet::WriteExcel;
-use Test::More tests => 8;
-
-
-###############################################################################
-#
-# Tests setup
-#
-my $test_file           = "temp_test_file.xml";
-my $workbook            = Spreadsheet::WriteExcel->new($test_file);
-my $worksheet           = $workbook->add_worksheet();
-my $merged_format       = $workbook->add_format(bold => 1);
-my $non_merged_format   = $workbook->add_format(bold => 1);
-
-
-$worksheet->set_row(5, undef, $merged_format);
-$worksheet->set_column('G:G', undef, $merged_format);
-
-###############################################################################
-#
-# Test
-#
-eval {
-    $worksheet->write      ('A1',    'Test', $non_merged_format);
-    $worksheet->merge_range('A3:B4', 'Test', $merged_format    );
-};
-ok(! $@, " \tNormal usage.");
-
-
-###############################################################################
-#
-# Test
-#
-eval {
-    $worksheet->write      ('D1',    'Test', $merged_format    );
-};
-ok(  $@, " \tMerge format in non-merged cell.");
-
-
-###############################################################################
-#
-# Test
-#
-eval {
-    $worksheet->merge_range('D3:E4', 'Test', $non_merged_format);
-};
-ok(  $@, " \tNon merge format in merged cells.");
-
-
-###############################################################################
-#
-# Test
-#
-eval {
-    $worksheet->write('G1', 'Test',);
-};
-ok(  $@, " \tMerge format in column.");
-
-
-###############################################################################
-#
-# Test
-#
-eval {
-    $worksheet->write('A6', 'Test',);
-};
-ok(  $@, " \tMerge format in row.");
-
-
-###############################################################################
-#
-# Test
-#
-eval {
-    $worksheet->write('G6', 'Test',);
-};
-ok(  $@, " \tMerge format in column and row.");
-
-
-###############################################################################
-#
-# Test
-#
-eval {
-    $worksheet->write('H7', 'Test',);
-};
-ok(! $@, " \tNo merge format in column and row.");
-
-###############################################################################
-#
-# Test
-#
-eval {
-    $worksheet->write      ('A1',    'Test', $non_merged_format);
-    $worksheet->merge_range('A3:B4', 'Test', $merged_format    );
-};
-ok(! $@, " \tNormal usage again.");
-
-
-
-
-$workbook->close();
-unlink $test_file;
-
-
-__END__
-
-
-

Copied: packages/libspreadsheet-writeexcel-perl/trunk/t/02_merge_formats.t (from rev 1957, packages/libspreadsheet-writeexcel-perl/branches/upstream/current/t/02_merge_formats.t)

Modified: packages/libspreadsheet-writeexcel-perl/trunk/t/11_date_time.t
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/t/11_date_time.t	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/t/11_date_time.t	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,494 +1,494 @@
-#!/usr/bin/perl -w
-
-###############################################################################
-#
-# A test for Spreadsheet::WriteExcel.
-#
-# Tests date and time handling.
-#
-# reverse('©'), May 2004, John McNamara, jmcnamara at cpan.org
-#
-
-use strict;
-
-use Spreadsheet::WriteExcel;
-use Test::More tests => 100;
-
-my $date_time;
-my $number;
-my $result;
-my $test_file = "temp_test_file.xls";
-
-my $workbook  = Spreadsheet::WriteExcel->new($test_file);
-my $worksheet = $workbook->add_worksheet();
-
-
-# Set float difference limit to half of an Excel millisecond
-my $flt_delta = 0.5/(24*60*60*1000);
-
-
-##############################################################################
-#
-# Float comparison function.
-#
-sub flt_cmp {
-    return abs($_[0] - $_[1]) < $flt_delta;
-}
-
-
-
-##############################################################################
-#
-# Test the flt_cmp() function used in the other tests.
-#
-
-$date_time = '1899-12-31T00:00:00.0004';
-$number    = 0;
-$result    = $worksheet->convert_date_time($date_time);
-$result    = -1 unless defined $result;
-
-# Test 1. This should pass. It is less than the float diff limit.
-ok(flt_cmp($number, $result),
-           " Testing convert_date_time: $date_time $number");
-
-$date_time = '1899-12-31T00:00:00.0005';
-$number    = 0;
-$result    = $worksheet->convert_date_time($date_time);
-$result    = -1 unless defined $result;
-
-# Test 2. This should fail. It is equal to the float diff limit.
-my $diff   = ! flt_cmp($number, $result);
-ok($diff, " Testing convert_date_time: $date_time $number");
-
-
-
-
-##############################################################################
-#
-# Test the time data generated in Excel.
-#
-while (<DATA>) {
-
-    last if /^# stop/; # For debugging
-    next unless /\S/;  # Ignore blank lines
-    next if /^#/;      # Ignore comments
-
-    if (/"DateTime">([^<]+)/) {
-        my $date_time = $1;
-        my $line      = <DATA>;
-
-        if ($line =~ /"Number">([^<]+)/) {
-            my $number = 0 + $1;
-            my $result = $worksheet->convert_date_time($date_time);
-               $result = -1 unless defined $result;
-
-            ok(flt_cmp($number, $result),
-                       " Testing convert_date_time: $date_time $number")
-               or diag("difference between $number and $result\n" .
-                       "= " . abs($number -$result) . "\n".
-                       "> $flt_delta");
-        }
-    }
-}
-
-# Clean up
-$workbook->close();
-unlink $test_file;
-
-
-__DATA__
-
-
-# Test data taken from Excel in XML format.
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">1899-12-31T00:00:00.000</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">0</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">1982-08-25T00:15:20.213</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">30188.010650613425</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">2065-04-19T00:16:48.290</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">60376.011670023145</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">2147-12-15T00:55:25.446</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">90565.038488958337</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">2230-08-10T01:02:46.891</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">120753.04359827546</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">2313-04-06T01:04:15.597</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">150942.04462496529</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">2395-11-30T01:09:40.889</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">181130.04838991899</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">2478-07-25T01:11:32.560</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">211318.04968240741</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">2561-03-21T01:30:19.169</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">241507.06272186342</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">2643-11-15T01:48:25.580</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">271695.07529606484</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">2726-07-12T02:03:31.919</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">301884.08578609955</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">2809-03-06T02:11:11.986</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">332072.09111094906</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">2891-10-31T02:24:37.095</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">362261.10042934027</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">2974-06-26T02:35:07.220</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">392449.10772245371</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">3057-02-19T02:45:12.109</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">422637.1147234838</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">3139-10-17T03:06:39.990</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">452826.12962951389</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">3222-06-11T03:08:08.251</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">483014.13065105322</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">3305-02-05T03:19:12.576</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">513203.13834</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">3387-10-01T03:29:42.574</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">543391.14563164348</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">3470-05-27T03:37:30.813</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">573579.15105107636</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">3553-01-21T04:14:38.231</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">603768.17683137732</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">3635-09-16T04:16:28.559</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">633956.17810832174</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">3718-05-13T04:17:58.222</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">664145.17914608796</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">3801-01-06T04:21:41.794</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">694333.18173372687</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">3883-09-02T04:56:35.792</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">724522.20596981479</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">3966-04-28T05:25:14.885</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">754710.2258667245</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">4048-12-21T05:26:05.724</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">784898.22645513888</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">4131-08-18T05:46:44.068</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">815087.24078782403</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">4214-04-13T05:48:01.141</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">845275.24167987274</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">4296-12-07T05:53:52.315</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">875464.24574438657</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">4379-08-03T06:14:48.580</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">905652.26028449077</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">4462-03-28T06:46:15.738</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">935840.28212659725</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">4544-11-22T07:31:20.407</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">966029.31343063654</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">4627-07-19T07:58:33.754</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">996217.33233511576</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">4710-03-15T08:07:43.130</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1026406.3386936343</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">4792-11-07T08:29:11.091</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1056594.3536005903</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">4875-07-04T09:08:15.328</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1086783.3807329629</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">4958-02-27T09:30:41.781</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1116971.3963169097</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">5040-10-23T09:34:04.462</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1147159.3986627546</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">5123-06-20T09:37:23.945</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1177348.4009715857</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">5206-02-12T09:37:56.655</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1207536.4013501736</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">5288-10-08T09:45:12.230</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1237725.406391551</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">5371-06-04T09:54:14.782</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1267913.412671088</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">5454-01-28T09:54:22.108</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1298101.4127558796</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">5536-09-24T10:01:36.151</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1328290.4177795255</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">5619-05-20T12:09:48.602</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1358478.5068125231</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">5702-01-14T12:34:08.549</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1388667.5237100578</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">5784-09-08T12:56:06.495</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1418855.5389640625</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">5867-05-06T12:58:58.217</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1449044.5409515856</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">5949-12-30T12:59:54.263</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1479232.5416002662</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">6032-08-24T13:34:41.331</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1509420.5657561459</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">6115-04-21T13:58:28.601</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1539609.5822754744</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">6197-12-14T14:02:16.899</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1569797.5849178126</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">6280-08-10T14:36:17.444</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1599986.6085352316</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">6363-04-06T14:37:57.451</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1630174.60969272</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">6445-11-30T14:57:42.757</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1660363.6234115392</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">6528-07-26T15:10:48.307</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1690551.6325035533</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">6611-03-22T15:14:39.890</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1720739.635183912</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">6693-11-15T15:19:47.988</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1750928.6387498612</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">6776-07-11T16:04:24.344</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1781116.6697262037</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">6859-03-07T16:22:23.952</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1811305.6822216667</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">6941-10-31T16:29:55.999</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1841493.6874536921</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">7024-06-26T16:58:20.259</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1871681.7071789235</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">7107-02-21T17:04:02.415</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1901870.7111390624</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">7189-10-16T17:18:29.630</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1932058.7211762732</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">7272-06-11T17:47:21.323</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1962247.7412190163</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">7355-02-05T17:53:29.866</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1992435.7454845603</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">7437-10-02T17:53:41.076</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2022624.7456143056</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">7520-05-28T17:55:06.044</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2052812.7465977315</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">7603-01-21T18:14:49.151</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2083000.7602910995</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">7685-09-16T18:17:45.738</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2113189.7623349307</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">7768-05-12T18:29:59.700</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2143377.7708298611</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">7851-01-07T18:33:21.233</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2173566.773162419</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">7933-09-02T19:14:24.673</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2203754.8016744559</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">8016-04-27T19:17:12.816</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2233942.8036205554</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">8098-12-22T19:23:36.418</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2264131.8080603937</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">8181-08-17T19:46:25.908</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2294319.8239109721</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">8264-04-13T20:07:47.314</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2324508.8387420601</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">8346-12-08T20:31:37.603</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2354696.855296331</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">8429-08-03T20:39:57.770</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2384885.8610853008</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">8512-03-29T20:50:17.067</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2415073.8682530904</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">8594-11-22T21:02:57.827</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2445261.8770581828</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">8677-07-19T21:23:05.519</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2475450.8910360998</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">8760-03-14T21:34:49.572</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2505638.8991848612</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">8842-11-08T21:39:05.944</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2535827.9021521294</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">8925-07-04T21:39:18.426</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2566015.9022965971</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">9008-02-28T21:46:07.769</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2596203.9070343636</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">9090-10-24T21:57:55.662</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2626392.9152275696</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">9173-06-19T22:19:11.732</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2656580.9299968979</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">9256-02-13T22:23:51.376</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2686769.9332335186</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">9338-10-09T22:27:58.771</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2716957.9360968866</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">9421-06-05T22:43:30.392</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2747146.9468795368</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">9504-01-30T22:48:25.834</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2777334.9502990046</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">9586-09-24T22:53:51.727</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2807522.9540709145</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">9669-05-20T23:12:56.536</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2837711.9673210187</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">9752-01-14T23:15:54.109</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2867899.9693762613</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">9834-09-10T23:17:12.632</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2898088.9702850925</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">9999-12-31T23:59:59.000</Data></Cell>
-    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2958465.999988426</Data></Cell>
-   </Row>
+#!/usr/bin/perl -w
+
+###############################################################################
+#
+# A test for Spreadsheet::WriteExcel.
+#
+# Tests date and time handling.
+#
+# reverse('©'), May 2004, John McNamara, jmcnamara at cpan.org
+#
+
+use strict;
+
+use Spreadsheet::WriteExcel;
+use Test::More tests => 100;
+
+my $date_time;
+my $number;
+my $result;
+my $test_file = "temp_test_file.xls";
+
+my $workbook  = Spreadsheet::WriteExcel->new($test_file);
+my $worksheet = $workbook->add_worksheet();
+
+
+# Set float difference limit to half of an Excel millisecond
+my $flt_delta = 0.5/(24*60*60*1000);
+
+
+##############################################################################
+#
+# Float comparison function.
+#
+sub flt_cmp {
+    return abs($_[0] - $_[1]) < $flt_delta;
+}
+
+
+
+##############################################################################
+#
+# Test the flt_cmp() function used in the other tests.
+#
+
+$date_time = '1899-12-31T00:00:00.0004';
+$number    = 0;
+$result    = $worksheet->convert_date_time($date_time);
+$result    = -1 unless defined $result;
+
+# Test 1. This should pass. It is less than the float diff limit.
+ok(flt_cmp($number, $result),
+           " Testing convert_date_time: $date_time $number");
+
+$date_time = '1899-12-31T00:00:00.0005';
+$number    = 0;
+$result    = $worksheet->convert_date_time($date_time);
+$result    = -1 unless defined $result;
+
+# Test 2. This should fail. It is equal to the float diff limit.
+my $diff   = ! flt_cmp($number, $result);
+ok($diff, " Testing convert_date_time: $date_time $number");
+
+
+
+
+##############################################################################
+#
+# Test the time data generated in Excel.
+#
+while (<DATA>) {
+
+    last if /^# stop/; # For debugging
+    next unless /\S/;  # Ignore blank lines
+    next if /^#/;      # Ignore comments
+
+    if (/"DateTime">([^<]+)/) {
+        my $date_time = $1;
+        my $line      = <DATA>;
+
+        if ($line =~ /"Number">([^<]+)/) {
+            my $number = 0 + $1;
+            my $result = $worksheet->convert_date_time($date_time);
+               $result = -1 unless defined $result;
+
+            ok(flt_cmp($number, $result),
+                       " Testing convert_date_time: $date_time $number")
+               or diag("difference between $number and $result\n" .
+                       "= " . abs($number -$result) . "\n".
+                       "> $flt_delta");
+        }
+    }
+}
+
+# Clean up
+$workbook->close();
+unlink $test_file;
+
+
+__DATA__
+
+
+# Test data taken from Excel in XML format.
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">1899-12-31T00:00:00.000</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">0</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">1982-08-25T00:15:20.213</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">30188.010650613425</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">2065-04-19T00:16:48.290</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">60376.011670023145</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">2147-12-15T00:55:25.446</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">90565.038488958337</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">2230-08-10T01:02:46.891</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">120753.04359827546</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">2313-04-06T01:04:15.597</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">150942.04462496529</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">2395-11-30T01:09:40.889</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">181130.04838991899</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">2478-07-25T01:11:32.560</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">211318.04968240741</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">2561-03-21T01:30:19.169</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">241507.06272186342</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">2643-11-15T01:48:25.580</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">271695.07529606484</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">2726-07-12T02:03:31.919</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">301884.08578609955</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">2809-03-06T02:11:11.986</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">332072.09111094906</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">2891-10-31T02:24:37.095</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">362261.10042934027</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">2974-06-26T02:35:07.220</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">392449.10772245371</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">3057-02-19T02:45:12.109</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">422637.1147234838</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">3139-10-17T03:06:39.990</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">452826.12962951389</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">3222-06-11T03:08:08.251</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">483014.13065105322</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">3305-02-05T03:19:12.576</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">513203.13834</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">3387-10-01T03:29:42.574</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">543391.14563164348</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">3470-05-27T03:37:30.813</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">573579.15105107636</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">3553-01-21T04:14:38.231</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">603768.17683137732</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">3635-09-16T04:16:28.559</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">633956.17810832174</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">3718-05-13T04:17:58.222</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">664145.17914608796</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">3801-01-06T04:21:41.794</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">694333.18173372687</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">3883-09-02T04:56:35.792</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">724522.20596981479</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">3966-04-28T05:25:14.885</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">754710.2258667245</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">4048-12-21T05:26:05.724</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">784898.22645513888</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">4131-08-18T05:46:44.068</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">815087.24078782403</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">4214-04-13T05:48:01.141</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">845275.24167987274</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">4296-12-07T05:53:52.315</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">875464.24574438657</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">4379-08-03T06:14:48.580</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">905652.26028449077</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">4462-03-28T06:46:15.738</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">935840.28212659725</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">4544-11-22T07:31:20.407</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">966029.31343063654</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">4627-07-19T07:58:33.754</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">996217.33233511576</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">4710-03-15T08:07:43.130</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1026406.3386936343</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">4792-11-07T08:29:11.091</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1056594.3536005903</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">4875-07-04T09:08:15.328</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1086783.3807329629</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">4958-02-27T09:30:41.781</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1116971.3963169097</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">5040-10-23T09:34:04.462</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1147159.3986627546</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">5123-06-20T09:37:23.945</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1177348.4009715857</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">5206-02-12T09:37:56.655</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1207536.4013501736</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">5288-10-08T09:45:12.230</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1237725.406391551</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">5371-06-04T09:54:14.782</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1267913.412671088</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">5454-01-28T09:54:22.108</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1298101.4127558796</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">5536-09-24T10:01:36.151</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1328290.4177795255</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">5619-05-20T12:09:48.602</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1358478.5068125231</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">5702-01-14T12:34:08.549</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1388667.5237100578</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">5784-09-08T12:56:06.495</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1418855.5389640625</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">5867-05-06T12:58:58.217</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1449044.5409515856</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">5949-12-30T12:59:54.263</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1479232.5416002662</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">6032-08-24T13:34:41.331</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1509420.5657561459</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">6115-04-21T13:58:28.601</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1539609.5822754744</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">6197-12-14T14:02:16.899</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1569797.5849178126</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">6280-08-10T14:36:17.444</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1599986.6085352316</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">6363-04-06T14:37:57.451</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1630174.60969272</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">6445-11-30T14:57:42.757</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1660363.6234115392</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">6528-07-26T15:10:48.307</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1690551.6325035533</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">6611-03-22T15:14:39.890</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1720739.635183912</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">6693-11-15T15:19:47.988</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1750928.6387498612</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">6776-07-11T16:04:24.344</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1781116.6697262037</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">6859-03-07T16:22:23.952</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1811305.6822216667</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">6941-10-31T16:29:55.999</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1841493.6874536921</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">7024-06-26T16:58:20.259</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1871681.7071789235</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">7107-02-21T17:04:02.415</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1901870.7111390624</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">7189-10-16T17:18:29.630</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1932058.7211762732</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">7272-06-11T17:47:21.323</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1962247.7412190163</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">7355-02-05T17:53:29.866</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">1992435.7454845603</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">7437-10-02T17:53:41.076</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2022624.7456143056</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">7520-05-28T17:55:06.044</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2052812.7465977315</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">7603-01-21T18:14:49.151</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2083000.7602910995</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">7685-09-16T18:17:45.738</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2113189.7623349307</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">7768-05-12T18:29:59.700</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2143377.7708298611</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">7851-01-07T18:33:21.233</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2173566.773162419</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">7933-09-02T19:14:24.673</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2203754.8016744559</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">8016-04-27T19:17:12.816</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2233942.8036205554</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">8098-12-22T19:23:36.418</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2264131.8080603937</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">8181-08-17T19:46:25.908</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2294319.8239109721</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">8264-04-13T20:07:47.314</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2324508.8387420601</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">8346-12-08T20:31:37.603</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2354696.855296331</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">8429-08-03T20:39:57.770</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2384885.8610853008</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">8512-03-29T20:50:17.067</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2415073.8682530904</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">8594-11-22T21:02:57.827</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2445261.8770581828</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">8677-07-19T21:23:05.519</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2475450.8910360998</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">8760-03-14T21:34:49.572</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2505638.8991848612</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">8842-11-08T21:39:05.944</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2535827.9021521294</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">8925-07-04T21:39:18.426</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2566015.9022965971</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">9008-02-28T21:46:07.769</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2596203.9070343636</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">9090-10-24T21:57:55.662</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2626392.9152275696</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">9173-06-19T22:19:11.732</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2656580.9299968979</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">9256-02-13T22:23:51.376</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2686769.9332335186</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">9338-10-09T22:27:58.771</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2716957.9360968866</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">9421-06-05T22:43:30.392</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2747146.9468795368</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">9504-01-30T22:48:25.834</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2777334.9502990046</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">9586-09-24T22:53:51.727</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2807522.9540709145</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">9669-05-20T23:12:56.536</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2837711.9673210187</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">9752-01-14T23:15:54.109</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2867899.9693762613</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">9834-09-10T23:17:12.632</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2898088.9702850925</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s21"><Data ss:Type="DateTime">9999-12-31T23:59:59.000</Data></Cell>
+    <Cell ss:StyleID="s22" ss:Formula="=RC[-1]"><Data ss:Type="Number">2958465.999988426</Data></Cell>
+   </Row>

Modified: packages/libspreadsheet-writeexcel-perl/trunk/t/12_date_only.t
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/t/12_date_only.t	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/t/12_date_only.t	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,505 +1,505 @@
-#!/usr/bin/perl -w
-
-###############################################################################
-#
-# A test for Spreadsheet::WriteExcel.
-#
-# Tests date and time handling. Tests dates in 1900 and 1904 format.
-#
-# reverse('©'), May 2004, John McNamara, jmcnamara at cpan.org
-#
-
-use strict;
-
-use Spreadsheet::WriteExcel;
-use Test::More tests => 420;
-
-my $date_time;
-my $number;
-my $result;
-my $test_file = "temp_test_file.xls";
-
-my $workbook  = Spreadsheet::WriteExcel->new($test_file);
-my $worksheet = $workbook->add_worksheet();
-
-
-
-
-
-
-##############################################################################
-#
-# Test the dates generated by Excel.
-#
-while (<DATA>) {
-    last if /^# stop/; # For debugging
-
-    $worksheet->{_1904} = 0 if /Excel 1900/; # Change date system
-    $worksheet->{_1904} = 1 if /Excel 1904/; # Change date system
-
-    next unless /\S/;  # Ignore blank lines
-    next if /^#/;      # Ignore comments
-
-
-    my ($count, $date, $result) = split;
-
-    my $number = $worksheet->convert_date_time($date);
-       $number = -1 unless defined $number;
-
-    is($number, $result, " Testing convert_date_time: $date $result")
-
-}
-
-
-# Clean up
-$workbook->close();
-unlink $test_file;
-
-
-
-__DATA__
-#
-# The following data was generated by Excel.
-#
-
-#
-# Excel 1900 date system
-#
-1      1899-12-31T    0
-2      1900-01-00T    0
-3      1900-01-01T    1
-4      1900-02-27T    58
-5      1900-02-28T    59
-6      1900-02-29T    60
-7      1900-03-01T    61
-8      1900-03-02T    62
-9      1900-03-11T    71
-10     1900-04-08T    99
-11     1900-09-12T    256
-12     1901-05-03T    489
-13     1901-10-13T    652
-14     1902-02-15T    777
-15     1902-06-06T    888
-16     1902-09-25T    999
-17     1902-09-27T    1001
-18     1903-04-26T    1212
-19     1903-08-05T    1313
-20     1903-12-31T    1461
-21     1904-01-01T    1462
-22     1904-02-28T    1520
-23     1904-02-29T    1521
-24     1904-03-01T    1522
-25     1907-02-27T    2615
-26     1907-02-28T    2616
-27     1907-03-01T    2617
-28     1907-03-02T    2618
-29     1907-03-03T    2619
-30     1907-03-04T    2620
-31     1907-03-05T    2621
-32     1907-03-06T    2622
-33     1999-01-01T    36161
-34     1999-01-31T    36191
-35     1999-02-01T    36192
-36     1999-02-28T    36219
-37     1999-03-01T    36220
-38     1999-03-31T    36250
-39     1999-04-01T    36251
-40     1999-04-30T    36280
-41     1999-05-01T    36281
-42     1999-05-31T    36311
-43     1999-06-01T    36312
-44     1999-06-30T    36341
-45     1999-07-01T    36342
-46     1999-07-31T    36372
-47     1999-08-01T    36373
-48     1999-08-31T    36403
-49     1999-09-01T    36404
-50     1999-09-30T    36433
-51     1999-10-01T    36434
-52     1999-10-31T    36464
-53     1999-11-01T    36465
-54     1999-11-30T    36494
-55     1999-12-01T    36495
-56     1999-12-31T    36525
-57     2000-01-01T    36526
-58     2000-01-31T    36556
-59     2000-02-01T    36557
-60     2000-02-29T    36585
-61     2000-03-01T    36586
-62     2000-03-31T    36616
-63     2000-04-01T    36617
-64     2000-04-30T    36646
-65     2000-05-01T    36647
-66     2000-05-31T    36677
-67     2000-06-01T    36678
-68     2000-06-30T    36707
-69     2000-07-01T    36708
-70     2000-07-31T    36738
-71     2000-08-01T    36739
-72     2000-08-31T    36769
-73     2000-09-01T    36770
-74     2000-09-30T    36799
-75     2000-10-01T    36800
-76     2000-10-31T    36830
-77     2000-11-01T    36831
-78     2000-11-30T    36860
-79     2000-12-01T    36861
-80     2000-12-31T    36891
-81     2001-01-01T    36892
-82     2001-01-31T    36922
-83     2001-02-01T    36923
-84     2001-02-28T    36950
-85     2001-03-01T    36951
-86     2001-03-31T    36981
-87     2001-04-01T    36982
-88     2001-04-30T    37011
-89     2001-05-01T    37012
-90     2001-05-31T    37042
-91     2001-06-01T    37043
-92     2001-06-30T    37072
-93     2001-07-01T    37073
-94     2001-07-31T    37103
-95     2001-08-01T    37104
-96     2001-08-31T    37134
-97     2001-09-01T    37135
-98     2001-09-30T    37164
-99     2001-10-01T    37165
-100    2001-10-31T    37195
-101    2001-11-01T    37196
-102    2001-11-30T    37225
-103    2001-12-01T    37226
-104    2001-12-31T    37256
-105    2400-01-01T    182623
-106    2400-01-31T    182653
-107    2400-02-01T    182654
-108    2400-02-29T    182682
-109    2400-03-01T    182683
-110    2400-03-31T    182713
-111    2400-04-01T    182714
-112    2400-04-30T    182743
-113    2400-05-01T    182744
-114    2400-05-31T    182774
-115    2400-06-01T    182775
-116    2400-06-30T    182804
-117    2400-07-01T    182805
-118    2400-07-31T    182835
-119    2400-08-01T    182836
-120    2400-08-31T    182866
-121    2400-09-01T    182867
-122    2400-09-30T    182896
-123    2400-10-01T    182897
-124    2400-10-31T    182927
-125    2400-11-01T    182928
-126    2400-11-30T    182957
-127    2400-12-01T    182958
-128    2400-12-31T    182988
-129    4000-01-01T    767011
-130    4000-01-31T    767041
-131    4000-02-01T    767042
-132    4000-02-29T    767070
-133    4000-03-01T    767071
-134    4000-03-31T    767101
-135    4000-04-01T    767102
-136    4000-04-30T    767131
-137    4000-05-01T    767132
-138    4000-05-31T    767162
-139    4000-06-01T    767163
-140    4000-06-30T    767192
-141    4000-07-01T    767193
-142    4000-07-31T    767223
-143    4000-08-01T    767224
-144    4000-08-31T    767254
-145    4000-09-01T    767255
-146    4000-09-30T    767284
-147    4000-10-01T    767285
-148    4000-10-31T    767315
-149    4000-11-01T    767316
-150    4000-11-30T    767345
-151    4000-12-01T    767346
-152    4000-12-31T    767376
-153    4321-01-01T    884254
-154    4321-01-31T    884284
-155    4321-02-01T    884285
-156    4321-02-28T    884312
-157    4321-03-01T    884313
-158    4321-03-31T    884343
-159    4321-04-01T    884344
-160    4321-04-30T    884373
-161    4321-05-01T    884374
-162    4321-05-31T    884404
-163    4321-06-01T    884405
-164    4321-06-30T    884434
-165    4321-07-01T    884435
-166    4321-07-31T    884465
-167    4321-08-01T    884466
-168    4321-08-31T    884496
-169    4321-09-01T    884497
-170    4321-09-30T    884526
-171    4321-10-01T    884527
-172    4321-10-31T    884557
-173    4321-11-01T    884558
-174    4321-11-30T    884587
-175    4321-12-01T    884588
-176    4321-12-31T    884618
-177    9999-01-01T    2958101
-178    9999-01-31T    2958131
-179    9999-02-01T    2958132
-180    9999-02-28T    2958159
-181    9999-03-01T    2958160
-182    9999-03-31T    2958190
-183    9999-04-01T    2958191
-184    9999-04-30T    2958220
-185    9999-05-01T    2958221
-186    9999-05-31T    2958251
-187    9999-06-01T    2958252
-188    9999-06-30T    2958281
-189    9999-07-01T    2958282
-190    9999-07-31T    2958312
-191    9999-08-01T    2958313
-192    9999-08-31T    2958343
-193    9999-09-01T    2958344
-194    9999-09-30T    2958373
-195    9999-10-01T    2958374
-196    9999-10-31T    2958404
-197    9999-11-01T    2958405
-198    9999-11-30T    2958434
-199    9999-12-01T    2958435
-200    9999-12-31T    2958465
-
-#
-# Excel 1904 date system
-#
-201    1904-01-01T    0
-202    1904-01-31T    30
-203    1904-02-01T    31
-204    1904-02-29T    59
-205    1904-03-01T    60
-206    1904-03-31T    90
-207    1904-04-01T    91
-208    1904-04-30T    120
-209    1904-05-01T    121
-210    1904-05-31T    151
-211    1904-06-01T    152
-212    1904-06-30T    181
-213    1904-07-01T    182
-214    1904-07-31T    212
-215    1904-08-01T    213
-216    1904-08-31T    243
-217    1904-09-01T    244
-218    1904-09-30T    273
-219    1904-10-01T    274
-220    1904-10-31T    304
-221    1904-11-01T    305
-222    1904-11-30T    334
-223    1904-12-01T    335
-224    1904-12-31T    365
-225    1907-02-27T    1153
-226    1907-02-28T    1154
-227    1907-03-01T    1155
-228    1907-03-02T    1156
-229    1907-03-03T    1157
-230    1907-03-04T    1158
-231    1907-03-05T    1159
-232    1907-03-06T    1160
-233    1999-01-01T    34699
-234    1999-01-31T    34729
-235    1999-02-01T    34730
-236    1999-02-28T    34757
-237    1999-03-01T    34758
-238    1999-03-31T    34788
-239    1999-04-01T    34789
-240    1999-04-30T    34818
-241    1999-05-01T    34819
-242    1999-05-31T    34849
-243    1999-06-01T    34850
-244    1999-06-30T    34879
-245    1999-07-01T    34880
-246    1999-07-31T    34910
-247    1999-08-01T    34911
-248    1999-08-31T    34941
-249    1999-09-01T    34942
-250    1999-09-30T    34971
-251    1999-10-01T    34972
-252    1999-10-31T    35002
-253    1999-11-01T    35003
-254    1999-11-30T    35032
-255    1999-12-01T    35033
-256    1999-12-31T    35063
-257    2000-01-01T    35064
-258    2000-01-31T    35094
-259    2000-02-01T    35095
-260    2000-02-29T    35123
-261    2000-03-01T    35124
-262    2000-03-31T    35154
-263    2000-04-01T    35155
-264    2000-04-30T    35184
-265    2000-05-01T    35185
-266    2000-05-31T    35215
-267    2000-06-01T    35216
-268    2000-06-30T    35245
-269    2000-07-01T    35246
-270    2000-07-31T    35276
-271    2000-08-01T    35277
-272    2000-08-31T    35307
-273    2000-09-01T    35308
-274    2000-09-30T    35337
-275    2000-10-01T    35338
-276    2000-10-31T    35368
-277    2000-11-01T    35369
-278    2000-11-30T    35398
-279    2000-12-01T    35399
-280    2000-12-31T    35429
-281    2001-01-01T    35430
-282    2001-01-31T    35460
-283    2001-02-01T    35461
-284    2001-02-28T    35488
-285    2001-03-01T    35489
-286    2001-03-31T    35519
-287    2001-04-01T    35520
-288    2001-04-30T    35549
-289    2001-05-01T    35550
-290    2001-05-31T    35580
-291    2001-06-01T    35581
-292    2001-06-30T    35610
-293    2001-07-01T    35611
-294    2001-07-31T    35641
-295    2001-08-01T    35642
-296    2001-08-31T    35672
-297    2001-09-01T    35673
-298    2001-09-30T    35702
-299    2001-10-01T    35703
-300    2001-10-31T    35733
-301    2001-11-01T    35734
-302    2001-11-30T    35763
-303    2001-12-01T    35764
-304    2001-12-31T    35794
-305    2400-01-01T    181161
-306    2400-01-31T    181191
-307    2400-02-01T    181192
-308    2400-02-29T    181220
-309    2400-03-01T    181221
-310    2400-03-31T    181251
-311    2400-04-01T    181252
-312    2400-04-30T    181281
-313    2400-05-01T    181282
-314    2400-05-31T    181312
-315    2400-06-01T    181313
-316    2400-06-30T    181342
-317    2400-07-01T    181343
-318    2400-07-31T    181373
-319    2400-08-01T    181374
-320    2400-08-31T    181404
-321    2400-09-01T    181405
-322    2400-09-30T    181434
-323    2400-10-01T    181435
-324    2400-10-31T    181465
-325    2400-11-01T    181466
-326    2400-11-30T    181495
-327    2400-12-01T    181496
-328    2400-12-31T    181526
-329    4000-01-01T    765549
-330    4000-01-31T    765579
-331    4000-02-01T    765580
-332    4000-02-29T    765608
-333    4000-03-01T    765609
-334    4000-03-31T    765639
-335    4000-04-01T    765640
-336    4000-04-30T    765669
-337    4000-05-01T    765670
-338    4000-05-31T    765700
-339    4000-06-01T    765701
-340    4000-06-30T    765730
-341    4000-07-01T    765731
-342    4000-07-31T    765761
-343    4000-08-01T    765762
-344    4000-08-31T    765792
-345    4000-09-01T    765793
-346    4000-09-30T    765822
-347    4000-10-01T    765823
-348    4000-10-31T    765853
-349    4000-11-01T    765854
-350    4000-11-30T    765883
-351    4000-12-01T    765884
-352    4000-12-31T    765914
-353    4321-01-01T    882792
-354    4321-01-31T    882822
-355    4321-02-01T    882823
-356    4321-02-28T    882850
-357    4321-03-01T    882851
-358    4321-03-31T    882881
-359    4321-04-01T    882882
-360    4321-04-30T    882911
-361    4321-05-01T    882912
-362    4321-05-31T    882942
-363    4321-06-01T    882943
-364    4321-06-30T    882972
-365    4321-07-01T    882973
-366    4321-07-31T    883003
-367    4321-08-01T    883004
-368    4321-08-31T    883034
-369    4321-09-01T    883035
-370    4321-09-30T    883064
-371    4321-10-01T    883065
-372    4321-10-31T    883095
-373    4321-11-01T    883096
-374    4321-11-30T    883125
-375    4321-12-01T    883126
-376    4321-12-31T    883156
-377    9999-01-01T    2956639
-378    9999-01-31T    2956669
-379    9999-02-01T    2956670
-380    9999-02-28T    2956697
-381    9999-03-01T    2956698
-382    9999-03-31T    2956728
-383    9999-04-01T    2956729
-384    9999-04-30T    2956758
-385    9999-05-01T    2956759
-386    9999-05-31T    2956789
-387    9999-06-01T    2956790
-388    9999-06-30T    2956819
-389    9999-07-01T    2956820
-390    9999-07-31T    2956850
-391    9999-08-01T    2956851
-392    9999-08-31T    2956881
-393    9999-09-01T    2956882
-394    9999-09-30T    2956911
-395    9999-10-01T    2956912
-396    9999-10-31T    2956942
-397    9999-11-01T    2956943
-398    9999-11-30T    2956972
-399    9999-12-01T    2956973
-400    9999-12-31T    2957003
-
-
-#
-# The following dates are invalid.
-#
-
-#
-# Excel 1900 date system
-#
-401    0000-12-30T    -1 # Below year range.
-402    1000-12-30T    -1 # Below year range.
-403    1899-12-30T    -1 # Below year range.
-404    2002-02-29T    -1 # False leap-day.
-405    2000-00-00T    -1 # No month or day.
-406    2000-01-00T    -1 # No day.
-407    2000-00-01T    -1 # No month.
-408    2000-13-01T    -1 # Month out of range.
-409    2000-12-32T    -1 # Day out of range.
-410   10000-01-01T    -1 # Year out of range.
-
-#
-# Excel 1904 date system
-#
-411    1899-12-31T    -1 # Below year range.
-412    1900-01-01T    -1 # Below year range.
-413    1903-12-31T    -1 # Below year range.
-414    2001-02-29T    -1 # False leap-day.
-415    2000-00-00T    -1 # No month or day.
-416    2000-01-00T    -1 # No day.
-417    2000-00-01T    -1 # No month.
-418    2000-13-01T    -1 # Month out of range.
-419    2000-12-32T    -1 # Day out of range.
-420   10000-01-01T    -1 # Year out of range.
-
+#!/usr/bin/perl -w
+
+###############################################################################
+#
+# A test for Spreadsheet::WriteExcel.
+#
+# Tests date and time handling. Tests dates in 1900 and 1904 format.
+#
+# reverse('©'), May 2004, John McNamara, jmcnamara at cpan.org
+#
+
+use strict;
+
+use Spreadsheet::WriteExcel;
+use Test::More tests => 420;
+
+my $date_time;
+my $number;
+my $result;
+my $test_file = "temp_test_file.xls";
+
+my $workbook  = Spreadsheet::WriteExcel->new($test_file);
+my $worksheet = $workbook->add_worksheet();
+
+
+
+
+
+
+##############################################################################
+#
+# Test the dates generated by Excel.
+#
+while (<DATA>) {
+    last if /^# stop/; # For debugging
+
+    $worksheet->{_1904} = 0 if /Excel 1900/; # Change date system
+    $worksheet->{_1904} = 1 if /Excel 1904/; # Change date system
+
+    next unless /\S/;  # Ignore blank lines
+    next if /^#/;      # Ignore comments
+
+
+    my ($count, $date, $result) = split;
+
+    my $number = $worksheet->convert_date_time($date);
+       $number = -1 unless defined $number;
+
+    is($number, $result, " Testing convert_date_time: $date $result")
+
+}
+
+
+# Clean up
+$workbook->close();
+unlink $test_file;
+
+
+
+__DATA__
+#
+# The following data was generated by Excel.
+#
+
+#
+# Excel 1900 date system
+#
+1      1899-12-31T    0
+2      1900-01-00T    0
+3      1900-01-01T    1
+4      1900-02-27T    58
+5      1900-02-28T    59
+6      1900-02-29T    60
+7      1900-03-01T    61
+8      1900-03-02T    62
+9      1900-03-11T    71
+10     1900-04-08T    99
+11     1900-09-12T    256
+12     1901-05-03T    489
+13     1901-10-13T    652
+14     1902-02-15T    777
+15     1902-06-06T    888
+16     1902-09-25T    999
+17     1902-09-27T    1001
+18     1903-04-26T    1212
+19     1903-08-05T    1313
+20     1903-12-31T    1461
+21     1904-01-01T    1462
+22     1904-02-28T    1520
+23     1904-02-29T    1521
+24     1904-03-01T    1522
+25     1907-02-27T    2615
+26     1907-02-28T    2616
+27     1907-03-01T    2617
+28     1907-03-02T    2618
+29     1907-03-03T    2619
+30     1907-03-04T    2620
+31     1907-03-05T    2621
+32     1907-03-06T    2622
+33     1999-01-01T    36161
+34     1999-01-31T    36191
+35     1999-02-01T    36192
+36     1999-02-28T    36219
+37     1999-03-01T    36220
+38     1999-03-31T    36250
+39     1999-04-01T    36251
+40     1999-04-30T    36280
+41     1999-05-01T    36281
+42     1999-05-31T    36311
+43     1999-06-01T    36312
+44     1999-06-30T    36341
+45     1999-07-01T    36342
+46     1999-07-31T    36372
+47     1999-08-01T    36373
+48     1999-08-31T    36403
+49     1999-09-01T    36404
+50     1999-09-30T    36433
+51     1999-10-01T    36434
+52     1999-10-31T    36464
+53     1999-11-01T    36465
+54     1999-11-30T    36494
+55     1999-12-01T    36495
+56     1999-12-31T    36525
+57     2000-01-01T    36526
+58     2000-01-31T    36556
+59     2000-02-01T    36557
+60     2000-02-29T    36585
+61     2000-03-01T    36586
+62     2000-03-31T    36616
+63     2000-04-01T    36617
+64     2000-04-30T    36646
+65     2000-05-01T    36647
+66     2000-05-31T    36677
+67     2000-06-01T    36678
+68     2000-06-30T    36707
+69     2000-07-01T    36708
+70     2000-07-31T    36738
+71     2000-08-01T    36739
+72     2000-08-31T    36769
+73     2000-09-01T    36770
+74     2000-09-30T    36799
+75     2000-10-01T    36800
+76     2000-10-31T    36830
+77     2000-11-01T    36831
+78     2000-11-30T    36860
+79     2000-12-01T    36861
+80     2000-12-31T    36891
+81     2001-01-01T    36892
+82     2001-01-31T    36922
+83     2001-02-01T    36923
+84     2001-02-28T    36950
+85     2001-03-01T    36951
+86     2001-03-31T    36981
+87     2001-04-01T    36982
+88     2001-04-30T    37011
+89     2001-05-01T    37012
+90     2001-05-31T    37042
+91     2001-06-01T    37043
+92     2001-06-30T    37072
+93     2001-07-01T    37073
+94     2001-07-31T    37103
+95     2001-08-01T    37104
+96     2001-08-31T    37134
+97     2001-09-01T    37135
+98     2001-09-30T    37164
+99     2001-10-01T    37165
+100    2001-10-31T    37195
+101    2001-11-01T    37196
+102    2001-11-30T    37225
+103    2001-12-01T    37226
+104    2001-12-31T    37256
+105    2400-01-01T    182623
+106    2400-01-31T    182653
+107    2400-02-01T    182654
+108    2400-02-29T    182682
+109    2400-03-01T    182683
+110    2400-03-31T    182713
+111    2400-04-01T    182714
+112    2400-04-30T    182743
+113    2400-05-01T    182744
+114    2400-05-31T    182774
+115    2400-06-01T    182775
+116    2400-06-30T    182804
+117    2400-07-01T    182805
+118    2400-07-31T    182835
+119    2400-08-01T    182836
+120    2400-08-31T    182866
+121    2400-09-01T    182867
+122    2400-09-30T    182896
+123    2400-10-01T    182897
+124    2400-10-31T    182927
+125    2400-11-01T    182928
+126    2400-11-30T    182957
+127    2400-12-01T    182958
+128    2400-12-31T    182988
+129    4000-01-01T    767011
+130    4000-01-31T    767041
+131    4000-02-01T    767042
+132    4000-02-29T    767070
+133    4000-03-01T    767071
+134    4000-03-31T    767101
+135    4000-04-01T    767102
+136    4000-04-30T    767131
+137    4000-05-01T    767132
+138    4000-05-31T    767162
+139    4000-06-01T    767163
+140    4000-06-30T    767192
+141    4000-07-01T    767193
+142    4000-07-31T    767223
+143    4000-08-01T    767224
+144    4000-08-31T    767254
+145    4000-09-01T    767255
+146    4000-09-30T    767284
+147    4000-10-01T    767285
+148    4000-10-31T    767315
+149    4000-11-01T    767316
+150    4000-11-30T    767345
+151    4000-12-01T    767346
+152    4000-12-31T    767376
+153    4321-01-01T    884254
+154    4321-01-31T    884284
+155    4321-02-01T    884285
+156    4321-02-28T    884312
+157    4321-03-01T    884313
+158    4321-03-31T    884343
+159    4321-04-01T    884344
+160    4321-04-30T    884373
+161    4321-05-01T    884374
+162    4321-05-31T    884404
+163    4321-06-01T    884405
+164    4321-06-30T    884434
+165    4321-07-01T    884435
+166    4321-07-31T    884465
+167    4321-08-01T    884466
+168    4321-08-31T    884496
+169    4321-09-01T    884497
+170    4321-09-30T    884526
+171    4321-10-01T    884527
+172    4321-10-31T    884557
+173    4321-11-01T    884558
+174    4321-11-30T    884587
+175    4321-12-01T    884588
+176    4321-12-31T    884618
+177    9999-01-01T    2958101
+178    9999-01-31T    2958131
+179    9999-02-01T    2958132
+180    9999-02-28T    2958159
+181    9999-03-01T    2958160
+182    9999-03-31T    2958190
+183    9999-04-01T    2958191
+184    9999-04-30T    2958220
+185    9999-05-01T    2958221
+186    9999-05-31T    2958251
+187    9999-06-01T    2958252
+188    9999-06-30T    2958281
+189    9999-07-01T    2958282
+190    9999-07-31T    2958312
+191    9999-08-01T    2958313
+192    9999-08-31T    2958343
+193    9999-09-01T    2958344
+194    9999-09-30T    2958373
+195    9999-10-01T    2958374
+196    9999-10-31T    2958404
+197    9999-11-01T    2958405
+198    9999-11-30T    2958434
+199    9999-12-01T    2958435
+200    9999-12-31T    2958465
+
+#
+# Excel 1904 date system
+#
+201    1904-01-01T    0
+202    1904-01-31T    30
+203    1904-02-01T    31
+204    1904-02-29T    59
+205    1904-03-01T    60
+206    1904-03-31T    90
+207    1904-04-01T    91
+208    1904-04-30T    120
+209    1904-05-01T    121
+210    1904-05-31T    151
+211    1904-06-01T    152
+212    1904-06-30T    181
+213    1904-07-01T    182
+214    1904-07-31T    212
+215    1904-08-01T    213
+216    1904-08-31T    243
+217    1904-09-01T    244
+218    1904-09-30T    273
+219    1904-10-01T    274
+220    1904-10-31T    304
+221    1904-11-01T    305
+222    1904-11-30T    334
+223    1904-12-01T    335
+224    1904-12-31T    365
+225    1907-02-27T    1153
+226    1907-02-28T    1154
+227    1907-03-01T    1155
+228    1907-03-02T    1156
+229    1907-03-03T    1157
+230    1907-03-04T    1158
+231    1907-03-05T    1159
+232    1907-03-06T    1160
+233    1999-01-01T    34699
+234    1999-01-31T    34729
+235    1999-02-01T    34730
+236    1999-02-28T    34757
+237    1999-03-01T    34758
+238    1999-03-31T    34788
+239    1999-04-01T    34789
+240    1999-04-30T    34818
+241    1999-05-01T    34819
+242    1999-05-31T    34849
+243    1999-06-01T    34850
+244    1999-06-30T    34879
+245    1999-07-01T    34880
+246    1999-07-31T    34910
+247    1999-08-01T    34911
+248    1999-08-31T    34941
+249    1999-09-01T    34942
+250    1999-09-30T    34971
+251    1999-10-01T    34972
+252    1999-10-31T    35002
+253    1999-11-01T    35003
+254    1999-11-30T    35032
+255    1999-12-01T    35033
+256    1999-12-31T    35063
+257    2000-01-01T    35064
+258    2000-01-31T    35094
+259    2000-02-01T    35095
+260    2000-02-29T    35123
+261    2000-03-01T    35124
+262    2000-03-31T    35154
+263    2000-04-01T    35155
+264    2000-04-30T    35184
+265    2000-05-01T    35185
+266    2000-05-31T    35215
+267    2000-06-01T    35216
+268    2000-06-30T    35245
+269    2000-07-01T    35246
+270    2000-07-31T    35276
+271    2000-08-01T    35277
+272    2000-08-31T    35307
+273    2000-09-01T    35308
+274    2000-09-30T    35337
+275    2000-10-01T    35338
+276    2000-10-31T    35368
+277    2000-11-01T    35369
+278    2000-11-30T    35398
+279    2000-12-01T    35399
+280    2000-12-31T    35429
+281    2001-01-01T    35430
+282    2001-01-31T    35460
+283    2001-02-01T    35461
+284    2001-02-28T    35488
+285    2001-03-01T    35489
+286    2001-03-31T    35519
+287    2001-04-01T    35520
+288    2001-04-30T    35549
+289    2001-05-01T    35550
+290    2001-05-31T    35580
+291    2001-06-01T    35581
+292    2001-06-30T    35610
+293    2001-07-01T    35611
+294    2001-07-31T    35641
+295    2001-08-01T    35642
+296    2001-08-31T    35672
+297    2001-09-01T    35673
+298    2001-09-30T    35702
+299    2001-10-01T    35703
+300    2001-10-31T    35733
+301    2001-11-01T    35734
+302    2001-11-30T    35763
+303    2001-12-01T    35764
+304    2001-12-31T    35794
+305    2400-01-01T    181161
+306    2400-01-31T    181191
+307    2400-02-01T    181192
+308    2400-02-29T    181220
+309    2400-03-01T    181221
+310    2400-03-31T    181251
+311    2400-04-01T    181252
+312    2400-04-30T    181281
+313    2400-05-01T    181282
+314    2400-05-31T    181312
+315    2400-06-01T    181313
+316    2400-06-30T    181342
+317    2400-07-01T    181343
+318    2400-07-31T    181373
+319    2400-08-01T    181374
+320    2400-08-31T    181404
+321    2400-09-01T    181405
+322    2400-09-30T    181434
+323    2400-10-01T    181435
+324    2400-10-31T    181465
+325    2400-11-01T    181466
+326    2400-11-30T    181495
+327    2400-12-01T    181496
+328    2400-12-31T    181526
+329    4000-01-01T    765549
+330    4000-01-31T    765579
+331    4000-02-01T    765580
+332    4000-02-29T    765608
+333    4000-03-01T    765609
+334    4000-03-31T    765639
+335    4000-04-01T    765640
+336    4000-04-30T    765669
+337    4000-05-01T    765670
+338    4000-05-31T    765700
+339    4000-06-01T    765701
+340    4000-06-30T    765730
+341    4000-07-01T    765731
+342    4000-07-31T    765761
+343    4000-08-01T    765762
+344    4000-08-31T    765792
+345    4000-09-01T    765793
+346    4000-09-30T    765822
+347    4000-10-01T    765823
+348    4000-10-31T    765853
+349    4000-11-01T    765854
+350    4000-11-30T    765883
+351    4000-12-01T    765884
+352    4000-12-31T    765914
+353    4321-01-01T    882792
+354    4321-01-31T    882822
+355    4321-02-01T    882823
+356    4321-02-28T    882850
+357    4321-03-01T    882851
+358    4321-03-31T    882881
+359    4321-04-01T    882882
+360    4321-04-30T    882911
+361    4321-05-01T    882912
+362    4321-05-31T    882942
+363    4321-06-01T    882943
+364    4321-06-30T    882972
+365    4321-07-01T    882973
+366    4321-07-31T    883003
+367    4321-08-01T    883004
+368    4321-08-31T    883034
+369    4321-09-01T    883035
+370    4321-09-30T    883064
+371    4321-10-01T    883065
+372    4321-10-31T    883095
+373    4321-11-01T    883096
+374    4321-11-30T    883125
+375    4321-12-01T    883126
+376    4321-12-31T    883156
+377    9999-01-01T    2956639
+378    9999-01-31T    2956669
+379    9999-02-01T    2956670
+380    9999-02-28T    2956697
+381    9999-03-01T    2956698
+382    9999-03-31T    2956728
+383    9999-04-01T    2956729
+384    9999-04-30T    2956758
+385    9999-05-01T    2956759
+386    9999-05-31T    2956789
+387    9999-06-01T    2956790
+388    9999-06-30T    2956819
+389    9999-07-01T    2956820
+390    9999-07-31T    2956850
+391    9999-08-01T    2956851
+392    9999-08-31T    2956881
+393    9999-09-01T    2956882
+394    9999-09-30T    2956911
+395    9999-10-01T    2956912
+396    9999-10-31T    2956942
+397    9999-11-01T    2956943
+398    9999-11-30T    2956972
+399    9999-12-01T    2956973
+400    9999-12-31T    2957003
+
+
+#
+# The following dates are invalid.
+#
+
+#
+# Excel 1900 date system
+#
+401    0000-12-30T    -1 # Below year range.
+402    1000-12-30T    -1 # Below year range.
+403    1899-12-30T    -1 # Below year range.
+404    2002-02-29T    -1 # False leap-day.
+405    2000-00-00T    -1 # No month or day.
+406    2000-01-00T    -1 # No day.
+407    2000-00-01T    -1 # No month.
+408    2000-13-01T    -1 # Month out of range.
+409    2000-12-32T    -1 # Day out of range.
+410   10000-01-01T    -1 # Year out of range.
+
+#
+# Excel 1904 date system
+#
+411    1899-12-31T    -1 # Below year range.
+412    1900-01-01T    -1 # Below year range.
+413    1903-12-31T    -1 # Below year range.
+414    2001-02-29T    -1 # False leap-day.
+415    2000-00-00T    -1 # No month or day.
+416    2000-01-00T    -1 # No day.
+417    2000-00-01T    -1 # No month.
+418    2000-13-01T    -1 # Month out of range.
+419    2000-12-32T    -1 # Day out of range.
+420   10000-01-01T    -1 # Year out of range.
+

Modified: packages/libspreadsheet-writeexcel-perl/trunk/t/13_date_seconds.t
===================================================================
--- packages/libspreadsheet-writeexcel-perl/trunk/t/13_date_seconds.t	2006-01-17 00:30:29 UTC (rev 1959)
+++ packages/libspreadsheet-writeexcel-perl/trunk/t/13_date_seconds.t	2006-01-17 00:30:29 UTC (rev 1960)
@@ -1,524 +1,524 @@
-#!/usr/bin/perl -w
-
-###############################################################################
-#
-# A test for Spreadsheet::WriteExcel.
-#
-# Tests date and time second handling.
-#
-# reverse('©'), May 2004, John McNamara, jmcnamara at cpan.org
-#
-
-use strict;
-
-use Spreadsheet::WriteExcel;
-use Test::More tests => 104;
-
-my $date_time;
-my $number;
-my $result;
-my $test_file = "temp_test_file.xls";
-
-my $workbook  = Spreadsheet::WriteExcel->new($test_file);
-my $worksheet = $workbook->add_worksheet();
-
-
-# Set float difference limit to half of an Excel millisecond
-my $flt_delta = 0.5/(24*60*60*1000);
-
-
-##############################################################################
-#
-# Float comparison function.
-#
-sub flt_cmp {
-    return abs($_[0] - $_[1]) < $flt_delta;
-}
-
-
-##############################################################################
-#
-# Test the flt_cmp() function used in the other tests.
-#
-
-$date_time = '1899-12-31T00:00:00.0004';
-$number    = 0;
-$result    = $worksheet->convert_date_time($date_time);
-$result    = -1 unless defined $result;
-
-# Test 1. This should pass. It is less than the float diff limit.
-ok(flt_cmp($number, $result),
-           " Testing flt_cmp() for $date_time $number");
-
-$date_time = '1899-12-31T00:00:00.0005';
-$number    = 0;
-$result    = $worksheet->convert_date_time($date_time);
-$result    = -1 unless defined $result;
-
-# Test 2. This should fail. It is equal to the float diff limit.
-my $diff   = ! flt_cmp($number, $result);
-ok($diff, " Testing flt_cmp() for $date_time $number");
-
-
-
-
-##############################################################################
-#
-# Test some false times.
-#
-
-# These should fail.
-my $fail;
-
-$date_time = '1899-12-31T24:00:00.000';
-$fail      = ! $worksheet->convert_date_time($date_time);
-ok($fail,  " Testing incorrect time: $date_time\tincorrect hour caught.");
-
-$date_time = '1899-12-31T00:60:00.000';
-$fail      = ! $worksheet->convert_date_time($date_time);
-ok($fail,  " Testing incorrect time: $date_time\tincorrect mins caught.");
-
-$date_time = '1899-12-31T00:00:60.000';
-$fail      = ! $worksheet->convert_date_time($date_time);
-ok($fail,  " Testing incorrect time: $date_time\tincorrect secs caught.");
-
-$date_time = '1899-12-31T00:00:59.9999999999999999999';
-$fail      = ! $worksheet->convert_date_time($date_time);
-ok($fail,  " Testing incorrect time: $date_time\tincorrect secs caught.");
-
-
-
-
-
-##############################################################################
-#
-# Test the time data generated in Excel.
-#
-while (<DATA>) {
-
-    last if /^# stop/; # For debugging
-    next unless /\S/;  # Ignore blank lines
-    next if /^#/;      # Ignore comments
-
-    if (/"DateTime">([^<]+)/) {
-        my $date_time = $1;
-        my $line      = <DATA>;
-
-        if ($line =~ /"Number">([^<]+)/) {
-            my $number = 0 + $1;
-            my $result = $worksheet->convert_date_time($date_time);
-               $result = -1 unless defined $result;
-
-            ok(flt_cmp($number, $result),
-                       " Testing convert_date_time: $date_time  $number")
-               or diag("difference between $number and $result\n" .
-                       "= " . abs($number -$result) . "\n".
-                       "> $flt_delta");
-        }
-    }
-}
-
-# Clean up
-$workbook->close();
-unlink $test_file;
-
-
-__DATA__
-
-
-# Test data taken from Excel in XML format.
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T00:00:00.000</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T00:15:20.213</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">1.0650613425925924E-2</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T00:16:48.290</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">1.1670023148148148E-2</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T00:55:25.446</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">3.8488958333333337E-2</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T01:02:46.891</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">4.3598275462962965E-2</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T01:04:15.597</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">4.4624965277777782E-2</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T01:09:40.889</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">4.8389918981481483E-2</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T01:11:32.560</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">4.9682407407407404E-2</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T01:30:19.169</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">6.2721863425925936E-2</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T01:48:25.580</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">7.5296064814814809E-2</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T02:03:31.919</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">8.5786099537037031E-2</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T02:11:11.986</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">9.1110949074074077E-2</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T02:24:37.095</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.10042934027777778</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T02:35:07.220</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.1077224537037037</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T02:45:12.109</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.11472348379629631</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T03:06:39.990</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.12962951388888888</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T03:08:08.251</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.13065105324074075</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T03:19:12.576</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.13833999999999999</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T03:29:42.574</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.14563164351851851</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T03:37:30.813</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.1510510763888889</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T04:14:38.231</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.1768313773148148</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T04:16:28.559</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.17810832175925925</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T04:17:58.222</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.17914608796296297</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T04:21:41.794</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.18173372685185185</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T04:56:35.792</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.2059698148148148</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T05:25:14.885</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.22586672453703704</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T05:26:05.724</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.22645513888888891</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T05:46:44.068</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.24078782407407406</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T05:48:01.141</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.2416798726851852</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T05:53:52.315</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.24574438657407408</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T06:14:48.580</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.26028449074074073</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T06:46:15.738</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.28212659722222222</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T07:31:20.407</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.31343063657407405</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T07:58:33.754</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.33233511574074076</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T08:07:43.130</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.33869363425925925</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T08:29:11.091</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.35360059027777774</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T09:08:15.328</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.380732962962963</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T09:30:41.781</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.39631690972222228</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T09:34:04.462</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.39866275462962958</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T09:37:23.945</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.40097158564814817</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T09:37:56.655</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.40135017361111114</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T09:45:12.230</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.40639155092592594</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T09:54:14.782</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.41267108796296298</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T09:54:22.108</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.41275587962962962</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T10:01:36.151</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.41777952546296299</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T12:09:48.602</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.50681252314814818</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T12:34:08.549</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.52371005787037039</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T12:56:06.495</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.53896406249999995</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T12:58:58.217</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.54095158564814816</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T12:59:54.263</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.54160026620370372</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T13:34:41.331</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.56575614583333333</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T13:58:28.601</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.58227547453703699</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T14:02:16.899</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.58491781249999997</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T14:36:17.444</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.60853523148148148</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T14:37:57.451</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.60969271990740748</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T14:57:42.757</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.6234115393518519</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T15:10:48.307</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.6325035532407407</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T15:14:39.890</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.63518391203703706</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T15:19:47.988</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.63874986111111109</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T16:04:24.344</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.66972620370370362</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T16:22:23.952</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.68222166666666662</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T16:29:55.999</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.6874536921296297</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T16:58:20.259</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.70717892361111112</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T17:04:02.415</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.71113906250000003</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T17:18:29.630</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.72117627314814825</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T17:47:21.323</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.74121901620370367</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T17:53:29.866</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.74548456018518516</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T17:53:41.076</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.74561430555555563</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T17:55:06.044</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.74659773148148145</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T18:14:49.151</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.760291099537037</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T18:17:45.738</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.76233493055555546</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T18:29:59.700</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.77082986111111118</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T18:33:21.233</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.77316241898148153</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T19:14:24.673</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.80167445601851861</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T19:17:12.816</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.80362055555555545</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T19:23:36.418</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.80806039351851855</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T19:46:25.908</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.82391097222222232</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T20:07:47.314</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.83874206018518516</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T20:31:37.603</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.85529633101851854</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T20:39:57.770</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.86108530092592594</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T20:50:17.067</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.86825309027777775</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T21:02:57.827</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.87705818287037041</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T21:23:05.519</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.891036099537037</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T21:34:49.572</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.89918486111111118</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T21:39:05.944</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.90215212962962965</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T21:39:18.426</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.90229659722222222</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T21:46:07.769</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.90703436342592603</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T21:57:55.662</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.91522756944444439</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T22:19:11.732</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.92999689814814823</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T22:23:51.376</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.93323351851851843</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T22:27:58.771</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.93609688657407408</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T22:43:30.392</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.94687953703703709</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T22:48:25.834</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.95029900462962968</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T22:53:51.727</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.95407091435185187</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T23:12:56.536</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.96732101851851848</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T23:15:54.109</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.96937626157407408</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T23:17:12.632</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.97028509259259266</Data></Cell>
-   </Row>
-   <Row>
-    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T23:59:59.999</Data></Cell>
-    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.99999998842592586</Data></Cell>
-   </Row>
-
-
-
+#!/usr/bin/perl -w
+
+###############################################################################
+#
+# A test for Spreadsheet::WriteExcel.
+#
+# Tests date and time second handling.
+#
+# reverse('©'), May 2004, John McNamara, jmcnamara at cpan.org
+#
+
+use strict;
+
+use Spreadsheet::WriteExcel;
+use Test::More tests => 104;
+
+my $date_time;
+my $number;
+my $result;
+my $test_file = "temp_test_file.xls";
+
+my $workbook  = Spreadsheet::WriteExcel->new($test_file);
+my $worksheet = $workbook->add_worksheet();
+
+
+# Set float difference limit to half of an Excel millisecond
+my $flt_delta = 0.5/(24*60*60*1000);
+
+
+##############################################################################
+#
+# Float comparison function.
+#
+sub flt_cmp {
+    return abs($_[0] - $_[1]) < $flt_delta;
+}
+
+
+##############################################################################
+#
+# Test the flt_cmp() function used in the other tests.
+#
+
+$date_time = '1899-12-31T00:00:00.0004';
+$number    = 0;
+$result    = $worksheet->convert_date_time($date_time);
+$result    = -1 unless defined $result;
+
+# Test 1. This should pass. It is less than the float diff limit.
+ok(flt_cmp($number, $result),
+           " Testing flt_cmp() for $date_time $number");
+
+$date_time = '1899-12-31T00:00:00.0005';
+$number    = 0;
+$result    = $worksheet->convert_date_time($date_time);
+$result    = -1 unless defined $result;
+
+# Test 2. This should fail. It is equal to the float diff limit.
+my $diff   = ! flt_cmp($number, $result);
+ok($diff, " Testing flt_cmp() for $date_time $number");
+
+
+
+
+##############################################################################
+#
+# Test some false times.
+#
+
+# These should fail.
+my $fail;
+
+$date_time = '1899-12-31T24:00:00.000';
+$fail      = ! $worksheet->convert_date_time($date_time);
+ok($fail,  " Testing incorrect time: $date_time\tincorrect hour caught.");
+
+$date_time = '1899-12-31T00:60:00.000';
+$fail      = ! $worksheet->convert_date_time($date_time);
+ok($fail,  " Testing incorrect time: $date_time\tincorrect mins caught.");
+
+$date_time = '1899-12-31T00:00:60.000';
+$fail      = ! $worksheet->convert_date_time($date_time);
+ok($fail,  " Testing incorrect time: $date_time\tincorrect secs caught.");
+
+$date_time = '1899-12-31T00:00:59.9999999999999999999';
+$fail      = ! $worksheet->convert_date_time($date_time);
+ok($fail,  " Testing incorrect time: $date_time\tincorrect secs caught.");
+
+
+
+
+
+##############################################################################
+#
+# Test the time data generated in Excel.
+#
+while (<DATA>) {
+
+    last if /^# stop/; # For debugging
+    next unless /\S/;  # Ignore blank lines
+    next if /^#/;      # Ignore comments
+
+    if (/"DateTime">([^<]+)/) {
+        my $date_time = $1;
+        my $line      = <DATA>;
+
+        if ($line =~ /"Number">([^<]+)/) {
+            my $number = 0 + $1;
+            my $result = $worksheet->convert_date_time($date_time);
+               $result = -1 unless defined $result;
+
+            ok(flt_cmp($number, $result),
+                       " Testing convert_date_time: $date_time  $number")
+               or diag("difference between $number and $result\n" .
+                       "= " . abs($number -$result) . "\n".
+                       "> $flt_delta");
+        }
+    }
+}
+
+# Clean up
+$workbook->close();
+unlink $test_file;
+
+
+__DATA__
+
+
+# Test data taken from Excel in XML format.
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T00:00:00.000</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T00:15:20.213</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">1.0650613425925924E-2</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T00:16:48.290</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">1.1670023148148148E-2</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T00:55:25.446</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">3.8488958333333337E-2</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T01:02:46.891</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">4.3598275462962965E-2</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T01:04:15.597</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">4.4624965277777782E-2</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T01:09:40.889</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">4.8389918981481483E-2</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T01:11:32.560</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">4.9682407407407404E-2</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T01:30:19.169</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">6.2721863425925936E-2</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T01:48:25.580</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">7.5296064814814809E-2</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T02:03:31.919</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">8.5786099537037031E-2</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T02:11:11.986</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">9.1110949074074077E-2</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T02:24:37.095</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.10042934027777778</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T02:35:07.220</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.1077224537037037</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T02:45:12.109</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.11472348379629631</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T03:06:39.990</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.12962951388888888</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T03:08:08.251</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.13065105324074075</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T03:19:12.576</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.13833999999999999</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T03:29:42.574</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.14563164351851851</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T03:37:30.813</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.1510510763888889</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T04:14:38.231</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.1768313773148148</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T04:16:28.559</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.17810832175925925</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T04:17:58.222</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.17914608796296297</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T04:21:41.794</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.18173372685185185</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T04:56:35.792</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.2059698148148148</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T05:25:14.885</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.22586672453703704</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T05:26:05.724</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.22645513888888891</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T05:46:44.068</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.24078782407407406</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T05:48:01.141</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.2416798726851852</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T05:53:52.315</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.24574438657407408</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T06:14:48.580</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.26028449074074073</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T06:46:15.738</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.28212659722222222</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T07:31:20.407</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.31343063657407405</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T07:58:33.754</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.33233511574074076</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T08:07:43.130</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.33869363425925925</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T08:29:11.091</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.35360059027777774</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T09:08:15.328</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.380732962962963</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T09:30:41.781</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.39631690972222228</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T09:34:04.462</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.39866275462962958</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T09:37:23.945</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.40097158564814817</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T09:37:56.655</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.40135017361111114</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T09:45:12.230</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.40639155092592594</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T09:54:14.782</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.41267108796296298</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T09:54:22.108</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.41275587962962962</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T10:01:36.151</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.41777952546296299</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T12:09:48.602</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.50681252314814818</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T12:34:08.549</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.52371005787037039</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T12:56:06.495</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.53896406249999995</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T12:58:58.217</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.54095158564814816</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T12:59:54.263</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.54160026620370372</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T13:34:41.331</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.56575614583333333</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T13:58:28.601</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.58227547453703699</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T14:02:16.899</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.58491781249999997</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T14:36:17.444</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.60853523148148148</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T14:37:57.451</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.60969271990740748</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T14:57:42.757</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.6234115393518519</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T15:10:48.307</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.6325035532407407</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T15:14:39.890</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.63518391203703706</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T15:19:47.988</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.63874986111111109</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T16:04:24.344</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.66972620370370362</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T16:22:23.952</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.68222166666666662</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T16:29:55.999</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.6874536921296297</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T16:58:20.259</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.70717892361111112</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T17:04:02.415</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.71113906250000003</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T17:18:29.630</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.72117627314814825</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T17:47:21.323</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.74121901620370367</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T17:53:29.866</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.74548456018518516</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T17:53:41.076</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.74561430555555563</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T17:55:06.044</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.74659773148148145</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T18:14:49.151</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.760291099537037</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T18:17:45.738</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.76233493055555546</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T18:29:59.700</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.77082986111111118</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T18:33:21.233</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.77316241898148153</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T19:14:24.673</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.80167445601851861</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T19:17:12.816</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.80362055555555545</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T19:23:36.418</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.80806039351851855</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T19:46:25.908</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.82391097222222232</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T20:07:47.314</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.83874206018518516</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T20:31:37.603</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.85529633101851854</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T20:39:57.770</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.86108530092592594</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T20:50:17.067</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.86825309027777775</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T21:02:57.827</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.87705818287037041</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T21:23:05.519</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.891036099537037</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T21:34:49.572</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.89918486111111118</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T21:39:05.944</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.90215212962962965</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T21:39:18.426</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.90229659722222222</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T21:46:07.769</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.90703436342592603</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T21:57:55.662</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.91522756944444439</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T22:19:11.732</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.92999689814814823</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T22:23:51.376</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.93323351851851843</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T22:27:58.771</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.93609688657407408</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T22:43:30.392</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.94687953703703709</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T22:48:25.834</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.95029900462962968</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T22:53:51.727</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.95407091435185187</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T23:12:56.536</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.96732101851851848</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T23:15:54.109</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.96937626157407408</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T23:17:12.632</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.97028509259259266</Data></Cell>
+   </Row>
+   <Row>
+    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">1899-12-31T23:59:59.999</Data></Cell>
+    <Cell ss:StyleID="s23" ss:Formula="=RC[-1]"><Data ss:Type="Number">0.99999998842592586</Data></Cell>
+   </Row>
+
+
+

Copied: packages/libspreadsheet-writeexcel-perl/trunk/t/21_escher.t (from rev 1957, packages/libspreadsheet-writeexcel-perl/branches/upstream/current/t/21_escher.t)

Copied: packages/libspreadsheet-writeexcel-perl/trunk/t/22_mso_drawing_group.t (from rev 1957, packages/libspreadsheet-writeexcel-perl/branches/upstream/current/t/22_mso_drawing_group.t)

Copied: packages/libspreadsheet-writeexcel-perl/trunk/t/23_note.t (from rev 1957, packages/libspreadsheet-writeexcel-perl/branches/upstream/current/t/23_note.t)

Copied: packages/libspreadsheet-writeexcel-perl/trunk/t/24_txo.t (from rev 1957, packages/libspreadsheet-writeexcel-perl/branches/upstream/current/t/24_txo.t)




More information about the Pkg-perl-cvs-commits mailing list