{
    "mode": "perldoc",
    "parameter": "Spreadsheet::WriteExcel",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Spreadsheet%3A%3AWriteExcel/json",
    "generated": "2026-06-12T18:09:26Z",
    "synopsis": "To write a string, a formatted string, a number and a formula to the first worksheet in an Excel\nworkbook called perl.xls:\nuse Spreadsheet::WriteExcel;\n# Create a new Excel workbook\nmy $workbook = Spreadsheet::WriteExcel->new('perl.xls');\n# Add a worksheet\n$worksheet = $workbook->addworksheet();\n#  Add and define a format\n$format = $workbook->addformat(); # Add a format\n$format->setbold();\n$format->setcolor('red');\n$format->setalign('center');\n# Write a formatted and unformatted string, row and column notation.\n$col = $row = 0;\n$worksheet->write($row, $col, 'Hi Excel!', $format);\n$worksheet->write(1,    $col, 'Hi Excel!');\n# Write a number and a formula using A1 notation\n$worksheet->write('A3', 1.2345);\n$worksheet->write('A4', '=SIN(PI()/4)');",
    "sections": {
        "NAME": {
            "content": "Spreadsheet::WriteExcel - Write to a cross-platform Excel binary file.\n",
            "subsections": []
        },
        "VERSION": {
            "content": "This document refers to version 2.40 of Spreadsheet::WriteExcel, released November 6, 2013.\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "To write a string, a formatted string, a number and a formula to the first worksheet in an Excel\nworkbook called perl.xls:\n\nuse Spreadsheet::WriteExcel;\n\n# Create a new Excel workbook\nmy $workbook = Spreadsheet::WriteExcel->new('perl.xls');\n\n# Add a worksheet\n$worksheet = $workbook->addworksheet();\n\n#  Add and define a format\n$format = $workbook->addformat(); # Add a format\n$format->setbold();\n$format->setcolor('red');\n$format->setalign('center');\n\n# Write a formatted and unformatted string, row and column notation.\n$col = $row = 0;\n$worksheet->write($row, $col, 'Hi Excel!', $format);\n$worksheet->write(1,    $col, 'Hi Excel!');\n\n# Write a number and a formula using A1 notation\n$worksheet->write('A3', 1.2345);\n$worksheet->write('A4', '=SIN(PI()/4)');\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "The Spreadsheet::WriteExcel Perl module can be used to create a cross-platform Excel binary\nfile. Multiple worksheets can be added to a workbook and formatting can be applied to cells.\nText, numbers, formulas, hyperlinks, images and charts can be written to the cells.\n\nThe file produced by this module is compatible with Excel 97, 2000, 2002, 2003 and 2007.\n\nThe module will work on the majority of Windows, UNIX and Mac platforms. Generated files are\nalso compatible with the Linux/UNIX spreadsheet applications Gnumeric and OpenOffice.org.\n\nThis module cannot be used to write to an existing Excel file (See \"MODIFYING AND REWRITING\nEXCEL FILES\").\n\nNote: This module is in maintenance only mode and in future will only be updated with bug fixes.\nThe newer, more feature rich and API compatible Excel::Writer::XLSX module is recommended\ninstead. See, \"Migrating to Excel::Writer::XLSX\".\n",
            "subsections": []
        },
        "QUICK START": {
            "content": "Spreadsheet::WriteExcel tries to provide an interface to as many of Excel's features as\npossible. As a result there is a lot of documentation to accompany the interface and it can be\ndifficult at first glance to see what it important and what is not. So for those of you who\nprefer to assemble Ikea furniture first and then read the instructions, here are three easy\nsteps:\n\n1. Create a new Excel *workbook* (i.e. file) using \"new()\".\n\n2. Add a *worksheet* to the new workbook using \"addworksheet()\".\n\n3. Write to the worksheet using \"write()\".\n\nLike this:\n\nuse Spreadsheet::WriteExcel;                             # Step 0\n\nmy $workbook = Spreadsheet::WriteExcel->new('perl.xls'); # Step 1\n$worksheet   = $workbook->addworksheet();               # Step 2\n$worksheet->write('A1', 'Hi Excel!');                    # Step 3\n\nThis will create an Excel file called \"perl.xls\" with a single worksheet and the text 'Hi\nExcel!' in the relevant cell. And that's it. Okay, so there is actually a zeroth step as well,\nbut \"use module\" goes without saying. There are also more than 80 examples that come with the\ndistribution and which you can use to get you started. See \"EXAMPLES\".\n\nThose of you who read the instructions first and assemble the furniture afterwards will know how\nto proceed. ;-)\n",
            "subsections": []
        },
        "WORKBOOK METHODS": {
            "content": "The Spreadsheet::WriteExcel module provides an object oriented interface to a new Excel\nworkbook. The following methods are available through a new workbook.\n\nnew()\naddworksheet()\naddformat()\naddchart()\naddchartext()\nclose()\ncompatibilitymode()\nsetproperties()\ndefinename()\nsettempdir()\nsetcustomcolor()\nsheets()\nset1904()\nsetcodepage()\n\nIf you are unfamiliar with object oriented interfaces or the way that they are implemented in\nPerl have a look at \"perlobj\" and \"perltoot\" in the main Perl documentation.\n\nnew()\nA new Excel workbook is created using the \"new()\" constructor which accepts either a filename or\na filehandle as a parameter. The following example creates a new Excel file based on a filename:\n\nmy $workbook  = Spreadsheet::WriteExcel->new('filename.xls');\nmy $worksheet = $workbook->addworksheet();\n$worksheet->write(0, 0, 'Hi Excel!');\n\nHere are some other examples of using \"new()\" with filenames:\n\nmy $workbook1 = Spreadsheet::WriteExcel->new($filename);\nmy $workbook2 = Spreadsheet::WriteExcel->new('/tmp/filename.xls');\nmy $workbook3 = Spreadsheet::WriteExcel->new(\"c:\\\\tmp\\\\filename.xls\");\nmy $workbook4 = Spreadsheet::WriteExcel->new('c:\\tmp\\filename.xls');\n\nThe last two examples demonstrates how to create a file on DOS or Windows where it is necessary\nto either escape the directory separator \"\\\" or to use single quotes to ensure that it isn't\ninterpolated. For more information see \"perlfaq5: Why can't I use \"C:\\temp\\foo\" in DOS paths?\".\n\nThe \"new()\" constructor returns a Spreadsheet::WriteExcel object that you can use to add\nworksheets and store data. It should be noted that although \"my\" is not specifically required it\ndefines the scope of the new workbook variable and, in the majority of cases, ensures that the\nworkbook is closed properly without explicitly calling the \"close()\" method.\n\nIf the file cannot be created, due to file permissions or some other reason, \"new\" will return\n\"undef\". Therefore, it is good practice to check the return value of \"new\" before proceeding. As\nusual the Perl variable $! will be set if there is a file creation error. You will also see one\nof the warning messages detailed in \"DIAGNOSTICS\":\n\nmy $workbook  = Spreadsheet::WriteExcel->new('protected.xls');\ndie \"Problems creating new Excel file: $!\" unless defined $workbook;\n\nYou can also pass a valid filehandle to the \"new()\" constructor. For example in a CGI program\nyou could do something like this:\n\nbinmode(STDOUT);\nmy $workbook  = Spreadsheet::WriteExcel->new(\\*STDOUT);\n\nThe requirement for \"binmode()\" is explained below.\n\nSee also, the \"cgi.pl\" program in the \"examples\" directory of the distro.\n\nHowever, this special case will not work in \"modperl\" programs where you will have to do\nsomething like the following:\n\n# modperl 1\n...\ntie *XLS, 'Apache';\nbinmode(XLS);\nmy $workbook  = Spreadsheet::WriteExcel->new(\\*XLS);\n...\n\n# modperl 2\n...\ntie *XLS => $r;  # Tie to the Apache::RequestRec object\nbinmode(*XLS);\nmy $workbook  = Spreadsheet::WriteExcel->new(\\*XLS);\n...\n\nSee also, the \"modperl1.pl\" and \"modperl2.pl\" programs in the \"examples\" directory of the\ndistro.\n\nFilehandles can also be useful if you want to stream an Excel file over a socket or if you want\nto store an Excel file in a scalar.\n\nFor example here is a way to write an Excel file to a scalar with \"perl 5.8\":\n\n#!/usr/bin/perl -w\n\nuse strict;\nuse Spreadsheet::WriteExcel;\n\n# Requires perl 5.8 or later\nopen my $fh, '>', \\my $str or die \"Failed to open filehandle: $!\";\n\nmy $workbook  = Spreadsheet::WriteExcel->new($fh);\nmy $worksheet = $workbook->addworksheet();\n\n$worksheet->write(0, 0,  'Hi Excel!');\n\n$workbook->close();\n\n# The Excel file in now in $str. Remember to binmode() the output\n# filehandle before printing it.\nbinmode STDOUT;\nprint $str;\n\nSee also the \"writetoscalar.pl\" and \"filehandle.pl\" programs in the \"examples\" directory of\nthe distro.\n\nNote about the requirement for \"binmode()\". An Excel file is comprised of binary data.\nTherefore, if you are using a filehandle you should ensure that you \"binmode()\" it prior to\npassing it to \"new()\".You should do this regardless of whether you are on a Windows platform or\nnot. This applies especially to users of perl 5.8 on systems where \"UTF-8\" is likely to be in\noperation such as RedHat Linux 9. If your program, either intentionally or not, writes \"UTF-8\"\ndata to a filehandle that is passed to \"new()\" it will corrupt the Excel file that is created.\n\nYou don't have to worry about \"binmode()\" if you are using filenames instead of filehandles.\nSpreadsheet::WriteExcel performs the \"binmode()\" internally when it converts the filename to a\nfilehandle. For more information about \"binmode()\" see \"perlfunc\" and \"perlopentut\" in the main\nPerl documentation.\n\naddworksheet($sheetname, $utf16be)\nAt least one worksheet should be added to a new workbook. A worksheet is used to write data into\ncells:\n\n$worksheet1 = $workbook->addworksheet();           # Sheet1\n$worksheet2 = $workbook->addworksheet('Foglio2');  # Foglio2\n$worksheet3 = $workbook->addworksheet('Data');     # Data\n$worksheet4 = $workbook->addworksheet();           # Sheet4\n\nIf $sheetname is not specified the default Excel convention will be followed, i.e. Sheet1,\nSheet2, etc. The $utf16be parameter is optional, see below.\n\nThe worksheet name must be a valid Excel worksheet name, i.e. it cannot contain any of the\nfollowing characters, \"[ ] : * ? / \\\" and it must be less than 32 characters. In addition, you\ncannot use the same, case insensitive, $sheetname for more than one worksheet.\n\nOn systems with \"perl 5.8\" and later the \"addworksheet()\" method will also handle strings in\n\"UTF-8\" format.\n\n$worksheet = $workbook->addworksheet(\"\\x{263a}\"); # Smiley\n\nOn earlier Perl systems your can specify \"UTF-16BE\" worksheet names using an additional optional\nparameter:\n\nmy $name = pack 'n', 0x263a;\n$worksheet = $workbook->addworksheet($name, 1);   # Smiley\n\naddformat(%properties)\nThe \"addformat()\" method can be used to create new Format objects which are used to apply\nformatting to a cell. You can either define the properties at creation time via a hash of\nproperty values or later via method calls.\n\n$format1 = $workbook->addformat(%props); # Set properties at creation\n$format2 = $workbook->addformat();       # Set properties later\n\nSee the \"CELL FORMATTING\" section for more details about Format properties and how to set them.\n\naddchart(%properties)\nThis method is use to create a new chart either as a standalone worksheet (the default) or as an\nembeddable object that can be inserted into a worksheet via the \"insertchart()\" Worksheet\nmethod.\n\nmy $chart = $workbook->addchart( type => 'column' );\n\nThe properties that can be set are:\n\ntype     (required)\nname     (optional)\nembedded (optional)\n\n*   \"type\"\n\nThis is a required parameter. It defines the type of chart that will be created.\n\nmy $chart = $workbook->addchart( type => 'line' );\n\nThe available types are:\n\narea\nbar\ncolumn\nline\npie\nscatter\nstock\n\n*   \"name\"\n\nSet the name for the chart sheet. The name property is optional and if it isn't supplied\nwill default to \"Chart1 .. n\". The name must be a valid Excel worksheet name. See\n\"addworksheet()\" for more details on valid sheet names. The \"name\" property can be omitted\nfor embedded charts.\n\nmy $chart = $workbook->addchart( type => 'line', name => 'Results Chart' );\n\n*   \"embedded\"\n\nSpecifies that the Chart object will be inserted in a worksheet via the \"insertchart()\"\nWorksheet method. It is an error to try insert a Chart that doesn't have this flag set.\n\nmy $chart = $workbook->addchart( type => 'line', embedded => 1 );\n\n# Configure the chart.\n...\n\n# Insert the chart into the a worksheet.\n$worksheet->insertchart( 'E2', $chart );\n\nSee Spreadsheet::WriteExcel::Chart for details on how to configure the chart object once it is\ncreated. See also the \"chart*.pl\" programs in the examples directory of the distro.\n\naddchartext($chartdata, $chartname)\nThis method is use to include externally generated charts in a Spreadsheet::WriteExcel file.\n\nmy $chart = $workbook->addchartext('chart01.bin', 'Chart1');\n\nThis feature is semi-deprecated in favour of the \"native\" charts created using \"addchart()\".\nRead \"externalcharts.txt\" (or \".pod\") in the externalcharts directory of the distro for a full\nexplanation.\n\nclose()\nIn general your Excel file will be closed automatically when your program ends or when the\nWorkbook object goes out of scope, however the \"close()\" method can be used to explicitly close\nan Excel file.\n\n$workbook->close();\n\nAn explicit \"close()\" is required if the file must be closed prior to performing some external\naction on it such as copying it, reading its size or attaching it to an email.\n\nIn addition, \"close()\" may be required to prevent perl's garbage collector from disposing of the\nWorkbook, Worksheet and Format objects in the wrong order. Situations where this can occur are:\n\n*   If \"my()\" was not used to declare the scope of a workbook variable created using \"new()\".\n\n*   If the \"new()\", \"addworksheet()\" or \"addformat()\" methods are called in subroutines.\n\nThe reason for this is that Spreadsheet::WriteExcel relies on Perl's \"DESTROY\" mechanism to\ntrigger destructor methods in a specific sequence. This may not happen in cases where the\nWorkbook, Worksheet and Format variables are not lexically scoped or where they have different\nlexical scopes.\n\nIn general, if you create a file with a size of 0 bytes or you fail to create a file you need to\ncall \"close()\".\n\nThe return value of \"close()\" is the same as that returned by perl when it closes the file\ncreated by \"new()\". This allows you to handle error conditions in the usual way:\n\n$workbook->close() or die \"Error closing file: $!\";\n\ncompatibilitymode()\nThis method is used to improve compatibility with third party applications that read Excel\nfiles.\n\n$workbook->compatibilitymode();\n\nAn Excel file is comprised of binary records that describe properties of a spreadsheet. Excel is\nreasonably liberal about this and, outside of a core subset, it doesn't require every possible\nrecord to be present when it reads a file. This is also true of Gnumeric and OpenOffice.Org\nCalc.\n\nSpreadsheet::WriteExcel takes advantage of this fact to omit some records in order to minimise\nthe amount of data stored in memory and to simplify and speed up the writing of files. However,\nsome third party applications that read Excel files often expect certain records to be present.\nIn \"compatibility mode\" Spreadsheet::WriteExcel writes these records and tries to be as close to\nan Excel generated file as possible.\n\nApplications that require \"compatibilitymode()\" are Apache POI, Apple Numbers, and Quickoffice\non Nokia, Palm and other devices. You should also use \"compatibilitymode()\" if your Excel file\nwill be used as an external data source by another Excel file.\n\nIf you encounter other situations that require \"compatibilitymode()\", please let me know.\n\nIt should be noted that \"compatibilitymode()\" requires additional data to be stored in memory\nand additional processing. This incurs a memory and speed penalty and may not be suitable for\nvery large files (>20MB).\n\nYou must call \"compatibilitymode()\" before calling \"addworksheet()\".\n\nsetproperties()\nThe \"setproperties\" method can be used to set the document properties of the Excel file created\nby \"Spreadsheet::WriteExcel\". These properties are visible when you use the \"File->Properties\"\nmenu option in Excel and are also available to external applications that read or index windows\nfiles.\n\nThe properties should be passed as a hash of values as follows:\n\n$workbook->setproperties(\ntitle    => 'This is an example spreadsheet',\nauthor   => 'John McNamara',\ncomments => 'Created with Perl and Spreadsheet::WriteExcel',\n);\n\nThe properties that can be set are:\n\ntitle\nsubject\nauthor\nmanager\ncompany\ncategory\nkeywords\ncomments\n\nUser defined properties are not supported due to effort required.\n\nIn perl 5.8+ you can also pass UTF-8 strings as properties. See \"UNICODE IN EXCEL\".\n\nmy $smiley = chr 0x263A;\n\n$workbook->setproperties(\nsubject => \"Happy now? $smiley\",\n);\n\nWith older versions of perl you can use a module to convert a non-ASCII string to a binary\nrepresentation of UTF-8 and then pass an additional \"utf8\" flag to \"setproperties()\":\n\nmy $smiley = pack 'H*', 'E298BA';\n\n$workbook->setproperties(\nsubject => \"Happy now? $smiley\",\nutf8    => 1,\n);\n\nUsually Spreadsheet::WriteExcel allows you to use UTF-16 with pre 5.8 versions of perl. However,\ndocument properties don't support UTF-16 for these type of strings.\n\nIn order to promote the usefulness of Perl and the Spreadsheet::WriteExcel module consider\nadding a comment such as the following when using document properties:\n\n$workbook->setproperties(\n...,\ncomments => 'Created with Perl and Spreadsheet::WriteExcel',\n...,\n);\n\nThis feature requires that the \"OLE::StorageLite\" module is installed (which is usually the\ncase for a standard Spreadsheet::WriteExcel installation). However, this also means that the\nresulting OLE document may possibly be buggy for files less than 7MB since it hasn't been as\nrigorously tested in that domain. As a result of this \"setproperties\" is currently incompatible\nwith Gnumeric for files less than 7MB. This is being investigated. If you encounter any problems\nwith this features let me know.\n\nFor convenience it is possible to pass either a hash or hash ref of arguments to this method.\n\nSee also the \"properties.pl\" program in the examples directory of the distro.\n\ndefinename()\nThis method is used to defined a name that can be used to represent a value, a single cell or a\nrange of cells in a workbook.\n\n$workbook->definename('Exchangerate', '=0.96');\n$workbook->definename('Sales',         '=Sheet1!$G$1:$H$10');\n$workbook->definename('Sheet2!Sales',  '=Sheet2!$G$1:$G$10');\n\nSee the definedname.pl program in the examples dir of the distro.\n\nNote: This currently a beta feature. More documentation and examples will be added.\n\nsettempdir()\nFor speed and efficiency \"Spreadsheet::WriteExcel\" stores worksheet data in temporary files\nprior to assembling the final workbook.\n\nIf Spreadsheet::WriteExcel is unable to create these temporary files it will store the required\ndata in memory. This can be slow for large files.\n\nThe problem occurs mainly with IIS on Windows although it could feasibly occur on Unix systems\nas well. The problem generally occurs because the default temp file directory is defined as\n\"C:/\" or some other directory that IIS doesn't provide write access to.\n\nTo check if this might be a problem on a particular system you can run a simple test program\nwith \"-w\" or \"use warnings\". This will generate a warning if the module cannot create the\nrequired temporary files:\n\n#!/usr/bin/perl -w\n\nuse Spreadsheet::WriteExcel;\n\nmy $workbook  = Spreadsheet::WriteExcel->new('test.xls');\nmy $worksheet = $workbook->addworksheet();\n\nTo avoid this problem the \"settempdir()\" method can be used to specify a directory that is\naccessible for the creation of temporary files.\n\nThe \"File::Temp\" module is used to create the temporary files. File::Temp uses \"File::Spec\" to\ndetermine an appropriate location for these files such as \"/tmp\" or \"c:\\windows\\temp\". You can\nfind out which directory is used on your system as follows:\n\nperl -MFile::Spec -le \"print File::Spec->tmpdir\"\n\nEven if the default temporary file directory is accessible you may wish to specify an\nalternative location for security or maintenance reasons:\n\n$workbook->settempdir('/tmp/writeexcel');\n$workbook->settempdir('c:\\windows\\temp\\writeexcel');\n\nThe directory for the temporary file must exist, \"settempdir()\" will not create a new\ndirectory.\n\nOne disadvantage of using the \"settempdir()\" method is that on some Windows systems it will\nlimit you to approximately 800 concurrent tempfiles. This means that a single program running on\none of these systems will be limited to creating a total of 800 workbook and worksheet objects.\nYou can run multiple, non-concurrent programs to work around this if necessary.\n\nsetcustomcolor($index, $red, $green, $blue)\nThe \"setcustomcolor()\" method can be used to override one of the built-in palette values with\na more suitable colour.\n\nThe value for $index should be in the range 8..63, see \"COLOURS IN EXCEL\".\n\nThe default named colours use the following indices:\n\n8   =>   black\n9   =>   white\n10   =>   red\n11   =>   lime\n12   =>   blue\n13   =>   yellow\n14   =>   magenta\n15   =>   cyan\n16   =>   brown\n17   =>   green\n18   =>   navy\n20   =>   purple\n22   =>   silver\n23   =>   gray\n33   =>   pink\n53   =>   orange\n\nA new colour is set using its RGB (red green blue) components. The $red, $green and $blue values\nmust be in the range 0..255. You can determine the required values in Excel using the\n\"Tools->Options->Colors->Modify\" dialog.\n\nThe \"setcustomcolor()\" workbook method can also be used with a HTML style \"#rrggbb\" hex value:\n\n$workbook->setcustomcolor(40, 255,  102,  0   ); # Orange\n$workbook->setcustomcolor(40, 0xFF, 0x66, 0x00); # Same thing\n$workbook->setcustomcolor(40, '#FF6600'       ); # Same thing\n\nmy $font = $workbook->addformat(color => 40); # Use the modified colour\n\nThe return value from \"setcustomcolor()\" is the index of the colour that was changed:\n\nmy $ferrari = $workbook->setcustomcolor(40, 216, 12, 12);\n\nmy $format  = $workbook->addformat(\nbgcolor => $ferrari,\npattern  => 1,\nborder   => 1\n);\n\nsheets(0, 1, ...)\nThe \"sheets()\" method returns a list, or a sliced list, of the worksheets in a workbook.\n\nIf no arguments are passed the method returns a list of all the worksheets in the workbook. This\nis useful if you want to repeat an operation on each worksheet:\n\nforeach $worksheet ($workbook->sheets()) {\nprint $worksheet->getname();\n}\n\nYou can also specify a slice list to return one or more worksheet objects:\n\n$worksheet = $workbook->sheets(0);\n$worksheet->write('A1', 'Hello');\n\nOr since return value from \"sheets()\" is a reference to a worksheet object you can write the\nabove example as:\n\n$workbook->sheets(0)->write('A1', 'Hello');\n\nThe following example returns the first and last worksheet in a workbook:\n\nforeach $worksheet ($workbook->sheets(0, -1)) {\n# Do something\n}\n\nArray slices are explained in the perldata manpage.\n\nset1904()\nExcel stores dates as real numbers where the integer part stores the number of days since the\nepoch and the fractional part stores the percentage of the day. The epoch can be either 1900 or\n1904. Excel for Windows uses 1900 and Excel for Macintosh uses 1904. However, Excel on either\nplatform will convert automatically between one system and the other.\n\nSpreadsheet::WriteExcel stores dates in the 1900 format by default. If you wish to change this\nyou can call the \"set1904()\" workbook method. You can query the current value by calling the\n\"get1904()\" workbook method. This returns 0 for 1900 and 1 for 1904.\n\nSee also \"DATES AND TIME IN EXCEL\" for more information about working with Excel's date system.\n\nIn general you probably won't need to use \"set1904()\".\n\nsetcodepage($codepage)\nThe default code page or character set used by Spreadsheet::WriteExcel is ANSI. This is also the\ndefault used by Excel for Windows. Occasionally however it may be necessary to change the code\npage via the \"setcodepage()\" method.\n\nChanging the code page may be required if your are using Spreadsheet::WriteExcel on the\nMacintosh and you are using characters outside the ASCII 128 character set:\n\n$workbook->setcodepage(1); # ANSI, MS Windows\n$workbook->setcodepage(2); # Apple Macintosh\n\nThe \"setcodepage()\" method is rarely required.\n",
            "subsections": []
        },
        "WORKSHEET METHODS": {
            "content": "A new worksheet is created by calling the \"addworksheet()\" method from a workbook object:\n\n$worksheet1 = $workbook->addworksheet();\n$worksheet2 = $workbook->addworksheet();\n\nThe following methods are available through a new worksheet:\n\nwrite()\nwritenumber()\nwritestring()\nwriteutf16bestring()\nwriteutf16lestring()\nkeepleadingzeros()\nwriteblank()\nwriterow()\nwritecol()\nwritedatetime()\nwriteurl()\nwriteurlrange()\nwriteformula()\nstoreformula()\nrepeatformula()\nwritecomment()\nshowcomments()\naddwritehandler()\ninsertimage()\ninsertchart()\ndatavalidation()\ngetname()\nactivate()\nselect()\nhide()\nsetfirstsheet()\nprotect()\nsetselection()\nsetrow()\nsetcolumn()\noutlinesettings()\nfreezepanes()\nsplitpanes()\nmergerange()\nsetzoom()\nrighttoleft()\nhidezero()\nsettabcolor()\nautofilter()\n",
            "subsections": [
                {
                    "name": "Cell notation",
                    "content": "Spreadsheet::WriteExcel supports two forms of notation to designate the position of cells:\nRow-column notation and A1 notation.\n\nRow-column notation uses a zero based index for both row and column while A1 notation uses the\nstandard Excel alphanumeric sequence of column letter and 1-based row. For example:\n\n(0, 0)      # The top left cell in row-column notation.\n('A1')      # The top left cell in A1 notation.\n\n(1999, 29)  # Row-column notation.\n('AD2000')  # The same cell in A1 notation.\n\nRow-column notation is useful if you are referring to cells programmatically:\n\nfor my $i (0 .. 9) {\n$worksheet->write($i, 0, 'Hello'); # Cells A1 to A10\n}\n\nA1 notation is useful for setting up a worksheet manually and for working with formulas:\n\n$worksheet->write('H1', 200);\n$worksheet->write('H2', '=H1+1');\n\nIn formulas and applicable methods you can also use the \"A:A\" column notation:\n\n$worksheet->write('A1', '=SUM(B:B)');\n\nThe \"Spreadsheet::WriteExcel::Utility\" module that is included in the distro contains helper\nfunctions for dealing with A1 notation, for example:\n\nuse Spreadsheet::WriteExcel::Utility;\n\n($row, $col)    = xlcelltorowcol('C2');  # (1, 2)\n$str            = xlrowcoltocell(1, 2);  # C2\n\nFor simplicity, the parameter lists for the worksheet method calls in the following sections are\ngiven in terms of row-column notation. In all cases it is also possible to use A1 notation.\n\nNote: in Excel it is also possible to use a R1C1 notation. This is not supported by\nSpreadsheet::WriteExcel.\n\nwrite($row, $column, $token, $format)\nExcel makes a distinction between data types such as strings, numbers, blanks, formulas and\nhyperlinks. To simplify the process of writing data the \"write()\" method acts as a general alias\nfor several more specific methods:\n\nwritestring()\nwritenumber()\nwriteblank()\nwriteformula()\nwriteurl()\nwriterow()\nwritecol()\n\nThe general rule is that if the data looks like a *something* then a *something* is written.\nHere are some examples in both row-column and A1 notation:\n\n# Same as:\n$worksheet->write(0, 0, 'Hello'                ); # writestring()\n$worksheet->write(1, 0, 'One'                  ); # writestring()\n$worksheet->write(2, 0,  2                     ); # writenumber()\n$worksheet->write(3, 0,  3.00001               ); # writenumber()\n$worksheet->write(4, 0,  \"\"                    ); # writeblank()\n$worksheet->write(5, 0,  ''                    ); # writeblank()\n$worksheet->write(6, 0,  undef                 ); # writeblank()\n$worksheet->write(7, 0                         ); # writeblank()\n$worksheet->write(8, 0,  'http://www.perl.com/'); # writeurl()\n$worksheet->write('A9',  'ftp://ftp.cpan.org/' ); # writeurl()\n$worksheet->write('A10', 'internal:Sheet1!A1'  ); # writeurl()\n$worksheet->write('A11', 'external:c:\\foo.xls' ); # writeurl()\n$worksheet->write('A12', '=A3 + 3*A4'          ); # writeformula()\n$worksheet->write('A13', '=SIN(PI()/4)'        ); # writeformula()\n$worksheet->write('A14', \\@array               ); # writerow()\n$worksheet->write('A15', [\\@array]             ); # writecol()\n\n# And if the keepleadingzeros property is set:\n$worksheet->write('A16', '2'                   ); # writenumber()\n$worksheet->write('A17', '02'                  ); # writestring()\n$worksheet->write('A18', '00002'               ); # writestring()\n\nThe \"looks like\" rule is defined by regular expressions:\n\n\"writenumber()\" if $token is a number based on the following regex: \"$token =~\n/^([+-]?)(?=\\d|\\.\\d)\\d*(\\.\\d*)?([Ee]([+-]?\\d+))?$/\".\n\n\"writestring()\" if \"keepleadingzeros()\" is set and $token is an integer with leading zeros\nbased on the following regex: \"$token =~ /^0\\d+$/\".\n\n\"writeblank()\" if $token is undef or a blank string: \"undef\", \"\" or ''.\n\n\"writeurl()\" if $token is a http, https, ftp or mailto URL based on the following regexes:\n\"$token =~ m|^[fh]tt?ps?://|\" or \"$token =~ m|^mailto:|\".\n\n\"writeurl()\" if $token is an internal or external sheet reference based on the following regex:\n\"$token =~ m[^(in|ex)ternal:]\".\n\n\"writeformula()\" if the first character of $token is \"=\".\n\n\"writerow()\" if $token is an array ref.\n\n\"writecol()\" if $token is an array ref of array refs.\n\n\"writestring()\" if none of the previous conditions apply.\n\nThe $format parameter is optional. It should be a valid Format object, see \"CELL FORMATTING\":\n\nmy $format = $workbook->addformat();\n$format->setbold();\n$format->setcolor('red');\n$format->setalign('center');\n\n$worksheet->write(4, 0, 'Hello', $format); # Formatted string\n\nThe write() method will ignore empty strings or \"undef\" tokens unless a format is also supplied.\nAs such you needn't worry about special handling for empty or \"undef\" values in your data. See\nalso the \"writeblank()\" method.\n\nOne problem with the \"write()\" method is that occasionally data looks like a number but you\ndon't want it treated as a number. For example, zip codes or ID numbers often start with a\nleading zero. If you write this data as a number then the leading zero(s) will be stripped. You\ncan change this default behaviour by using the \"keepleadingzeros()\" method. While this\nproperty is in place any integers with leading zeros will be treated as strings and the zeros\nwill be preserved. See the \"keepleadingzeros()\" section for a full discussion of this issue.\n\nYou can also add your own data handlers to the \"write()\" method using \"addwritehandler()\".\n\nOn systems with \"perl 5.8\" and later the \"write()\" method will also handle Unicode strings in\n\"UTF-8\" format.\n\nThe \"write\" methods return:\n\n0 for success.\n-1 for insufficient number of arguments.\n-2 for row or column out of bounds.\n-3 for string too long.\n\nwritenumber($row, $column, $number, $format)\nWrite an integer or a float to the cell specified by $row and $column:\n\n$worksheet->writenumber(0, 0,  123456);\n$worksheet->writenumber('A2',  2.3451);\n\nSee the note about \"Cell notation\". The $format parameter is optional.\n\nIn general it is sufficient to use the \"write()\" method.\n\nwritestring($row, $column, $string, $format)\nWrite a string to the cell specified by $row and $column:\n\n$worksheet->writestring(0, 0, 'Your text here' );\n$worksheet->writestring('A2', 'or here' );\n\nThe maximum string size is 32767 characters. However the maximum string segment that Excel can\ndisplay in a cell is 1000. All 32767 characters can be displayed in the formula bar.\n\nThe $format parameter is optional.\n\nOn systems with \"perl 5.8\" and later the \"write()\" method will also handle strings in \"UTF-8\"\nformat. With older perls you can also write Unicode in \"UTF16\" format via the\n\"writeutf16bestring()\" method. See also the \"unicode*.pl\" programs in the examples directory\nof the distro.\n\nIn general it is sufficient to use the \"write()\" method. However, you may sometimes wish to use\nthe \"writestring()\" method to write data that looks like a number but that you don't want\ntreated as a number. For example, zip codes or phone numbers:\n\n# Write as a plain string\n$worksheet->writestring('A1', '01209');\n\nHowever, if the user edits this string Excel may convert it back to a number. To get around this\nyou can use the Excel text format \"@\":\n\n# Format as a string. Doesn't change to a number when edited\nmy $format1 = $workbook->addformat(numformat => '@');\n$worksheet->writestring('A2', '01209', $format1);\n\nSee also the note about \"Cell notation\".\n\nwriteutf16bestring($row, $column, $string, $format)\nThis method is used to write \"UTF-16BE\" strings to a cell in Excel. It is functionally the same\nas the \"writestring()\" method except that the string should be in \"UTF-16BE\" Unicode format. It\nis generally easier, when using Spreadsheet::WriteExcel, to write unicode strings in \"UTF-8\"\nformat, see \"UNICODE IN EXCEL\". The \"writeutf16bestring()\" method is mainly of use in versions\nof perl prior to 5.8.\n\nThe following is a simple example showing how to write some Unicode strings in \"UTF-16BE\"\nformat:\n\n#!/usr/bin/perl -w\n\n\nuse strict;\nuse Spreadsheet::WriteExcel;\nuse Unicode::Map();\n\nmy $workbook  = Spreadsheet::WriteExcel->new('utf16be.xls');\nmy $worksheet = $workbook->addworksheet();\n\n# Increase the column width for clarity\n$worksheet->setcolumn('A:A', 25);\n\n\n# Write a Unicode character\n#\nmy $smiley = pack 'n', 0x263a;\n\n# Increase the font size for legibility.\nmy $bigfont = $workbook->addformat(size => 72);\n\n$worksheet->writeutf16bestring('A3', $smiley, $bigfont);\n\n\n\n# Write a phrase in Cyrillic using a hex-encoded string\n#\nmy $str = pack 'H*', '042d0442043e0020044404400430043704300020043d' .\n'043000200440044304410441043a043e043c0021';\n\n$worksheet->writeutf16bestring('A5', $str);\n\n\n\n# Map a string to UTF-16BE using an external module.\n#\nmy $map   = Unicode::Map->new('ISO-8859-1');\nmy $utf16 = $map->tounicode('Hello world!');\n\n$worksheet->writeutf16bestring('A7', $utf16);\n\nYou can convert ASCII encodings to the required \"UTF-16BE\" format using one of the many Unicode\nmodules on CPAN. For example \"Unicode::Map\" and \"Unicode::String\":\n<http://search.cpan.org/author/MSCHWARTZ/Unicode-Map/Map.pm> and\n<http://search.cpan.org/author/GAAS/Unicode-String/String.pm>.\n\nFor a full list of the Perl Unicode modules see:\n<http://search.cpan.org/search?query=unicode&mode=all>.\n\n\"UTF-16BE\" is the format most often returned by \"Perl\" modules that generate \"UTF-16\". To write\n\"UTF-16\" strings in little-endian format use the \"writeutf16bestringle()\" method below.\n\nThe \"writeutf16bestring()\" method was previously called \"writeunicode()\". That, overly\ngeneral, name is still supported but deprecated.\n\nSee also the \"unicode*.pl\" programs in the examples directory of the distro.\n\nwriteutf16lestring($row, $column, $string, $format)\nThis method is the same as \"writeutf16be()\" except that the string should be 16-bit characters\nin little-endian format. This is generally referred to as \"UTF-16LE\". See \"UNICODE IN EXCEL\".\n\n\"UTF-16\" data can be changed from little-endian to big-endian format (and vice-versa) as\nfollows:\n\n$utf16be = pack 'n*', unpack 'v*', $utf16le;\n\nkeepleadingzeros()\nThis method changes the default handling of integers with leading zeros when using the \"write()\"\nmethod.\n\nThe \"write()\" method uses regular expressions to determine what type of data to write to an\nExcel worksheet. If the data looks like a number it writes a number using \"writenumber()\". One\nproblem with this approach is that occasionally data looks like a number but you don't want it\ntreated as a number.\n\nZip codes and ID numbers, for example, often start with a leading zero. If you write this data\nas a number then the leading zero(s) will be stripped. This is the also the default behaviour\nwhen you enter data manually in Excel.\n\nTo get around this you can use one of three options. Write a formatted number, write the number\nas a string or use the \"keepleadingzeros()\" method to change the default behaviour of\n\"write()\":\n\n# Implicitly write a number, the leading zero is removed: 1209\n$worksheet->write('A1', '01209');\n\n# Write a zero padded number using a format: 01209\nmy $format1 = $workbook->addformat(numformat => '00000');\n$worksheet->write('A2', '01209', $format1);\n\n# Write explicitly as a string: 01209\n$worksheet->writestring('A3', '01209');\n\n# Write implicitly as a string: 01209\n$worksheet->keepleadingzeros();\n$worksheet->write('A4', '01209');\n\nThe above code would generate a worksheet that looked like the following:\n\n-----------------------------------------------------------\n|   |     A     |     B     |     C     |     D     | ...\n-----------------------------------------------------------\n| 1 |      1209 |           |           |           | ...\n| 2 |     01209 |           |           |           | ...\n| 3 | 01209     |           |           |           | ...\n| 4 | 01209     |           |           |           | ...\n\nThe examples are on different sides of the cells due to the fact that Excel displays strings\nwith a left justification and numbers with a right justification by default. You can change this\nby using a format to justify the data, see \"CELL FORMATTING\".\n\nIt should be noted that if the user edits the data in examples \"A3\" and \"A4\" the strings will\nrevert back to numbers. Again this is Excel's default behaviour. To avoid this you can use the\ntext format \"@\":\n\n# Format as a string (01209)\nmy $format2 = $workbook->addformat(numformat => '@');\n$worksheet->writestring('A5', '01209', $format2);\n\nThe \"keepleadingzeros()\" property is off by default. The \"keepleadingzeros()\" method takes 0\nor 1 as an argument. It defaults to 1 if an argument isn't specified:\n\n$worksheet->keepleadingzeros();  # Set on\n$worksheet->keepleadingzeros(1); # Set on\n$worksheet->keepleadingzeros(0); # Set off\n\nSee also the \"addwritehandler()\" method.\n\nwriteblank($row, $column, $format)\nWrite a blank cell specified by $row and $column:\n\n$worksheet->writeblank(0, 0, $format);\n\nThis method is used to add formatting to a cell which doesn't contain a string or number value.\n\nExcel differentiates between an \"Empty\" cell and a \"Blank\" cell. An \"Empty\" cell is a cell which\ndoesn't contain data whilst a \"Blank\" cell is a cell which doesn't contain data but does contain\nformatting. Excel stores \"Blank\" cells but ignores \"Empty\" cells.\n\nAs such, if you write an empty cell without formatting it is ignored:\n\n$worksheet->write('A1',  undef, $format); # writeblank()\n$worksheet->write('A2',  undef         ); # Ignored\n\nThis seemingly uninteresting fact means that you can write arrays of data without special\ntreatment for undef or empty string values.\n\nSee the note about \"Cell notation\".\n\nwriterow($row, $column, $arrayref, $format)\nThe \"writerow()\" method can be used to write a 1D or 2D array of data in one go. This is useful\nfor converting the results of a database query into an Excel worksheet. You must pass a\nreference to the array of data rather than the array itself. The \"write()\" method is then called\nfor each element of the data. For example:\n\n@array      = ('awk', 'gawk', 'mawk');\n$arrayref  = \\@array;\n\n$worksheet->writerow(0, 0, $arrayref);\n\n# The above example is equivalent to:\n$worksheet->write(0, 0, $array[0]);\n$worksheet->write(0, 1, $array[1]);\n$worksheet->write(0, 2, $array[2]);\n\nNote: For convenience the \"write()\" method behaves in the same way as \"writerow()\" if it is\npassed an array reference. Therefore the following two method calls are equivalent:\n\n$worksheet->writerow('A1', $arrayref); # Write a row of data\n$worksheet->write(    'A1', $arrayref); # Same thing\n\nAs with all of the write methods the $format parameter is optional. If a format is specified it\nis applied to all the elements of the data array.\n\nArray references within the data will be treated as columns. This allows you to write 2D arrays\nof data in one go. For example:\n\n@eec =  (\n['maggie', 'milly', 'molly', 'may'  ],\n[13,       14,      15,      16     ],\n['shell',  'star',  'crab',  'stone']\n);\n\n$worksheet->writerow('A1', \\@eec);\n\nWould produce a worksheet as follows:\n\n-----------------------------------------------------------\n|   |    A    |    B    |    C    |    D    |    E    | ...\n-----------------------------------------------------------\n| 1 | maggie  | 13      | shell   | ...     |  ...    | ...\n| 2 | milly   | 14      | star    | ...     |  ...    | ...\n| 3 | molly   | 15      | crab    | ...     |  ...    | ...\n| 4 | may     | 16      | stone   | ...     |  ...    | ...\n| 5 | ...     | ...     | ...     | ...     |  ...    | ...\n| 6 | ...     | ...     | ...     | ...     |  ...    | ...\n\nTo write the data in a row-column order refer to the \"writecol()\" method below.\n\nAny \"undef\" values in the data will be ignored unless a format is applied to the data, in which\ncase a formatted blank cell will be written. In either case the appropriate row or column value\nwill still be incremented.\n\nTo find out more about array references refer to \"perlref\" and \"perlreftut\" in the main Perl\ndocumentation. To find out more about 2D arrays or \"lists of lists\" refer to \"perllol\".\n\nThe \"writerow()\" method returns the first error encountered when writing the elements of the\ndata or zero if no errors were encountered. See the return values described for the \"write()\"\nmethod above.\n\nSee also the \"writearrays.pl\" program in the \"examples\" directory of the distro.\n\nThe \"writerow()\" method allows the following idiomatic conversion of a text file to an Excel\nfile:\n\n#!/usr/bin/perl -w\n\nuse strict;\nuse Spreadsheet::WriteExcel;\n\nmy $workbook  = Spreadsheet::WriteExcel->new('file.xls');\nmy $worksheet = $workbook->addworksheet();\n\nopen INPUT, 'file.txt' or die \"Couldn't open file: $!\";\n\n$worksheet->write($.-1, 0, [split]) while <INPUT>;\n\nwritecol($row, $column, $arrayref, $format)\nThe \"writecol()\" method can be used to write a 1D or 2D array of data in one go. This is useful\nfor converting the results of a database query into an Excel worksheet. You must pass a\nreference to the array of data rather than the array itself. The \"write()\" method is then called\nfor each element of the data. For example:\n\n@array      = ('awk', 'gawk', 'mawk');\n$arrayref  = \\@array;\n\n$worksheet->writecol(0, 0, $arrayref);\n\n# The above example is equivalent to:\n$worksheet->write(0, 0, $array[0]);\n$worksheet->write(1, 0, $array[1]);\n$worksheet->write(2, 0, $array[2]);\n\nAs with all of the write methods the $format parameter is optional. If a format is specified it\nis applied to all the elements of the data array.\n\nArray references within the data will be treated as rows. This allows you to write 2D arrays of\ndata in one go. For example:\n\n@eec =  (\n['maggie', 'milly', 'molly', 'may'  ],\n[13,       14,      15,      16     ],\n['shell',  'star',  'crab',  'stone']\n);\n\n$worksheet->writecol('A1', \\@eec);\n\nWould produce a worksheet as follows:\n\n-----------------------------------------------------------\n|   |    A    |    B    |    C    |    D    |    E    | ...\n-----------------------------------------------------------\n| 1 | maggie  | milly   | molly   | may     |  ...    | ...\n| 2 | 13      | 14      | 15      | 16      |  ...    | ...\n| 3 | shell   | star    | crab    | stone   |  ...    | ...\n| 4 | ...     | ...     | ...     | ...     |  ...    | ...\n| 5 | ...     | ...     | ...     | ...     |  ...    | ...\n| 6 | ...     | ...     | ...     | ...     |  ...    | ...\n\nTo write the data in a column-row order refer to the \"writerow()\" method above.\n\nAny \"undef\" values in the data will be ignored unless a format is applied to the data, in which\ncase a formatted blank cell will be written. In either case the appropriate row or column value\nwill still be incremented.\n\nAs noted above the \"write()\" method can be used as a synonym for \"writerow()\" and \"writerow()\"\nhandles nested array refs as columns. Therefore, the following two method calls are equivalent\nalthough the more explicit call to \"writecol()\" would be preferable for maintainability:\n\n$worksheet->writecol('A1', $arrayref    ); # Write a column of data\n$worksheet->write(    'A1', [ $arrayref ]); # Same thing\n\nTo find out more about array references refer to \"perlref\" and \"perlreftut\" in the main Perl\ndocumentation. To find out more about 2D arrays or \"lists of lists\" refer to \"perllol\".\n\nThe \"writecol()\" method returns the first error encountered when writing the elements of the\ndata or zero if no errors were encountered. See the return values described for the \"write()\"\nmethod above.\n\nSee also the \"writearrays.pl\" program in the \"examples\" directory of the distro.\n\nwritedatetime($row, $col, $datestring, $format)\nThe \"writedatetime()\" method can be used to write a date or time to the cell specified by $row\nand $column:\n\n$worksheet->writedatetime('A1', '2004-05-13T23:20', $dateformat);\n\nThe $datestring should be in the following format:\n\nyyyy-mm-ddThh:mm:ss.sss\n\nThis conforms to an ISO8601 date but it should be noted that the full range of ISO8601 formats\nare not supported.\n\nThe following variations on the $datestring parameter are permitted:\n\nyyyy-mm-ddThh:mm:ss.sss         # Standard format\nyyyy-mm-ddT                     # No time\nThh:mm:ss.sss         # No date\nyyyy-mm-ddThh:mm:ss.sssZ        # Additional Z (but not time zones)\nyyyy-mm-ddThh:mm:ss             # No fractional seconds\nyyyy-mm-ddThh:mm                # No seconds\n\nNote that the \"T\" is required in all cases.\n\nA date should always have a $format, otherwise it will appear as a number, see \"DATES AND TIME\nIN EXCEL\" and \"CELL FORMATTING\". Here is a typical example:\n\nmy $dateformat = $workbook->addformat(numformat => 'mm/dd/yy');\n$worksheet->writedatetime('A1', '2004-05-13T23:20', $dateformat);\n\nValid dates should be in the range 1900-01-01 to 9999-12-31, for the 1900 epoch and 1904-01-01\nto 9999-12-31, for the 1904 epoch. As with Excel, dates outside these ranges will be written as\na string.\n\nSee also the datetime.pl program in the \"examples\" directory of the distro.\n\nwriteurl($row, $col, $url, $label, $format)\nWrite a hyperlink to a URL in the cell specified by $row and $column. The hyperlink is comprised\nof two elements: the visible label and the invisible link. The visible label is the same as the\nlink unless an alternative label is specified. The parameters $label and the $format are\noptional and their position is interchangeable.\n\nThe label is written using the \"write()\" method. Therefore it is possible to write strings,\nnumbers or formulas as labels.\n\nThere are four web style URI's supported: \"http://\", \"https://\", \"ftp://\" and \"mailto:\":\n\n$worksheet->writeurl(0, 0,  'ftp://www.perl.org/'                  );\n$worksheet->writeurl(1, 0,  'http://www.perl.com/', 'Perl home'    );\n$worksheet->writeurl('A3',  'http://www.perl.com/', $format        );\n$worksheet->writeurl('A4',  'http://www.perl.com/', 'Perl', $format);\n$worksheet->writeurl('A5',  'mailto:jmcnamara@cpan.org'            );\n\nThere are two local URIs supported: \"internal:\" and \"external:\". These are used for hyperlinks\nto internal worksheet references or external workbook and worksheet references:\n\n$worksheet->writeurl('A6',  'internal:Sheet2!A1'                   );\n$worksheet->writeurl('A7',  'internal:Sheet2!A1',   $format        );\n$worksheet->writeurl('A8',  'internal:Sheet2!A1:B2'                );\n$worksheet->writeurl('A9',  q{internal:'Sales Data'!A1}            );\n$worksheet->writeurl('A10', 'external:c:\\temp\\foo.xls'             );\n$worksheet->writeurl('A11', 'external:c:\\temp\\foo.xls#Sheet2!A1'   );\n$worksheet->writeurl('A12', 'external:..\\..\\..\\foo.xls'            );\n$worksheet->writeurl('A13', 'external:..\\..\\..\\foo.xls#Sheet2!A1'  );\n$worksheet->writeurl('A13', 'external:\\\\\\\\NETWORK\\share\\foo.xls'   );\n\nAll of the these URI types are recognised by the \"write()\" method, see above.\n\nWorksheet references are typically of the form \"Sheet1!A1\". You can also refer to a worksheet\nrange using the standard Excel notation: \"Sheet1!A1:B2\".\n\nIn external links the workbook and worksheet name must be separated by the \"#\" character:\n\"external:Workbook.xls#Sheet1!A1'\".\n\nYou can also link to a named range in the target worksheet. For example say you have a named\nrange called \"myname\" in the workbook \"c:\\temp\\foo.xls\" you could link to it as follows:\n\n$worksheet->writeurl('A14', 'external:c:\\temp\\foo.xls#myname');\n\nNote, you cannot currently create named ranges with \"Spreadsheet::WriteExcel\".\n\nExcel requires that worksheet names containing spaces or non alphanumeric characters are single\nquoted as follows \"'Sales Data'!A1\". If you need to do this in a single quoted string then you\ncan either escape the single quotes \"\\'\" or use the quote operator \"q{}\" as described in\n\"perlop\" in the main Perl documentation.\n\nLinks to network files are also supported. MS/Novell Network files normally begin with two back\nslashes as follows \"\\\\NETWORK\\etc\". In order to generate this in a single or double quoted\nstring you will have to escape the backslashes, '\\\\\\\\NETWORK\\etc'.\n\nIf you are using double quote strings then you should be careful to escape anything that looks\nlike a metacharacter. For more information see \"perlfaq5: Why can't I use \"C:\\temp\\foo\" in DOS\npaths?\".\n\nFinally, you can avoid most of these quoting problems by using forward slashes. These are\ntranslated internally to backslashes:\n\n$worksheet->writeurl('A14', \"external:c:/temp/foo.xls\"             );\n$worksheet->writeurl('A15', 'external://NETWORK/share/foo.xls'     );\n\nSee also, the note about \"Cell notation\".\n\nwriteurlrange($row1, $col1, $row2, $col2, $url, $string, $format)\nThis method is essentially the same as the \"writeurl()\" method described above. The main\ndifference is that you can specify a link for a range of cells:\n\n$worksheet->writeurl(0, 0, 0, 3, 'ftp://www.perl.org/'              );\n$worksheet->writeurl(1, 0, 0, 3, 'http://www.perl.com/', 'Perl home');\n$worksheet->writeurl('A3:D3',    'internal:Sheet2!A1'               );\n$worksheet->writeurl('A4:D4',    'external:c:\\temp\\foo.xls'         );\n\nThis method is generally only required when used in conjunction with merged cells. See the\n\"mergerange()\" method and the \"merge\" property of a Format object, \"CELL FORMATTING\".\n\nThere is no way to force this behaviour through the \"write()\" method.\n\nThe parameters $string and the $format are optional and their position is interchangeable.\nHowever, they are applied only to the first cell in the range.\n\nSee also, the note about \"Cell notation\".\n\nwriteformula($row, $column, $formula, $format, $value)\nWrite a formula or function to the cell specified by $row and $column:\n\n$worksheet->writeformula(0, 0, '=$B$3 + B4'  );\n$worksheet->writeformula(1, 0, '=SIN(PI()/4)');\n$worksheet->writeformula(2, 0, '=SUM(B1:B5)' );\n$worksheet->writeformula('A4', '=IF(A3>1,\"Yes\", \"No\")'   );\n$worksheet->writeformula('A5', '=AVERAGE(1, 2, 3, 4)'    );\n$worksheet->writeformula('A6', '=DATEVALUE(\"1-Jan-2001\")');\n\nSee the note about \"Cell notation\". For more information about writing Excel formulas see\n\"FORMULAS AND FUNCTIONS IN EXCEL\"\n\nSee also the section \"Improving performance when working with formulas\" and the\n\"storeformula()\" and \"repeatformula()\" methods.\n\nIf required, it is also possible to specify the calculated value of the formula. This is\noccasionally necessary when working with non-Excel applications that don't calculate the value\nof the formula. The calculated $value is added at the end of the argument list:\n\n$worksheet->write('A1', '=2+2', $format, 4);\n\nHowever, this probably isn't something that will ever need to do. If you do use this feature\nthen do so with care.\n\nstoreformula($formula)\nThe \"storeformula()\" method is used in conjunction with \"repeatformula()\" to speed up the\ngeneration of repeated formulas. See \"Improving performance when working with formulas\" in\n\"FORMULAS AND FUNCTIONS IN EXCEL\".\n\nThe \"storeformula()\" method pre-parses a textual representation of a formula and stores it for\nuse at a later stage by the \"repeatformula()\" method.\n\n\"storeformula()\" carries the same speed penalty as \"writeformula()\". However, in practice it\nwill be used less frequently.\n\nThe return value of this method is a scalar that can be thought of as a reference to a formula.\n\nmy $sin = $worksheet->storeformula('=SIN(A1)');\nmy $cos = $worksheet->storeformula('=COS(A1)');\n\n$worksheet->repeatformula('B1', $sin, $format, 'A1', 'A2');\n$worksheet->repeatformula('C1', $cos, $format, 'A1', 'A2');\n\nAlthough \"storeformula()\" is a worksheet method the return value can be used in any worksheet:\n\nmy $now = $worksheet->storeformula('=NOW()');\n\n$worksheet1->repeatformula('B1', $now);\n$worksheet2->repeatformula('B1', $now);\n$worksheet3->repeatformula('B1', $now);\n\nrepeatformula($row, $col, $formula, $format, ($pattern => $replace, ...))\nThe \"repeatformula()\" method is used in conjunction with \"storeformula()\" to speed up the\ngeneration of repeated formulas. See \"Improving performance when working with formulas\" in\n\"FORMULAS AND FUNCTIONS IN EXCEL\".\n\nIn many respects \"repeatformula()\" behaves like \"writeformula()\" except that it is\nsignificantly faster.\n\nThe \"repeatformula()\" method creates a new formula based on the pre-parsed tokens returned by\n\"storeformula()\". The new formula is generated by substituting $pattern, $replace pairs in the\nstored formula:\n\nmy $formula = $worksheet->storeformula('=A1 * 3 + 50');\n\nfor my $row (0..99) {\n$worksheet->repeatformula($row, 1, $formula, $format, 'A1', 'A'.($row +1));\n}\n\nIt should be noted that \"repeatformula()\" doesn't modify the tokens. In the above example the\nsubstitution is always made against the original token, \"A1\", which doesn't change.\n\nAs usual, you can use \"undef\" if you don't wish to specify a $format:\n\n$worksheet->repeatformula('B2', $formula, $format, 'A1', 'A2');\n$worksheet->repeatformula('B3', $formula, undef,   'A1', 'A3');\n\nThe substitutions are made from left to right and you can use as many $pattern, $replace pairs\nas you need. However, each substitution is made only once:\n\nmy $formula = $worksheet->storeformula('=A1 + A1');\n\n# Gives '=B1 + A1'\n$worksheet->repeatformula('B1', $formula, undef, 'A1', 'B1');\n\n# Gives '=B1 + B1'\n$worksheet->repeatformula('B2', $formula, undef, ('A1', 'B1') x 2);\n\nSince the $pattern is interpolated each time that it is used it is worth using the \"qr\" operator\nto quote the pattern. The \"qr\" operator is explained in the \"perlop\" man page.\n\n$worksheet->repeatformula('B1', $formula, $format, qr/A1/, 'A2');\n\nCare should be taken with the values that are substituted. The formula returned by\n\"repeatformula()\" contains several other tokens in addition to those in the formula and these\nmight also match the pattern that you are trying to replace. In particular you should avoid\nsubstituting a single 0, 1, 2 or 3.\n\nYou should also be careful to avoid false matches. For example the following snippet is meant to\nchange the stored formula in steps from \"=A1 + SIN(A1)\" to \"=A10 + SIN(A10)\".\n\nmy $formula = $worksheet->storeformula('=A1 + SIN(A1)');\n\nfor my $row (1 .. 10) {\n$worksheet->repeatformula($row -1, 1, $formula, undef,\nqw/A1/, 'A' . $row,   #! Bad.\nqw/A1/, 'A' . $row    #! Bad.\n);\n}\n\nHowever it contains a bug. In the last iteration of the loop when $row is 10 the following\nsubstitutions will occur:\n\ns/A1/A10/;    changes    =A1 + SIN(A1)     to    =A10 + SIN(A1)\ns/A1/A10/;    changes    =A10 + SIN(A1)    to    =A100 + SIN(A1) # !!\n\nThe solution in this case is to use a more explicit match such as \"qw/^A1$/\":\n\n$worksheet->repeatformula($row -1, 1, $formula, undef,\nqw/^A1$/, 'A' . $row,\nqw/^A1$/, 'A' . $row\n);\n\nAnother similar problem occurs due to the fact that substitutions are made in order. For example\nthe following snippet is meant to change the stored formula from \"=A10 + A11\" to \"=A11 + A12\":\n\nmy $formula = $worksheet->storeformula('=A10 + A11');\n\n$worksheet->repeatformula('A1', $formula, undef,\nqw/A10/, 'A11',   #! Bad.\nqw/A11/, 'A12'    #! Bad.\n);\n\nHowever, the actual substitution yields \"=A12 + A11\":\n\ns/A10/A11/;    changes    =A10 + A11    to    =A11 + A11\ns/A11/A12/;    changes    =A11 + A11    to    =A12 + A11 # !!\n\nThe solution here would be to reverse the order of the substitutions or to start with a stored\nformula that won't yield a false match such as \"=X10 + Y11\":\n\nmy $formula = $worksheet->storeformula('=X10 + Y11');\n\n$worksheet->repeatformula('A1', $formula, undef,\nqw/X10/, 'A11',\nqw/Y11/, 'A12'\n);\n\nIf you think that you have a problem related to a false match you can check the tokens that you\nare substituting against as follows.\n\nmy $formula = $worksheet->storeformula('=A1*5+4');\nprint \"@$formula\\n\";\n\nSee also the \"repeat.pl\" program in the \"examples\" directory of the distro.\n\nwritecomment($row, $column, $string, ...)\nThe \"writecomment()\" method is used to add a comment to a cell. A cell comment is indicated in\nExcel by a small red triangle in the upper right-hand corner of the cell. Moving the cursor over\nthe red triangle will reveal the comment.\n\nThe following example shows how to add a comment to a cell:\n\n$worksheet->write        (2, 2, 'Hello');\n$worksheet->writecomment(2, 2, 'This is a comment.');\n\nAs usual you can replace the $row and $column parameters with an \"A1\" cell reference. See the\nnote about \"Cell notation\".\n\n$worksheet->write        ('C3', 'Hello');\n$worksheet->writecomment('C3', 'This is a comment.');\n\nOn systems with \"perl 5.8\" and later the \"writecomment()\" method will also handle strings in\n\"UTF-8\" format.\n\n$worksheet->writecomment('C3', \"\\x{263a}\");       # Smiley\n$worksheet->writecomment('C4', 'Comment ca va?');\n\nIn addition to the basic 3 argument form of \"writecomment()\" you can pass in several optional\nkey/value pairs to control the format of the comment. For example:\n\n$worksheet->writecomment('C3', 'Hello', visible => 1, author => 'Perl');\n\nMost of these options are quite specific and in general the default comment behaviour will be\nall that you need. However, should you need greater control over the format of the cell comment\nthe following options are available:\n\nencoding\nauthor\nauthorencoding\nvisible\nxscale\nwidth\nyscale\nheight\ncolor\nstartcell\nstartrow\nstartcol\nxoffset\nyoffset\n\nOption: encoding\nThis option is used to indicate that the comment string is encoded as \"UTF-16BE\".\n\nmy $comment = pack 'n', 0x263a; # UTF-16BE Smiley symbol\n\n$worksheet->writecomment('C3', $comment, encoding => 1);\n\nIf you wish to use Unicode characters in the comment string then the preferred method is to\nuse perl 5.8 and \"UTF-8\" strings, see \"UNICODE IN EXCEL\".\n\nOption: author\nThis option is used to indicate who the author of the comment is. Excel displays the author\nof the comment in the status bar at the bottom of the worksheet. This is usually of interest\nin corporate environments where several people might review and provide comments to a\nworkbook.\n\n$worksheet->writecomment('C3', 'Atonement', author => 'Ian McEwan');\n\nOption: authorencoding\nThis option is used to indicate that the author string is encoded as \"UTF-16BE\".\n\nOption: visible\nThis option is used to make a cell comment visible when the worksheet is opened. The default\nbehaviour in Excel is that comments are initially hidden. However, it is also possible in\nExcel to make individual or all comments visible. In Spreadsheet::WriteExcel individual\ncomments can be made visible as follows:\n\n$worksheet->writecomment('C3', 'Hello', visible => 1);\n\nIt is possible to make all comments in a worksheet visible using the \"showcomments()\"\nworksheet method (see below). Alternatively, if all of the cell comments have been made\nvisible you can hide individual comments:\n\n$worksheet->writecomment('C3', 'Hello', visible => 0);\n\nOption: xscale\nThis option is used to set the width of the cell comment box as a factor of the default\nwidth.\n\n$worksheet->writecomment('C3', 'Hello', xscale => 2);\n$worksheet->writecomment('C4', 'Hello', xscale => 4.2);\n\nOption: width\nThis option is used to set the width of the cell comment box explicitly in pixels.\n\n$worksheet->writecomment('C3', 'Hello', width => 200);\n\nOption: yscale\nThis option is used to set the height of the cell comment box as a factor of the default\nheight.\n\n$worksheet->writecomment('C3', 'Hello', yscale => 2);\n$worksheet->writecomment('C4', 'Hello', yscale => 4.2);\n\nOption: height\nThis option is used to set the height of the cell comment box explicitly in pixels.\n\n$worksheet->writecomment('C3', 'Hello', height => 200);\n\nOption: color\nThis option is used to set the background colour of cell comment box. You can use one of the\nnamed colours recognised by Spreadsheet::WriteExcel or a colour index. See \"COLOURS IN\nEXCEL\".\n\n$worksheet->writecomment('C3', 'Hello', color => 'green');\n$worksheet->writecomment('C4', 'Hello', color => 0x35);    # Orange\n\nOption: startcell\nThis option is used to set the cell in which the comment will appear. By default Excel\ndisplays comments one cell to the right and one cell above the cell to which the comment\nrelates. However, you can change this behaviour if you wish. In the following example the\ncomment which would appear by default in cell \"D2\" is moved to \"E2\".\n\n$worksheet->writecomment('C3', 'Hello', startcell => 'E2');\n\nOption: startrow\nThis option is used to set the row in which the comment will appear. See the \"startcell\"\noption above. The row is zero indexed.\n\n$worksheet->writecomment('C3', 'Hello', startrow => 0);\n\nOption: startcol\nThis option is used to set the column in which the comment will appear. See the \"startcell\"\noption above. The column is zero indexed.\n\n$worksheet->writecomment('C3', 'Hello', startcol => 4);\n\nOption: xoffset\nThis option is used to change the x offset, in pixels, of a comment within a cell:\n\n$worksheet->writecomment('C3', $comment, xoffset => 30);\n\nOption: yoffset\nThis option is used to change the y offset, in pixels, of a comment within a cell:\n\n$worksheet->writecomment('C3', $comment, xoffset => 30);\n\nYou can apply as many of these options as you require.\n\nSee also \"ROW HEIGHTS AND WORKSHEET OBJECTS\".\n\nshowcomments()\nThis method is used to make all cell comments visible when a worksheet is opened.\n\nIndividual comments can be made visible using the \"visible\" parameter of the \"writecomment\"\nmethod (see above):\n\n$worksheet->writecomment('C3', 'Hello', visible => 1);\n\nIf all of the cell comments have been made visible you can hide individual comments as follows:\n\n$worksheet->writecomment('C3', 'Hello', visible => 0);\n\naddwritehandler($re, $coderef)\nThis method is used to extend the Spreadsheet::WriteExcel write() method to handle user defined\ndata.\n\nIf you refer to the section on \"write()\" above you will see that it acts as an alias for several\nmore specific \"write*\" methods. However, it doesn't always act in exactly the way that you\nwould like it to.\n\nOne solution is to filter the input data yourself and call the appropriate \"write*\" method.\nAnother approach is to use the \"addwritehandler()\" method to add your own automated behaviour\nto \"write()\".\n\nThe \"addwritehandler()\" method take two arguments, $re, a regular expression to match incoming\ndata and $coderef a callback function to handle the matched data:\n\n$worksheet->addwritehandler(qr/^\\d\\d\\d\\d$/, \\&mywrite);\n\n(In the these examples the \"qr\" operator is used to quote the regular expression strings, see\nperlop for more details).\n\nThe method is used as follows. say you wished to write 7 digit ID numbers as a string so that\nany leading zeros were preserved*, you could do something like the following:\n\n$worksheet->addwritehandler(qr/^\\d{7}$/, \\&writemyid);\n\n\nsub writemyid {\nmy $worksheet = shift;\nreturn $worksheet->writestring(@);\n}\n\n* You could also use the \"keepleadingzeros()\" method for this.\n\nThen if you call \"write()\" with an appropriate string it will be handled automatically:\n\n# Writes 0000000. It would normally be written as a number; 0.\n$worksheet->write('A1', '0000000');\n\nThe callback function will receive a reference to the calling worksheet and all of the other\narguments that were passed to \"write()\". The callback will see an @ argument list that looks\nlike the following:\n\n$[0]   A ref to the calling worksheet. *\n$[1]   Zero based row number.\n$[2]   Zero based column number.\n$[3]   A number or string or token.\n$[4]   A format ref if any.\n$[5]   Any other arguments.\n...\n\n*  It is good style to shift this off the list so the @ is the same\nas the argument list seen by write().\n\nYour callback should \"return()\" the return value of the \"write*\" method that was called or\n\"undef\" to indicate that you rejected the match and want \"write()\" to continue as normal.\n\nSo for example if you wished to apply the previous filter only to ID values that occur in the\nfirst column you could modify your callback function as follows:\n\nsub writemyid {\nmy $worksheet = shift;\nmy $col       = $[1];\n\nif ($col == 0) {\nreturn $worksheet->writestring(@);\n}\nelse {\n# Reject the match and return control to write()\nreturn undef;\n}\n}\n\nNow, you will get different behaviour for the first column and other columns:\n\n$worksheet->write('A1', '0000000'); # Writes 0000000\n$worksheet->write('B1', '0000000'); # Writes 0\n\nYou may add more than one handler in which case they will be called in the order that they were\nadded.\n\nNote, the \"addwritehandler()\" method is particularly suited for handling dates.\n\nSee the \"writehandler 1-4\" programs in the \"examples\" directory for further examples.\n\ninsertimage($row, $col, $filename, $x, $y, $scalex, $scaley)\nThis method can be used to insert a image into a worksheet. The image can be in PNG, JPEG or BMP\nformat. The $x, $y, $scalex and $scaley parameters are optional.\n\n$worksheet1->insertimage('A1', 'perl.bmp');\n$worksheet2->insertimage('A1', '../images/perl.bmp');\n$worksheet3->insertimage('A1', '.c:\\images\\perl.bmp');\n\nThe parameters $x and $y can be used to specify an offset from the top left hand corner of the\ncell specified by $row and $col. The offset values are in pixels.\n\n$worksheet1->insertimage('A1', 'perl.bmp', 32, 10);\n\nThe default width of a cell is 63 pixels. The default height of a cell is 17 pixels. The pixels\noffsets can be calculated using the following relationships:\n\nWp = int(12We)   if We <  1\nWp = int(7We +5) if We >= 1\nHp = int(4/3He)\n\nwhere:\nWe is the cell width in Excels units\nWp is width in pixels\nHe is the cell height in Excels units\nHp is height in pixels\n\nThe offsets can be greater than the width or height of the underlying cell. This can be\noccasionally useful if you wish to align two or more images relative to the same cell.\n\nThe parameters $scalex and $scaley can be used to scale the inserted image horizontally and\nvertically:\n\n# Scale the inserted image: width x 2.0, height x 0.8\n$worksheet->insertimage('A1', 'perl.bmp', 0, 0, 2, 0.8);\n\nSee also the \"images.pl\" program in the \"examples\" directory of the distro.\n\nBMP images must be 24 bit, true colour, bitmaps. In general it is best to avoid BMP images since\nthey aren't compressed. The older \"insertbitmap()\" method is still supported but deprecated.\n\nSee also \"ROW HEIGHTS AND WORKSHEET OBJECTS\".\n\ninsertchart($row, $col, $chart, $x, $y, $scalex, $scaley)\nThis method can be used to insert a Chart object into a worksheet. The Chart must be created by\nthe \"addchart()\" Workbook method and it must have the \"embedded\" option set.\n\nmy $chart = $workbook->addchart( type => 'line', embedded => 1 );\n\n# Configure the chart.\n...\n\n# Insert the chart into the a worksheet.\n$worksheet->insertchart('E2', $chart);\n\nSee \"addchart()\" for details on how to create the Chart object and\nSpreadsheet::WriteExcel::Chart for details on how to configure it. See also the \"chart*.pl\"\nprograms in the examples directory of the distro.\n\nThe $x, $y, $scalex and $scaley parameters are optional.\n\nThe parameters $x and $y can be used to specify an offset from the top left hand corner of the\ncell specified by $row and $col. The offset values are in pixels. See the \"insertimage\" method\nabove for more information on sizes.\n\n$worksheet1->insertchart('E2', $chart, 3, 3);\n\nThe parameters $scalex and $scaley can be used to scale the inserted image horizontally and\nvertically:\n\n# Scale the width by 120% and the height by 150%\n$worksheet->insertchart('E2', $chart, 0, 0, 1.2, 1.5);\n\nThe easiest way to calculate the required scaling is to create a test chart worksheet with\nSpreadsheet::WriteExcel. Then open the file, select the chart and drag the corner to get the\nrequired size. While holding down the mouse the scale of the resized chart is shown to the left\nof the formula bar.\n\nSee also \"ROW HEIGHTS AND WORKSHEET OBJECTS\".\n\nembedchart($row, $col, $filename, $x, $y, $scalex, $scaley)\nThis method can be used to insert a externally generated chart into a worksheet. The chart must\nfirst be extracted from an existing Excel file. This feature is semi-deprecated in favour of the\n\"native\" charts created using \"addchart()\". Read \"externalcharts.txt\" (or \".pod\") in the\nexternalcharts directory of the distro for a full explanation.\n\nHere is an example:\n\n$worksheet->embedchart('B2', 'saleschart.bin');\n\nThe $x, $y, $scalex and $scaley parameters are optional. See \"insertchart()\" above for\ndetails.\n\ndatavalidation()\nThe \"datavalidation()\" method is used to construct an Excel data validation or to limit the\nuser input to a dropdown list of values.\n\n$worksheet->datavalidation('B3',\n{\nvalidate => 'integer',\ncriteria => '>',\nvalue    => 100,\n});\n\n$worksheet->datavalidation('B5:B9',\n{\nvalidate => 'list',\nvalue    => ['open', 'high', 'close'],\n});\n\nThis method contains a lot of parameters and is described in detail in a separate section \"DATA\nVALIDATION IN EXCEL\".\n\nSee also the \"datavalidate.pl\" program in the examples directory of the distro\n\ngetname()\nThe \"getname()\" method is used to retrieve the name of a worksheet. For example:\n\nforeach my $sheet ($workbook->sheets()) {\nprint $sheet->getname();\n}\n\nFor reasons related to the design of Spreadsheet::WriteExcel and to the internals of Excel there\nis no \"setname()\" method. The only way to set the worksheet name is via the \"addworksheet()\"\nmethod.\n\nactivate()\nThe \"activate()\" method is used to specify which worksheet is initially visible in a multi-sheet\nworkbook:\n\n$worksheet1 = $workbook->addworksheet('To');\n$worksheet2 = $workbook->addworksheet('the');\n$worksheet3 = $workbook->addworksheet('wind');\n\n$worksheet3->activate();\n\nThis is similar to the Excel VBA activate method. More than one worksheet can be selected via\nthe \"select()\" method, see below, however only one worksheet can be active.\n\nThe default active worksheet is the first worksheet.\n\nselect()\nThe \"select()\" method is used to indicate that a worksheet is selected in a multi-sheet\nworkbook:\n\n$worksheet1->activate();\n$worksheet2->select();\n$worksheet3->select();\n\nA selected worksheet has its tab highlighted. Selecting worksheets is a way of grouping them\ntogether so that, for example, several worksheets could be printed in one go. A worksheet that\nhas been activated via the \"activate()\" method will also appear as selected.\n\nhide()\nThe \"hide()\" method is used to hide a worksheet:\n\n$worksheet2->hide();\n\nYou may wish to hide a worksheet in order to avoid confusing a user with intermediate data or\ncalculations.\n\nA hidden worksheet can not be activated or selected so this method is mutually exclusive with\nthe \"activate()\" and \"select()\" methods. In addition, since the first worksheet will default to\nbeing the active worksheet, you cannot hide the first worksheet without activating another\nsheet:\n\n$worksheet2->activate();\n$worksheet1->hide();\n\nsetfirstsheet()\nThe \"activate()\" method determines which worksheet is initially selected. However, if there are\na large number of worksheets the selected worksheet may not appear on the screen. To avoid this\nyou can select which is the leftmost visible worksheet using \"setfirstsheet()\":\n\nfor (1..20) {\n$workbook->addworksheet;\n}\n\n$worksheet21 = $workbook->addworksheet();\n$worksheet22 = $workbook->addworksheet();\n\n$worksheet21->setfirstsheet();\n$worksheet22->activate();\n\nThis method is not required very often. The default value is the first worksheet.\n\nprotect($password)\nThe \"protect()\" method is used to protect a worksheet from modification:\n\n$worksheet->protect();\n\nIt can be turned off in Excel via the \"Tools->Protection->Unprotect Sheet\" menu command.\n\nThe \"protect()\" method also has the effect of enabling a cell's \"locked\" and \"hidden\" properties\nif they have been set. A \"locked\" cell cannot be edited. A \"hidden\" cell will display the\nresults of a formula but not the formula itself. In Excel a cell's locked property is on by\ndefault.\n\n# Set some format properties\nmy $unlocked  = $workbook->addformat(locked => 0);\nmy $hidden    = $workbook->addformat(hidden => 1);\n\n# Enable worksheet protection\n$worksheet->protect();\n\n# This cell cannot be edited, it is locked by default\n$worksheet->write('A1', '=1+2');\n\n# This cell can be edited\n$worksheet->write('A2', '=1+2', $unlocked);\n\n# The formula in this cell isn't visible\n$worksheet->write('A3', '=1+2', $hidden);\n\nSee also the \"setlocked\" and \"sethidden\" format methods in \"CELL FORMATTING\".\n\nYou can optionally add a password to the worksheet protection:\n\n$worksheet->protect('drowssap');\n\nNote, the worksheet level password in Excel provides very weak protection. It does not encrypt\nyour data in any way and it is very easy to deactivate. Therefore, do not use the above method\nif you wish to protect sensitive data or calculations. However, before you get worried, Excel's\nown workbook level password protection does provide strong encryption in Excel 97+. For\ntechnical reasons this will never be supported by \"Spreadsheet::WriteExcel\".\n\nsetselection($firstrow, $firstcol, $lastrow, $lastcol)\nThis method can be used to specify which cell or cells are selected in a worksheet. The most\ncommon requirement is to select a single cell, in which case $lastrow and $lastcol can be\nomitted. The active cell within a selected range is determined by the order in which $first and\n$last are specified. It is also possible to specify a cell or a range using A1 notation. See the\nnote about \"Cell notation\".\n\nExamples:\n\n$worksheet1->setselection(3, 3);       # 1. Cell D4.\n$worksheet2->setselection(3, 3, 6, 6); # 2. Cells D4 to G7.\n$worksheet3->setselection(6, 6, 3, 3); # 3. Cells G7 to D4.\n$worksheet4->setselection('D4');       # Same as 1.\n$worksheet5->setselection('D4:G7');    # Same as 2.\n$worksheet6->setselection('G7:D4');    # Same as 3.\n\nThe default cell selections is (0, 0), 'A1'.\n\nsetrow($row, $height, $format, $hidden, $level, $collapsed)\nThis method can be used to change the default properties of a row. All parameters apart from\n$row are optional.\n\nThe most common use for this method is to change the height of a row:\n\n$worksheet->setrow(0, 20); # Row 1 height set to 20\n\nIf you wish to set the format without changing the height you can pass \"undef\" as the height\nparameter:\n\n$worksheet->setrow(0, undef, $format);\n\nThe $format parameter will be applied to any cells in the row that don't have a format. For\nexample\n\n$worksheet->setrow(0, undef, $format1);    # Set the format for row 1\n$worksheet->write('A1', 'Hello');           # Defaults to $format1\n$worksheet->write('B1', 'Hello', $format2); # Keeps $format2\n\nIf you wish to define a row format in this way you should call the method before any calls to\n\"write()\". Calling it afterwards will overwrite any format that was previously specified.\n\nThe $hidden parameter should be set to 1 if you wish to hide a row. This can be used, for\nexample, to hide intermediary steps in a complicated calculation:\n\n$worksheet->setrow(0, 20,    $format, 1);\n$worksheet->setrow(1, undef, undef,   1);\n\nThe $level parameter is used to set the outline level of the row. Outlines are described in\n\"OUTLINES AND GROUPING IN EXCEL\". Adjacent rows with the same outline level are grouped together\ninto a single outline.\n\nThe following example sets an outline level of 1 for rows 1 and 2 (zero-indexed):\n\n$worksheet->setrow(1, undef, undef, 0, 1);\n$worksheet->setrow(2, undef, undef, 0, 1);\n\nThe $hidden parameter can also be used to hide collapsed outlined rows when used in conjunction\nwith the $level parameter.\n\n$worksheet->setrow(1, undef, undef, 1, 1);\n$worksheet->setrow(2, undef, undef, 1, 1);\n\nFor collapsed outlines you should also indicate which row has the collapsed \"+\" symbol using the\noptional $collapsed parameter.\n\n$worksheet->setrow(3, undef, undef, 0, 0, 1);\n\nFor a more complete example see the \"outline.pl\" and \"outlinecollapsed.pl\" programs in the\nexamples directory of the distro.\n\nExcel allows up to 7 outline levels. Therefore the $level parameter should be in the range \"0 <=\n$level <= 7\".\n\nsetcolumn($firstcol, $lastcol, $width, $format, $hidden, $level, $collapsed)\nThis method can be used to change the default properties of a single column or a range of\ncolumns. All parameters apart from $firstcol and $lastcol are optional.\n\nIf \"setcolumn()\" is applied to a single column the value of $firstcol and $lastcol should be\nthe same. In the case where $lastcol is zero it is set to the same value as $firstcol.\n\nIt is also possible, and generally clearer, to specify a column range using the form of A1\nnotation used for columns. See the note about \"Cell notation\".\n\nExamples:\n\n$worksheet->setcolumn(0, 0,  20); # Column  A   width set to 20\n$worksheet->setcolumn(1, 3,  30); # Columns B-D width set to 30\n$worksheet->setcolumn('E:E', 20); # Column  E   width set to 20\n$worksheet->setcolumn('F:H', 30); # Columns F-H width set to 30\n\nThe width corresponds to the column width value that is specified in Excel. It is approximately\nequal to the length of a string in the default font of Arial 10. Unfortunately, there is no way\nto specify \"AutoFit\" for a column in the Excel file format. This feature is only available at\nruntime from within Excel.\n\nAs usual the $format parameter is optional, for additional information, see \"CELL FORMATTING\".\nIf you wish to set the format without changing the width you can pass \"undef\" as the width\nparameter:\n\n$worksheet->setcolumn(0, 0, undef, $format);\n\nThe $format parameter will be applied to any cells in the column that don't have a format. For\nexample\n\n$worksheet->setcolumn('A:A', undef, $format1); # Set format for col 1\n$worksheet->write('A1', 'Hello');               # Defaults to $format1\n$worksheet->write('A2', 'Hello', $format2);     # Keeps $format2\n\nIf you wish to define a column format in this way you should call the method before any calls to\n\"write()\". If you call it afterwards it won't have any effect.\n\nA default row format takes precedence over a default column format\n\n$worksheet->setrow(0, undef,        $format1); # Set format for row 1\n$worksheet->setcolumn('A:A', undef, $format2); # Set format for col 1\n$worksheet->write('A1', 'Hello');               # Defaults to $format1\n$worksheet->write('A2', 'Hello');               # Defaults to $format2\n\nThe $hidden parameter should be set to 1 if you wish to hide a column. This can be used, for\nexample, to hide intermediary steps in a complicated calculation:\n\n$worksheet->setcolumn('D:D', 20,    $format, 1);\n$worksheet->setcolumn('E:E', undef, undef,   1);\n\nThe $level parameter is used to set the outline level of the column. Outlines are described in\n\"OUTLINES AND GROUPING IN EXCEL\". Adjacent columns with the same outline level are grouped\ntogether into a single outline.\n\nThe following example sets an outline level of 1 for columns B to G:\n\n$worksheet->setcolumn('B:G', undef, undef, 0, 1);\n\nThe $hidden parameter can also be used to hide collapsed outlined columns when used in\nconjunction with the $level parameter.\n\n$worksheet->setcolumn('B:G', undef, undef, 1, 1);\n\nFor collapsed outlines you should also indicate which row has the collapsed \"+\" symbol using the\noptional $collapsed parameter.\n\n$worksheet->setcolumn('H:H', undef, undef, 0, 0, 1);\n\nFor a more complete example see the \"outline.pl\" and \"outlinecollapsed.pl\" programs in the\nexamples directory of the distro.\n\nExcel allows up to 7 outline levels. Therefore the $level parameter should be in the range \"0 <=\n$level <= 7\".\n\noutlinesettings($visible, $symbolsbelow, $symbolsright, $autostyle)\nThe \"outlinesettings()\" method is used to control the appearance of outlines in Excel. Outlines\nare described in \"OUTLINES AND GROUPING IN EXCEL\".\n\nThe $visible parameter is used to control whether or not outlines are visible. Setting this\nparameter to 0 will cause all outlines on the worksheet to be hidden. They can be unhidden in\nExcel by means of the \"Show Outline Symbols\" command button. The default setting is 1 for\nvisible outlines.\n\n$worksheet->outlinesettings(0);\n\nThe $symbolsbelow parameter is used to control whether the row outline symbol will appear above\nor below the outline level bar. The default setting is 1 for symbols to appear below the outline\nlevel bar.\n\nThe \"symbolsright\" parameter is used to control whether the column outline symbol will appear\nto the left or the right of the outline level bar. The default setting is 1 for symbols to\nappear to the right of the outline level bar.\n\nThe $autostyle parameter is used to control whether the automatic outline generator in Excel\nuses automatic styles when creating an outline. This has no effect on a file generated by\n\"Spreadsheet::WriteExcel\" but it does have an effect on how the worksheet behaves after it is\ncreated. The default setting is 0 for \"Automatic Styles\" to be turned off.\n\nThe default settings for all of these parameters correspond to Excel's default parameters.\n\nThe worksheet parameters controlled by \"outlinesettings()\" are rarely used.\n\nfreezepanes($row, $col, $toprow, $leftcol)\nThis method can be used to divide a worksheet into horizontal or vertical regions known as panes\nand to also \"freeze\" these panes so that the splitter bars are not visible. This is the same as\nthe \"Window->Freeze Panes\" menu command in Excel\n\nThe parameters $row and $col are used to specify the location of the split. It should be noted\nthat the split is specified at the top or left of a cell and that the method uses zero based\nindexing. Therefore to freeze the first row of a worksheet it is necessary to specify the split\nat row 2 (which is 1 as the zero-based index). This might lead you to think that you are using a\n1 based index but this is not the case.\n\nYou can set one of the $row and $col parameters as zero if you do not want either a vertical or\nhorizontal split.\n\nExamples:\n\n$worksheet->freezepanes(1, 0); # Freeze the first row\n$worksheet->freezepanes('A2'); # Same using A1 notation\n$worksheet->freezepanes(0, 1); # Freeze the first column\n$worksheet->freezepanes('B1'); # Same using A1 notation\n$worksheet->freezepanes(1, 2); # Freeze first row and first 2 columns\n$worksheet->freezepanes('C2'); # Same using A1 notation\n\nThe parameters $toprow and $leftcol are optional. They are used to specify the top-most or\nleft-most visible row or column in the scrolling region of the panes. For example to freeze the\nfirst row and to have the scrolling region begin at row twenty:\n\n$worksheet->freezepanes(1, 0, 20, 0);\n\nYou cannot use A1 notation for the $toprow and $leftcol parameters.\n\nSee also the \"panes.pl\" program in the \"examples\" directory of the distribution.\n\nsplitpanes($y, $x, $toprow, $leftcol)\nThis method can be used to divide a worksheet into horizontal or vertical regions known as\npanes. This method is different from the \"freezepanes()\" method in that the splits between the\npanes will be visible to the user and each pane will have its own scroll bars.\n\nThe parameters $y and $x are used to specify the vertical and horizontal position of the split.\nThe units for $y and $x are the same as those used by Excel to specify row height and column\nwidth. However, the vertical and horizontal units are different from each other. Therefore you\nmust specify the $y and $x parameters in terms of the row heights and column widths that you\nhave set or the default values which are 12.75 for a row and 8.43 for a column.\n\nYou can set one of the $y and $x parameters as zero if you do not want either a vertical or\nhorizontal split. The parameters $toprow and $leftcol are optional. They are used to specify\nthe top-most or left-most visible row or column in the bottom-right pane.\n\nExample:\n\n$worksheet->splitpanes(12.75, 0,    1, 0); # First row\n$worksheet->splitpanes(0,     8.43, 0, 1); # First column\n$worksheet->splitpanes(12.75, 8.43, 1, 1); # First row and column\n\nYou cannot use A1 notation with this method.\n\nSee also the \"freezepanes()\" method and the \"panes.pl\" program in the \"examples\" directory of\nthe distribution.\n\nNote: This \"splitpanes()\" method was called \"thawpanes()\" in older versions. The older name is\nstill available for backwards compatibility.\n\nmergerange($firstrow, $firstcol, $lastrow, $lastcol, $token, $format, $utf16be)\nMerging cells can be achieved by setting the \"merge\" property of a Format object, see \"CELL\nFORMATTING\". However, this only allows simple Excel5 style horizontal merging which Excel refers\nto as \"center across selection\".\n\nThe \"mergerange()\" method allows you to do Excel97+ style formatting where the cells can\ncontain other types of alignment in addition to the merging:\n\nmy $format = $workbook->addformat(\nborder  => 6,\nvalign  => 'vcenter',\nalign   => 'center',\n);\n\n$worksheet->mergerange('B3:D4', 'Vertical and horizontal', $format);\n\nWARNING. The format object that is used with a \"mergerange()\" method call is marked internally\nas being associated with a merged range. It is a fatal error to use a merged format in a\nnon-merged cell. Instead you should use separate formats for merged and non-merged cells. This\nrestriction will be removed in a future release.\n\nThe $utf16be parameter is optional, see below.\n\n\"mergerange()\" writes its $token argument using the worksheet \"write()\" method. Therefore it\nwill handle numbers, strings, formulas or urls as required.\n\nSetting the \"merge\" property of the format isn't required when you are using \"mergerange()\". In\nfact using it will exclude the use of any other horizontal alignment option.\n\nOn systems with \"perl 5.8\" and later the \"mergerange()\" method will also handle strings in\n\"UTF-8\" format.\n\n$worksheet->mergerange('B3:D4', \"\\x{263a}\", $format); # Smiley\n\nOn earlier Perl systems your can specify \"UTF-16BE\" worksheet names using an additional optional\nparameter:\n\nmy $str = pack 'n', 0x263a;\n$worksheet->mergerange('B3:D4', $str, $format, 1); # Smiley\n\nThe full possibilities of this method are shown in the \"merge3.pl\" to \"merge6.pl\" programs in\nthe \"examples\" directory of the distribution.\n\nsetzoom($scale)\nSet the worksheet zoom factor in the range \"10 <= $scale <= 400\":\n\n$worksheet1->setzoom(50);\n$worksheet2->setzoom(75);\n$worksheet3->setzoom(300);\n$worksheet4->setzoom(400);\n\nThe default zoom factor is 100. You cannot zoom to \"Selection\" because it is calculated by Excel\nat run-time.\n\nNote, \"setzoom()\" does not affect the scale of the printed page. For that you should use\n\"setprintscale()\".\n\nrighttoleft()\nThe \"righttoleft()\" method is used to change the default direction of the worksheet from\nleft-to-right, with the A1 cell in the top left, to right-to-left, with the he A1 cell in the\ntop right.\n\n$worksheet->righttoleft();\n\nThis is useful when creating Arabic, Hebrew or other near or far eastern worksheets that use\nright-to-left as the default direction.\n\nhidezero()\nThe \"hidezero()\" method is used to hide any zero values that appear in cells.\n\n$worksheet->hidezero();\n\nIn Excel this option is found under Tools->Options->View.\n\nsettabcolor()\nThe \"settabcolor()\" method is used to change the colour of the worksheet tab. This feature is\nonly available in Excel 2002 and later. You can use one of the standard colour names provided by\nthe Format object or a colour index. See \"COLOURS IN EXCEL\" and the \"setcustomcolor()\" method.\n\n$worksheet1->settabcolor('red');\n$worksheet2->settabcolor(0x0C);\n\nSee the \"tabcolors.pl\" program in the examples directory of the distro.\n\nautofilter($firstrow, $firstcol, $lastrow, $lastcol)\nThis method allows an autofilter to be added to a worksheet. An autofilter is a way of adding\ndrop down lists to the headers of a 2D range of worksheet data. This in turn allow users to\nfilter the data based on simple criteria so that some data is shown and some is hidden.\n\nTo add an autofilter to a worksheet:\n\n$worksheet->autofilter(0, 0, 10, 3);\n$worksheet->autofilter('A1:D11');    # Same as above in A1 notation.\n\nFilter conditions can be applied using the \"filtercolumn()\" method.\n\nSee the \"autofilter.pl\" program in the examples directory of the distro for a more detailed\nexample.\n\nfiltercolumn($column, $expression)\nThe \"filtercolumn\" method can be used to filter columns in a autofilter range based on simple\nconditions.\n\nNOTE: It isn't sufficient to just specify the filter condition. You must also hide any rows that\ndon't match the filter condition. Rows are hidden using the \"setrow()\" \"visible\" parameter.\n\"Spreadsheet::WriteExcel\" cannot do this automatically since it isn't part of the file format.\nSee the \"autofilter.pl\" program in the examples directory of the distro for an example.\n\nThe conditions for the filter are specified using simple expressions:\n\n$worksheet->filtercolumn('A', 'x > 2000');\n$worksheet->filtercolumn('B', 'x > 2000 and x < 5000');\n\nThe $column parameter can either be a zero indexed column number or a string column name.\n\nThe following operators are available:\n\nOperator        Synonyms\n==           =   eq  =~\n!=           <>  ne  !=\n>\n<\n>=\n<=\n\nand          &&\nor           ||\n\nThe operator synonyms are just syntactic sugar to make you more comfortable using the\nexpressions. It is important to remember that the expressions will be interpreted by Excel and\nnot by perl.\n\nAn expression can comprise a single statement or two statements separated by the \"and\" and \"or\"\noperators. For example:\n\n'x <  2000'\n'x >  2000'\n'x == 2000'\n'x >  2000 and x <  5000'\n'x == 2000 or  x == 5000'\n\nFiltering of blank or non-blank data can be achieved by using a value of \"Blanks\" or \"NonBlanks\"\nin the expression:\n\n'x == Blanks'\n'x == NonBlanks'\n\nTop 10 style filters can be specified using a expression like the following:\n\nTop|Bottom 1-500 Items|%\n\nFor example:\n\n'Top    10 Items'\n'Bottom  5 Items'\n'Top    25 %'\n'Bottom 50 %'\n\nExcel also allows some simple string matching operations:\n\n'x =~ b*'   # begins with b\n'x !~ b*'   # doesn't begin with b\n'x =~ *b'   # ends with b\n'x !~ *b'   # doesn't end with b\n'x =~ *b*'  # contains b\n'x !~ *b*'  # doesn't contains b\n\nYou can also use \"*\" to match any character or number and \"?\" to match any single character or\nnumber. No other regular expression quantifier is supported by Excel's filters. Excel's regular\nexpression characters can be escaped using \"~\".\n\nThe placeholder variable \"x\" in the above examples can be replaced by any simple string. The\nactual placeholder name is ignored internally so the following are all equivalent:\n\n'x     < 2000'\n'col   < 2000'\n'Price < 2000'\n\nAlso, note that a filter condition can only be applied to a column in a range specified by the\n\"autofilter()\" Worksheet method.\n\nSee the \"autofilter.pl\" program in the examples directory of the distro for a more detailed\nexample.\n"
                }
            ]
        },
        "PAGE SET-UP METHODS": {
            "content": "Page set-up methods affect the way that a worksheet looks when it is printed. They control\nfeatures such as page headers and footers and margins. These methods are really just standard\nworksheet methods. They are documented here in a separate section for the sake of clarity.\n\nThe following methods are available for page set-up:\n\nsetlandscape()\nsetportrait()\nsetpageview()\nsetpaper()\ncenterhorizontally()\ncentervertically()\nsetmargins()\nsetheader()\nsetfooter()\nrepeatrows()\nrepeatcolumns()\nhidegridlines()\nprintrowcolheaders()\nprintarea()\nprintacross()\nfittopages()\nsetstartpage()\nsetprintscale()\nsethpagebreaks()\nsetvpagebreaks()\n\nA common requirement when working with Spreadsheet::WriteExcel is to apply the same page set-up\nfeatures to all of the worksheets in a workbook. To do this you can use the \"sheets()\" method of\nthe \"workbook\" class to access the array of worksheets in a workbook:\n\nforeach $worksheet ($workbook->sheets()) {\n$worksheet->setlandscape();\n}\n\nsetlandscape()\nThis method is used to set the orientation of a worksheet's printed page to landscape:\n\n$worksheet->setlandscape(); # Landscape mode\n\nsetportrait()\nThis method is used to set the orientation of a worksheet's printed page to portrait. The\ndefault worksheet orientation is portrait, so you won't generally need to call this method.\n\n$worksheet->setportrait(); # Portrait mode\n\nsetpageview()\nThis method is used to display the worksheet in \"Page View\" mode. This is currently only\nsupported by Mac Excel, where it is the default.\n\n$worksheet->setpageview();\n\nsetpaper($index)\nThis method is used to set the paper format for the printed output of a worksheet. The following\npaper styles are available:\n\nIndex   Paper format            Paper size\n=====   ============            ==========\n0     Printer default         -\n1     Letter                  8 1/2 x 11 in\n2     Letter Small            8 1/2 x 11 in\n3     Tabloid                 11 x 17 in\n4     Ledger                  17 x 11 in\n5     Legal                   8 1/2 x 14 in\n6     Statement               5 1/2 x 8 1/2 in\n7     Executive               7 1/4 x 10 1/2 in\n8     A3                      297 x 420 mm\n9     A4                      210 x 297 mm\n10     A4 Small                210 x 297 mm\n11     A5                      148 x 210 mm\n12     B4                      250 x 354 mm\n13     B5                      182 x 257 mm\n14     Folio                   8 1/2 x 13 in\n15     Quarto                  215 x 275 mm\n16     -                       10x14 in\n17     -                       11x17 in\n18     Note                    8 1/2 x 11 in\n19     Envelope  9             3 7/8 x 8 7/8\n20     Envelope 10             4 1/8 x 9 1/2\n21     Envelope 11             4 1/2 x 10 3/8\n22     Envelope 12             4 3/4 x 11\n23     Envelope 14             5 x 11 1/2\n24     C size sheet            -\n25     D size sheet            -\n26     E size sheet            -\n27     Envelope DL             110 x 220 mm\n28     Envelope C3             324 x 458 mm\n29     Envelope C4             229 x 324 mm\n30     Envelope C5             162 x 229 mm\n31     Envelope C6             114 x 162 mm\n32     Envelope C65            114 x 229 mm\n33     Envelope B4             250 x 353 mm\n34     Envelope B5             176 x 250 mm\n35     Envelope B6             176 x 125 mm\n36     Envelope                110 x 230 mm\n37     Monarch                 3.875 x 7.5 in\n38     Envelope                3 5/8 x 6 1/2 in\n39     Fanfold                 14 7/8 x 11 in\n40     German Std Fanfold      8 1/2 x 12 in\n41     German Legal Fanfold    8 1/2 x 13 in\n\nNote, it is likely that not all of these paper types will be available to the end user since it\nwill depend on the paper formats that the user's printer supports. Therefore, it is best to\nstick to standard paper types.\n\n$worksheet->setpaper(1); # US Letter\n$worksheet->setpaper(9); # A4\n\nIf you do not specify a paper type the worksheet will print using the printer's default paper.\n\ncenterhorizontally()\nCenter the worksheet data horizontally between the margins on the printed page:\n\n$worksheet->centerhorizontally();\n\ncentervertically()\nCenter the worksheet data vertically between the margins on the printed page:\n\n$worksheet->centervertically();\n\nsetmargins($inches)\nThere are several methods available for setting the worksheet margins on the printed page:\n\nsetmargins()        # Set all margins to the same value\nsetmarginsLR()     # Set left and right margins to the same value\nsetmarginsTB()     # Set top and bottom margins to the same value\nsetmarginleft();   # Set left margin\nsetmarginright();  # Set right margin\nsetmargintop();    # Set top margin\nsetmarginbottom(); # Set bottom margin\n\nAll of these methods take a distance in inches as a parameter. Note: 1 inch = 25.4mm. ;-) The\ndefault left and right margin is 0.75 inch. The default top and bottom margin is 1.00 inch.\n\nsetheader($string, $margin)\nHeaders and footers are generated using a $string which is a combination of plain text and\ncontrol characters. The $margin parameter is optional.\n\nThe available control character are:\n\nControl             Category            Description\n=======             ========            ===========\n&L                  Justification       Left\n&C                                      Center\n&R                                      Right\n\n&P                  Information         Page number\n&N                                      Total number of pages\n&D                                      Date\n&T                                      Time\n&F                                      File name\n&A                                      Worksheet name\n&Z                                      Workbook path\n\n&fontsize           Font                Font size\n&\"font,style\"                           Font name and style\n&U                                      Single underline\n&E                                      Double underline\n&S                                      Strikethrough\n&X                                      Superscript\n&Y                                      Subscript\n\n&&                  Miscellaneous       Literal ampersand &\n\nText in headers and footers can be justified (aligned) to the left, center and right by\nprefixing the text with the control characters &L, &C and &R.\n\nFor example (with ASCII art representation of the results):\n\n$worksheet->setheader('&LHello');\n\n---------------------------------------------------------------\n|                                                               |\n| Hello                                                         |\n|                                                               |\n\n\n$worksheet->setheader('&CHello');\n\n---------------------------------------------------------------\n|                                                               |\n|                          Hello                                |\n|                                                               |\n\n\n$worksheet->setheader('&RHello');\n\n---------------------------------------------------------------\n|                                                               |\n|                                                         Hello |\n|                                                               |\n\nFor simple text, if you do not specify any justification the text will be centred. However, you\nmust prefix the text with &C if you specify a font name or any other formatting:\n\n$worksheet->setheader('Hello');\n\n---------------------------------------------------------------\n|                                                               |\n|                          Hello                                |\n|                                                               |\n\nYou can have text in each of the justification regions:\n\n$worksheet->setheader('&LCiao&CBello&RCielo');\n\n---------------------------------------------------------------\n|                                                               |\n| Ciao                     Bello                          Cielo |\n|                                                               |\n\nThe information control characters act as variables that Excel will update as the workbook or\nworksheet changes. Times and dates are in the users default format:\n\n$worksheet->setheader('&CPage &P of &N');\n\n---------------------------------------------------------------\n|                                                               |\n|                        Page 1 of 6                            |\n|                                                               |\n\n\n$worksheet->setheader('&CUpdated at &T');\n\n---------------------------------------------------------------\n|                                                               |\n|                    Updated at 12:30 PM                        |\n|                                                               |\n\nYou can specify the font size of a section of the text by prefixing it with the control\ncharacter &n where \"n\" is the font size:\n\n$worksheet1->setheader('&C&30Hello Big'  );\n$worksheet2->setheader('&C&10Hello Small');\n\nYou can specify the font of a section of the text by prefixing it with the control sequence\n\"&\"font,style\"\" where \"fontname\" is a font name such as \"Courier New\" or \"Times New Roman\" and\n\"style\" is one of the standard Windows font descriptions: \"Regular\", \"Italic\", \"Bold\" or \"Bold\nItalic\":\n\n$worksheet1->setheader('&C&\"Courier New,Italic\"Hello');\n$worksheet2->setheader('&C&\"Courier New,Bold Italic\"Hello');\n$worksheet3->setheader('&C&\"Times New Roman,Regular\"Hello');\n\nIt is possible to combine all of these features together to create sophisticated headers and\nfooters. As an aid to setting up complicated headers and footers you can record a page set-up as\na macro in Excel and look at the format strings that VBA produces. Remember however that VBA\nuses two double quotes \"\" to indicate a single double quote. For the last example above the\nequivalent VBA code looks like this:\n\n.LeftHeader   = \"\"\n.CenterHeader = \"&\"\"Times New Roman,Regular\"\"Hello\"\n.RightHeader  = \"\"\n\nTo include a single literal ampersand \"&\" in a header or footer you should use a double\nampersand \"&&\":\n\n$worksheet1->setheader('&CCuriouser && Curiouser - Attorneys at Law');\n\nAs stated above the margin parameter is optional. As with the other margins the value should be\nin inches. The default header and footer margin is 0.50 inch. The header and footer margin size\ncan be set as follows:\n\n$worksheet->setheader('&CHello', 0.75);\n\nThe header and footer margins are independent of the top and bottom margins.\n\nNote, the header or footer string must be less than 255 characters. Strings longer than this\nwill not be written and a warning will be generated.\n\nOn systems with \"perl 5.8\" and later the \"setheader()\" method can also handle Unicode strings\nin \"UTF-8\" format.\n\n$worksheet->setheader(\"&C\\x{263a}\")\n\nSee, also the \"headers.pl\" program in the \"examples\" directory of the distribution.\n\nsetfooter()\nThe syntax of the \"setfooter()\" method is the same as \"setheader()\", see above.\n\nrepeatrows($firstrow, $lastrow)\nSet the number of rows to repeat at the top of each printed page.\n\nFor large Excel documents it is often desirable to have the first row or rows of the worksheet\nprint out at the top of each page. This can be achieved by using the \"repeatrows()\" method. The\nparameters $firstrow and $lastrow are zero based. The $lastrow parameter is optional if you\nonly wish to specify one row:\n\n$worksheet1->repeatrows(0);    # Repeat the first row\n$worksheet2->repeatrows(0, 1); # Repeat the first two rows\n\nrepeatcolumns($firstcol, $lastcol)\nSet the columns to repeat at the left hand side of each printed page.\n\nFor large Excel documents it is often desirable to have the first column or columns of the\nworksheet print out at the left hand side of each page. This can be achieved by using the\n\"repeatcolumns()\" method. The parameters $firstcolumn and $lastcolumn are zero based. The\n$lastcolumn parameter is optional if you only wish to specify one column. You can also specify\nthe columns using A1 column notation, see the note about \"Cell notation\".\n\n$worksheet1->repeatcolumns(0);     # Repeat the first column\n$worksheet2->repeatcolumns(0, 1);  # Repeat the first two columns\n$worksheet3->repeatcolumns('A:A'); # Repeat the first column\n$worksheet4->repeatcolumns('A:B'); # Repeat the first two columns\n\nhidegridlines($option)\nThis method is used to hide the gridlines on the screen and printed page. Gridlines are the\nlines that divide the cells on a worksheet. Screen and printed gridlines are turned on by\ndefault in an Excel worksheet. If you have defined your own cell borders you may wish to hide\nthe default gridlines.\n\n$worksheet->hidegridlines();\n\nThe following values of $option are valid:\n\n0 : Don't hide gridlines\n1 : Hide printed gridlines only\n2 : Hide screen and printed gridlines\n\nIf you don't supply an argument or use \"undef\" the default option is 1, i.e. only the printed\ngridlines are hidden.\n\nprintrowcolheaders()\nSet the option to print the row and column headers on the printed page.\n\nAn Excel worksheet looks something like the following;\n\n------------------------------------------\n|   |   A   |   B   |   C   |   D   |  ...\n------------------------------------------\n| 1 |       |       |       |       |  ...\n| 2 |       |       |       |       |  ...\n| 3 |       |       |       |       |  ...\n| 4 |       |       |       |       |  ...\n|...|  ...  |  ...  |  ...  |  ...  |  ...\n\nThe headers are the letters and numbers at the top and the left of the worksheet. Since these\nheaders serve mainly as a indication of position on the worksheet they generally do not appear\non the printed page. If you wish to have them printed you can use the \"printrowcolheaders()\"\nmethod :\n\n$worksheet->printrowcolheaders();\n\nDo not confuse these headers with page headers as described in the \"setheader()\" section above.\n\nprintarea($firstrow, $firstcol, $lastrow, $lastcol)\nThis method is used to specify the area of the worksheet that will be printed. All four\nparameters must be specified. You can also use A1 notation, see the note about \"Cell notation\".\n\n$worksheet1->printarea('A1:H20');    # Cells A1 to H20\n$worksheet2->printarea(0, 0, 19, 7); # The same\n$worksheet2->printarea('A:H');       # Columns A to H if rows have data\n\nprintacross()\nThe \"printacross\" method is used to change the default print direction. This is referred to by\nExcel as the sheet \"page order\".\n\n$worksheet->printacross();\n\nThe default page order is shown below for a worksheet that extends over 4 pages. The order is\ncalled \"down then across\":\n\n[1] [3]\n[2] [4]\n\nHowever, by using the \"printacross\" method the print order will be changed to \"across then\ndown\":\n\n[1] [2]\n[3] [4]\n\nfittopages($width, $height)\nThe \"fittopages()\" method is used to fit the printed area to a specific number of pages both\nvertically and horizontally. If the printed area exceeds the specified number of pages it will\nbe scaled down to fit. This guarantees that the printed area will always appear on the specified\nnumber of pages even if the page size or margins change.\n\n$worksheet1->fittopages(1, 1); # Fit to 1x1 pages\n$worksheet2->fittopages(2, 1); # Fit to 2x1 pages\n$worksheet3->fittopages(1, 2); # Fit to 1x2 pages\n\nThe print area can be defined using the \"printarea()\" method as described above.\n\nA common requirement is to fit the printed output to *n* pages wide but have the height be as\nlong as necessary. To achieve this set the $height to zero or leave it blank:\n\n$worksheet1->fittopages(1, 0); # 1 page wide and as long as necessary\n$worksheet2->fittopages(1);    # The same\n\nNote that although it is valid to use both \"fittopages()\" and \"setprintscale()\" on the same\nworksheet only one of these options can be active at a time. The last method call made will set\nthe active option.\n\nNote that \"fittopages()\" will override any manual page breaks that are defined in the\nworksheet.\n\nsetstartpage($startpage)\nThe \"setstartpage()\" method is used to set the number of the starting page when the worksheet\nis printed out. The default value is 1.\n\n$worksheet->setstartpage(2);\n\nsetprintscale($scale)\nSet the scale factor of the printed page. Scale factors in the range \"10 <= $scale <= 400\" are\nvalid:\n\n$worksheet1->setprintscale(50);\n$worksheet2->setprintscale(75);\n$worksheet3->setprintscale(300);\n$worksheet4->setprintscale(400);\n\nThe default scale factor is 100. Note, \"setprintscale()\" does not affect the scale of the\nvisible page in Excel. For that you should use \"setzoom()\".\n\nNote also that although it is valid to use both \"fittopages()\" and \"setprintscale()\" on the\nsame worksheet only one of these options can be active at a time. The last method call made will\nset the active option.\n\nsethpagebreaks(@breaks)\nAdd horizontal page breaks to a worksheet. A page break causes all the data that follows it to\nbe printed on the next page. Horizontal page breaks act between rows. To create a page break\nbetween rows 20 and 21 you must specify the break at row 21. However in zero index notation this\nis actually row 20. So you can pretend for a small while that you are using 1 index notation:\n\n$worksheet1->sethpagebreaks(20); # Break between row 20 and 21\n\nThe \"sethpagebreaks()\" method will accept a list of page breaks and you can call it more than\nonce:\n\n$worksheet2->sethpagebreaks( 20,  40,  60,  80, 100); # Add breaks\n$worksheet2->sethpagebreaks(120, 140, 160, 180, 200); # Add some more\n\nNote: If you specify the \"fit to page\" option via the \"fittopages()\" method it will override\nall manual page breaks.\n\nThere is a silent limitation of about 1000 horizontal page breaks per worksheet in line with an\nExcel internal limitation.\n\nsetvpagebreaks(@breaks)\nAdd vertical page breaks to a worksheet. A page break causes all the data that follows it to be\nprinted on the next page. Vertical page breaks act between columns. To create a page break\nbetween columns 20 and 21 you must specify the break at column 21. However in zero index\nnotation this is actually column 20. So you can pretend for a small while that you are using 1\nindex notation:\n\n$worksheet1->setvpagebreaks(20); # Break between column 20 and 21\n\nThe \"setvpagebreaks()\" method will accept a list of page breaks and you can call it more than\nonce:\n\n$worksheet2->setvpagebreaks( 20,  40,  60,  80, 100); # Add breaks\n$worksheet2->setvpagebreaks(120, 140, 160, 180, 200); # Add some more\n\nNote: If you specify the \"fit to page\" option via the \"fittopages()\" method it will override\nall manual page breaks.\n",
            "subsections": []
        },
        "CELL FORMATTING": {
            "content": "This section describes the methods and properties that are available for formatting cells in\nExcel. The properties of a cell that can be formatted include: fonts, colours, patterns,\nborders, alignment and number formatting.\n",
            "subsections": [
                {
                    "name": "Creating and using a Format object",
                    "content": "Cell formatting is defined through a Format object. Format objects are created by calling the\nworkbook \"addformat()\" method as follows:\n\nmy $format1 = $workbook->addformat();       # Set properties later\nmy $format2 = $workbook->addformat(%props); # Set at creation\n\nThe format object holds all the formatting properties that can be applied to a cell, a row or a\ncolumn. The process of setting these properties is discussed in the next section.\n\nOnce a Format object has been constructed and its properties have been set it can be passed as\nan argument to the worksheet \"write\" methods as follows:\n\n$worksheet->write(0, 0, 'One', $format);\n$worksheet->writestring(1, 0, 'Two', $format);\n$worksheet->writenumber(2, 0, 3, $format);\n$worksheet->writeblank(3, 0, $format);\n\nFormats can also be passed to the worksheet \"setrow()\" and \"setcolumn()\" methods to define the\ndefault property for a row or column.\n\n$worksheet->setrow(0, 15, $format);\n$worksheet->setcolumn(0, 0, 15, $format);\n"
                },
                {
                    "name": "Format methods and Format properties",
                    "content": "The following table shows the Excel format categories, the formatting properties that can be\napplied and the equivalent object method:\n\nCategory   Description       Property        Method Name\n--------   -----------       --------        -----------\nFont       Font type         font            setfont()\nFont size         size            setsize()\nFont color        color           setcolor()\nBold              bold            setbold()\nItalic            italic          setitalic()\nUnderline         underline       setunderline()\nStrikeout         fontstrikeout  setfontstrikeout()\nSuper/Subscript   fontscript     setfontscript()\nOutline           fontoutline    setfontoutline()\nShadow            fontshadow     setfontshadow()\n\nNumber     Numeric format    numformat      setnumformat()\n\nProtection Lock cells        locked          setlocked()\nHide formulas     hidden          sethidden()\n\nAlignment  Horizontal align  align           setalign()\nVertical align    valign          setalign()\nRotation          rotation        setrotation()\nText wrap         textwrap       settextwrap()\nJustify last      textjustlast   settextjustlast()\nCenter across     centeracross   setcenteracross()\nIndentation       indent          setindent()\nShrink to fit     shrink          setshrink()\n\nPattern    Cell pattern      pattern         setpattern()\nBackground color  bgcolor        setbgcolor()\nForeground color  fgcolor        setfgcolor()\n\nBorder     Cell border       border          setborder()\nBottom border     bottom          setbottom()\nTop border        top             settop()\nLeft border       left            setleft()\nRight border      right           setright()\nBorder color      bordercolor    setbordercolor()\nBottom color      bottomcolor    setbottomcolor()\nTop color         topcolor       settopcolor()\nLeft color        leftcolor      setleftcolor()\nRight color       rightcolor     setrightcolor()\n\nThere are two ways of setting Format properties: by using the object method interface or by\nsetting the property directly. For example, a typical use of the method interface would be as\nfollows:\n\nmy $format = $workbook->addformat();\n$format->setbold();\n$format->setcolor('red');\n\nBy comparison the properties can be set directly by passing a hash of properties to the Format\nconstructor:\n\nmy $format = $workbook->addformat(bold => 1, color => 'red');\n\nor after the Format has been constructed by means of the \"setformatproperties()\" method as\nfollows:\n\nmy $format = $workbook->addformat();\n$format->setformatproperties(bold => 1, color => 'red');\n\nYou can also store the properties in one or more named hashes and pass them to the required\nmethod:\n\nmy %font    = (\nfont  => 'Arial',\nsize  => 12,\ncolor => 'blue',\nbold  => 1,\n);\n\nmy %shading = (\nbgcolor => 'green',\npattern  => 1,\n);\n\n\nmy $format1 = $workbook->addformat(%font);           # Font only\nmy $format2 = $workbook->addformat(%font, %shading); # Font and shading\n\nThe provision of two ways of setting properties might lead you to wonder which is the best way.\nThe method mechanism may be better is you prefer setting properties via method calls (which the\nauthor did when the code was first written) otherwise passing properties to the constructor has\nproved to be a little more flexible and self documenting in practice. An additional advantage of\nworking with property hashes is that it allows you to share formatting between workbook objects\nas shown in the example above.\n\nThe Perl/Tk style of adding properties is also supported:\n\nmy %font    = (\n-font      => 'Arial',\n-size      => 12,\n-color     => 'blue',\n-bold      => 1,\n);\n"
                },
                {
                    "name": "Working with formats",
                    "content": "The default format is Arial 10 with all other properties off.\n\nEach unique format in Spreadsheet::WriteExcel must have a corresponding Format object. It isn't\npossible to use a Format with a write() method and then redefine the Format for use at a later\nstage. This is because a Format is applied to a cell not in its current state but in its final\nstate. Consider the following example:\n\nmy $format = $workbook->addformat();\n$format->setbold();\n$format->setcolor('red');\n$worksheet->write('A1', 'Cell A1', $format);\n$format->setcolor('green');\n$worksheet->write('B1', 'Cell B1', $format);\n\nCell A1 is assigned the Format $format which is initially set to the colour red. However, the\ncolour is subsequently set to green. When Excel displays Cell A1 it will display the final state\nof the Format which in this case will be the colour green.\n\nIn general a method call without an argument will turn a property on, for example:\n\nmy $format1 = $workbook->addformat();\n$format1->setbold();  # Turns bold on\n$format1->setbold(1); # Also turns bold on\n$format1->setbold(0); # Turns bold off\n"
                }
            ]
        },
        "FORMAT METHODS": {
            "content": "The Format object methods are described in more detail in the following sections. In addition,\nthere is a Perl program called \"formats.pl\" in the \"examples\" directory of the WriteExcel\ndistribution. This program creates an Excel workbook called \"formats.xls\" which contains\nexamples of almost all the format types.\n\nThe following Format methods are available:\n\nsetfont()\nsetsize()\nsetcolor()\nsetbold()\nsetitalic()\nsetunderline()\nsetfontstrikeout()\nsetfontscript()\nsetfontoutline()\nsetfontshadow()\nsetnumformat()\nsetlocked()\nsethidden()\nsetalign()\nsetrotation()\nsettextwrap()\nsettextjustlast()\nsetcenteracross()\nsetindent()\nsetshrink()\nsetpattern()\nsetbgcolor()\nsetfgcolor()\nsetborder()\nsetbottom()\nsettop()\nsetleft()\nsetright()\nsetbordercolor()\nsetbottomcolor()\nsettopcolor()\nsetleftcolor()\nsetrightcolor()\n\nThe above methods can also be applied directly as properties. For example \"$format->setbold()\"\nis equivalent to \"$workbook->addformat(bold => 1)\".\n\nsetformatproperties(%properties)\nThe properties of an existing Format object can be also be set by means of\n\"setformatproperties()\":\n\nmy $format = $workbook->addformat();\n$format->setformatproperties(bold => 1, color => 'red');\n\nHowever, this method is here mainly for legacy reasons. It is preferable to set the properties\nin the format constructor:\n\nmy $format = $workbook->addformat(bold => 1, color => 'red');\n\nsetfont($fontname)\nDefault state:      Font is Arial\nDefault action:     None\nValid args:         Any valid font name\n\nSpecify the font used:\n\n$format->setfont('Times New Roman');\n\nExcel can only display fonts that are installed on the system that it is running on. Therefore\nit is best to use the fonts that come as standard such as 'Arial', 'Times New Roman' and\n'Courier New'. See also the Fonts worksheet created by formats.pl\n\nsetsize()\nDefault state:      Font size is 10\nDefault action:     Set font size to 1\nValid args:         Integer values from 1 to as big as your screen.\n\nSet the font size. Excel adjusts the height of a row to accommodate the largest font size in the\nrow. You can also explicitly specify the height of a row using the setrow() worksheet method.\n\nmy $format = $workbook->addformat();\n$format->setsize(30);\n\nsetcolor()\nDefault state:      Excels default color, usually black\nDefault action:     Set the default color\nValid args:         Integers from 8..63 or the following strings:\n'black'\n'blue'\n'brown'\n'cyan'\n'gray'\n'green'\n'lime'\n'magenta'\n'navy'\n'orange'\n'pink'\n'purple'\n'red'\n'silver'\n'white'\n'yellow'\n\nSet the font colour. The \"setcolor()\" method is used as follows:\n\nmy $format = $workbook->addformat();\n$format->setcolor('red');\n$worksheet->write(0, 0, 'wheelbarrow', $format);\n\nNote: The \"setcolor()\" method is used to set the colour of the font in a cell. To set the\ncolour of a cell use the \"setbgcolor()\" and \"setpattern()\" methods.\n\nFor additional examples see the 'Named colors' and 'Standard colors' worksheets created by\nformats.pl in the examples directory.\n\nSee also \"COLOURS IN EXCEL\".\n\nsetbold()\nDefault state:      bold is off\nDefault action:     Turn bold on\nValid args:         0, 1 [1]\n\nSet the bold property of the font:\n\n$format->setbold();  # Turn bold on\n\n[1] Actually, values in the range 100..1000 are also valid. 400 is normal, 700 is bold and 1000\nis very bold indeed. It is probably best to set the value to 1 and use normal bold.\n\nsetitalic()\nDefault state:      Italic is off\nDefault action:     Turn italic on\nValid args:         0, 1\n\nSet the italic property of the font:\n\n$format->setitalic();  # Turn italic on\n\nsetunderline()\nDefault state:      Underline is off\nDefault action:     Turn on single underline\nValid args:         0  = No underline\n1  = Single underline\n2  = Double underline\n33 = Single accounting underline\n34 = Double accounting underline\n\nSet the underline property of the font.\n\n$format->setunderline();   # Single underline\n\nsetfontstrikeout()\nDefault state:      Strikeout is off\nDefault action:     Turn strikeout on\nValid args:         0, 1\n\nSet the strikeout property of the font.\n\nsetfontscript()\nDefault state:      Super/Subscript is off\nDefault action:     Turn Superscript on\nValid args:         0  = Normal\n1  = Superscript\n2  = Subscript\n\nSet the superscript/subscript property of the font. This format is currently not very useful.\n\nsetfontoutline()\nDefault state:      Outline is off\nDefault action:     Turn outline on\nValid args:         0, 1\n\nMacintosh only.\n\nsetfontshadow()\nDefault state:      Shadow is off\nDefault action:     Turn shadow on\nValid args:         0, 1\n\nMacintosh only.\n\nsetnumformat()\nDefault state:      General format\nDefault action:     Format index 1\nValid args:         See the following table\n\nThis method is used to define the numerical format of a number in Excel. It controls whether a\nnumber is displayed as an integer, a floating point number, a date, a currency value or some\nother user defined format.\n\nThe numerical format of a cell can be specified by using a format string or an index to one of\nExcel's built-in formats:\n\nmy $format1 = $workbook->addformat();\nmy $format2 = $workbook->addformat();\n$format1->setnumformat('d mmm yyyy'); # Format string\n$format2->setnumformat(0x0f);         # Format index\n\n$worksheet->write(0, 0, 36892.521, $format1);      # 1 Jan 2001\n$worksheet->write(0, 0, 36892.521, $format2);      # 1-Jan-01\n\nUsing format strings you can define very sophisticated formatting of numbers.\n\n$format01->setnumformat('0.000');\n$worksheet->write(0,  0, 3.1415926, $format01);    # 3.142\n\n$format02->setnumformat('#,##0');\n$worksheet->write(1,  0, 1234.56,   $format02);    # 1,235\n\n$format03->setnumformat('#,##0.00');\n$worksheet->write(2,  0, 1234.56,   $format03);    # 1,234.56\n\n$format04->setnumformat('$0.00');\n$worksheet->write(3,  0, 49.99,     $format04);    # $49.99\n\n# Note you can use other currency symbols such as the pound or yen as well.\n# Other currencies may require the use of Unicode.\n\n$format07->setnumformat('mm/dd/yy');\n$worksheet->write(6,  0, 36892.521, $format07);    # 01/01/01\n\n$format08->setnumformat('mmm d yyyy');\n$worksheet->write(7,  0, 36892.521, $format08);    # Jan 1 2001\n\n$format09->setnumformat('d mmmm yyyy');\n$worksheet->write(8,  0, 36892.521, $format09);    # 1 January 2001\n\n$format10->setnumformat('dd/mm/yyyy hh:mm AM/PM');\n$worksheet->write(9,  0, 36892.521, $format10);    # 01/01/2001 12:30 AM\n\n$format11->setnumformat('0 \"dollar and\" .00 \"cents\"');\n$worksheet->write(10, 0, 1.87,      $format11);    # 1 dollar and .87 cents\n\n# Conditional formatting\n$format12->setnumformat('[Green]General;[Red]-General;General');\n$worksheet->write(11, 0, 123,       $format12);    # > 0 Green\n$worksheet->write(12, 0, -45,       $format12);    # < 0 Red\n$worksheet->write(13, 0, 0,         $format12);    # = 0 Default colour\n\n# Zip code\n$format13->setnumformat('00000');\n$worksheet->write(14, 0, '01209',   $format13);\n\nThe number system used for dates is described in \"DATES AND TIME IN EXCEL\".\n\nThe colour format should have one of the following values:\n\n[Black] [Blue] [Cyan] [Green] [Magenta] [Red] [White] [Yellow]\n\nAlternatively you can specify the colour based on a colour index as follows: \"[Color n]\", where\nn is a standard Excel colour index - 7. See the 'Standard colors' worksheet created by\nformats.pl.\n\nFor more information refer to the documentation on formatting in the \"docs\" directory of the\nSpreadsheet::WriteExcel distro, the Excel on-line help or\n<http://office.microsoft.com/en-gb/assistance/HP051995001033.aspx>.\n\nYou should ensure that the format string is valid in Excel prior to using it in WriteExcel.\n\nExcel's built-in formats are shown in the following table:\n\nIndex   Index   Format String\n0       0x00    General\n1       0x01    0\n2       0x02    0.00\n3       0x03    #,##0\n4       0x04    #,##0.00\n5       0x05    ($#,##0);($#,##0)\n6       0x06    ($#,##0);[Red]($#,##0)\n7       0x07    ($#,##0.00);($#,##0.00)\n8       0x08    ($#,##0.00);[Red]($#,##0.00)\n9       0x09    0%\n10      0x0a    0.00%\n11      0x0b    0.00E+00\n12      0x0c    # ?/?\n13      0x0d    # ??/??\n14      0x0e    m/d/yy\n15      0x0f    d-mmm-yy\n16      0x10    d-mmm\n17      0x11    mmm-yy\n18      0x12    h:mm AM/PM\n19      0x13    h:mm:ss AM/PM\n20      0x14    h:mm\n21      0x15    h:mm:ss\n22      0x16    m/d/yy h:mm\n..      ....    ...........\n37      0x25    (#,##0);(#,##0)\n38      0x26    (#,##0);[Red](#,##0)\n39      0x27    (#,##0.00);(#,##0.00)\n40      0x28    (#,##0.00);[Red](#,##0.00)\n41      0x29    (* #,##0);(* (#,##0);(* \"-\");(@)\n42      0x2a    ($* #,##0);($* (#,##0);($* \"-\");(@)\n43      0x2b    (* #,##0.00);(* (#,##0.00);(* \"-\"??);(@)\n44      0x2c    ($* #,##0.00);($* (#,##0.00);($* \"-\"??);(@)\n45      0x2d    mm:ss\n46      0x2e    [h]:mm:ss\n47      0x2f    mm:ss.0\n48      0x30    ##0.0E+0\n49      0x31    @\n\nFor examples of these formatting codes see the 'Numerical formats' worksheet created by\nformats.pl. See also the numberformats1.html and the numberformats2.html documents in the\n\"docs\" directory of the distro.\n\nNote 1. Numeric formats 23 to 36 are not documented by Microsoft and may differ in international\nversions.\n\nNote 2. In Excel 5 the dollar sign appears as a dollar sign. In Excel 97-2000 it appears as the\ndefined local currency symbol.\n\nNote 3. The red negative numeric formats display slightly differently in Excel 5 and Excel\n97-2000.\n\nsetlocked()\nDefault state:      Cell locking is on\nDefault action:     Turn locking on\nValid args:         0, 1\n\nThis property can be used to prevent modification of a cells contents. Following Excel's\nconvention, cell locking is turned on by default. However, it only has an effect if the\nworksheet has been protected, see the worksheet \"protect()\" method.\n\nmy $locked  = $workbook->addformat();\n$locked->setlocked(1); # A non-op\n\nmy $unlocked = $workbook->addformat();\n$locked->setlocked(0);\n\n# Enable worksheet protection\n$worksheet->protect();\n\n# This cell cannot be edited.\n$worksheet->write('A1', '=1+2', $locked);\n\n# This cell can be edited.\n$worksheet->write('A2', '=1+2', $unlocked);\n\nNote: This offers weak protection even with a password, see the note in relation to the\n\"protect()\" method.\n\nsethidden()\nDefault state:      Formula hiding is off\nDefault action:     Turn hiding on\nValid args:         0, 1\n\nThis property is used to hide a formula while still displaying its result. This is generally\nused to hide complex calculations from end users who are only interested in the result. It only\nhas an effect if the worksheet has been protected, see the worksheet \"protect()\" method.\n\nmy $hidden = $workbook->addformat();\n$hidden->sethidden();\n\n# Enable worksheet protection\n$worksheet->protect();\n\n# The formula in this cell isn't visible\n$worksheet->write('A1', '=1+2', $hidden);\n\nNote: This offers weak protection even with a password, see the note in relation to the\n\"protect()\" method.\n\nsetalign()\nDefault state:      Alignment is off\nDefault action:     Left alignment\nValid args:         'left'              Horizontal\n'center'\n'right'\n'fill'\n'justify'\n'centeracross'\n\n'top'               Vertical\n'vcenter'\n'bottom'\n'vjustify'\n\nThis method is used to set the horizontal and vertical text alignment within a cell. Vertical\nand horizontal alignments can be combined. The method is used as follows:\n\nmy $format = $workbook->addformat();\n$format->setalign('center');\n$format->setalign('vcenter');\n$worksheet->setrow(0, 30);\n$worksheet->write(0, 0, 'X', $format);\n\nText can be aligned across two or more adjacent cells using the \"centeracross\" property.\nHowever, for genuine merged cells it is better to use the \"mergerange()\" worksheet method.\n\nThe \"vjustify\" (vertical justify) option can be used to provide automatic text wrapping in a\ncell. The height of the cell will be adjusted to accommodate the wrapped text. To specify where\nthe text wraps use the \"settextwrap()\" method.\n\nFor further examples see the 'Alignment' worksheet created by formats.pl.\n\nsetcenteracross()\nDefault state:      Center across selection is off\nDefault action:     Turn center across on\nValid args:         1\n\nText can be aligned across two or more adjacent cells using the \"setcenteracross()\" method.\nThis is an alias for the \"setalign('centeracross')\" method call.\n\nOnly one cell should contain the text, the other cells should be blank:\n\nmy $format = $workbook->addformat();\n$format->setcenteracross();\n\n$worksheet->write(1, 1, 'Center across selection', $format);\n$worksheet->writeblank(1, 2, $format);\n\nSee also the \"merge1.pl\" to \"merge6.pl\" programs in the \"examples\" directory and the\n\"mergerange()\" method.\n\nsettextwrap()\nDefault state:      Text wrap is off\nDefault action:     Turn text wrap on\nValid args:         0, 1\n\nHere is an example using the text wrap property, the escape character \"\\n\" is used to indicate\nthe end of line:\n\nmy $format = $workbook->addformat();\n$format->settextwrap();\n$worksheet->write(0, 0, \"It's\\na bum\\nwrap\", $format);\n\nExcel will adjust the height of the row to accommodate the wrapped text. A similar effect can be\nobtained without newlines using the \"setalign('vjustify')\" method. See the \"textwrap.pl\"\nprogram in the \"examples\" directory.\n\nsetrotation()\nDefault state:      Text rotation is off\nDefault action:     None\nValid args:         Integers in the range -90 to 90 and 270\n\nSet the rotation of the text in a cell. The rotation can be any angle in the range -90 to 90\ndegrees.\n\nmy $format = $workbook->addformat();\n$format->setrotation(30);\n$worksheet->write(0, 0, 'This text is rotated', $format);\n\nThe angle 270 is also supported. This indicates text where the letters run from top to bottom.\n\nsetindent()\nDefault state:      Text indentation is off\nDefault action:     Indent text 1 level\nValid args:         Positive integers\n\nThis method can be used to indent text. The argument, which should be an integer, is taken as\nthe level of indentation:\n\nmy $format = $workbook->addformat();\n$format->setindent(2);\n$worksheet->write(0, 0, 'This text is indented', $format);\n\nIndentation is a horizontal alignment property. It will override any other horizontal properties\nbut it can be used in conjunction with vertical properties.\n\nsetshrink()\nDefault state:      Text shrinking is off\nDefault action:     Turn \"shrink to fit\" on\nValid args:         1\n\nThis method can be used to shrink text so that it fits in a cell.\n\nmy $format = $workbook->addformat();\n$format->setshrink();\n$worksheet->write(0, 0, 'Honey, I shrunk the text!', $format);\n\nsettextjustlast()\nDefault state:      Justify last is off\nDefault action:     Turn justify last on\nValid args:         0, 1\n\nOnly applies to Far Eastern versions of Excel.\n\nsetpattern()\nDefault state:      Pattern is off\nDefault action:     Solid fill is on\nValid args:         0 .. 18\n\nSet the background pattern of a cell.\n\nExamples of the available patterns are shown in the 'Patterns' worksheet created by formats.pl.\nHowever, it is unlikely that you will ever need anything other than Pattern 1 which is a solid\nfill of the background color.\n\nsetbgcolor()\nDefault state:      Color is off\nDefault action:     Solid fill.\nValid args:         See setcolor()\n\nThe \"setbgcolor()\" method can be used to set the background colour of a pattern. Patterns are\ndefined via the \"setpattern()\" method. If a pattern hasn't been defined then a solid fill\npattern is used as the default.\n\nHere is an example of how to set up a solid fill in a cell:\n\nmy $format = $workbook->addformat();\n\n$format->setpattern(); # This is optional when using a solid fill\n\n$format->setbgcolor('green');\n$worksheet->write('A1', 'Ray', $format);\n\nFor further examples see the 'Patterns' worksheet created by formats.pl.\n\nsetfgcolor()\nDefault state:      Color is off\nDefault action:     Solid fill.\nValid args:         See setcolor()\n\nThe \"setfgcolor()\" method can be used to set the foreground colour of a pattern.\n\nFor further examples see the 'Patterns' worksheet created by formats.pl.\n\nsetborder()\nAlso applies to:    setbottom()\nsettop()\nsetleft()\nsetright()\n\nDefault state:      Border is off\nDefault action:     Set border type 1\nValid args:         0-13, See below.\n\nA cell border is comprised of a border on the bottom, top, left and right. These can be set to\nthe same value using \"setborder()\" or individually using the relevant method calls shown above.\n\nThe following shows the border styles sorted by Spreadsheet::WriteExcel index number:\n\nIndex   Name            Weight   Style\n=====   =============   ======   ===========\n0       None            0\n1       Continuous      1        -----------\n2       Continuous      2        -----------\n3       Dash            1        - - - - - -\n4       Dot             1        . . . . . .\n5       Continuous      3        -----------\n6       Double          3        ===========\n7       Continuous      0        -----------\n8       Dash            2        - - - - - -\n9       Dash Dot        1        - . - . - .\n10      Dash Dot        2        - . - . - .\n11      Dash Dot Dot    1        - . . - . .\n12      Dash Dot Dot    2        - . . - . .\n13      SlantDash Dot   2        / - . / - .\n\nThe following shows the borders sorted by style:\n\nName            Weight   Style         Index\n=============   ======   ===========   =====\nContinuous      0        -----------   7\nContinuous      1        -----------   1\nContinuous      2        -----------   2\nContinuous      3        -----------   5\nDash            1        - - - - - -   3\nDash            2        - - - - - -   8\nDash Dot        1        - . - . - .   9\nDash Dot        2        - . - . - .   10\nDash Dot Dot    1        - . . - . .   11\nDash Dot Dot    2        - . . - . .   12\nDot             1        . . . . . .   4\nDouble          3        ===========   6\nNone            0                      0\nSlantDash Dot   2        / - . / - .   13\n\nThe following shows the borders in the order shown in the Excel Dialog.\n\nIndex   Style             Index   Style\n=====   =====             =====   =====\n0       None              12      - . . - . .\n7       -----------       13      / - . / - .\n4       . . . . . .       10      - . - . - .\n11      - . . - . .       8       - - - - - -\n9       - . - . - .       2       -----------\n3       - - - - - -       5       -----------\n1       -----------       6       ===========\n\nExamples of the available border styles are shown in the 'Borders' worksheet created by\nformats.pl.\n\nsetbordercolor()\nAlso applies to:    setbottomcolor()\nsettopcolor()\nsetleftcolor()\nsetrightcolor()\n\nDefault state:      Color is off\nDefault action:     Undefined\nValid args:         See setcolor()\n\nSet the colour of the cell borders. A cell border is comprised of a border on the bottom, top,\nleft and right. These can be set to the same colour using \"setbordercolor()\" or individually\nusing the relevant method calls shown above. Examples of the border styles and colours are shown\nin the 'Borders' worksheet created by formats.pl.\n\ncopy($format)\nThis method is used to copy all of the properties from one Format object to another:\n\nmy $lorry1 = $workbook->addformat();\n$lorry1->setbold();\n$lorry1->setitalic();\n$lorry1->setcolor('red');    # lorry1 is bold, italic and red\n\nmy $lorry2 = $workbook->addformat();\n$lorry2->copy($lorry1);\n$lorry2->setcolor('yellow'); # lorry2 is bold, italic and yellow\n\nThe \"copy()\" method is only useful if you are using the method interface to Format properties.\nIt generally isn't required if you are setting Format properties directly using hashes.\n\nNote: this is not a copy constructor, both objects must exist prior to copying.\n",
            "subsections": []
        },
        "UNICODE IN EXCEL": {
            "content": "The following is a brief introduction to handling Unicode in \"Spreadsheet::WriteExcel\".\n\n*For a more general introduction to Unicode handling in Perl see* perlunitut and perluniintro.\n\nWhen using Spreadsheet::WriteExcel the best and easiest way to write unicode strings to an Excel\nfile is to use \"UTF-8\" encoded strings and perl 5.8 (or later). Spreadsheet::WriteExcel also\nallows you to write unicode strings using older perls but it generally requires more work, as\nexplained below.\n\nInternally, Excel encodes unicode data as \"UTF-16LE\" (where LE means little-endian). If you are\nusing perl 5.8+ then Spreadsheet::WriteExcel will convert \"UTF-8\" strings to \"UTF-16LE\" when\nrequired. No further intervention is required from the programmer, for example:\n\n# perl 5.8+ example:\nmy $smiley = \"\\x{263A}\";\n\n$worksheet->write('A1', 'Hello world'); # ASCII\n$worksheet->write('A2', $smiley);       # UTF-8\n\nSpreadsheet::WriteExcel also lets you write unicode data as \"UTF-16\". Since the majority of CPAN\nmodules default to \"UTF-16BE\" (big-endian) Spreadsheet::WriteExcel also uses \"UTF-16BE\" and\nconverts it internally to \"UTF-16LE\":\n\n# perl 5.005 example:\nmy $smiley = pack 'n', 0x263A;\n\n$worksheet->write               ('A3', 'Hello world'); # ASCII\n$worksheet->writeutf16bestring('A4', $smiley);       # UTF-16\n\nAlthough the above examples look similar there is an important difference. With \"uft8\" and perl\n5.8+ Spreadsheet::WriteExcel treats \"UTF-8\" strings in exactly the same way as any other string.\nHowever, with \"UTF16\" data we need to distinguish it from other strings either by calling a\nseparate function or by passing an additional flag to indicate the data type.\n\nIf you are dealing with non-ASCII characters that aren't in \"UTF-8\" then perl 5.8+ provides\nuseful tools in the guise of the \"Encode\" module to help you to convert to the required format.\nFor example:\n\nuse Encode 'decode';\n\nmy $string = 'some string with koi8-r characters';\n$string = decode('koi8-r', $string); # koi8-r to utf8\n\nAlternatively you can read data from an encoded file and convert it to \"UTF-8\" as you read it\nin:\n\nmy $file = 'unicodekoi8r.txt';\nopen FH, '<:encoding(koi8-r)', $file  or die \"Couldn't open $file: $!\\n\";\n\nmy $row = 0;\nwhile (<FH>) {\n# Data read in is now in utf8 format.\nchomp;\n$worksheet->write($row++, 0,  $);\n}\n\nThese methodologies are explained in more detail in perlunitut, perluniintro and perlunicode.\n\nSee also the \"unicode*.pl\" programs in the examples directory of the distro.\n",
            "subsections": []
        },
        "COLOURS IN EXCEL": {
            "content": "Excel provides a colour palette of 56 colours. In Spreadsheet::WriteExcel these colours are\naccessed via their palette index in the range 8..63. This index is used to set the colour of\nfonts, cell patterns and cell borders. For example:\n\nmy $format = $workbook->addformat(\ncolor => 12, # index for blue\nfont  => 'Arial',\nsize  => 12,\nbold  => 1,\n);\n\nThe most commonly used colours can also be accessed by name. The name acts as a simple alias for\nthe colour index:\n\nblack     =>    8\nblue      =>   12\nbrown     =>   16\ncyan      =>   15\ngray      =>   23\ngreen     =>   17\nlime      =>   11\nmagenta   =>   14\nnavy      =>   18\norange    =>   53\npink      =>   33\npurple    =>   20\nred       =>   10\nsilver    =>   22\nwhite     =>    9\nyellow    =>   13\n\nFor example:\n\nmy $font = $workbook->addformat(color => 'red');\n\nUsers of VBA in Excel should note that the equivalent colour indices are in the range 1..56\ninstead of 8..63.\n\nIf the default palette does not provide a required colour you can override one of the built-in\nvalues. This is achieved by using the \"setcustomcolor()\" workbook method to adjust the RGB\n(red green blue) components of the colour:\n\nmy $ferrari = $workbook->setcustomcolor(40, 216, 12, 12);\n\nmy $format  = $workbook->addformat(\nbgcolor => $ferrari,\npattern  => 1,\nborder   => 1\n);\n\n$worksheet->writeblank('A1', $format);\n\nThe default Excel colour palette is shown in \"palette.html\" in the \"docs\" directory of the\ndistro. You can generate an Excel version of the palette using \"colors.pl\" in the \"examples\"\ndirectory.\n",
            "subsections": []
        },
        "DATES AND TIME IN EXCEL": {
            "content": "There are two important things to understand about dates and times in Excel:\n\n1 A date/time in Excel is a real number plus an Excel number format.\n2 Spreadsheet::WriteExcel doesn't automatically convert date/time strings in \"write()\" to an\nExcel date/time.\n\nThese two points are explained in more detail below along with some suggestions on how to\nconvert times and dates to the required format.\n\nAn Excel date/time is a number plus a format\nIf you write a date string with \"write()\" then all you will get is a string:\n\n$worksheet->write('A1', '02/03/04'); # !! Writes a string not a date. !!\n\nDates and times in Excel are represented by real numbers, for example \"Jan 1 2001 12:30 AM\" is\nrepresented by the number 36892.521.\n\nThe integer part of the number stores the number of days since the epoch and the fractional part\nstores the percentage of the day.\n\nA date or time in Excel is just like any other number. To have the number display as a date you\nmust apply an Excel number format to it. Here are some examples.\n\n#!/usr/bin/perl -w\n\nuse strict;\nuse Spreadsheet::WriteExcel;\n\nmy $workbook  = Spreadsheet::WriteExcel->new('dateexamples.xls');\nmy $worksheet = $workbook->addworksheet();\n\n$worksheet->setcolumn('A:A', 30); # For extra visibility.\n\nmy $number    = 39506.5;\n\n$worksheet->write('A1', $number);            #     39506.5\n\nmy $format2 = $workbook->addformat(numformat => 'dd/mm/yy');\n$worksheet->write('A2', $number , $format2); #     28/02/08\n\nmy $format3 = $workbook->addformat(numformat => 'mm/dd/yy');\n$worksheet->write('A3', $number , $format3); #     02/28/08\n\nmy $format4 = $workbook->addformat(numformat => 'd-m-yyyy');\n$worksheet->write('A4', $number , $format4); #     28-2-2008\n\nmy $format5 = $workbook->addformat(numformat => 'dd/mm/yy hh:mm');\n$worksheet->write('A5', $number , $format5); #     28/02/08 12:00\n\nmy $format6 = $workbook->addformat(numformat => 'd mmm yyyy');\n$worksheet->write('A6', $number , $format6); #     28 Feb 2008\n\nmy $format7 = $workbook->addformat(numformat => 'mmm d yyyy hh:mm AM/PM');\n$worksheet->write('A7', $number , $format7); #     Feb 28 2008 12:00 PM\n\nSpreadsheet::WriteExcel doesn't automatically convert date/time strings\nSpreadsheet::WriteExcel doesn't automatically convert input date strings into Excel's formatted\ndate numbers due to the large number of possible date formats and also due to the possibility of\nmisinterpretation.\n\nFor example, does \"02/03/04\" mean March 2 2004, February 3 2004 or even March 4 2002.\n\nTherefore, in order to handle dates you will have to convert them to numbers and apply an Excel\nformat. Some methods for converting dates are listed in the next section.\n\nThe most direct way is to convert your dates to the ISO8601 \"yyyy-mm-ddThh:mm:ss.sss\" date\nformat and use the \"writedatetime()\" worksheet method:\n\n$worksheet->writedatetime('A2', '2001-01-01T12:20', $format);\n\nSee the \"writedatetime()\" section of the documentation for more details.\n\nA general methodology for handling date strings with \"writedatetime()\" is:\n\n1. Identify incoming date/time strings with a regex.\n2. Extract the component parts of the date/time using the same regex.\n3. Convert the date/time to the ISO8601 format.\n4. Write the date/time using writedatetime() and a number format.\n\nHere is an example:\n\n#!/usr/bin/perl -w\n\nuse strict;\nuse Spreadsheet::WriteExcel;\n\nmy $workbook    = Spreadsheet::WriteExcel->new('example.xls');\nmy $worksheet   = $workbook->addworksheet();\n\n# Set the default format for dates.\nmy $dateformat = $workbook->addformat(numformat => 'mmm d yyyy');\n\n# Increase column width to improve visibility of data.\n$worksheet->setcolumn('A:C', 20);\n\n# Simulate reading from a data source.\nmy $row = 0;\n\nwhile (<DATA>) {\nchomp;\n\nmy $col  = 0;\nmy @data = split ' ';\n\nfor my $item (@data) {\n\n# Match dates in the following formats: d/m/yy, d/m/yyyy\nif ($item =~ qr[^(\\d{1,2})/(\\d{1,2})/(\\d{4})$]) {\n\n# Change to the date format required by writedatetime().\nmy $date = sprintf \"%4d-%02d-%02dT\", $3, $2, $1;\n\n$worksheet->writedatetime($row, $col++, $date, $dateformat);\n}\nelse {\n# Just plain data\n$worksheet->write($row, $col++, $item);\n}\n}\n$row++;\n}\n\nDATA\nItem    Cost    Date\nBook    10      1/9/2007\nBeer    4       12/9/2007\nBed     500     5/10/2007\n\nFor a slightly more advanced solution you can modify the \"write()\" method to handle date formats\nof your choice via the \"addwritehandler()\" method. See the \"addwritehandler()\" section of\nthe docs and the writehandler3.pl and writehandler4.pl programs in the examples directory of\nthe distro.\n",
            "subsections": [
                {
                    "name": "Converting dates and times to an Excel date or time",
                    "content": "The \"writedatetime()\" method above is just one way of handling dates and times.\n\nThe Spreadsheet::WriteExcel::Utility module which is included in the distro has date/time\nhandling functions:\n\nuse Spreadsheet::WriteExcel::Utility;\n\n$date           = xldatelist(2002, 1, 1);         # 37257\n$date           = xlparsedate(\"11 July 1997\");    # 35622\n$time           = xlparsetime('3:21:36 PM');      # 0.64\n$date           = xldecodedateEU(\"13 May 2002\"); # 37389\n\nNote: some of these functions require additional CPAN modules.\n\nFor date conversions using the CPAN \"DateTime\" framework see DateTime::Format::Excel\n<http://search.cpan.org/search?dist=DateTime-Format-Excel>.\n"
                }
            ]
        },
        "OUTLINES AND GROUPING IN EXCEL": {
            "content": "Excel allows you to group rows or columns so that they can be hidden or displayed with a single\nmouse click. This feature is referred to as outlines.\n\nOutlines can reduce complex data down to a few salient sub-totals or summaries.\n\nThis feature is best viewed in Excel but the following is an ASCII representation of what a\nworksheet with three outlines might look like. Rows 3-4 and rows 7-8 are grouped at level 2.\nRows 2-9 are grouped at level 1. The lines at the left hand side are called outline level bars.\n\n------------------------------------------\n1 2 3 |   |   A   |   B   |   C   |   D   |  ...\n------------------------------------------\n| 1 |   A   |       |       |       |  ...\n|    | 2 |   B   |       |       |       |  ...\n| |   | 3 |  (C)  |       |       |       |  ...\n| |   | 4 |  (D)  |       |       |       |  ...\n| -   | 5 |   E   |       |       |       |  ...\n|    | 6 |   F   |       |       |       |  ...\n| |   | 7 |  (G)  |       |       |       |  ...\n| |   | 8 |  (H)  |       |       |       |  ...\n| -   | 9 |   I   |       |       |       |  ...\n-     | . |  ...  |  ...  |  ...  |  ...  |  ...\n\nClicking the minus sign on each of the level 2 outlines will collapse and hide the data as shown\nin the next figure. The minus sign changes to a plus sign to indicate that the data in the\noutline is hidden.\n\n------------------------------------------\n1 2 3 |   |   A   |   B   |   C   |   D   |  ...\n------------------------------------------\n| 1 |   A   |       |       |       |  ...\n|     | 2 |   B   |       |       |       |  ...\n| +   | 5 |   E   |       |       |       |  ...\n|     | 6 |   F   |       |       |       |  ...\n| +   | 9 |   I   |       |       |       |  ...\n-     | . |  ...  |  ...  |  ...  |  ...  |  ...\n\nClicking on the minus sign on the level 1 outline will collapse the remaining rows as follows:\n\n------------------------------------------\n1 2 3 |   |   A   |   B   |   C   |   D   |  ...\n------------------------------------------\n| 1 |   A   |       |       |       |  ...\n+     | . |  ...  |  ...  |  ...  |  ...  |  ...\n\nGrouping in \"Spreadsheet::WriteExcel\" is achieved by setting the outline level via the\n\"setrow()\" and \"setcolumn()\" worksheet methods:\n\nsetrow($row, $height, $format, $hidden, $level, $collapsed)\nsetcolumn($firstcol, $lastcol, $width, $format, $hidden, $level, $collapsed)\n\nThe following example sets an outline level of 1 for rows 1 and 2 (zero-indexed) and columns B\nto G. The parameters $height and $XF are assigned default values since they are undefined:\n\n$worksheet->setrow(1, undef, undef, 0, 1);\n$worksheet->setrow(2, undef, undef, 0, 1);\n$worksheet->setcolumn('B:G', undef, undef, 0, 1);\n\nExcel allows up to 7 outline levels. Therefore the $level parameter should be in the range \"0 <=\n$level <= 7\".\n\nRows and columns can be collapsed by setting the $hidden flag for the hidden rows/columns and\nsetting the $collapsed flag for the row/column that has the collapsed \"+\" symbol:\n\n$worksheet->setrow(1, undef, undef, 1, 1);\n$worksheet->setrow(2, undef, undef, 1, 1);\n$worksheet->setrow(3, undef, undef, 0, 0, 1);        # Collapsed flag.\n\n$worksheet->setcolumn('B:G', undef, undef, 1, 1);\n$worksheet->setcolumn('H:H', undef, undef, 0, 0, 1); # Collapsed flag.\n\nNote: Setting the $collapsed flag is particularly important for compatibility with\nOpenOffice.org and Gnumeric.\n\nFor a more complete example see the \"outline.pl\" and \"outlinecollapsed.pl\" programs in the\nexamples directory of the distro.\n\nSome additional outline properties can be set via the \"outlinesettings()\" worksheet method, see\nabove.\n",
            "subsections": []
        },
        "DATA VALIDATION IN EXCEL": {
            "content": "Data validation is a feature of Excel which allows you to restrict the data that a users enters\nin a cell and to display help and warning messages. It also allows you to restrict input to\nvalues in a drop down list.\n\nA typical use case might be to restrict data in a cell to integer values in a certain range, to\nprovide a help message to indicate the required value and to issue a warning if the input data\ndoesn't meet the stated criteria. In Spreadsheet::WriteExcel we could do that as follows:\n\n$worksheet->datavalidation('B3',\n{\nvalidate        => 'integer',\ncriteria        => 'between',\nminimum         => 1,\nmaximum         => 100,\ninputtitle     => 'Input an integer:',\ninputmessage   => 'Between 1 and 100',\nerrormessage   => 'Sorry, try again.',\n});\n\nThe above example would look like this in Excel:\n<http://homepage.eircom.net/~jmcnamara/perl/datavalidation.jpg>.\n\nFor more information on data validation see the following Microsoft support article \"Description\nand examples of data validation in Excel\": <http://support.microsoft.com/kb/211485>.\n\nThe following sections describe how to use the \"datavalidation()\" method and its various\noptions.\n\ndatavalidation($row, $col, { parameter => 'value', ... })\nThe \"datavalidation()\" method is used to construct an Excel data validation.\n\nIt can be applied to a single cell or a range of cells. You can pass 3 parameters such as\n\"($row, $col, {...})\" or 5 parameters such as \"($firstrow, $firstcol, $lastrow, $lastcol,\n{...})\". You can also use \"A1\" style notation. For example:\n\n$worksheet->datavalidation(0, 0,       {...});\n$worksheet->datavalidation(0, 0, 4, 1, {...});\n\n# Which are the same as:\n\n$worksheet->datavalidation('A1',       {...});\n$worksheet->datavalidation('A1:B5',    {...});\n\nSee also the note about \"Cell notation\" for more information.\n\nThe last parameter in \"datavalidation()\" must be a hash ref containing the parameters that\ndescribe the type and style of the data validation. The allowable parameters are:\n\nvalidate\ncriteria\nvalue | minimum | source\nmaximum\nignoreblank\ndropdown\n\ninputtitle\ninputmessage\nshowinput\n\nerrortitle\nerrormessage\nerrortype\nshowerror\n\nThese parameters are explained in the following sections. Most of the parameters are optional,\nhowever, you will generally require the three main options \"validate\", \"criteria\" and \"value\".\n\n$worksheet->datavalidation('B3',\n{\nvalidate => 'integer',\ncriteria => '>',\nvalue    => 100,\n});\n\nThe \"datavalidation\" method returns:\n\n0 for success.\n-1 for insufficient number of arguments.\n-2 for row or column out of bounds.\n-3 for incorrect parameter or value.\n\nvalidate\nThis parameter is passed in a hash ref to \"datavalidation()\".\n\nThe \"validate\" parameter is used to set the type of data that you wish to validate. It is always\nrequired and it has no default value. Allowable values are:\n\nany\ninteger\ndecimal\nlist\ndate\ntime\nlength\ncustom\n\n*   any is used to specify that the type of data is unrestricted. This is the same as not\napplying a data validation. It is only provided for completeness and isn't used very often\nin the context of Spreadsheet::WriteExcel.\n\n*   integer restricts the cell to integer values. Excel refers to this as 'whole number'.\n\nvalidate => 'integer',\ncriteria => '>',\nvalue    => 100,\n\n*   decimal restricts the cell to decimal values.\n\nvalidate => 'decimal',\ncriteria => '>',\nvalue    => 38.6,\n\n*   list restricts the cell to a set of user specified values. These can be passed in an array\nref or as a cell range (named ranges aren't currently supported):\n\nvalidate => 'list',\nvalue    => ['open', 'high', 'close'],\n# Or like this:\nvalue    => 'B1:B3',\n\nExcel requires that range references are only to cells on the same worksheet.\n\n*   date restricts the cell to date values. Dates in Excel are expressed as integer values but\nyou can also pass an ISO860 style string as used in \"writedatetime()\". See also \"DATES AND\nTIME IN EXCEL\" for more information about working with Excel's dates.\n\nvalidate => 'date',\ncriteria => '>',\nvalue    => 39653, # 24 July 2008\n# Or like this:\nvalue    => '2008-07-24T',\n\n*   time restricts the cell to time values. Times in Excel are expressed as decimal values but\nyou can also pass an ISO860 style string as used in \"writedatetime()\". See also \"DATES AND\nTIME IN EXCEL\" for more information about working with Excel's times.\n\nvalidate => 'time',\ncriteria => '>',\nvalue    => 0.5, # Noon\n# Or like this:\nvalue    => 'T12:00:00',\n\n*   length restricts the cell data based on an integer string length. Excel refers to this as\n'Text length'.\n\nvalidate => 'length',\ncriteria => '>',\nvalue    => 10,\n\n*   custom restricts the cell based on an external Excel formula that returns a \"TRUE/FALSE\"\nvalue.\n\nvalidate => 'custom',\nvalue    => '=IF(A10>B10,TRUE,FALSE)',\n\ncriteria\nThis parameter is passed in a hash ref to \"datavalidation()\".\n\nThe \"criteria\" parameter is used to set the criteria by which the data in the cell is validated.\nIt is almost always required except for the \"list\" and \"custom\" validate options. It has no\ndefault value. Allowable values are:\n\n'between'\n'not between'\n'equal to'                  |  '=='  |  '='\n'not equal to'              |  '!='  |  '<>'\n'greater than'              |  '>'\n'less than'                 |  '<'\n'greater than or equal to'  |  '>='\n'less than or equal to'     |  '<='\n\nYou can either use Excel's textual description strings, in the first column above, or the more\ncommon operator alternatives. The following are equivalent:\n\nvalidate => 'integer',\ncriteria => 'greater than',\nvalue    => 100,\n\nvalidate => 'integer',\ncriteria => '>',\nvalue    => 100,\n\nThe \"list\" and \"custom\" validate options don't require a \"criteria\". If you specify one it will\nbe ignored.\n\nvalidate => 'list',\nvalue    => ['open', 'high', 'close'],\n\nvalidate => 'custom',\nvalue    => '=IF(A10>B10,TRUE,FALSE)',\n\nvalue | minimum | source\nThis parameter is passed in a hash ref to \"datavalidation()\".\n\nThe \"value\" parameter is used to set the limiting value to which the \"criteria\" is applied. It\nis always required and it has no default value. You can also use the synonyms \"minimum\" or\n\"source\" to make the validation a little clearer and closer to Excel's description of the\nparameter:\n\n# Use 'value'\nvalidate => 'integer',\ncriteria => '>',\nvalue    => 100,\n\n# Use 'minimum'\nvalidate => 'integer',\ncriteria => 'between',\nminimum  => 1,\nmaximum  => 100,\n\n# Use 'source'\nvalidate => 'list',\nsource   => '$B$1:$B$3',\n\nmaximum\nThis parameter is passed in a hash ref to \"datavalidation()\".\n\nThe \"maximum\" parameter is used to set the upper limiting value when the \"criteria\" is either\n'between' or 'not between':\n\nvalidate => 'integer',\ncriteria => 'between',\nminimum  => 1,\nmaximum  => 100,\n\nignoreblank\nThis parameter is passed in a hash ref to \"datavalidation()\".\n\nThe \"ignoreblank\" parameter is used to toggle on and off the 'Ignore blank' option in the Excel\ndata validation dialog. When the option is on the data validation is not applied to blank data\nin the cell. It is on by default.\n\nignoreblank => 0,  # Turn the option off\n\ndropdown\nThis parameter is passed in a hash ref to \"datavalidation()\".\n\nThe \"dropdown\" parameter is used to toggle on and off the 'In-cell dropdown' option in the Excel\ndata validation dialog. When the option is on a dropdown list will be shown for \"list\"\nvalidations. It is on by default.\n\ndropdown => 0,      # Turn the option off\n\ninputtitle\nThis parameter is passed in a hash ref to \"datavalidation()\".\n\nThe \"inputtitle\" parameter is used to set the title of the input message that is displayed when\na cell is entered. It has no default value and is only displayed if the input message is\ndisplayed. See the \"inputmessage\" parameter below.\n\ninputtitle   => 'This is the input title',\n\nThe maximum title length is 32 characters. UTF8 strings are handled automatically in perl 5.8\nand later.\n\ninputmessage\nThis parameter is passed in a hash ref to \"datavalidation()\".\n\nThe \"inputmessage\" parameter is used to set the input message that is displayed when a cell is\nentered. It has no default value.\n\nvalidate      => 'integer',\ncriteria      => 'between',\nminimum       => 1,\nmaximum       => 100,\ninputtitle   => 'Enter the applied discount:',\ninputmessage => 'between 1 and 100',\n\nThe message can be split over several lines using newlines, \"\\n\" in double quoted strings.\n\ninputmessage => \"This is\\na test.\",\n\nThe maximum message length is 255 characters. UTF8 strings are handled automatically in perl 5.8\nand later.\n\nshowinput\nThis parameter is passed in a hash ref to \"datavalidation()\".\n\nThe \"showinput\" parameter is used to toggle on and off the 'Show input message when cell is\nselected' option in the Excel data validation dialog. When the option is off an input message is\nnot displayed even if it has been set using \"inputmessage\". It is on by default.\n\nshowinput => 0,      # Turn the option off\n\nerrortitle\nThis parameter is passed in a hash ref to \"datavalidation()\".\n\nThe \"errortitle\" parameter is used to set the title of the error message that is displayed when\nthe data validation criteria is not met. The default error title is 'Microsoft Excel'.\n\nerrortitle   => 'Input value is not valid',\n\nThe maximum title length is 32 characters. UTF8 strings are handled automatically in perl 5.8\nand later.\n\nerrormessage\nThis parameter is passed in a hash ref to \"datavalidation()\".\n\nThe \"errormessage\" parameter is used to set the error message that is displayed when a cell is\nentered. The default error message is \"The value you entered is not valid.\\nA user has\nrestricted values that can be entered into the cell.\".\n\nvalidate      => 'integer',\ncriteria      => 'between',\nminimum       => 1,\nmaximum       => 100,\nerrortitle   => 'Input value is not valid',\nerrormessage => 'It should be an integer between 1 and 100',\n\nThe message can be split over several lines using newlines, \"\\n\" in double quoted strings.\n\ninputmessage => \"This is\\na test.\",\n\nThe maximum message length is 255 characters. UTF8 strings are handled automatically in perl 5.8\nand later.\n\nerrortype\nThis parameter is passed in a hash ref to \"datavalidation()\".\n\nThe \"errortype\" parameter is used to specify the type of error dialog that is displayed. There\nare 3 options:\n\n'stop'\n'warning'\n'information'\n\nThe default is 'stop'.\n\nshowerror\nThis parameter is passed in a hash ref to \"datavalidation()\".\n\nThe \"showerror\" parameter is used to toggle on and off the 'Show error alert after invalid data\nis entered' option in the Excel data validation dialog. When the option is off an error message\nis not displayed even if it has been set using \"errormessage\". It is on by default.\n\nshowerror => 0,      # Turn the option off\n",
            "subsections": [
                {
                    "name": "Data Validation Examples",
                    "content": "Example 1. Limiting input to an integer greater than a fixed value.\n\n$worksheet->datavalidation('A1',\n{\nvalidate        => 'integer',\ncriteria        => '>',\nvalue           => 0,\n});\n\nExample 2. Limiting input to an integer greater than a fixed value where the value is referenced\nfrom a cell.\n\n$worksheet->datavalidation('A2',\n{\nvalidate        => 'integer',\ncriteria        => '>',\nvalue           => '=E3',\n});\n\nExample 3. Limiting input to a decimal in a fixed range.\n\n$worksheet->datavalidation('A3',\n{\nvalidate        => 'decimal',\ncriteria        => 'between',\nminimum         => 0.1,\nmaximum         => 0.5,\n});\n\nExample 4. Limiting input to a value in a dropdown list.\n\n$worksheet->datavalidation('A4',\n{\nvalidate        => 'list',\nsource          => ['open', 'high', 'close'],\n});\n\nExample 5. Limiting input to a value in a dropdown list where the list is specified as a cell\nrange.\n\n$worksheet->datavalidation('A5',\n{\nvalidate        => 'list',\nsource          => '=E4:G4',\n});\n\nExample 6. Limiting input to a date in a fixed range.\n\n$worksheet->datavalidation('A6',\n{\nvalidate        => 'date',\ncriteria        => 'between',\nminimum         => '2008-01-01T',\nmaximum         => '2008-12-12T',\n});\n\nExample 7. Displaying a message when the cell is selected.\n\n$worksheet->datavalidation('A7',\n{\nvalidate      => 'integer',\ncriteria      => 'between',\nminimum       => 1,\nmaximum       => 100,\ninputtitle   => 'Enter an integer:',\ninputmessage => 'between 1 and 100',\n});\n\nSee also the \"datavalidate.pl\" program in the examples directory of the distro.\n"
                }
            ]
        },
        "ROW HEIGHTS AND WORKSHEET OBJECTS": {
            "content": "The following relates to worksheet objects such as images, comments and charts.\n\nIf you specify the height of a row that contains a worksheet object then Spreadsheet::WriteExcel\nwill adjust the height of the object to maintain its default or user specified dimensions. In\nthis way the object won't appear stretched or compressed in Excel.\n\nHowever, Excel can also adjust the height of a row automatically if it contains cells that have\nthe text wrap property set or contain large fonts. In these cases the height of the row is\nunknown to Spreadsheet::WriteExcel at execution time and the scaling calculations it performs\nare incorrect. The effect of this is that the object is stretched with the row when it is\ndisplayed in Excel.\n\nIn order to avoid this issue you should use the \"setrow()\" method to explicitly specify the\nheight of any row that may otherwise be changed automatically by Excel.\n",
            "subsections": []
        },
        "FORMULAS AND FUNCTIONS IN EXCEL": {
            "content": "",
            "subsections": [
                {
                    "name": "Caveats",
                    "content": "The first thing to note is that there are still some outstanding issues with the implementation\nof formulas and functions:\n\n1. Writing a formula is much slower than writing the equivalent string.\n2. You cannot use array constants, i.e. {1;2;3}, in functions.\n3. Unary minus isn't supported.\n4. Whitespace is not preserved around operators.\n5. Named ranges are not supported.\n6. Array formulas are not supported.\n\nHowever, these constraints will be removed in future versions. They are here because of a\ntrade-off between features and time. Also, it is possible to work around issue 1 using the\n\"storeformula()\" and \"repeatformula()\" methods as described later in this section.\n"
                },
                {
                    "name": "Introduction",
                    "content": "The following is a brief introduction to formulas and functions in Excel and\nSpreadsheet::WriteExcel.\n\nA formula is a string that begins with an equals sign:\n\n'=A1+B1'\n'=AVERAGE(1, 2, 3)'\n\nThe formula can contain numbers, strings, boolean values, cell references, cell ranges and\nfunctions. Named ranges are not supported. Formulas should be written as they appear in Excel,\nthat is cells and functions must be in uppercase.\n\nCells in Excel are referenced using the A1 notation system where the column is designated by a\nletter and the row by a number. Columns range from A to IV i.e. 0 to 255, rows range from 1 to\n65536. The \"Spreadsheet::WriteExcel::Utility\" module that is included in the distro contains\nhelper functions for dealing with A1 notation, for example:\n\nuse Spreadsheet::WriteExcel::Utility;\n\n($row, $col) = xlcelltorowcol('C2');  # (1, 2)\n$str         = xlrowcoltocell(1, 2);  # C2\n\nThe Excel \"$\" notation in cell references is also supported. This allows you to specify whether\na row or column is relative or absolute. This only has an effect if the cell is copied. The\nfollowing examples show relative and absolute values.\n\n'=A1'   # Column and row are relative\n'=$A1'  # Column is absolute and row is relative\n'=A$1'  # Column is relative and row is absolute\n'=$A$1' # Column and row are absolute\n\nFormulas can also refer to cells in other worksheets of the current workbook. For example:\n\n'=Sheet2!A1'\n'=Sheet2!A1:A5'\n'=Sheet2:Sheet3!A1'\n'=Sheet2:Sheet3!A1:A5'\nq{='Test Data'!A1}\nq{='Test Data1:Test Data2'!A1}\n\nThe sheet reference and the cell reference are separated by \"!\" the exclamation mark symbol. If\nworksheet names contain spaces, commas or parentheses then Excel requires that the name is\nenclosed in single quotes as shown in the last two examples above. In order to avoid using a lot\nof escape characters you can use the quote operator \"q{}\" to protect the quotes. See \"perlop\" in\nthe main Perl documentation. Only valid sheet names that have been added using the\n\"addworksheet()\" method can be used in formulas. You cannot reference external workbooks.\n\nThe following table lists the operators that are available in Excel's formulas. The majority of\nthe operators are the same as Perl's, differences are indicated:\n\nArithmetic operators:\n=====================\nOperator  Meaning                   Example\n+      Addition                  1+2\n-      Subtraction               2-1\n*      Multiplication            2*3\n/      Division                  1/4\n^      Exponentiation            2^3      # Equivalent to\n-      Unary minus               -(1+2)   # Not yet supported\n%      Percent (Not modulus)     13%      # Not supported, [1]\n\n\nComparison operators:\n=====================\nOperator  Meaning                   Example\n=     Equal to                  A1 =  B1 # Equivalent to ==\n<>    Not equal to              A1 <> B1 # Equivalent to !=\n>     Greater than              A1 >  B1\n<     Less than                 A1 <  B1\n>=    Greater than or equal to  A1 >= B1\n<=    Less than or equal to     A1 <= B1\n\n\nString operator:\n================\nOperator  Meaning                   Example\n&     Concatenation             \"Hello \" & \"World!\" # [2]\n\n\nReference operators:\n====================\nOperator  Meaning                   Example\n:     Range operator            A1:A4               # [3]\n,     Union operator            SUM(1, 2+2, B3)     # [4]\n\n\nNotes:\n[1]: You can get a percentage with formatting and modulus with MOD().\n[2]: Equivalent to (\"Hello \" . \"World!\") in Perl.\n[3]: This range is equivalent to cells A1, A2, A3 and A4.\n[4]: The comma behaves like the list separator in Perl.\n\nThe range and comma operators can have different symbols in non-English versions of Excel. These\nwill be supported in a later version of Spreadsheet::WriteExcel. European users of Excel take\nnote:\n\n$worksheet->write('A1', '=SUM(1; 2; 3)'); # Wrong!!\n$worksheet->write('A1', '=SUM(1, 2, 3)'); # Okay\n\nThe following table lists all of the core functions supported by Excel 5 and\nSpreadsheet::WriteExcel. Any additional functions that are available through the \"Analysis\nToolPak\" or other add-ins are not supported. These functions have all been tested to verify that\nthey work.\n\nABS           DB            INDIRECT      NORMINV       SLN\nACOS          DCOUNT        INFO          NORMSDIST     SLOPE\nACOSH         DCOUNTA       INT           NORMSINV      SMALL\nADDRESS       DDB           INTERCEPT     NOT           SQRT\nAND           DEGREES       IPMT          NOW           STANDARDIZE\nAREAS         DEVSQ         IRR           NPER          STDEV\nASIN          DGET          ISBLANK       NPV           STDEVP\nASINH         DMAX          ISERR         ODD           STEYX\nATAN          DMIN          ISERROR       OFFSET        SUBSTITUTE\nATAN2         DOLLAR        ISLOGICAL     OR            SUBTOTAL\nATANH         DPRODUCT      ISNA          PEARSON       SUM\nAVEDEV        DSTDEV        ISNONTEXT     PERCENTILE    SUMIF\nAVERAGE       DSTDEVP       ISNUMBER      PERCENTRANK   SUMPRODUCT\nBETADIST      DSUM          ISREF         PERMUT        SUMSQ\nBETAINV       DVAR          ISTEXT        PI            SUMX2MY2\nBINOMDIST     DVARP         KURT          PMT           SUMX2PY2\nCALL          ERROR.TYPE    LARGE         POISSON       SUMXMY2\nCEILING       EVEN          LEFT          POWER         SYD\nCELL          EXACT         LEN           PPMT          T\nCHAR          EXP           LINEST        PROB          TAN\nCHIDIST       EXPONDIST     LN            PRODUCT       TANH\nCHIINV        FACT          LOG           PROPER        TDIST\nCHITEST       FALSE         LOG10         PV            TEXT\nCHOOSE        FDIST         LOGEST        QUARTILE      TIME\nCLEAN         FIND          LOGINV        RADIANS       TIMEVALUE\nCODE          FINV          LOGNORMDIST   RAND          TINV\nCOLUMN        FISHER        LOOKUP        RANK          TODAY\nCOLUMNS       FISHERINV     LOWER         RATE          TRANSPOSE\nCOMBIN        FIXED         MATCH         REGISTER.ID   TREND\nCONCATENATE   FLOOR         MAX           REPLACE       TRIM\nCONFIDENCE    FORECAST      MDETERM       REPT          TRIMMEAN\nCORREL        FREQUENCY     MEDIAN        RIGHT         TRUE\nCOS           FTEST         MID           ROMAN         TRUNC\nCOSH          FV            MIN           ROUND         TTEST\nCOUNT         GAMMADIST     MINUTE        ROUNDDOWN     TYPE\nCOUNTA        GAMMAINV      MINVERSE      ROUNDUP       UPPER\nCOUNTBLANK    GAMMALN       MIRR          ROW           VALUE\nCOUNTIF       GEOMEAN       MMULT         ROWS          VAR\nCOVAR         GROWTH        MOD           RSQ           VARP\nCRITBINOM     HARMEAN       MODE          SEARCH        VDB\nDATE          HLOOKUP       MONTH         SECOND        VLOOKUP\nDATEVALUE     HOUR          N             SIGN          WEEKDAY\nDAVERAGE      HYPGEOMDIST   NA            SIN           WEIBULL\nDAY           IF            NEGBINOMDIST  SINH          YEAR\nDAYS360       INDEX         NORMDIST      SKEW          ZTEST\n\nYou can also modify the module to support function names in the following languages: German,\nFrench, Spanish, Portuguese, Dutch, Finnish, Italian and Swedish. See the \"functionlocale.pl\"\nprogram in the \"examples\" directory of the distro.\n\nFor a general introduction to Excel's formulas and an explanation of the syntax of the function\nrefer to the Excel help files or the following:\n<http://office.microsoft.com/en-us/assistance/CH062528031033.aspx>.\n\nIf your formula doesn't work in Spreadsheet::WriteExcel try the following:\n\n1. Verify that the formula works in Excel (or Gnumeric or OpenOffice.org).\n2. Ensure that it isn't on the Caveats list shown above.\n3. Ensure that cell references and formula names are in uppercase.\n4. Ensure that you are using ':' as the range operator, A1:A4.\n5. Ensure that you are using ',' as the union operator, SUM(1,2,3).\n6. Ensure that the function is in the above table.\n\nIf you go through steps 1-6 and you still have a problem, mail me.\n"
                },
                {
                    "name": "Improving performance when working with formulas",
                    "content": "Writing a large number of formulas with Spreadsheet::WriteExcel can be slow. This is due to the\nfact that each formula has to be parsed and with the current implementation this is\ncomputationally expensive.\n\nHowever, in a lot of cases the formulas that you write will be quite similar, for example:\n\n$worksheet->writeformula('B1',    '=A1 * 3 + 50',    $format);\n$worksheet->writeformula('B2',    '=A2 * 3 + 50',    $format);\n...\n...\n$worksheet->writeformula('B99',   '=A999 * 3 + 50',  $format);\n$worksheet->writeformula('B1000', '=A1000 * 3 + 50', $format);\n\nIn this example the cell reference changes in iterations from \"A1\" to \"A1000\". The parser treats\nthis variable as a *token* and arranges it according to predefined rules. However, since the\nparser is oblivious to the value of the token, it is essentially performing the same calculation\n1000 times. This is inefficient.\n\nThe way to avoid this inefficiency and thereby speed up the writing of formulas is to parse the\nformula once and then repeatedly substitute similar tokens.\n\nA formula can be parsed and stored via the \"storeformula()\" worksheet method. You can then use\nthe \"repeatformula()\" method to substitute $pattern, $replace pairs in the stored formula:\n\nmy $formula = $worksheet->storeformula('=A1 * 3 + 50');\n\nfor my $row (0..999) {\n$worksheet->repeatformula($row, 1, $formula, $format, 'A1', 'A'.($row +1));\n}\n\nOn an arbitrary test machine this method was 10 times faster than the brute force method shown\nabove.\n\nFor more information about how Spreadsheet::WriteExcel parses and stores formulas see the\n\"Spreadsheet::WriteExcel::Formula\" man page.\n\nIt should be noted however that the overall speed of direct formula parsing will be improved in\na future version.\n"
                }
            ]
        },
        "EXAMPLES": {
            "content": "See Spreadsheet::WriteExcel::Examples for a full list of examples.\n",
            "subsections": [
                {
                    "name": "Example 1",
                    "content": "The following example shows some of the basic features of Spreadsheet::WriteExcel.\n\n#!/usr/bin/perl -w\n\nuse strict;\nuse Spreadsheet::WriteExcel;\n\n# Create a new workbook called simple.xls and add a worksheet\nmy $workbook  = Spreadsheet::WriteExcel->new('simple.xls');\nmy $worksheet = $workbook->addworksheet();\n\n# The general syntax is write($row, $column, $token). Note that row and\n# column are zero indexed\n\n# Write some text\n$worksheet->write(0, 0,  'Hi Excel!');\n\n\n# Write some numbers\n$worksheet->write(2, 0,  3);          # Writes 3\n$worksheet->write(3, 0,  3.00000);    # Writes 3\n$worksheet->write(4, 0,  3.00001);    # Writes 3.00001\n$worksheet->write(5, 0,  3.14159);    # TeX revision no.?\n\n\n# Write some formulas\n$worksheet->write(7, 0,  '=A3 + A6');\n$worksheet->write(8, 0,  '=IF(A5>3,\"Yes\", \"No\")');\n\n\n# Write a hyperlink\n$worksheet->write(10, 0, 'http://www.perl.com/');\n"
                },
                {
                    "name": "Example 2",
                    "content": "The following is a general example which demonstrates some features of working with multiple\nworksheets.\n\n#!/usr/bin/perl -w\n\nuse strict;\nuse Spreadsheet::WriteExcel;\n\n# Create a new Excel workbook\nmy $workbook = Spreadsheet::WriteExcel->new('regions.xls');\n\n# Add some worksheets\nmy $north = $workbook->addworksheet('North');\nmy $south = $workbook->addworksheet('South');\nmy $east  = $workbook->addworksheet('East');\nmy $west  = $workbook->addworksheet('West');\n\n# Add a Format\nmy $format = $workbook->addformat();\n$format->setbold();\n$format->setcolor('blue');\n\n# Add a caption to each worksheet\nforeach my $worksheet ($workbook->sheets()) {\n$worksheet->write(0, 0, 'Sales', $format);\n}\n\n# Write some data\n$north->write(0, 1, 200000);\n$south->write(0, 1, 100000);\n$east->write (0, 1, 150000);\n$west->write (0, 1, 100000);\n\n# Set the active worksheet\n$south->activate();\n\n# Set the width of the first column\n$south->setcolumn(0, 0, 20);\n\n# Set the active cell\n$south->setselection(0, 1);\n"
                },
                {
                    "name": "Example 3",
                    "content": "This example shows how to use a conditional numerical format with colours to indicate if a share\nprice has gone up or down.\n\nuse strict;\nuse Spreadsheet::WriteExcel;\n\n# Create a new workbook and add a worksheet\nmy $workbook  = Spreadsheet::WriteExcel->new('stocks.xls');\nmy $worksheet = $workbook->addworksheet();\n\n# Set the column width for columns 1, 2, 3 and 4\n$worksheet->setcolumn(0, 3, 15);\n\n\n# Create a format for the column headings\nmy $header = $workbook->addformat();\n$header->setbold();\n$header->setsize(12);\n$header->setcolor('blue');\n\n\n# Create a format for the stock price\nmy $fprice = $workbook->addformat();\n$fprice->setalign('left');\n$fprice->setnumformat('$0.00');\n\n\n# Create a format for the stock volume\nmy $fvolume = $workbook->addformat();\n$fvolume->setalign('left');\n$fvolume->setnumformat('#,##0');\n\n\n# Create a format for the price change. This is an example of a\n# conditional format. The number is formatted as a percentage. If it is\n# positive it is formatted in green, if it is negative it is formatted\n# in red and if it is zero it is formatted as the default font colour\n# (in this case black). Note: the [Green] format produces an unappealing\n# lime green. Try [Color 10] instead for a dark green.\n#\nmy $fchange = $workbook->addformat();\n$fchange->setalign('left');\n$fchange->setnumformat('[Green]0.0%;[Red]-0.0%;0.0%');\n\n\n# Write out the data\n$worksheet->write(0, 0, 'Company',$header);\n$worksheet->write(0, 1, 'Price',  $header);\n$worksheet->write(0, 2, 'Volume', $header);\n$worksheet->write(0, 3, 'Change', $header);\n\n$worksheet->write(1, 0, 'Damage Inc.'       );\n$worksheet->write(1, 1, 30.25,    $fprice ); # $30.25\n$worksheet->write(1, 2, 1234567,  $fvolume); # 1,234,567\n$worksheet->write(1, 3, 0.085,    $fchange); # 8.5% in green\n\n$worksheet->write(2, 0, 'Dump Corp.'        );\n$worksheet->write(2, 1, 1.56,     $fprice ); # $1.56\n$worksheet->write(2, 2, 7564,     $fvolume); # 7,564\n$worksheet->write(2, 3, -0.015,   $fchange); # -1.5% in red\n\n$worksheet->write(3, 0, 'Rev Ltd.'          );\n$worksheet->write(3, 1, 0.13,     $fprice ); # $0.13\n$worksheet->write(3, 2, 321,      $fvolume); # 321\n$worksheet->write(3, 3, 0,        $fchange); # 0 in the font color (black)\n"
                },
                {
                    "name": "Example 4",
                    "content": "The following is a simple example of using functions.\n\n#!/usr/bin/perl -w\n\nuse strict;\nuse Spreadsheet::WriteExcel;\n\n# Create a new workbook and add a worksheet\nmy $workbook  = Spreadsheet::WriteExcel->new('stats.xls');\nmy $worksheet = $workbook->addworksheet('Test data');\n\n# Set the column width for columns 1\n$worksheet->setcolumn(0, 0, 20);\n\n\n# Create a format for the headings\nmy $format = $workbook->addformat();\n$format->setbold();\n\n\n# Write the sample data\n$worksheet->write(0, 0, 'Sample', $format);\n$worksheet->write(0, 1, 1);\n$worksheet->write(0, 2, 2);\n$worksheet->write(0, 3, 3);\n$worksheet->write(0, 4, 4);\n$worksheet->write(0, 5, 5);\n$worksheet->write(0, 6, 6);\n$worksheet->write(0, 7, 7);\n$worksheet->write(0, 8, 8);\n\n$worksheet->write(1, 0, 'Length', $format);\n$worksheet->write(1, 1, 25.4);\n$worksheet->write(1, 2, 25.4);\n$worksheet->write(1, 3, 24.8);\n$worksheet->write(1, 4, 25.0);\n$worksheet->write(1, 5, 25.3);\n$worksheet->write(1, 6, 24.9);\n$worksheet->write(1, 7, 25.2);\n$worksheet->write(1, 8, 24.8);\n\n# Write some statistical functions\n$worksheet->write(4,  0, 'Count', $format);\n$worksheet->write(4,  1, '=COUNT(B1:I1)');\n\n$worksheet->write(5,  0, 'Sum', $format);\n$worksheet->write(5,  1, '=SUM(B2:I2)');\n\n$worksheet->write(6,  0, 'Average', $format);\n$worksheet->write(6,  1, '=AVERAGE(B2:I2)');\n\n$worksheet->write(7,  0, 'Min', $format);\n$worksheet->write(7,  1, '=MIN(B2:I2)');\n\n$worksheet->write(8,  0, 'Max', $format);\n$worksheet->write(8,  1, '=MAX(B2:I2)');\n\n$worksheet->write(9,  0, 'Standard Deviation', $format);\n$worksheet->write(9,  1, '=STDEV(B2:I2)');\n\n$worksheet->write(10, 0, 'Kurtosis', $format);\n$worksheet->write(10, 1, '=KURT(B2:I2)');\n"
                },
                {
                    "name": "Example 5",
                    "content": "The following example converts a tab separated file called \"tab.txt\" into an Excel file called\n\"tab.xls\".\n\n#!/usr/bin/perl -w\n\nuse strict;\nuse Spreadsheet::WriteExcel;\n\nopen (TABFILE, 'tab.txt') or die \"tab.txt: $!\";\n\nmy $workbook  = Spreadsheet::WriteExcel->new('tab.xls');\nmy $worksheet = $workbook->addworksheet();\n\n# Row and column are zero indexed\nmy $row = 0;\n\nwhile (<TABFILE>) {\nchomp;\n# Split on single tab\nmy @Fld = split('\\t', $);\n\nmy $col = 0;\nforeach my $token (@Fld) {\n$worksheet->write($row, $col, $token);\n$col++;\n}\n$row++;\n}\n\nNOTE: This is a simple conversion program for illustrative purposes only. For converting a CSV\nor Tab separated or any other type of delimited text file to Excel I recommend the more rigorous\ncsv2xls program that is part of H.Merijn Brand's Text::CSVXS module distro.\n\nSee the examples/csv2xls link here: <http://search.cpan.org/~hmbrand/Text-CSVXS/MANIFEST>.\n"
                },
                {
                    "name": "Additional Examples",
                    "content": "The following is a description of the example files that are provided in the standard\nSpreadsheet::WriteExcel distribution. They demonstrate the different features and options of the\nmodule. See Spreadsheet::WriteExcel::Examples for more details.\n\nGetting started\n===============\nasimple.pl             A get started example with some basic features.\ndemo.pl                 A demo of some of the available features.\nregions.pl              A simple example of multiple worksheets.\nstats.pl                Basic formulas and functions.\nformats.pl              All the available formatting on several worksheets.\nbugreport.pl           A template for submitting bug reports.\n\n\nAdvanced\n========\nautofilter.pl           Examples of worksheet autofilters.\nautofit.pl              Simulate Excel's autofit for column widths.\nbigfile.pl              Write past the 7MB limit with OLE::StorageLite.\ncgi.pl                  A simple CGI program.\nchartarea.pl           A demo of area style charts.\nchartbar.pl            A demo of bar (vertical histogram) style charts.\nchartcolumn.pl         A demo of column (histogram) style charts.\nchartline.pl           A demo of line style charts.\nchartpie.pl            A demo of pie style charts.\nchartscatter.pl        A demo of scatter style charts.\nchartstock.pl          A demo of stock style charts.\nchess.pl                An example of reusing formatting via properties.\ncolors.pl               A demo of the colour palette and named colours.\ncomments1.pl            Add comments to worksheet cells.\ncomments2.pl            Add comments with advanced options.\ncopyformat.pl           Example of copying a cell format.\ndatavalidate.pl        An example of data validation and dropdown lists.\ndatetime.pl            Write dates and times with writedatetime().\ndefinedname.pl         Example of how to create defined names.\ndiagborder.pl          A simple example of diagonal cell borders.\neasteregg.pl           Expose the Excel97 flight simulator.\nfilehandle.pl           Examples of working with filehandles.\nformularesult.pl       Formulas with user specified results.\nheaders.pl              Examples of worksheet headers and footers.\nhidesheet.pl           Simple example of hiding a worksheet.\nhyperlink1.pl           Shows how to create web hyperlinks.\nhyperlink2.pl           Examples of internal and external hyperlinks.\nimages.pl               Adding images to worksheets.\nindent.pl               An example of cell indentation.\nmerge1.pl               A simple example of cell merging.\nmerge2.pl               A simple example of cell merging with formatting.\nmerge3.pl               Add hyperlinks to merged cells.\nmerge4.pl               An advanced example of merging with formatting.\nmerge5.pl               An advanced example of merging with formatting.\nmerge6.pl               An example of merging with Unicode strings.\nmodperl1.pl            A simple modperl 1 program.\nmodperl2.pl            A simple modperl 2 program.\noutline.pl              An example of outlines and grouping.\noutlinecollapsed.pl    An example of collapsed outlines.\npanes.pl                An examples of how to create panes.\nproperties.pl           Add document properties to a workbook.\nprotection.pl           Example of cell locking and formula hiding.\nrepeat.pl               Example of writing repeated formulas.\nrighttoleft.pl        Change default sheet direction to right to left.\nrowwrap.pl             How to wrap data from one worksheet onto another.\nsales.pl                An example of a simple sales spreadsheet.\nsendmail.pl             Send an Excel email attachment using Mail::Sender.\nstatsext.pl            Same as stats.pl with external references.\nstocks.pl               Demonstrates conditional formatting.\ntabcolors.pl           Example of how to set worksheet tab colours.\ntextwrap.pl             Demonstrates text wrapping options.\nwin32ole.pl             A sample Win32::OLE example for comparison.\nwritearrays.pl         Example of writing 1D or 2D arrays of data.\nwritehandler1.pl       Example of extending the write() method. Step 1.\nwritehandler2.pl       Example of extending the write() method. Step 2.\nwritehandler3.pl       Example of extending the write() method. Step 3.\nwritehandler4.pl       Example of extending the write() method. Step 4.\nwritetoscalar.pl      Example of writing an Excel file to a Perl scalar.\n\n\nUnicode\n=======\nunicodeutf16.pl        Simple example of using Unicode UTF16 strings.\nunicodeutf16japan.pl  Write Japanese Unicode strings using UTF-16.\nunicodecyrillic.pl     Write Russian Cyrillic strings using UTF-8.\nunicodelist.pl         List the chars in a Unicode font.\nunicode2022jp.pl      Japanese: ISO-2022-JP to utf8 in perl 5.8.\nunicode885911.pl      Thai:     ISO-885911 to utf8 in perl 5.8.\nunicode88597.pl       Greek:    ISO-88597  to utf8 in perl 5.8.\nunicodebig5.pl         Chinese:  BIG5        to utf8 in perl 5.8.\nunicodecp1251.pl       Russian:  CP1251      to utf8 in perl 5.8.\nunicodecp1256.pl       Arabic:   CP1256      to utf8 in perl 5.8.\nunicodekoi8r.pl        Russian:  KOI8-R      to utf8 in perl 5.8.\nunicodepolishutf8.pl  Polish :  UTF8        to utf8 in perl 5.8.\nunicodeshiftjis.pl    Japanese: Shift JIS   to utf8 in perl 5.8.\n\n\nUtility\n=======\ncsv2xls.pl              Program to convert a CSV file to an Excel file.\ntab2xls.pl              Program to convert a tab separated file to xls.\ndatecalc1.pl            Convert Unix/Perl time to Excel time.\ndatecalc2.pl            Calculate an Excel date using Date::Calc.\nlecxe.pl                Convert Excel to WriteExcel using Win32::OLE.\n\n\nDeveloper\n=========\nconvertA1.pl            Helper functions for dealing with A1 notation.\nfunctionlocale.pl      Add non-English function names to Formula.pm.\nwriteA1.pl              Example of how to extend the module.\n"
                }
            ]
        },
        "LIMITATIONS": {
            "content": "The following limits are imposed by Excel:\n\nDescription                          Limit\n-----------------------------------  ------\nMaximum number of chars in a string  32767\nMaximum number of columns            256\nMaximum number of rows               65536\nMaximum chars in a sheet name        31\nMaximum chars in a header/footer     254\n\nFor Excel 2007+ file limits see the Excel::Writer::XLSX module.\n\nThe minimum file size is 6K due to the OLE overhead. The maximum file size is approximately 7MB\n(7087104 bytes) of BIFF data. This can be extended by installing Takanori Kawai's\nOLE::StorageLite module <http://search.cpan.org/search?dist=OLE-StorageLite> see the\n\"bigfile.pl\" example in the \"examples\" directory of the distro.\n",
            "subsections": []
        },
        "DOWNLOADING": {
            "content": "The latest version of this module is always available at:\n<http://search.cpan.org/search?dist=Spreadsheet-WriteExcel/>.\n",
            "subsections": []
        },
        "REQUIREMENTS": {
            "content": "This module requires Perl >= 5.005, Parse::RecDescent, File::Temp and OLE::StorageLite:\n\nhttp://search.cpan.org/search?dist=Parse-RecDescent/ # For formulas.\nhttp://search.cpan.org/search?dist=File-Temp/        # For settempdir().\nhttp://search.cpan.org/search?dist=OLE-StorageLite/ # For files > 7MB.\n\nNote, these aren't strict requirements. Spreadsheet::WriteExcel will work without these modules\nif you don't use writeformula(), settempdir() or create files greater than 7MB. However, it is\nbest to install them if possible and they will be installed automatically if you use a tool such\nas CPAN.pm or ppm.\n",
            "subsections": []
        },
        "INSTALLATION": {
            "content": "See the INSTALL or install.html docs that come with the distribution or:\n<http://search.cpan.org/src/JMCNAMARA/Spreadsheet-WriteExcel-2.31/INSTALL>.\n",
            "subsections": []
        },
        "PORTABILITY": {
            "content": "Spreadsheet::WriteExcel will work on the majority of Windows, UNIX and Macintosh platforms.\nSpecifically, the module will work on any system where perl packs floats in the 64 bit IEEE\nformat. The float must also be in little-endian format but it will be reversed if necessary.\nThus:\n\nprint join(' ', map { sprintf '%#02x', $ } unpack('C*', pack 'd', 1.2345)), \"\\n\";\n\nshould give (or in reverse order):\n\n0x8d 0x97 0x6e 0x12 0x83 0xc0 0xf3 0x3f\n\nIn general, if you don't know whether your system supports a 64 bit IEEE float or not, it\nprobably does. If your system doesn't, WriteExcel will \"croak()\" with the message given in the\n\"DIAGNOSTICS\" section. You can check which platforms the module has been tested on at the CPAN\ntesters site: <http://testers.cpan.org/search?request=dist&dist=Spreadsheet-WriteExcel>.\n",
            "subsections": []
        },
        "DIAGNOSTICS": {
            "content": "Filename required by Spreadsheet::WriteExcel->new()\nA filename must be given in the constructor.\n\nCan't open filename. It may be in use or protected.\nThe file cannot be opened for writing. The directory that you are writing to may be\nprotected or the file may be in use by another program.\n\nUnable to create tmp files via File::Temp::tempfile()...\nThis is a \"-w\" warning. You will see it if you are using Spreadsheet::WriteExcel in an\nenvironment where temporary files cannot be created, in which case all data will be stored\nin memory. The warning is for information only: it does not affect creation but it will\naffect the speed of execution for large files. See the \"settempdir\" workbook method.\n\nMaximum file size, 7087104, exceeded.\nThe current OLE implementation only supports a maximum BIFF file of this size. This limit\ncan be extended, see the \"LIMITATIONS\" section.\n\nCan't locate Parse/RecDescent.pm in @INC ...\nSpreadsheet::WriteExcel requires the Parse::RecDescent module. Download it from CPAN:\n<http://search.cpan.org/search?dist=Parse-RecDescent>\n\nCouldn't parse formula ...\nThere are a large number of warnings which relate to badly formed formulas and functions.\nSee the \"FORMULAS AND FUNCTIONS IN EXCEL\" section for suggestions on how to avoid these\nerrors. You should also check the formula in Excel to ensure that it is valid.\n\nRequired floating point format not supported on this platform.\nOperating system doesn't support 64 bit IEEE float or it is byte-ordered in a way unknown to\nWriteExcel.\n\n'file.xls' cannot be accessed. The file may be read-only ...\nYou may sometimes encounter the following error when trying to open a file in Excel:\n\"file.xls cannot be accessed. The file may be read-only, or you may be trying to access a\nread-only location. Or, the server the document is stored on may not be responding.\"\n\nThis error generally means that the Excel file has been corrupted. There are two likely\ncauses of this: the file was FTPed in ASCII mode instead of binary mode or else the file was\ncreated with \"UTF-8\" data returned by an XML parser. See \"Warning about XML::Parser and perl\n5.6\" for further details.\n",
            "subsections": []
        },
        "THE EXCEL BINARY FORMAT": {
            "content": "The following is some general information about the Excel binary format for anyone who may be\ninterested.\n\nExcel data is stored in the \"Binary Interchange File Format\" (BIFF) file format. Details of this\nformat are given in \"Excel 97-2007 Binary File Format Specification\"\n<http://www.microsoft.com/interop/docs/OfficeBinaryFormats.mspx>.\n\nDaniel Rentz of OpenOffice.org has also written a detailed description of the Excel workbook\nrecords, see <http://sc.openoffice.org/excelfileformat.pdf>.\n\nCharles Wybble has collected together additional information about the Excel file format. See\n\"The Chicago Project\" at <http://chicago.sourceforge.net/devel/>.\n\nThe BIFF data is stored along with other data in an OLE Compound File. This is a structured\nstorage which acts like a file system within a file. A Compound File is comprised of storages\nand streams which, to follow the file system analogy, are like directories and files.\n\nThe OLE format is explained in the \"Windows Compound Binary File Format Specification\"\n<http://www.microsoft.com/interop/docs/supportingtechnologies.mspx>\n\nThe Digital Imaging Group have also detailed the OLE format in the JPEG2000 specification: see\nAppendix A of <http://www.i3a.org/pdf/wg1n1017.pdf>.\n\nPlease note that the provision of this information does not constitute an invitation to start\nhacking at the BIFF or OLE file formats. There are more interesting ways to waste your time. ;-)\n",
            "subsections": []
        },
        "WRITING EXCEL FILES": {
            "content": "Depending on your requirements, background and general sensibilities you may prefer one of the\nfollowing methods of getting data into Excel:\n\n*   Win32::OLE module and office automation\n\nThis requires a Windows platform and an installed copy of Excel. This is the most powerful\nand complete method for interfacing with Excel. See\n<http://www.activestate.com/ASPN/Reference/Products/ActivePerl-5.6/faq/Windows/ActivePerl-Wi\nnfaq12.html> and\n<http://www.activestate.com/ASPN/Reference/Products/ActivePerl-5.6/site/lib/Win32/OLE.html>.\nIf your main platform is UNIX but you have the resources to set up a separate Win32/MSOffice\nserver, you can convert office documents to text, postscript or PDF using Win32::OLE. For a\ndemonstration of how to do this using Perl see Docserver:\n<http://search.cpan.org/search?mode=module&query=docserver>.\n\n*   CSV, comma separated variables or text\n\nIf the file extension is \"csv\", Excel will open and convert this format automatically.\nGenerating a valid CSV file isn't as easy as it seems. Have a look at the DBD::RAM,\nDBD::CSV, Text::xSV and Text::CSVXS modules.\n\n*   DBI with DBD::ADO or DBD::ODBC\n\nExcel files contain an internal index table that allows them to act like a database file.\nUsing one of the standard Perl database modules you can connect to an Excel file as a\ndatabase.\n\n*   DBD::Excel\n\nYou can also access Spreadsheet::WriteExcel using the standard DBI interface via Takanori\nKawai's DBD::Excel module <http://search.cpan.org/dist/DBD-Excel>\n\n*   Spreadsheet::WriteExcelXML\n\nThis module allows you to create an Excel XML file using the same interface as\nSpreadsheet::WriteExcel. See: <http://search.cpan.org/dist/Spreadsheet-WriteExcelXML>\n\n*   Excel::Template\n\nThis module allows you to create an Excel file from an XML template in a manner similar to\nHTML::Template. See <http://search.cpan.org/dist/Excel-Template/>.\n\n*   Spreadsheet::WriteExcel::FromXML\n\nThis module allows you to turn a simple XML file into an Excel file using\nSpreadsheet::WriteExcel as a back-end. The format of the XML file is defined by a supplied\nDTD: <http://search.cpan.org/dist/Spreadsheet-WriteExcel-FromXML>.\n\n*   Spreadsheet::WriteExcel::Simple\n\nThis provides an easier interface to Spreadsheet::WriteExcel:\n<http://search.cpan.org/dist/Spreadsheet-WriteExcel-Simple>.\n\n*   Spreadsheet::WriteExcel::FromDB\n\nThis is a useful module for creating Excel files directly from a DB table:\n<http://search.cpan.org/dist/Spreadsheet-WriteExcel-FromDB>.\n\n*   HTML tables\n\nThis is an easy way of adding formatting via a text based format.\n\n*   XML or HTML\n\nThe Excel XML and HTML file specification are available from\n<http://msdn.microsoft.com/library/officedev/ofxml2k/ofxml2k.htm>.\n\nFor other Perl-Excel modules try the following search:\n<http://search.cpan.org/search?mode=module&query=excel>.\n",
            "subsections": []
        },
        "READING EXCEL FILES": {
            "content": "To read data from Excel files try:\n\n*   Spreadsheet::ParseExcel\n\nThis uses the OLE::Storage-Lite module to extract data from an Excel file.\n<http://search.cpan.org/dist/Spreadsheet-ParseExcel>.\n\n*   Spreadsheet::ParseExcelXLHTML\n\nThis module uses Spreadsheet::ParseExcel's interface but uses xlHtml (see below) to do the\nconversion: <http://search.cpan.org/dist/Spreadsheet-ParseExcelXLHTML>\nSpreadsheet::ParseExcelXLHTML\n\n*   xlHtml\n\nThis is an open source \"Excel to HTML Converter\" C/C++ project at\n<http://chicago.sourceforge.net/xlhtml/>.\n\n*   DBD::Excel (reading)\n\nYou can also access Spreadsheet::ParseExcel using the standard DBI interface via Takanori\nKawai's DBD::Excel module <http://search.cpan.org/dist/DBD-Excel>.\n\n*   Win32::OLE module and office automation (reading)\n\nSee, the section \"WRITING EXCEL FILES\".\n\n*   HTML tables (reading)\n\nIf the files are saved from Excel in a HTML format the data can be accessed using\nHTML::TableExtract <http://search.cpan.org/dist/HTML-TableExtract>.\n\n*   DBI with DBD::ADO or DBD::ODBC.\n\nSee, the section \"WRITING EXCEL FILES\".\n\n*   XML::Excel\n\nConverts Excel files to XML using Spreadsheet::ParseExcel\n<http://search.cpan.org/dist/XML-Excel>.\n\n*   OLE::Storage, aka LAOLA\n\nThis is a Perl interface to OLE file formats. In particular, the distro contains an Excel to\nHTML converter called Herbert, <http://user.cs.tu-berlin.de/~schwartz/pmh/>. This has been\nsuperseded by the Spreadsheet::ParseExcel module.\n\nFor other Perl-Excel modules try the following search:\n<http://search.cpan.org/search?mode=module&query=excel>.\n\nIf you wish to view Excel files on a UNIX/Linux platform check out the excellent Gnumeric\nspreadsheet application at <http://www.gnome.org/projects/gnumeric/> or OpenOffice.org at\n<http://www.openoffice.org/>.\n\nIf you wish to view Excel files on a Windows platform which doesn't have Excel installed you can\nuse the free Microsoft Excel Viewer <http://office.microsoft.com/downloads/2000/xlviewer.aspx>.\n",
            "subsections": []
        },
        "MODIFYING AND REWRITING EXCEL FILES": {
            "content": "An Excel file is a binary file within a binary file. It contains several interlinked checksums\nand changing even one byte can cause it to become corrupted.\n\nAs such you cannot simply append or update an Excel file. The only way to achieve this is to\nread the entire file into memory, make the required changes or additions and then write the file\nout again.\n\nYou can read and rewrite an Excel file using the Spreadsheet::ParseExcel::SaveParser module\nwhich is a wrapper around Spreadsheet::ParseExcel and Spreadsheet::WriteExcel. It is part of the\nSpreadsheet::ParseExcel package: <http://search.cpan.org/search?dist=Spreadsheet-ParseExcel>.\n\nHowever, you can only rewrite the features that Spreadsheet::WriteExcel supports so macros,\ngraphs and some other features in the original Excel file will be lost. Also, formulas aren't\nrewritten, only the result of a formula is written.\n\nHere is an example:\n\n#!/usr/bin/perl -w\n\nuse strict;\nuse Spreadsheet::ParseExcel;\nuse Spreadsheet::ParseExcel::SaveParser;\n\n# Open the template with SaveParser\nmy $parser   = new Spreadsheet::ParseExcel::SaveParser;\nmy $template = $parser->Parse('template.xls');\n\nmy $sheet    = 0;\nmy $row      = 0;\nmy $col      = 0;\n\n# Get the format from the cell\nmy $format   = $template->{Worksheet}[$sheet]\n->{Cells}[$row][$col]\n->{FormatNo};\n\n# Write data to some cells\n$template->AddCell(0, $row,   $col,   1,     $format);\n$template->AddCell(0, $row+1, $col, \"Hello\", $format);\n\n# Add a new worksheet\n$template->AddWorksheet('New Data');\n\n# The SaveParser SaveAs() method returns a reference to a\n# Spreadsheet::WriteExcel object. If you wish you can then\n# use this to access any of the methods that aren't\n# available from the SaveParser object. If you don't need\n# to do this just use SaveAs().\n#\nmy $workbook;\n\n{\n# SaveAs generates a lot of harmless warnings about unset\n# Worksheet properties. You can ignore them if you wish.\nlocal $^W = 0;\n\n# Rewrite the file or save as a new file\n$workbook = $template->SaveAs('new.xls');\n}\n\n# Use Spreadsheet::WriteExcel methods\nmy $worksheet  = $workbook->sheets(0);\n\n$worksheet->write($row+2, $col, \"World2\");\n\n$workbook->close();\n",
            "subsections": []
        },
        "Warning about XML::Parser and perl 5.6": {
            "content": "You must be careful when using Spreadsheet::WriteExcel in conjunction with perl 5.6 and\nXML::Parser (and other XML parsers) due to the fact that the data returned by the parser is\ngenerally in \"UTF-8\" format.\n\nWhen \"UTF-8\" strings are added to Spreadsheet::WriteExcel's internal data it causes the\ngenerated Excel file to become corrupt.\n\nNote, this doesn't affect perl 5.005 (which doesn't try to handle \"UTF-8\") or 5.8 (which handles\nit correctly).\n\nTo avoid this problem you should upgrade to perl 5.8, if possible, or else you should convert\nthe output data from XML::Parser to ASCII or ISO-8859-1 using one of the following methods:\n\n$newstr = pack 'C*', unpack 'U*', $utf8str;\n\n\nuse Unicode::MapUTF8 'fromutf8';\n$newstr = fromutf8({-str => $utf8str, -charset => 'ISO-8859-1'});\n",
            "subsections": []
        },
        "Warning about Office Service Pack 3": {
            "content": "If you have Office Service Pack 3 (SP3) installed you may see the following warning when you\nopen a file created by Spreadsheet::WriteExcel:\n\n\"File Error: data may have been lost\".\n\nThis is usually caused by multiple instances of data in a cell.\n\nSP3 changed Excel's default behaviour when it encounters multiple data in a cell so that it\nissues a warning when the file is opened and it displays the first data that was written. Prior\nto SP3 it didn't issue a warning and displayed the last data written.\n\nFor a longer discussion and some workarounds see the following:\n<http://groups.google.com/group/spreadsheet-writeexcel/browsethread/thread/3dcea40e6620af3a>.\n",
            "subsections": []
        },
        "BUGS": {
            "content": "Formulas are formulae.\n\nXML and \"UTF-8\" data on perl 5.6 can cause Excel files created by Spreadsheet::WriteExcel to\nbecome corrupt. See \"Warning about XML::Parser and perl 5.6\" for further details.\n\nThe format object that is used with a \"mergerange()\" method call is marked internally as being\nassociated with a merged range. It is a fatal error to use a merged format in a non-merged cell.\nThe current workaround is to use separate formats for merged and non-merged cell. This\nrestriction will be removed in a future release.\n\nNested formulas sometimes aren't parsed correctly and give a result of \"#VALUE\". If you come\nacross a formula that parses like this, let me know.\n\nSpreadsheet::ParseExcel: All formulas created by Spreadsheet::WriteExcel are read as having a\nvalue of zero. This is because Spreadsheet::WriteExcel only stores the formula and not the\ncalculated result.\n\nOpenOffice.org: No known issues in this release.\n\nGnumeric: No known issues in this release.\n\nIf you wish to submit a bug report run the \"bugreport.pl\" program in the \"examples\" directory\nof the distro.\n",
            "subsections": []
        },
        "Migrating to Excel::Writer::XLSX": {
            "content": "Spreadsheet::WriteExcel is in maintenance only mode and has effectively been superseded by\nExcel::Writer::XLSX.\n\nExcel::Writer::XLSX is an API compatible, drop-in replacement for Spreadsheet::WriteExcel. It\nalso has many more features such as conditional formats, better charts, better formula handling,\nExcel tables and even sparklines.\n\nTo convert your Spreadsheet::WriteExcel program to Excel::Writer::XLSX you only need do the\nfollowing:\n\n*   Substitute Excel::Writer::XLSX for Spreadsheet::WriteExcel in your program.\n\n*   Change the file extension of the output file from \".xls\" to \".xlsx\".\n\n*   Optionally replace \"storeformula()\" and \"repeatformula()\" with \"writeformula()\" which is\nno longer an expensive operation in Excel::Writer::XLSX. However, you can leave them\nunchanged if required.\n\nThere are some differences between the formats and the modules that are worth noting:\n\n*   The default font in the XLSX format is Calibri 11 not Arial 10.\n\n*   Default column widths and row heights are different between XLS and XLSX.\n\n*   The Excel::Writer::XLSX module uses more memory by default but has a optimisation mode to\nreduce usage for large files.\n\n*   The XLSX format doesn't have reading support that is as complete as Spreadsheet::ParseExcel.\n",
            "subsections": []
        },
        "REPOSITORY": {
            "content": "The Spreadsheet::WriteExcel source code in host on github:\n<http://github.com/jmcnamara/spreadsheet-writeexcel>.\n",
            "subsections": []
        },
        "MAILING LIST": {
            "content": "There is a Google group for discussing and asking questions about Spreadsheet::WriteExcel. This\nis a good place to search to see if your question has been asked before:\n<http://groups.google.com/group/spreadsheet-writeexcel>.\n\nAlternatively you can keep up to date with future releases by subscribing at:\n<http://freshmeat.net/projects/writeexcel/>.\n",
            "subsections": []
        },
        "DONATIONS": {
            "content": "If you'd care to donate to the Spreadsheet::WriteExcel project, you can do so via PayPal:\n<http://tinyurl.com/7ayes>.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "Spreadsheet::ParseExcel: <http://search.cpan.org/dist/Spreadsheet-ParseExcel>.\n\nSpreadsheet-WriteExcel-FromXML: <http://search.cpan.org/dist/Spreadsheet-WriteExcel-FromXML>.\n\nSpreadsheet::WriteExcel::FromDB: <http://search.cpan.org/dist/Spreadsheet-WriteExcel-FromDB>.\n\nExcel::Template: <http://search.cpan.org/~rkinyon/Excel-Template/>.\n\nDateTime::Format::Excel: <http://search.cpan.org/dist/DateTime-Format-Excel>.\n\n\"Reading and writing Excel files with Perl\" by Teodor Zlatanov, at IBM developerWorks:\n<http://www-106.ibm.com/developerworks/library/l-pexcel/>.\n\n\"Excel-Dateien mit Perl erstellen - Controller im Gluck\" by Peter Dintelmann and Christian\nKirsch in the German Unix/web journal iX: <http://www.heise.de/ix/artikel/2001/06/175/>.\n\nSpreadsheet::WriteExcel documentation in Japanese by Takanori Kawai.\n<http://member.nifty.ne.jp/hippo2000/perltips/Spreadsheet/WriteExcel.htm>.\n\nOesterly user brushes with fame: <http://oesterly.com/releases/12102000.html>.\n\nThe csv2xls program that is part of Text::CSVXS:\n<http://search.cpan.org/~hmbrand/Text-CSVXS/MANIFEST>.\n",
            "subsections": []
        },
        "ACKNOWLEDGMENTS": {
            "content": "The following people contributed to the debugging and testing of Spreadsheet::WriteExcel:\n\nAlexander Farber, Andre de Bruin, Arthur@ais, Artur Silveira da Cunha, Bob Rose, Borgar Olsen,\nBrian Foley, Brian White, Bob Mackay, Cedric Bouvier, Chad Johnson, CPAN testers, Damyan Ivanov,\nDaniel Berger, Daniel Gardner, Dmitry Kochurov, Eric Frazier, Ernesto Baschny, Felipe Perez\nGaliana, Gordon Simpson, Hanc Pavel, Harold Bamford, James Holmes, James Wilkinson, Johan\nEkenberg, Johann Hanne, Jonathan Scott Duff, J.C. Wren, Kenneth Stacey, Keith Miller, Kyle Krom,\nMarc Rosenthal, Markus Schmitz, Michael Braig, Michael Buschauer, Mike Blazer, Michael Erickson,\nMichael W J West, Ning Xie, Paul J. Falbe, Paul Medynski, Peter Dintelmann, Pierre Laplante,\nPraveen Kotha, Reto Badertscher, Rich Sorden, Shane Ashby, Sharron McKenzie, Shenyu Zheng,\nStephan Loescher, Steve Sapovits, Sven Passig, Svetoslav Marinov, Tamas Gulacsi, Troy Daniels,\nVahe Sarkissian.\n\nThe following people contributed patches, examples or Excel information:\n\nAndrew Benham, Bill Young, Cedric Bouvier, Charles Wybble, Daniel Rentz, David Robins, Franco\nVenturi, Guy Albertelli, Ian Penman, John Heitmann, Jon Guy, Kyle R. Burton, Pierre-Jean\nVouette, Rubio, Marco Geri, Mark Fowler, Matisse Enzer, Sam Kington, Takanori Kawai, Tom\nO'Sullivan.\n\nMany thanks to Ron McKelvey, Ronzo Consulting for Siemens, who sponsored the development of the\nformula caching routines.\n\nMany thanks to Cassens Transport who sponsored the development of the embedded charts and\nautofilters.\n\nAdditional thanks to Takanori Kawai for translating the documentation into Japanese.\n\nGunnar Wolf maintains the Debian distro.\n\nThanks to Damian Conway for the excellent Parse::RecDescent.\n\nThanks to Tim Jenness for File::Temp.\n\nThanks to Michael Meeks and Jody Goldberg for their work on Gnumeric.\n",
            "subsections": []
        },
        "DISCLAIMER OF WARRANTY": {
            "content": "Because this software is licensed free of charge, there is no warranty for the software, to the\nextent permitted by applicable law. Except when otherwise stated in writing the copyright\nholders and/or other parties provide the software \"as is\" without warranty of any kind, either\nexpressed or implied, including, but not limited to, the implied warranties of merchantability\nand fitness for a particular purpose. The entire risk as to the quality and performance of the\nsoftware is with you. Should the software prove defective, you assume the cost of all necessary\nservicing, repair, or correction.\n\nIn no event unless required by applicable law or agreed to in writing will any copyright holder,\nor any other party who may modify and/or redistribute the software as permitted by the above\nlicence, be liable to you for damages, including any general, special, incidental, or\nconsequential damages arising out of the use or inability to use the software (including but not\nlimited to loss of data or data being rendered inaccurate or losses sustained by you or third\nparties or a failure of the software to operate with any other software), even if such holder or\nother party has been advised of the possibility of such damages.\n",
            "subsections": []
        },
        "LICENSE": {
            "content": "Either the Perl Artistic Licence <http://dev.perl.org/licenses/artistic.html> or the GPL\n<http://www.opensource.org/licenses/gpl-license.php>.\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "John McNamara jmcnamara@cpan.org\n\nThe ashtray says\nYou were up all night.\nWhen you went to bed\nWith your darkest mind.\nYour pillow wept\nAnd covered your eyes.\nAnd you finally slept\nWhile the sun caught fire.\n\nYou've changed.\n-- Jeff Tweedy\n",
            "subsections": []
        },
        "COPYRIGHT": {
            "content": "Copyright MM-MMXII, John McNamara.\n\nAll Rights Reserved. This module is free software. It may be used, redistributed and/or modified\nunder the same terms as Perl itself.\n",
            "subsections": []
        }
    },
    "summary": "Spreadsheet::WriteExcel - Write to a cross-platform Excel binary file.",
    "flags": [],
    "examples": [
        "See Spreadsheet::WriteExcel::Examples for a full list of examples.",
        "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->addworksheet();",
        "# 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/');",
        "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->addworksheet('North');",
        "my $south = $workbook->addworksheet('South');",
        "my $east  = $workbook->addworksheet('East');",
        "my $west  = $workbook->addworksheet('West');",
        "# Add a Format",
        "my $format = $workbook->addformat();",
        "$format->setbold();",
        "$format->setcolor('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->setcolumn(0, 0, 20);",
        "# Set the active cell",
        "$south->setselection(0, 1);",
        "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->addworksheet();",
        "# Set the column width for columns 1, 2, 3 and 4",
        "$worksheet->setcolumn(0, 3, 15);",
        "# Create a format for the column headings",
        "my $header = $workbook->addformat();",
        "$header->setbold();",
        "$header->setsize(12);",
        "$header->setcolor('blue');",
        "# Create a format for the stock price",
        "my $fprice = $workbook->addformat();",
        "$fprice->setalign('left');",
        "$fprice->setnumformat('$0.00');",
        "# Create a format for the stock volume",
        "my $fvolume = $workbook->addformat();",
        "$fvolume->setalign('left');",
        "$fvolume->setnumformat('#,##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 $fchange = $workbook->addformat();",
        "$fchange->setalign('left');",
        "$fchange->setnumformat('[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,    $fprice ); # $30.25",
        "$worksheet->write(1, 2, 1234567,  $fvolume); # 1,234,567",
        "$worksheet->write(1, 3, 0.085,    $fchange); # 8.5% in green",
        "$worksheet->write(2, 0, 'Dump Corp.'        );",
        "$worksheet->write(2, 1, 1.56,     $fprice ); # $1.56",
        "$worksheet->write(2, 2, 7564,     $fvolume); # 7,564",
        "$worksheet->write(2, 3, -0.015,   $fchange); # -1.5% in red",
        "$worksheet->write(3, 0, 'Rev Ltd.'          );",
        "$worksheet->write(3, 1, 0.13,     $fprice ); # $0.13",
        "$worksheet->write(3, 2, 321,      $fvolume); # 321",
        "$worksheet->write(3, 3, 0,        $fchange); # 0 in the font color (black)",
        "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->addworksheet('Test data');",
        "# Set the column width for columns 1",
        "$worksheet->setcolumn(0, 0, 20);",
        "# Create a format for the headings",
        "my $format = $workbook->addformat();",
        "$format->setbold();",
        "# 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)');",
        "The following example converts a tab separated file called \"tab.txt\" into an Excel file called",
        "\"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->addworksheet();",
        "# 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++;",
        "NOTE: This is a simple conversion program for illustrative purposes only. For converting a CSV",
        "or Tab separated or any other type of delimited text file to Excel I recommend the more rigorous",
        "csv2xls program that is part of H.Merijn Brand's Text::CSVXS module distro.",
        "See the examples/csv2xls link here: <http://search.cpan.org/~hmbrand/Text-CSVXS/MANIFEST>.",
        "The following is a description of the example files that are provided in the standard",
        "Spreadsheet::WriteExcel distribution. They demonstrate the different features and options of the",
        "module. See Spreadsheet::WriteExcel::Examples for more details.",
        "Getting started",
        "===============",
        "asimple.pl             A get started example with some basic features.",
        "demo.pl                 A demo of some of the available features.",
        "regions.pl              A simple example of multiple worksheets.",
        "stats.pl                Basic formulas and functions.",
        "formats.pl              All the available formatting on several worksheets.",
        "bugreport.pl           A template for submitting bug reports.",
        "Advanced",
        "========",
        "autofilter.pl           Examples of worksheet autofilters.",
        "autofit.pl              Simulate Excel's autofit for column widths.",
        "bigfile.pl              Write past the 7MB limit with OLE::StorageLite.",
        "cgi.pl                  A simple CGI program.",
        "chartarea.pl           A demo of area style charts.",
        "chartbar.pl            A demo of bar (vertical histogram) style charts.",
        "chartcolumn.pl         A demo of column (histogram) style charts.",
        "chartline.pl           A demo of line style charts.",
        "chartpie.pl            A demo of pie style charts.",
        "chartscatter.pl        A demo of scatter style charts.",
        "chartstock.pl          A demo of stock style charts.",
        "chess.pl                An example of reusing formatting via properties.",
        "colors.pl               A 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.",
        "datavalidate.pl        An example of data validation and dropdown lists.",
        "datetime.pl            Write dates and times with writedatetime().",
        "definedname.pl         Example of how to create defined names.",
        "diagborder.pl          A simple example of diagonal cell borders.",
        "easteregg.pl           Expose the Excel97 flight simulator.",
        "filehandle.pl           Examples of working with filehandles.",
        "formularesult.pl       Formulas with user specified results.",
        "headers.pl              Examples of worksheet headers and footers.",
        "hidesheet.pl           Simple example of hiding a worksheet.",
        "hyperlink1.pl           Shows how to create web hyperlinks.",
        "hyperlink2.pl           Examples of internal and external hyperlinks.",
        "images.pl               Adding 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.",
        "modperl1.pl            A simple modperl 1 program.",
        "modperl2.pl            A simple modperl 2 program.",
        "outline.pl              An example of outlines and grouping.",
        "outlinecollapsed.pl    An example of collapsed outlines.",
        "panes.pl                An examples of how to create panes.",
        "properties.pl           Add document properties to a workbook.",
        "protection.pl           Example of cell locking and formula hiding.",
        "repeat.pl               Example of writing repeated formulas.",
        "righttoleft.pl        Change default sheet direction to right to left.",
        "rowwrap.pl             How to wrap data from one worksheet onto another.",
        "sales.pl                An example of a simple sales spreadsheet.",
        "sendmail.pl             Send an Excel email attachment using Mail::Sender.",
        "statsext.pl            Same as stats.pl with external references.",
        "stocks.pl               Demonstrates conditional formatting.",
        "tabcolors.pl           Example of how to set worksheet tab colours.",
        "textwrap.pl             Demonstrates text wrapping options.",
        "win32ole.pl             A sample Win32::OLE example for comparison.",
        "writearrays.pl         Example of writing 1D or 2D arrays of data.",
        "writehandler1.pl       Example of extending the write() method. Step 1.",
        "writehandler2.pl       Example of extending the write() method. Step 2.",
        "writehandler3.pl       Example of extending the write() method. Step 3.",
        "writehandler4.pl       Example of extending the write() method. Step 4.",
        "writetoscalar.pl      Example of writing an Excel file to a Perl scalar.",
        "Unicode",
        "=======",
        "unicodeutf16.pl        Simple example of using Unicode UTF16 strings.",
        "unicodeutf16japan.pl  Write Japanese Unicode strings using UTF-16.",
        "unicodecyrillic.pl     Write Russian Cyrillic strings using UTF-8.",
        "unicodelist.pl         List the chars in a Unicode font.",
        "unicode2022jp.pl      Japanese: ISO-2022-JP to utf8 in perl 5.8.",
        "unicode885911.pl      Thai:     ISO-885911 to utf8 in perl 5.8.",
        "unicode88597.pl       Greek:    ISO-88597  to utf8 in perl 5.8.",
        "unicodebig5.pl         Chinese:  BIG5        to utf8 in perl 5.8.",
        "unicodecp1251.pl       Russian:  CP1251      to utf8 in perl 5.8.",
        "unicodecp1256.pl       Arabic:   CP1256      to utf8 in perl 5.8.",
        "unicodekoi8r.pl        Russian:  KOI8-R      to utf8 in perl 5.8.",
        "unicodepolishutf8.pl  Polish :  UTF8        to utf8 in perl 5.8.",
        "unicodeshiftjis.pl    Japanese: Shift JIS   to utf8 in perl 5.8.",
        "Utility",
        "=======",
        "csv2xls.pl              Program to convert a CSV file to an Excel file.",
        "tab2xls.pl              Program to convert a tab separated file to xls.",
        "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.",
        "Developer",
        "=========",
        "convertA1.pl            Helper functions for dealing with A1 notation.",
        "functionlocale.pl      Add non-English function names to Formula.pm.",
        "writeA1.pl              Example of how to extend the module."
    ],
    "see_also": []
}