Spreadsheet-ParseExcel-0.58/ 000755 000765 000024 00000000000 11444726714 016021 5 ustar 00John staff 000000 000000 Spreadsheet-ParseExcel-0.58/Changes 000644 000765 000024 00000046053 11444724205 017315 0 ustar 00John staff 000000 000000 Revision history for Perl module Spreadsheet::ParseExcel. 0.58 September 17 2010 ! Fix for text cells formatted with a leading apostrophe. http://rt.cpan.org/Public/Bug/Display.html?id=61299 ! Documentation fixes. Thanks to Dan Dascalescu Fix RT #61320 (typos) http://rt.cpan.org/Public/Bug/Display.html?id=61320 ! Fix for currency locales in format strings. Reported by wjaguar. http://rt.cpan.org/Public/Bug/Display.html?id=60547 ! Fix for incomplete SETUP records. Reported by M.C. Deurloo. 0.57 January 24 2010 ! Added fix for reading formatted data from Excel 4 files. ! Added example programs, a_simple_parser.pl and display_text_table.pl. ! Removed Build.PL from README. Thanks Ed Avis. https://rt.cpan.org/Ticket/Display.html?id=52670 0.56 November 9 2009 + Added error() and error_code() error handling routines. This allows encrypted files to be ignored. Added t/10_error_codes.t for the above methods. http://rt.cpan.org/Public/Bug/Display.html?id=51033 http://rt.cpan.org/Public/Bug/Display.html?id=47978 ! Made version 0.19 of OLE::Storage_Lite a prerequisite to avoid issues when writing OLE header in SaveParser. ! Changed Parse() method name to parse() for consistency with the rest of the API. The older method name is still supported but not documented. 0.55 August 25 2009 + Refactored Cell.pm documentation and method names and added regression suite, t/06_regression.t. ! Added float comparison test to avoid false failing tests on 64bit systems. 0.54 August 25 2009 ! Fix for height/width of hidden rows/columns with additional. tests in 05_regression.t. Thanks to Greger Leijonhufvud. http://rt.cpan.org/Public/Bug/Display.html?id=48450 ! Fix for mal-formed Print_Title Name block. Reported by Marc Elser. 0.53 August 24 2009 + Made perl 5.8.0 a requirement for proper Unicode handling. ! Fixed minor int2col() bug thanks to David Black. Added 28_int2col.t test for above. http://rt.cpan.org/Public/Bug/Display.html?id=48967 + Refactored Workbook API and docs. 0.52 August 21 2009 + Added new FmtJapan module and tests written by Goro Fuji. ! Fixed bug in ExcelFmt() date handling where conversion to weekday and month names wasn't handled correctly. Add extra tests to 21_number_format_user.t for above. ! Fixed bug when checking $Config{useperlio}. Reported by kbates and H.Merijn Brand. http://rt.cpan.org/Public/Bug/Display.html?id=28861 ! Fixed bug where CellHandler variables weren't scoped to package. Reported by pomoxp. http://rt.cpan.org/Public/Bug/Display.html?id=43250 + Added tests for ExcelLocaltime() and LocaltimeExcel(). 26_localtime2excel.t and 27_localtime2excel.t. + Refactored SaveParser docs. Work still ongoing. 0.51 August 19 2009 ! Added fix for incorrectly skipped charts. Thanks Guntram Blohm. https://rt.cpan.org/Ticket/Display.html?id=44009 ! Added fix for locale [$-ddd] strings in number formats. Reported by Jeff Mitchell. https://rt.cpan.org/Ticket/Display.html?id=43638 ! Added fix for multiple dots in number formats. Thanks to Father Chrysostomos. http://rt.cpan.org/Public/Bug/Display.html?id=45502 ! Added fix to make half way rounding behave like Excel. Thanks to Joshua Megerman. http://rt.cpan.org/Public/Bug/Display.html?id=45626 ! Added checks for valid dates in Utility::ExcelFmt. Reported by Alan James. http://rt.cpan.org/Public/Bug/Display.html?id=48831 0.50 August 18 2009 + Refactored Worksheet interface and documentation. Added 04_regression.t and 05_regression.t to test above changes. ! Fixed column units conversion. Added 24_row_col_sizes.t for above change. ! Fixed RK number conversion. The existing code was the source of several RT bugs and portability issues. Added 25_decode_rk_numbers.t testcase. 0.49 January 24 2009 ! Added Text::CSV_XS to xls2csv() function to handle embedded commas in csv data. Reported by Fredrik Linde. http://rt.cpan.org/Public/Bug/Display.html?id=41337 + Rewrote Utility.pm documentation. - Removed wantarray from ExcelFmt() and the unused and undocumented feature of returning the result and a format color in a list context. The older mechanism is still available but now requires an explicit flag. 0.48 January 23 2009 ! Fixed bug where numbers with uppercase formats such as MM/DD/YY were ignored. Applies to files created by OpenOffice.org and some international versions of Excel. Added tests for above. http://rt.cpan.org/Public/Bug/Display.html?id=20526 http://rt.cpan.org/Public/Bug/Display.html?id=31206 http://rt.cpan.org/Public/Bug/Display.html?id=40307 ! Removed undocumented and counter-intuitive use of overload on SheetNo in Worksheet.pm. http://rt.cpan.org/Public/Bug/Display.html?id=14278 0.47 January 22 2009 ! Fixed bug where multiple embedded charts on a worksheet caused the worksheet order to be lost and data to get overwritten. Reported by Steven Martin and others. http://rt.cpan.org/Public/Bug/Display.html?id=13365 0.46 January 18 2009 ! Heavily refactored the ExcelFmt() function for maintainability and fixed several bugs, in particular for 12 hour clock times. Added test cases for above. ! Removed use of $& match variables from ExcelFmt. Reported by Aaron Wigley. http://rt.cpan.org/Public/Bug/Display.html?id=42425 ! Replaced lvalue substr() in ExcelFmt () with 4-arg substr() for efficiency. Reported by Goro Fuji. http://rt.cpan.org/Public/Bug/Display.html?id=42518 ! Removed spurious t/examples dir from Makefile.PL and removed unused t/lib dir. Reported by Peter (Stig) Edwards. http://rt.cpan.org/Public/Bug/Display.html?id=42442 0.45 January 13 2009 ! Fixed failed parsing of large (8-16k) Unicode strings. Reported by Graham Stead and Moka. http://rt.cpan.org/Public/Bug/Display.html?id=41813 http://rt.cpan.org/Public/Bug/Display.html?id=35678 ! Fixed critical bug where data rows could be ignored. Reported and isolated by Peter (Stig) Edwards. http://rt.cpan.org/Public/Bug/Display.html?id=30677 0.44 January 8 2009 ! Fix for OpenOffice.org GENERAL format. http://rt.cpan.org/Public/Bug/Display.html?id=7206 Thanks to Niko Tyni and the Debian Perl team + Perltidyed source and added standard headers and Pod sections to all modules. 0.43 January 7 2009 + Restructured and rewrote the main documentation. This is the start of a general refactoring. If you would like to keep up to date with it keep an eye on the Spreadsheet::ParseExcel Google Group. http://groups.google.com/group/spreadsheet-parseexcel + Added worksheets() Workbook method to iterate over the Worksheet objects. + Added unformatted() method to get a Cell's unformatted value. + Renamed public methods RowRange(), ColRange() and Cell() to row_range(), col_range() and get_cell(). Old methods are still available. ! Turned on compatibility_mode() by default in SaveParser to avoid SP3 problems. ! Fixed minor SaveParser bug with font rotation. http://rt.cpan.org/Public/Bug/Display.html?id=41626 0.42 January 1 2009 + Fix for world writeable files in distro to allow PAUSE indexing. 0.41 October 24 2008 + Changed maintainership to John McNamara. ! Fixed bug when parsing RK numbers (generally ints or small floats). http://rt.cpan.org/Public/Bug/Display.html?id=39892 ! Changed margin units to inches to (cleanly) avoid undef warning in SaveParser. 0.33 2008.09.07 - Default format for formatted dates changed from 'm-d-yy' to 'yyyy-mm-dd' - Numeric fields with date-formats now promote to Date - Added docs about date type 14 problem - skip another test when prereq is missing - split Spreadsheet::ParseExcel::SaveParser into packages - split Spreadsheet::ParseExcel into packages 0.32 2007.05.05 - Remove the memory_leak test as well as it still fails. 0.31 2007.05.03 - Require IO::Scalar always as OLE::Storage_Lite needs it but does not prereq it - disable some of the tests that don't yet work on 64 bit due to number precision in order to allow automatic installation 0.30 2007.03.31 - add some more tests - add test to see memory leak using Proc::ProcessTable - Start using Scalar::Util qw(weaken) to (hopefully) avoid memory leak - It seems we did not check correctly if PERLIO is available in Makefile.PL now it is the same test we do in the code itself. - Flag1904 renamed to Flg1904 in documentation (Chad) RT #24293 0.29 2007.03.30 - clean up basic.t to skip tests that need additional and missing module - No more need for IO::Scalar if PERLIO is available (H.Merijn Brand) 0.28 Wed Jan 7, 2007 - Documentation update - Add t/parse.t - Add sample/parse.pl - fix some syntax errors in the sub-modules 0.27 Wed Jan 3, 2007 - See changes in the 0.27_XX versions 0.27_03 Thu Nov 2, 2006 - Officially receive maintainership (Gabor Szabo) - slight code cleanup - more sample test 0.27_02 - Fixing another warning: Character in 'c' format wrapped in pack http://rt.cpan.org/Ticket/Display.html?id=18063 (Grant Stevens) - More test, enable use of Devel::Cover 0.27_01 Mon Sep 11, 2006 - Moving test.pl to t/ and using Test::More - Add tests running (some of the) sample files - Add 'use warnings', remove prototypes - Fix the warning in Spreadsheet::ParseExcel::FmtDefault Character in "C" format wrapped at .../Spreadsheet/ParseExcel/FmtDefault.pm line 68. http://rt.cpan.org/Public/Bug/Display.html?id=7376 (Slaven Rezić and others) 0.2603 Mon May 30, 2004 - Mod SaveParser : Apply a path from Eduardo J adding Protect feature (Thank you, Eduardo J for patch) - Mod ParseExcel : Apply a path from C. Jon Larsen adding GetContent (Thank you, C. Jon Larsen) 0.2602 Mon Jul 15, 2002 - Fix SaveParser : Mod hidden support(with 0 column width) (Thank you, HIROSHIGE,Shigeru for report) 0.2601 Sat Jul 13, 2002 Thank you for Peter Marschall for PATCH. - Mod ParseExcel : Add new methods - Mod SaveParser : Add new methods - Mod ParseExcel : Mod subHeader, subFooter (Thank you, RT? for report) - Mod SaveParser : Add hidden support (Thank you, HIROSHIGE,Shigeru for report) - Add new sample : Add dmpEx_2xml.pl (Thank you, Khalid EZZARAOUI for new code) 0.26 Sat Jun 1, 2002 Thank you for Peter Marschall. - Mod ParseExcel : Add new interface - Mod SaveParser : Add new interface 0.25 Fri May 10, 2002 - Mod ParseExcel : Fix For SaveParser - Mod SaveParser : Add Create Add page setting Add some documents 0.2407 Mon Apr 24, 2002 - Mod Utility : Fix Numeric format (Thank you, Jeff Shaffer for report) Fix MakeBun - Mod ParseExcel : Fix Continue (COTINUE with no header) (Thank you, Tuneyosi Fukusima for report) : Add {Val} in sample :-) (Thank you, Ernst Kloppenburg for suggestion) 0.2406 Mon Apr 8, 2002 - Mod Utility : Fix $sNUMEXP (Thank you for Xavier Catteau for patch) Add col2int int2col sheetRef xls2csv (Thank you for Xavier Catteau for patch) - Mod ParseExcel : Add file contents - Mod SaveParser : Mod AddCell 0.2405 Tue Jan 29, 2002 - Mod FmtDefault : Fix 0x01 (='0') format (Thank you Marc Pohl for report) - Mod ParseExcel : Mod Parse Fh of CGI.pm and GLOB ref. (Thank you Nicholas Hamlin and Abe Daisuke for reports) Fix PrintArea detection (Thank you Todd A. Green for patch) Add custom palette support (Thank you Florian Pflug for patch) Fix _SetDimension prototype (Thank you David Dyck for patch) - Mod SaveParser : Mod return value of SaveParser (Thank you Iceman for patch) - Mod Utility : Mod $iAftP manipulation (Thank you Stanislav Sukholet for patch) 0.2404 Tue Jul 24 7:30:00 2001 - Tue Dec 4 11:00:00 2001 - Mod ParseExcel : Mod _SwapForUnicode for a string with odd length (Thank you, Mikhail Turenko) : Add GLOB reference support (Thank you, coral.) : Fix/Add Font name Unicode judge (Thank you, Mikhail Turenko, Alex Edelman) - Mod Utility : Fix Backslash problem (Thank you, Bruno Wolff III. And sorry for TOO LATE) : Fix add number expressions (Thank you, Jing Zhao) 0.2403 Tue Jul 24 7:30:00 2001 - Mod FmtUnicode, FmtJapan, FmtJapan2 : Fix NL (Thank you, Jeremy Smartt) 0.2402 Thu Jul 12 20:30:00 2001 - Mod Utility, FmtDefault :Fix format error (Thank you, Kevin Ko) - Mod Utility :Mod for Japanese sign(triangle) 0.2401 Mon Jul 9 19:00:00 2001 - Mod FmtUnicode :Mod alphanumeric in BIG5 (Thank you, Kevin Ko) Sorry, it is not effective (ToT) 0.24 Wed Jul 5 06:30:00 2001 - Mod ParseExcel :Add OO style callback (Thank you, Ilya Sterin) - Add sample/Ilya.pl :-) - Mod ParseExcel : Mod use FmtDefault for PDK (Thank you, Maxime Alechine) 0.2301 Tue Jun 26 8:00:00 2001 - Mod FmtDefault :Fix not convert undefined or '' string 0.23 Thu Jun 21 21:00:00 2001 - Mod ParseExcel, FmtUnicode, FmtJapan, FmtJapan2 : :Fix Unicode Latin1 adapt (Thank you, Seiko Yamamura and Sadahiro) - Mod ParseExcel : my(undef) -> my($undef1) ... (Thank you, Alex) 0.22.3 Thu May 16 8:00:00 2001 - Mod FmtUnicode : Fix code undefined - Mod ParseExcel : Fix Marged area (row>255) (Thank you, Dmitriy Litovchin) 0.22.2 Thu May 16 8:00:00 2001 - Mod ParseExcel : Fix Hidden RowHeight, ColWidht (Thank you, Maxim Ovchinnikov) 0.22.1 Wed May 14 20:35:00 2001 - Mod ParseExcel : Fix Continue (COTINUE with no header) (Thank you, Steve Sapovits) : Fix ignore Graph sheet (Thank you, Joel Defarge ) - Mod Utility : Fix eval at Conditiona-Format (Thank you, Alok K. Dhir) 0.22 Sat May 5 19:00:00 2001 - Add SaveParser : For DBD::Excel 0.21.2 Tue May 1 7:00:00 2001 - Fix ParseExcel : MergedArea (Thank you, Bradley M. Handy ) 0.21.1 Sat Apr 29 14:00:00 2001 - Add ParseExcel : Rich text information support (Thank you, Vladimir Igrevsky) 0.21 Sat Apr 24 18:00:00 2001 - Mod ParseExcel : Add New Feature for CellHandler (Thank you, Jeff Clark) - Mod ParseExcel, FmtDefault, FmtJapan, Utility: : Expanding format information to support (Supported by Nippon-RAD OP Division) 0.20.2 Wed Apr 18 9:00:00 2001 - Fix Utility : ExcelFmt (For Number format) (Thank you, Jeff Clark) 0.20.1 Sun Apr 11 9:00:00 2001 - Fix FmtJapan, FmtJapan2 : TxtFmt - Fix FmtDefault : ValFmt (for 'String' format') (Thank you, Fukusima, Tuneyosi) 0.20 Mon Mar 30 20:00:00 2001 - Fix ParseExcel.pm : RK int minus (Thank you, Morten Sickel) - Mod ParseExcel.pm : Fix Font number but not complete (Thank you, Vladimir Igrevsky) - Fix ParseExcel.pm : _convBIFF8 non conversion (LABEL, String...) (Thank you, Fukusima, Tuneyosi) - Add pod : Limitaion with Spreadsheet::WriteExcel.pm (Thank you, Venkataramana Mokkapati) 0.19 Mon Mar 26 12:00:00 2001 - Fix Utility.pm :Month short name (Thank you, Morten Sickel) - Fix Utility.pm :Formatting Error (Thank you, yusuf_najuddin) - Fix FmtJapan2.pm: CP932Excel.map readable check (Thank you, Kawasaki) 0.18 Sat Mar 18 16:00:00 2001 - Fix Excel4 file support - Fix subLabel (Unicode) (Thank you, yusuf_najmuddin) 0.17 Wed Mar 12 9:00:00 2001 - Fix Utility.pm for Number format - Fix FmtJapan2.pm to use FmtJapan (Thank you, Kawasaki) - Fix Utility.pm for Number format (not Numeric) (Thank you, John Dawson) - Fix Format string with Chinese Character (in Excel95) 0.16 Wed Mar 7 22:00:00 2001 - Fix Format String - Avoding warnings (Thank you Jimmy Sieben and Daniel Berger) 0.15 Wed Mar 6 10:00:00 2001 - Fix RK number (Thank you Jimmy Sieben) - Modify many internal functions!! - Add Spreadsheet::ParseExcel::Utity for formatting! 0.13 Sat Feb 21 20:40:00 2001 - Support Pps 'BOOK' (not 'Book') with OLE::Storage_Lite 0.07 (Thank you, Punam Chordia ) - Modify Makefile.PL (define OLE::Storage_Lite Version) (Thank you, Aldo Calpini) - Fix Conetinue ASCII-Unicode pattern (Thank you, Tim Wills) - Add FmtUnicode sample :dmpExU.pl (Sorry and thank you, Mike Goblin) 0.12 Sat Feb 5 11:00:00 2001 - Support Excel4 file (Thank you, Jeff Haferman and herbert ) - Add reference of scalar and IO::File object support in Parse (Thank you, Jeff Haferman) - Fix Continue SST (Thank you, Gennadiy) - Delete VBAMacros from sample/Excel/Test97j.xls and Test97.xls avoiding virus check. (Thank you, Alfred Nathaniel) - Fix weekday of ExcelLocaltime 0.11 Sat Jan 26 14:00:00 2001 - Skip 0xEF to EOF(0x0A) (Thank you, Phil DiFalco) 0.10 Mon Jan 15 12:00:00 2001 - Fix _subString, _subFormula (Thank you, Ilter Cekic and Mike Edwards) 0.09 Sat Dec 15 12:00:00 2000 - Fix Month name of FmtDefault.pm (Thank you, Michael Edwards) - Add FmtJapan2.pm - Fix Slightly Bug 0.08 Sat Nov 25 12:00:00 2000 - Fix RString, PackedString BUGS (Thank you, Kim Namsuk) - Fix undefined function _subDefColW (Thank you, Hirofumi Morisada) 0.07 Sat Nov 18 12:00:00 2000 - Change to use OLE::Storage_Lite - Fix RString, PackedString BUGS (Thank you, Hirofumi Morisada) - Fix and Add Formula String (Thank you, Michael Edwards) 0.05 Mon Oct 2 03:14:04 2000 - original version Spreadsheet-ParseExcel-0.58/CP932Excel.map 000644 000765 000024 00000050122 11247565351 020240 0 ustar 00John staff 000000 000000 ' 0 ??a ?@0 00 @ >?000N00 <^"%\ & % 0;=[] 0 - "`"f""4&B&@ 2! &&%%%%%%%%%%% ;0!!!0"""""*")"'!!" "" "#"""a"R"j""=""5"+!+ 0&o&m&j % O `!ASS0A?@?00!@p0Q6> % %%%%%%%,%$%4%<%%%%%%%#%3%+%;%K% %/%(%7%?%%0%%%8%B@$` !`_3I33"3M33'3363Q3W3 3&3#3+3J3;3333~3{00!3!!221293~3}3|"."""^NUZ?Tac(Y"uzP`cn%efhW'ebq[Y{}b}b|[^c fhHgONO OMOPIVY7YZ\ `aapfipuOupy}}cUzS;NNWxN Xn8z2(/QASpTTVY_m-?@bpTS[pSo\zNxn&VUk;YSmftVBNKOSU[0_qf fhl8lm)t[vzN4[`muv`iSQ}WX0YD[^`(cclopqqYqs?~v`[XielZu%QY.Ye__bej*k'ksV,\l{Q\KahvraNYOSx`in)zONSNOUO=OOsRSV YZ[[yfggkLlpksyyz<{wfV)NO\brYu;NOVXJX^_`*``babbe9?@AffhmwppuLv}uQRYT[]ahimxWrmlWgRVT^bdh<h8ksrxzkki[f\i}Mc{ j+}jh o_RrU`pbm;nn[DN9Sij:h*Q\zV[(h"1|RtN~OQ[R RR]UX*Y[[[^r^y`aacacebghShk>kSlWo"ooEtuvwz{|!}6fQe(N8T+\]svLw<\TXOOSqUVhWYG[ [\^^~_cg:eeghh?@j_^0kll}uyH[cz } _w<NP}Q Y[b/bdk:ruyGpcT TUhTjXpx'guSt[PNNENOST8[_`%eQ}g=lBlrlpxtzvz{}|}fer[S\E]bbcn Z1oyZNNOOPQGzQqQSTS!SSUX\_7_J`/`P`mceYjKlrrwNWZNQ\-fim\@fiushP|PRWG]&ek#k=t4yy{K}_9TN]P6SS:rswQwa^UzzPv[GN2j\Q\H?@czltazq|h~phQlRTSfyAOPRQDUSW-sWYQ_b_`uavagacd:elfohBnufz=|}L}~KkJcf}RbdohAPk lzoTzt}P@#gNP9P&PeQ|R8RcUWXZ^aabcrij)r}rs.xxo}ywcuzUxQCSS^{_&nnss}C7 PNNPST|VY[d]^_'b8eEgnVr|N7gNNO SHTIT>Z/__`hjtZxwN^NO|OPPQIQlRRRSST?@TUWQWY}[T[][]]]^x^^^_`RaLbbce;ffCfgmh!hil_m*min/nu2vxlz?|}}}^}T*RLauqx?M};R[RSTXboj_QKR;TJVz@w`sDo pu_`rkdNVWdXZZ`haffh9hmu}:nBNOPSU]o]]gltsxPWP^c+PPQg TX^Y[_ibMch=ksnp}rxx&yme}0 RdW(gPjQWB*X:iT]WxO\RJTd>f(ggz{V}"/h\{9SQR7?@[bddg-kvcLvfRN PS\q`dech_qsu#{~xefkNNO:OR:SSUVXYYY[P\M^^+_`ce/[\eeegkb}k{lsEyIy|}}+^ifkoNO<OQP[W[aHcfBk!nlr>tuxy:3lP_X+z[NSWY1Z[`nou[ {Prg\aJ~Q\chfeqny>}nPR\:gSp|r5L+[_1`N;S[bKg1krsz.kRQSTj[cj9} VSTh?@[\1]Oabm2yy}B~MFrt/1KlNOOQESA_bglAnsc~&SY[my]~.|X~qQSO\f%wzQ_eiokm}nodv}]uQRb@ffn^}rfRSYs^_`UdPQRS SGSTUFU1VYhYZ<[\\\\^^^_pbbbccwfff-fvg~hjj5lmn nXq<q&qguwx]yyeyz{|}9I]<Tsaf~N NNNWQRpWX4X["^8`dgagVmDruszcr V1W?@bi kq~TwrU\;O8OOUZ [[_aNc/efKhimxmu3uwy^y}3:2NNRXuX\u\=N cm{%bVS}T9W^%cl4pwa|pBTt^]]iepgcngIiodz[Np,u]f/QR6RY_`'be?etffthhkcnrruv|VXRYez^-`befgwzM|M~> d_xRbcdBb-z{}vINQHSCS`[\\]b&bGdhh4lmEmgo\qNq}ez{}?@~Jz9nxwRMUo8q6Qhy~U|VLXQ\cffiZruuyyVy|} }D4;a PRuSSP UXYOr=[\dS``c\cc?c}def]iioqNuvz|}}aIXlpmPXa5 OPtRGSs`ocIg_n,O\^e}SRQvc[X[k\ d gQ\NYY*lpQU>XY`bSg5iU@(OSX[\^/_` aKb4fln .NSY'{,Lnp'SSUD[bXbblot"8o8QS?@SOFTYj1]zh7rHj=N9SXVWfbcekNmn[pwz{}=[VX_>efjku7P$wW0_`efzl`uznE{u\z{Q}yz6Zw@N-N[_bf<glkw;Njp&s*WNQFQU[^^3^__5_k_acfgonrRu:w:t9xvwRcWvglssm%XiiuXZhciOCo,g&}Ti?opWjX[,},r*T NONP\PuRCTHX$[^^^^_`bc:chl@xyz}GD?@-ldXdeunv{inT_dMDQxXkY)\U^m~u[pOkou0QNTX5XWY\`_eg\n!v{Mx%x:R^WYt`PQZQ}QR UXTXXYW[\]`bd-gqhChhvmnompoq_Suyw{I{T{R|}qR0ciFv-0PRTX\admwzS\S?__mrywcy{krhjaQzi4\J[IpVx\o`eflZATQf YHQNMQpXczKib~uwSWi`l]N\<_Sy^eNsQe?@Y\?NY_oyyb[qs+q^t_c{dq|NC^NKWV`o} 3]bdgwlm>t6x4ZFuO^bceWgovrL)MP WZh}isqdrXjyw)O/ReSZbglv}{|6fo r~Q{xr{{Hj^auQu`QkbnvzOpb{OVzXYO4R$SJSS^d,egl>lNrHrsuT~A,{qic=fiujvxCS*SQT&Y^_|`bIbybekluvxy}w^j|8P\>_gkt5w ?@;gzS9u_f_<_ub{F<hgYZ}v~,O_jjl7otyhhUy^cuy(-T_lem\p;eOtN NWY+Zf[Q^^`bvew}efnmnr6{&P\tDOdkfaj\iSzWORo_^Eg yym_bUlNriRT;VtXabnqYn||}e^NOuQuX@^c^s_ gN&=[|sPXvVxR%w{POY rG{}MORZ)_OWcUkiu+zBRXaUb fk|?P#OSTFX1YI[\\])^bcge>eg?@llpx2~+*JlNONPRVWJY^=_b?fgghQ}! ~2T ,SPS\Xdg4rgwfzFRlkX ^LYTg,Qv}dixTWYf'gkTi^UggRh]NOSbg+lO~mNabno+Tsg*E]{\[nJzY|lw RY"q!r_w'aiZZQT T}fvYr]nQMh}}bdxj!Y[_ksv}Q2g(vgbR\$b;|~UO`}SN_QYr:6_%wS_y}3VgSa alvR?@8U/OQQ*RS[^}`acg gngms6u1yPJYNOYN?P^|Y[^ccdfiJimnqu(z I! e} a~bk2}lmtmge<m}a=jNqSu]Pko-R)T\egNhttux_szNcueRmAnt uYxk|zOane\NNPN!Q[ehmsvBwz|o|uR}P+Sgmqt3*Wt`XAm}/^NO6OQR]`sy<4 bfktRRp^`Kao#qI|>}o3@#,TBojp2RZA^_gi|imjorbr{~KQmy2P-Tqkj`gNNkhi n~xU^_NNN*N1N6N<N?NBNVNXNNkN_ NNNNNNNNNNNNNNNNO OZO0O[O]OWOGOvOOOO{OiOpOOoOOQOOOOOOOOOPP(PP*P%POOP!P)P,OOPPPCPGgPUPPPHPZPVPlPxPPPPP?@PPPPPPPPPPPQ QQQQQQ!Q:Q7Q<Q;Q?QRQLQTQbzQiQnQQVQQQQQQQQQQQQQQQQQQQUQQ}QQQRRRRR'R*R.R3R9RORDRKR^RTRjRtRiRsRR}RRRRqRRRRRRRRRRRRRRRSSu8S SSSSS#S/S1S3S8S@SFSENSISMQS^SiSnYS{SwSSSSSSSSS|SfqSSSSTT=T@T,T<T.T6T)TTNTTuTT_TqTwTpTT{TTvTTTTTTTTTTT?@TTTTTTTUUTTTTTU9U@UcULU.U\UEUVU8U3U]UUTUUU{U~UUUU|UUUUUUUUUUUVUVUUVUVNVPqV4V6V2V8}VkVdV/VlVjVVVVVVVVVVVVVVVVVVVVVVW VWW WWW WWWUWW&W7WNW;W@WOWiWWWaWWWWWWWWWWWWX WWXXXXrX!XbXKXpkXRX=XyXXXXXXXXXXXXXXXXXXXXXXXYY YYhY%Y,Y2Y8Y>zYUYPYNYZYXYbY`YgYlYi?@YxYYO^OYYYYYYYZ%ZZZZ ZZ@ZlZIZ5ZbZjZZZZZZZZZZZZ[[[[2Z[*[6[>[C[E[@[Q[U[Z[e[i[p[s[u[xe[z[}[[[[[[[[[[[[[[[[[\\\ \\ \"\(\8\A\F\N\S\P\O[q\l\nNb\v\y\\\Y\\\\\\\\\\\\\]\]]]]\]]]]]"]]]]L]R]N]K]l]s]v]]]]]]]]]]]]]]]]]]]]^^^^^^6^D^C^@^N^W^T^_^b^d^G^u^z^^^^^^?@^^^^^^^^^^^^^^__ _]_\____)_-_8_A_H_L_N_/_Q_V_Y_a_m_s_w____________________`_`!``}```)``1```+`&``:`Z`A`j`w`_`J`F`M`c`C`d`B`l`k`Y````````````````_````aMaa`a ``aa!``a aGa>a(a'aJa?a<a,a4a=aBaDasawaXakataoaeaqa_a]aSauaaaaaaaaaaaaaaaaaaayaaaaaaaaaab bb bbb?@bb!b*b.b0b2bAbNb^bcb[b`bhb|bbb~bbbbbbbbbbbdbbbbbbbbcbbc'ccbbcPc>cMdcOcccccvcccccck}cicccccccccdd4ddd&d6edd(ddgdodvdNe*ddddddddddddddd dbdde,dddde deeee$e#e+e4e7e6e8uKeHeVeUeMeXe^e]erexeeeeeeeeeeeeeeegrf fegsf5f4ffOfDfIfAf^f]fdfgf_fbfpffffffffffff?@ffffff?fffffgggg&8g.g?g6gAg8g7gFg^g`gYgcggpgg|gjgggggggggggggggggggggjhhFh)h@hMh2hN}hh+hYhchwhhhhhhhhjhhthhhihh~ihihi"i&hihhhhi6iihhi%hhhi(i*ii#i!hiyiwi\ixikiTi~ini9iti=iYi0iai^i]iijiiiiiiii[iiiiij.iiiiiiijjik iiijijijij jjj#jjDjjrj6jxjGjbjYjfjHj8j"jjjjj?@jjjjjjjjjjjjjjkjkk1kk8k7vk9kGkCkIkPkYkTk[k_kakxkkkkkkkkkkkkkkkkkkkkkkk}llll$l#l^lUlbljllllll~lhlslllllllllllllllllmMm6m+m=m8mm5m3mmmcmmdmZmymYmmommnn mmmmmmmmmmmmmmmmmn-nnn.nnrn_n>n#nkn+nvnMnnCn:nNn$nnn8nnnnnnnnnnnnnnnoAopLnnno?no1no2n?@o>onoozoxooooo[oomoo|oXoooofooooooooooooooop popppoppotpppp0p>p2pQpcppppppppppp}pq pqqqeqUqqfqbqLqVqlqqqqqqqqqqqqqqqqqqqqr rrr(r-r,r0r2r;r?rFrKrXrtr~rrrrrrrrrrrrrrrrrrPss ssss4s/s)s%s>sNsWsjshspsxsus{szsssssssstttot%st2t:tUt?t_tYtAt\titptctjtvt~tttttts?@tttttttttuuuuuu uuuu&u,u<uDuMuJuIu[uFuZuiudugukumuxuvuutuuuuuuuuuuuuuuuuuuuuuuu}uvuuuvv v vv'v v$v4v0v;vGvFv\vXvavhvgvlvpvrvvvxv|vvvvvvvvvvvvvvvvvvvv/vwwww)w$ww%ww7wGwZwhwkw[weww~wywwwwwwwwwwwwwwwwwwwxxy&x y*xExxtxx|xxxxxxxxxxxxxxx?@xxxxyyyyy,y+y@y`yWy_yZyUySyzyyyyKyyyyyyyyyyzz zz zyz1z;z>z7zCzWzIzazizpzyz}zzzzzzzz}zzzzzzzzzzzzzzzz{{{ {{3{{{5{({6{P{z{{M{{L{E{u{e{t{g{p{l{n{{{{{{{{{{]{{{{{{{{{||{{|`| ||{{|| {|#|'|*||7|+|=|L|C|T|O|@|P|X|_|d|V|e|l|u|||||||||||||||||||||;|||||}?@}}}} }E}K}.}2}?}5}F}s}V}N}r}h}n}O}c}}}[}}}}}}}}}}}~=}}}}}}}}}}}}}~~ ~#~!~~1~~ ~~"~F~f~;~5~9~C~7}~2~:~g~]~V~^~Y~y~j~i~|~{~}~}~~~~~~~~~8:ELPUTX_hgxq!(?;JFRXZ_bhsrpvy}Q )#/K?@F>SQqnet_ )+83@YX]Z_d}bhj.qw~ 5421@9PE/+#|su " 8m*<ZwkniF,oy5b!,@cXH?@AKUmw~ "0?MNUT_gq#} 4?7;%)`_xLNtWhnYScj "!169';DBRY^bk~u}r C%*AD;68L`^?@fdmjotw~%6A[RFH|mlb} 3&+>(ALONIV[Zk_lot}:A?HLNPUblxz|b NgmqsB504J?@GILPHYd`*cUvr| &3;9EB>LIFNW\}b! '659OI>VX^hovr}bH20JVXceisr,^WEIdH?KPZD.?@"#:5;\`|nV6+5!:ARD[`b^j)puw}Z|~}o!(.BLOKw\^]_frlM $*09=DFHBI\`dfhRkqy|zOz8$!7=FOKko?@qts !$ ,.=BIEPKQLU+7EB@C}>UM[W_bedikj"%'.2DCOMQXt: .%$!0G2F>Z`gvx *&#DA?>FH?@]dQPYrozuy}a%v!,>JRTc_fljwrvX/iYtdQq?@~HOpf1hf_EN(NNO OO9OVOOOOOP@P"OPPFPpPBPPPQJQdQQQRRRRRS SS$SrSSSTTTTUWYWeWWW}XXYYSY[Y]YcYY[V[u/[[\\\\]']S]B]m]]_!_4_g__`]````a `aa7a0abbcd`ddeNf ff;f f.ff$fefWfYfsfffffg)gfghRghhDhihiij0jkjFjsj~jjkl?l\llolmmmommmmmmn9n\n'n<noooppp(ppqqq\qFqqr?@rs$swssssstst&t*t)t.tbttuuovvvvvwFRx!xNxdxzy0yyzzz{}H}\}}}~RGbHSYmk 7y"Sv#$g&' :@<NYQ9gw'%!(pW1EH)3;CMOQUWe*',Nur pk- !p Spreadsheet-ParseExcel-0.58/examples/ 000755 000765 000024 00000000000 11444726713 017636 5 ustar 00John staff 000000 000000 Spreadsheet-ParseExcel-0.58/lib/ 000755 000765 000024 00000000000 11444726713 016566 5 ustar 00John staff 000000 000000 Spreadsheet-ParseExcel-0.58/Makefile.PL 000644 000765 000024 00000001750 11317406231 017762 0 ustar 00John staff 000000 000000 #!/usr/bin/perl -w use strict; use warnings; use ExtUtils::MakeMaker; use 5.008; my %deps = ( 'OLE::Storage_Lite' => 0.19, 'IO::File' => 0, 'Scalar::Util' => 0, 'IO::Scalar' => 0, ); my %resources = ( repository => 'http://github.com/jmcnamara/spreadsheet-parseexcel', MailingList => 'http://groups.google.com/group/spreadsheet-parseexcel', ); my %params = ( 'AUTHOR' => 'John McNamara (jmcnamara@cpan.org)', 'NAME' => 'Spreadsheet::ParseExcel', 'ABSTRACT' => 'Read information from an Excel file.', 'VERSION_FROM' => 'lib/Spreadsheet/ParseExcel.pm', 'LICENSE' => 'perl', 'EXE_FILES' => [], 'INSTALLDIRS' => 'site', 'PL_FILES' => {}, 'PREREQ_PM' => \%deps, 'NEEDS_LINKING' => 0, 'test' => { TESTS => 't/*.t' } ); if ( $ExtUtils::MakeMaker::VERSION ge '6.46' ) { $params{META_MERGE} = { resources => \%resources }; } WriteMakefile(%params); Spreadsheet-ParseExcel-0.58/MANIFEST 000644 000765 000024 00000004610 11327115350 017137 0 ustar 00John staff 000000 000000 CP932Excel.map Changes MANIFEST Makefile.PL README README_Japan.htm META.yml t/00_basic.t t/01_parse.t t/02_parse-dates.t t/03_regression.t t/04_regression.t t/05_regression.t t/06_regression.t t/10_error_codes.t t/20_number_format_default.t t/21_number_format_user.t t/22_number_format_datetime.t t/23_number_format_time.t t/24_row_col_sizes.t t/25_decode_rk_numbers.t t/26_localtime2excel.t t/27_localtime2excel.t t/28_int2col.t t/30_sst_01.t t/32_charts.t t/41_test95-97j.t t/42_test95-97j-2.t t/43_test2000J.t t/44_oem.t t/45_oem-2.t t/90_pod.t t/91_minimumversion.t t/92_meta.t t/excel_files/Dates.xls t/excel_files/Dates1904.xls t/excel_files/Test2000J.xls t/excel_files/Test95.xls t/excel_files/Test95J.xls t/excel_files/Test97J.xls t/excel_files/TestEncoding.xls t/excel_files/chart1.xls t/excel_files/chart2.xls t/excel_files/chart3.xls t/excel_files/chart4.xls t/excel_files/encrypted.xls t/excel_files/long_string1.xls t/excel_files/long_string2.xls t/excel_files/long_string3.xls t/excel_files/long_string4.xls t/excel_files/long_string5.xls t/excel_files/long_string6.xls t/excel_files/long_string7.xls t/excel_files/long_string8.xls t/excel_files/worksheet_01.xls lib/Spreadsheet/ParseExcel.pm lib/Spreadsheet/ParseExcel/Cell.pm lib/Spreadsheet/ParseExcel/Dump.pm lib/Spreadsheet/ParseExcel/FmtDefault.pm lib/Spreadsheet/ParseExcel/FmtJapan.pm lib/Spreadsheet/ParseExcel/FmtJapan2.pm lib/Spreadsheet/ParseExcel/FmtUnicode.pm lib/Spreadsheet/ParseExcel/Font.pm lib/Spreadsheet/ParseExcel/Format.pm lib/Spreadsheet/ParseExcel/SaveParser.pm lib/Spreadsheet/ParseExcel/SaveParser/Workbook.pm lib/Spreadsheet/ParseExcel/SaveParser/Worksheet.pm lib/Spreadsheet/ParseExcel/Utility.pm lib/Spreadsheet/ParseExcel/Workbook.pm lib/Spreadsheet/ParseExcel/Worksheet.pm examples/a_simple_parser.pl examples/display_text_table.pl sample/Excel/AuthorK.xls sample/Excel/AuthorK95.xls sample/Excel/FmtTest.xls sample/Excel/Rich.xls sample/Excel/Test1904.xls sample/Excel/Test1904_95.xls sample/Excel/Test95.xls sample/Excel/Test95J.xls sample/Excel/Test97.xls sample/Excel/Test97J.xls sample/Excel/oem.xls sample/README sample/chkFmt.pl sample/chkInfo.pl sample/dmpEx.pl sample/dmpExU.pl sample/dmpExH.pl sample/dmpExHJ.pl sample/dmpExJ.pl sample/dmpExR.pl sample/Ilya.pl sample/sample.pl sample/sampleOEM.pl sample/sample_j.pl sample/smpFile.pl sample/xls2csv.pl sample/iftest.pl sample/iftestj.pl sample/dmpEx_2xml.pl sample/parse.pl Spreadsheet-ParseExcel-0.58/META.yml 000644 000765 000024 00000001444 11444726714 017275 0 ustar 00John staff 000000 000000 --- #YAML:1.0 name: Spreadsheet-ParseExcel version: 0.58 abstract: Read information from an Excel file. author: - John McNamara (jmcnamara@cpan.org) license: perl distribution_type: module configure_requires: ExtUtils::MakeMaker: 0 build_requires: ExtUtils::MakeMaker: 0 requires: IO::File: 0 IO::Scalar: 0 OLE::Storage_Lite: 0.19 Scalar::Util: 0 resources: MailingList: http://groups.google.com/group/spreadsheet-parseexcel repository: http://github.com/jmcnamara/spreadsheet-parseexcel no_index: directory: - t - inc generated_by: ExtUtils::MakeMaker version 6.54 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 Spreadsheet-ParseExcel-0.58/README 000644 000765 000024 00000004375 11310425206 016672 0 ustar 00John staff 000000 000000 NAME Spreadsheet::ParseExcel - Extract information from Excel file. DESCRIPTION This module allows you to extract information from Excel file. This module can handle files in Excel95, 97 and 2000 format. The module will work on the majority of Windows, UNIX and Macintosh platforms. REQUIREMENT This module requires these modules: OLE::Storage_Lite Jcode.pm (if you are using FmtJapan, or FmtJapan2) Unicode::Map (if you are using FmtJapan2 or FmtUnicode) IO::Scalar (if PERLIO is not available) Spreadsheet::WriteExcel (to use Spreadsheet::ParseExcel::SaveParser) INSTALLATION The module can be installed using the standard Perl procedure: perl Makefile.PL make make test make install # You may need to be root make clean # or make realclean or using CPAN.pm or CPANPLUS.pm cpan Spreadsheet::ParseExcel Windows users without a working "make" can get nmake from: ftp://ftp.microsoft.com/Softlib/MSLFILES/nmake15.exe For FmtJapan2 If you use FmtJapan2, you must do following actions: (1) Copy "CP932Excel.map" included with this distribution to an applicatable directry. (2) To add "CP932Excel" as map name, append following lines to REGISTRY in the Unicode::Map hierarchy (changing map directy to applicatable directry): name: CP932Excel srcURL: $SrcUnicode/VENDORS/MICSFT/WINDOWS/CP932.TXT src: $DestUnicode/VENDORS/MICSFT/WINDOWS/CP932.TXT map: (which you copied directry)/CP932Excel.map # Don't remove this line AUTHOR Current maintainer 0.40+: John McNamara jmcnamara@cpan.org Maintainer 0.27-0.33: Gabor Szabo szabgab@cpan.org Original author: Kawai Takanori (Hippo2000) kwitknr@cpan.org SUPPORT Before you report problems, please check the "KNOWN PROBLEMS" section in the manual page for Spreadsheet::ParseExcel. There is a Google group for discussing and asking questions about Spreadsheet::ParseExcel. http://groups-beta.google.com/group/spreadsheet-parseexcel/ Bugs can be reported via rt.cpan.org. See the following for instructions: http://rt.cpan.org/Public/Dist/Display.html?Name=Spreadsheet-ParseExcel Test cases are always welcome. Spreadsheet-ParseExcel-0.58/README_Japan.htm 000644 000765 000024 00000013406 11247565351 020604 0 ustar 00John staff 000000 000000
Speadsheet::ParseExcel.pm - 0.2405 by 繧ŵ (Hippo2000) Changes Υ⥸塼ϡޤСǤ MicrosoftҤExcelեWindowsʳΥץåȥեǤ Ф褦ˤ⥸塼Ǥ ưǧ DOS/V WindowsNT ver.4.0 Perl5.005 DOS/V TurboLinux ver.6.0 Perl5.005 Sun Sparc Solaris 2.6 Perl5.005 DOS/V Vine Linux 2.0 Perl5.005 Macintosh JPerlFreeBSDǤưƤȤݡȤƤޤ ¾δĶǼ¹Ԥ줿ϡƤ ưƤưʤƤ⡢Ϥꤤޤ <(__)> ñʳǧ(testǥ쥯ȥ sampleǥ쥯ȥ˰ʲΥե뤬äƤޤ sample.pl ñʥƥȥץȡSpreadsheet::ParseExcel::FmtDefaultѡ sample_j.pl ñʥƥȥץȡSpreadsheet::ParseExcel::FmtJapanѡɤꤷƽϡ res_sample sample.plμ¹Է res_sample_jsample_j.plμ¹Է(euc) dmpEx.pl : ExcelեƤɽSpreadsheet::ParseExcel::FmtDefaultѡ dmpExj.pl : ExcelեƤɽSpreadsheet::ParseExcel::FmtJapanѡ ñˤΥ⥸塼ưǧǤСdmpExj.plˤä ꤷExcelեƤɽ뤳ȤǤޤ ex. # perl -I.. dmpExj.pl Excel/Test97.xls euc -I..פϡƥǥ쥯ȥˤSpreadsheet::ParseExcel.pmѤ뤿˻ꤷޤ Excel/Test97.xlsפоݤȤʤե̾ eucפϴϤȤʸɤǤeucsjisjisʤ Jcode.pmƱǤ ȡ OLE::Storage_Liteȡ뤵Ƥɬפޤ Spreadsheet::ParseExcel::FmtJapanѤ硢Jcode.pmɬפȤޤ¾Υ⥸塼ɬפȤޤ Spreadsheet::ParseExcel::FmtJapan2Ѥ硢Jcode.pmUnicode::MapɬפȤޤ PerlɸŪʥȡˤʤޤΥ⥸塼뼫ΤPerlΤߤǺƤΤǡԡǤưޤ
perl Makefile.PL make make test make install (rootˤʤäơ
FmtJapan2Τ
¸ʸб뤿FmtJapan20.09Ʊޤ Ѥ뤿ˤUnicode::Mapȡ뤹ۤʲμ礬ɬפˤʤޤ
(1) Ʊ"CP932Excel.map"Ŭڤʥǥ쥯ȥ˥ԡޤ
(2) "CP932Excel"ޥå̾Ȥɲä뤿ˡUnicode::MapؤˤREGISTRY˰ʲιԤɲäޤ mapΥǥ쥯ȥ̾Ŭڤʥǥ쥯ȥ̾ˤƤ
name: CP932Excel srcURL: $SrcUnicode/VENDORS/MICSFT/WINDOWS/CP932.TXT src: $DestUnicode/VENDORS/MICSFT/WINDOWS/CP932.TXT map: (ԡΥǥ쥯ȥ)/CP932Excel.map # Don't remove this line
Ȥ use strict; use Spreadsheet::ParseExcel; my $oExcel = new Spreadsheet::ParseExcel; my $oBook = $oExcel->Parse('Excel/Test97.xls'); #ޤܸбǤ use strict; use Spreadsheet::ParseExcel; use Spreadsheet::ParseExcel::FmtJapan; my $oExcel = new Spreadsheet::ParseExcel; my $oFmtJ = Spreadsheet::ParseExcel::FmtJapan->new(Code => 'euc'); #sjisjisʤɤΥ my $oBook = $oExcel->Parse('Excel/Test97.xls', $oFmtJ);
#μФ my($iR, $iC, $oWkS, $oWkC); print "FILE :", $oBook->{File} , "\n"; print "COUNT :", $oBook->{SheetCount} , "\n"; print "AUTHOR:", $oBook->{Author} , "\n"; for(my $iSheet=0; $iSheet < $oBook->{SheetCount} ; $iSheet++) { $oWkS = $oBook->{Worksheet}[$iSheet]; print "--------- SHEET:", $oWkS->{Name}, "\n"; for(my $iR = $oWkS->{MinRow} ; defined $oWkS->{MaxRow} && $iR <= $oWkS->{MaxRow} ; $iR++) { for(my $iC = $oWkS->{MinCol} ; defined $oWkS->{MaxCol} && $iC <= $oWkS->{MaxCol} ; $iC++) { $oWkC = $oWkS->{Cells}[$iR][$iC]; print "( $iR , $iC ) =>", $oWkC->Value, "\n" if($oWkC); } } } Х
ǤäExce97 ǥ٥åѡ åȡפޤ Hirofumi Morisada˴ադǤ
Excel97/2000¸硢FmtJapanǤϵ¸ʸ()IʤɡˤˤʤäƤޤޤ FmtJapan2ǤϰбƤĤǤ
ޤƥȤȤǤƤޤȤꤢưǤ礦 <(__)> TurboLinux Version 6ǺƤΤǡ¾δĶǤɤʤΤȤƤⵤ ʤޤ SolarisǤưǧƤ餤ޤʤޤԶ礬ꤽǤ ȡХݡȤԤƤޤ 繧ŵkwitknr@cpn.org ʤ㤤ʤȡ ƥȡ ɥȤ Ϥؤб (^_^) Spreadsheet::WriteExcelȤäƤΤ 줫ޤ뤴ȰĤƤͤϤޤ(^^) ռ Ⱦüʾ֤Ǽռ⤢äΤǤϤޤʲΥץࡢ ⥸塼ͤˤƤޤ xlHtml OLE::Storage herbert (OLE::StorageƱġ Spreadsheet::WriteExcel SolarisΥǥХåȻϩवʤСΩޤǤ(cloudy˴ա ǸˤExcel2000Υեޤ Hirofumi MorisadaξʸΥХȯ뤳ȤǤޤ ơExcel97ǥ٥åѡåȡפɤ⤢꤬Ȥޤ ¾ưХݡȤադǤSpreadsheet-ParseExcel-0.58/sample/ 000755 000765 000024 00000000000 11444726713 017301 5 ustar 00John staff 000000 000000 Spreadsheet-ParseExcel-0.58/t/ 000755 000765 000024 00000000000 11444726713 016263 5 ustar 00John staff 000000 000000 Spreadsheet-ParseExcel-0.58/t/00_basic.t 000644 000765 000024 00000001737 11247565351 020040 0 ustar 00John staff 000000 000000 #!/usr/bin/perl use strict; use warnings; use Test::More tests => 8; use_ok('Spreadsheet::ParseExcel'); use_ok('Spreadsheet::ParseExcel::Dump'); use_ok('Spreadsheet::ParseExcel::FmtDefault'); use_ok('Spreadsheet::ParseExcel::Utility'); eval "use Jcode"; my $no_jcode = $@; eval "use Unicode::Map"; my $no_unicode_map = $@; eval "use Spreadsheet::WriteExcel"; my $no_writeexcel = $@; SKIP: { skip "Need Jcode for additional tests", 1 if $no_jcode; use_ok('Spreadsheet::ParseExcel::FmtJapan'); } SKIP: { skip "Need Unicode::Map for additional tests", 1 if $no_unicode_map; use_ok('Spreadsheet::ParseExcel::FmtUnicode'); } SKIP: { skip "Need Jcode and Unicode::Map for additional tests", 1 if $no_jcode or $no_unicode_map; use_ok('Spreadsheet::ParseExcel::FmtJapan2'); } SKIP: { skip "Need Spreadsheet::WriteExcel for additional tests", 1 if $no_writeexcel; use_ok('Spreadsheet::ParseExcel::SaveParser'); } Spreadsheet-ParseExcel-0.58/t/01_parse.t 000644 000765 000024 00000010265 11247565351 020066 0 ustar 00John staff 000000 000000 #!/usr/bin/perl use strict; use warnings; use Test::More; my $tests; plan tests => $tests; use Data::Dumper; use_ok('Spreadsheet::ParseExcel'); BEGIN { $tests += 1; } # these tests were created based on the values received using 0.27 # to create regressions tests { # historically Parse returned and unblessed reference on missing file my $excel = Spreadsheet::ParseExcel::Workbook->Parse('no_such_file.xls'); is(ref($excel), 'HASH', 'failed Parse method returns HASH ref'); isa_ok($excel->{_Excel}, 'Spreadsheet::ParseExcel', 'failed Parse method creates _Excel object'); BEGIN { $tests += 2; } } { # historically Parse returned and unblessed reference on failure (e.g. # input file is not an Excel file) my $excel = Spreadsheet::ParseExcel::Workbook->Parse($0); is(ref($excel), 'HASH', 'failed Parse method returns HASH ref'); isa_ok($excel->{_Excel}, 'Spreadsheet::ParseExcel', 'failed Parse method creates _Excel object'); BEGIN { $tests += 2; } } my $workbook_1; { my $workbook = Spreadsheet::ParseExcel::Workbook->Parse('sample/Excel/Test95.xls'); $workbook_1 = $workbook; use Data::Dumper; #diag Dumper $excel; #_save_file('dump.txt', Dumper $excel); is(ref($workbook), 'Spreadsheet::ParseExcel::Workbook', 'Spreadsheet::ParseExcel::Workbook created'); my $excel = $workbook->{_Excel}; isa_ok($excel, 'Spreadsheet::ParseExcel', 'Parse method creates _Excel object'); is(ref($excel->{FuncTbl}), 'HASH'); is(ref($excel->{GetContent}), 'CODE'); # meta data is($workbook->{_CurSheet_}, 1, 'current sheet is 1'); is($workbook->{_CurSheet}, 1); is($workbook->{Flg1904}, 0); isa_ok($workbook->{FmtClass}, 'Spreadsheet::ParseExcel::FmtDefault'); # TODO more tests in Format is(ref($workbook->{Format}), 'ARRAY'); my $formats = $workbook->{Format}; is(scalar(@$formats), 22); # all but 2 are 'Spreadsheet::ParseExcel::Format' objects is(ref($workbook->{FormatStr}), 'HASH'); is($workbook->{SheetCount}, 2); my $fonts = $workbook->{Font}; is(ref($fonts), 'ARRAY'); is(scalar(@$fonts), 6); is($workbook->{Version}, 1280); is($workbook->{BIFFVersion}, 8); is($workbook->{File}, 'sample/Excel/Test95.xls'); is($workbook->{Author}, 'kawait'); my @sheets = @{$workbook->{Worksheet}}; is (@sheets, 2, "two sheets"); is($sheets[0]->{Name}, 'Sheet1-ASC'); # Open Office shows: 'Sheet1_ASC' is($sheets[1]->{Name}, 'Sheet1-ASC (2)'); # OO shows 'Sheet1_ASC_2_' is($sheets[0]->{MinRow}, 0); is($sheets[0]->{MaxRow}, 7); #diag Dumper $sheets[0]->{Cells}; #qw(ASC Date INTEGER Float Double Formula) is($sheets[0]->{Cells}[0][0]->{Val}, 'ASC'); #diag Dumper $sheets[0]->{Cells}[0][0]; is($sheets[1]->{MinRow}, 0); is($sheets[1]->{MaxRow}, 5); BEGIN { $tests += 26; } } eval "require IO::Scalar"; if ($@) { ok (1, "Skipped - no IO::Scalar") for 1..6; } else { { open my $fh, '<','t/excel_files/Test95.xls'; my $workbook = Spreadsheet::ParseExcel::Workbook->Parse($fh); isnt($workbook, $workbook_1); delete $workbook_1->{File}; # when give a filehandlres this field is not set is_deeply($workbook, $workbook_1); BEGIN { $tests += 2; } } # pass a reference to a scalar containing the file content { my $data; if (open my $fh, '<','t/excel_files/Test95.xls') { binmode($fh); local $/ = undef; $data = <$fh>; } my $workbook = Spreadsheet::ParseExcel::Workbook->Parse(\$data); isnt($workbook, $workbook_1); is_deeply($workbook, $workbook_1); BEGIN { $tests += 2; } } { open my $fh, '<','t/excel_files/Test95.xls'; binmode($fh); my @data = <$fh>; my $workbook = Spreadsheet::ParseExcel::Workbook->Parse(\@data); isnt($workbook, $workbook_1); $workbook_1->{File} = undef; is_deeply($workbook, $workbook_1); BEGIN { $tests += 2; } } } sub _save_file { my ($file, $data) = @_; if (open my $fh, '>', $file) { print {$fh} $data; } } Spreadsheet-ParseExcel-0.58/t/02_parse-dates.t 000644 000765 000024 00000006750 11251562267 021167 0 ustar 00John staff 000000 000000 #!/usr/bin/perl use strict; use warnings; BEGIN { delete @ENV{qw( LANG LC_ALL LC_DATE )}; } use Test::More tests => 151; use_ok ("Spreadsheet::ParseExcel"); my $bk; ok ($bk = Spreadsheet::ParseExcel::Workbook->Parse ("t/excel_files/Dates.xls"), "Open/parse Dates.xls"); ok (my @ws = @{$bk->{Worksheet}}, "Book has sheets"); is (scalar @ws, 1, "But just one"); my $ws = $ws[0]; ok (my $cells = $ws->{Cells}, "Worksheet has cells"); is ($ws->{Name}, "DateTest", "Worksheet label"); is ($ws->{MinRow}, 0, "Row start"); is ($ws->{MinCol}, 0, "Col start"); is ($ws->{MaxRow}, 6, "Row count"); is ($ws->{MaxCol}, 4, "Col count"); my @expect = (# Date Date Date Date Text [ 39668, "8-Aug", 20080808, "2008-08-08", "08/08/2008", "08 Aug 2008" ], [ 39672, "12-Aug", 20080812, "2008-08-12", "08/12/2008", "12 Aug 2008" ], [ 39790, "8-Dec", 20081208, "2008-12-08", "12/08/2008", "08 Dec 2008" ], [ 39673, "13-Aug", 20080813, "2008-08-13", "08/13/2008", "13 Aug 2008" ], ); # non given, ISO, type 14, US broken, Text-default my @format = (undef, "yyyymmdd", undef, "mm/dd/yyyy", undef); my @col = ("A".."E"); foreach my $row (0 .. 3) { foreach my $col (0 .. 4) { my $R = $row + 1; my $C = $col + 1; my $cell = ("A".."E")[$col].$R; ok (my $wc = $ws->{Cells}[$row][$col], "Cell $cell"); is ($wc->{Val}, $expect[$row][$col == 4 ? 5 : 0], "Base value for $cell"); is ($wc->Value, $expect[$row][$C], "Formatted value for $cell"); is ($wc->{Type}, $col == 4 ? "Text" : "Date", "Cell $cell Type"); my $fmt = $wc->{Format}; my $fmtstr = $bk->{FormatStr}{$fmt->{FmtIdx}}; $fmtstr and $fmtstr =~ s/\\//g; is ($fmtstr, $format[$col], "Format string"); } } # Additional allignment tests is ($ws->{Cells}[0][$_]{Format}{AlignV}, 3, "$col[$_]1 v-aligned justified") for 1..3; is ($ws->{Cells}[1][$_]{Format}{AlignV}, 0, "$col[$_]2 v-aligned top") for 1..3; is ($ws->{Cells}[2][$_]{Format}{AlignV}, 1, "$col[$_]3 v-aligned center") for 1..3; is ($ws->{Cells}[3][$_]{Format}{AlignV}, 2, "$col[$_]4 v-aligned bottom") for 1..3; is ($ws->{Cells}[$_][0]{Format}{AlignH}, 0, "A$_ h-aligned -") for 1..3; is ($ws->{Cells}[$_][1]{Format}{AlignH}, 1, "B$_ h-aligned left") for 1..3; is ($ws->{Cells}[$_][2]{Format}{AlignH}, 2, "C$_ h-aligned center") for 1..3; is ($ws->{Cells}[$_][3]{Format}{AlignH}, 3, "D$_ h-aligned right") for 1..3; # Additional color tests is ($ws->{Cells}[0][$_]{Format}{Font}{Color}, 32767, "$col[$_]1 font color") for 0..3; is ($ws->{Cells}[0][ 4]{Format}{Font}{Color}, 18, "E1 font color"); my %expect = ( B7 => [ 1, 6, 39673, "ddd, dd mmm yyyy", "Wed, 13 Aug 2008" ], C7 => [ 2, 6, 39673, "m-d-yy", "8-13-08" ], ); # Test ddd, dd MM yyyy foreach my $cell ("B7", "C7") { my ($c, $r) = @{$expect{$cell}}[0,1]; ok (my $wc = $ws->{Cells}[$r][$c], "Cell $cell"); ok (my $fmt = $wc->{Format}, "Format $cell"); ok (my $fmtstr = $bk->{FormatStr}{$fmt->{FmtIdx}}, "FmtStr $cell"); $fmtstr and $fmtstr =~ s{\\}{}g; # Unescape for test $fmtstr and $fmtstr =~ s{/}{-}g and $expect{$cell}[4] =~ s{-}{/}g; # System locale's deate-sep is used :( is ($wc->{Val}, $expect{$cell}[2], "$cell value"); is ($fmtstr, $expect{$cell}[3], "$cell Format string"); is ($wc->Value, $expect{$cell}[4], "$cell formatted value"); } Spreadsheet-ParseExcel-0.58/t/03_regression.t 000644 000765 000024 00000015140 11247565351 021133 0 ustar 00John staff 000000 000000 #!/usr/bin/perl ############################################################################### # # A test for Spreadsheet::ParseExcel. # # Regression tests for Workbook properties and methods. # # The testcases comprise tests direct hash access (old methodology) and method # calls (>= version 0.50 methodology). # # reverse(''), January 2009, John McNamara, jmcnamara@cpan.org # use strict; use warnings; use Spreadsheet::ParseExcel; use Test::More tests => 16; ############################################################################### # # Tests setup. # my $file = 't/excel_files/worksheet_01.xls'; my $parser = Spreadsheet::ParseExcel->new(); my $workbook = $parser->Parse($file); my @worksheets; my $worksheet; my $got; my $expected; my $caption; ############################################################################### # # Test 1 Test worksheets() method. # $caption = "Test worksheet()"; @worksheets = $workbook->worksheets(); $got = join ' ', map { $_->get_name } @worksheets; $expected = 'Sheet1 Sheet2 Sheet3'; $caption = " \tWorkbook regression: " . $caption; is( $got, $expected, $caption ); ############################################################################### # # Test 2 Test deprecated Worksheets property. # $caption = "Test worksheet()"; @worksheets = @{ $workbook->{Worksheet} }; $got = join ' ', map { $_->get_name } @worksheets; $expected = 'Sheet1 Sheet2 Sheet3'; $caption = " \tWorkbook regression: " . $caption; is( $got, $expected, $caption ); ############################################################################### # # Test 3 Test worksheet() method. # $caption = "Test worksheet()"; $worksheet = $workbook->worksheet(1); $got = $worksheet->get_name(); $expected = 'Sheet2'; $caption = " \tWorkbook regression: " . $caption; is( $got, $expected, $caption ); ############################################################################### # # Test 4 Test worksheet() method. # $caption = "Test worksheet()"; $worksheet = $workbook->worksheet('Sheet3'); $got = $worksheet->get_name(); $expected = 'Sheet3'; $caption = " \tWorkbook regression: " . $caption; is( $got, $expected, $caption ); ############################################################################### # # Test 5 Test deprecated Worksheet() method # $caption = "Test worksheet()"; $worksheet = $workbook->Worksheet('Sheet3'); $got = $worksheet->get_name(); $expected = 'Sheet3'; $caption = " \tWorkbook regression: " . $caption; is( $got, $expected, $caption ); ############################################################################### # # Test 6 Test worksheet_count() method. # $caption = "Test worksheet_count()"; $got = $workbook->worksheet_count(); $expected = 3; $caption = " \tWorkbook regression: " . $caption; is( $got, $expected, $caption ); ############################################################################### # # Test 7 Test deprecated SheetCount property. # $caption = "Test worksheet_count()"; $got = $workbook->{SheetCount}; $expected = 3; $caption = " \tWorkbook regression: " . $caption; is( $got, $expected, $caption ); ############################################################################### # # Test 8 Test get_filename() method. # $caption = "Test get_filename()"; $got = $workbook->get_filename(); $expected = $file; $caption = " \tWorkbook regression: " . $caption; is( $got, $expected, $caption ); ############################################################################### # # Test 9 Test deprecated File property. # $caption = "Test get_filename()"; $got = $workbook->{File}; $expected = $file; $caption = " \tWorkbook regression: " . $caption; is( $got, $expected, $caption ); ############################################################################### # # Test 10 Test get_filename() method on a filehandle. # my $fh; open $fh, '<', $file; binmode $fh; $workbook = $parser->Parse($fh); $caption = "Test get_filename()"; $got = $workbook->get_filename(); $expected = undef; $caption = " \tWorkbook regression: " . $caption; is( $got, $expected, $caption ); ############################################################################### # # Test 11 Test get_print_areas() method. # $caption = "Test get_print_areas()"; $worksheet = $workbook->worksheet(0); $got = $workbook->get_print_areas(); $expected = [ undef, [ [ 0, 0, 14, 2 ] ], [ [ 0, 1, 65535, 1 ], [ 3, 4, 7, 6 ] ] ]; $caption = " \tWorkbook regression: " . $caption; is_deeply( $got, $expected, $caption ); ############################################################################### # # Test 12 Test deprecated PrintArea property. # $caption = "Test get_print_areas()"; $worksheet = $workbook->worksheet(0); $got = $workbook->{PrintArea}; $expected = [ undef, [ [ 0, 0, 14, 2 ] ], [ [ 0, 1, 65535, 1 ], [ 3, 4, 7, 6 ] ] ]; $caption = " \tWorkbook regression: " . $caption; is_deeply( $got, $expected, $caption ); ############################################################################### # # Test 13 Test get_print_titles() method. # $caption = "Test get_print_titles()"; $worksheet = $workbook->worksheet(0); $got = $workbook->get_print_titles(); $expected = [ undef, { 'Row' => [ [ 0, 1 ] ], 'Column' => [ [ 0, 2 ] ], }, { 'Row' => [], 'Column' => [ [ 0, 7 ] ], } ]; $caption = " \tWorkbook regression: " . $caption; is_deeply( $got, $expected, $caption ); ############################################################################### # # Test 14 Test deprecated PrintArea property. # $caption = "Test get_print_titles()"; $worksheet = $workbook->worksheet(0); $got = $workbook->{PrintTitle}; $expected = [ undef, { 'Row' => [ [ 0, 1 ] ], 'Column' => [ [ 0, 2 ] ], }, { 'Row' => [], 'Column' => [ [ 0, 7 ] ], } ]; $caption = " \tWorkbook regression: " . $caption; is_deeply( $got, $expected, $caption ); ############################################################################### # # Test 15 Test using_1904_date() method. # $caption = "Test using_1904_date()"; $got = $workbook->using_1904_date(); $expected = 0; $caption = " \tWorkbook regression: " . $caption; is( $got, $expected, $caption ); ############################################################################### # # Test 16 Test using_1904_date() method. # $workbook = $parser->Parse('t/excel_files/Dates1904.xls'); # File change. $caption = "Test using_1904_date()"; $got = $workbook->using_1904_date(); $expected = 1; $caption = " \tWorkbook regression: " . $caption; is( $got, $expected, $caption ); __END__ Spreadsheet-ParseExcel-0.58/t/04_regression.t 000644 000765 000024 00000041024 11260573025 021124 0 ustar 00John staff 000000 000000 #!/usr/bin/perl ############################################################################### # # A test for Spreadsheet::ParseExcel. # # Regression tests for Worksheet properties and methods. # # The tests are mainly in pairs where direct hash access (old methodology) # is tested along with the method calls (>= version 0.50 methodology). # # The tests in this testsuite are mainly for default Worksheet properties. # See also 05_regression.t for testing of non-default properties. # # reverse(''), January 2009, John McNamara, jmcnamara@cpan.org # use strict; use warnings; use Spreadsheet::ParseExcel; use Test::More tests => 72; ############################################################################### # # Tests setup. # my $file = 't/excel_files/worksheet_01.xls'; my $parser = Spreadsheet::ParseExcel->new(); my $workbook = $parser->Parse($file); my $worksheet; my $got_1; my $got_2; my $expected_1; my $expected_2; my $caption; ############################################################################### # # Test 1, 2 # $caption = "Test cell value"; $worksheet = $workbook->worksheet('Sheet1'); $expected_1 = 'This is a test workbook for worksheet regression'; $got_1 = $worksheet->{Cells}->[0]->[0]->value(); $got_2 = $worksheet->get_cell( 0, 0 )->value(); $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 3, 4. # $caption = "Test worksheet name"; $worksheet = $workbook->worksheet('Sheet1'); $expected_1 = 'Sheet1'; $got_1 = $worksheet->{Name}; $got_2 = $worksheet->get_name(); $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 5, 6. # $caption = "Test row range"; $worksheet = $workbook->worksheet('Sheet1'); $expected_1 = 0; $expected_2 = 1; $got_1 = ( $worksheet->row_range() )[0]; $got_2 = ( $worksheet->row_range() )[1]; $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_2, $caption ); ############################################################################### # # Test 7, 8. # $caption = "Test col range"; $worksheet = $workbook->worksheet('Sheet1'); $expected_1 = 0; $expected_2 = 0; $got_1 = ( $worksheet->col_range() )[0]; $got_2 = ( $worksheet->col_range() )[1]; $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_2, $caption ); ############################################################################### # # Test 9, 10. # $caption = "Test worksheet number"; $worksheet = $workbook->worksheet('Sheet1'); $expected_1 = 0; $got_1 = $worksheet->{_SheetNo}; $got_2 = $worksheet->sheet_num(); $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 11, 12. # $caption = "Test default row height"; $worksheet = $workbook->worksheet('Sheet1'); $expected_1 = 12.75; $got_1 = $worksheet->{DefRowHeight}; $got_2 = $worksheet->get_default_row_height; $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 13, 14. # $caption = "Test default column width"; $worksheet = $workbook->worksheet('Sheet1'); $expected_1 = 8.43; $got_1 = $worksheet->{DefColWidth}; $got_2 = $worksheet->get_default_col_width; $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 15, 16. # $caption = "Test row '1' height"; $worksheet = $workbook->worksheet('Sheet1'); $expected_1 = 12.75; $got_1 = $worksheet->{RowHeight}->[0]; $got_2 = ( $worksheet->get_row_heights() )[0]; $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 17, 18. # $caption = "Test column 'A' width"; $worksheet = $workbook->worksheet('Sheet1'); $expected_1 = undef; $got_1 = $worksheet->{ColWidth}->[0]; $got_2 = ( $worksheet->get_col_widths() )[0]; $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 19, 20. # $caption = "Test landscape print setting"; $worksheet = $workbook->worksheet('Sheet1'); $expected_1 = 1; $got_1 = $worksheet->{Landscape}; $got_2 = $worksheet->is_portrait(); $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 21, 22. # $caption = "Test print scale"; $worksheet = $workbook->worksheet('Sheet1'); $expected_1 = 100; $got_1 = $worksheet->{Scale}; $got_2 = $worksheet->get_print_scale(); $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 23, 24. Note, use Sheet3 for counter example. # $caption = "Test print fit to page"; $worksheet = $workbook->worksheet('Sheet1'); $expected_1 = 0; $got_1 = $worksheet->{PageFit}; $got_2 = $worksheet->get_fit_to_pages(); $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 25, 26. Note, use Sheet3 for counter example. # $caption = "Test print fit to page width"; $worksheet = $workbook->worksheet('Sheet1'); $expected_1 = 1; $got_1 = $worksheet->{FitWidth}; $expected_2 = 0; $got_2 = ( $worksheet->get_fit_to_pages() )[0]; $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_2, $caption ); ############################################################################### # # Test 27, 28. Note, use Sheet3 for counter example. # $caption = "Test print fit to page height"; $worksheet = $workbook->worksheet('Sheet1'); $expected_1 = 1; $got_1 = $worksheet->{FitHeight}; $expected_2 = 0; $got_2 = ( $worksheet->get_fit_to_pages() )[1]; $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_2, $caption ); ############################################################################### # # Test 29, 30. Note, use Sheet3 for counter example. # $caption = "Test paper size"; $worksheet = $workbook->worksheet('Sheet1'); $expected_1 = 9; $got_1 = $worksheet->{PaperSize}; $got_2 = $worksheet->get_paper(); $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 31, 32. # $caption = "Test user defined start page for printing"; $worksheet = $workbook->worksheet('Sheet1'); $expected_1 = 0; $got_1 = $worksheet->{UsePage}; $got_2 = $worksheet->get_start_page(); $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 33, 34. # $caption = "Test user defined start page for printing"; $worksheet = $workbook->worksheet('Sheet1'); $expected_1 = 1; $got_1 = $worksheet->{PageStart}; $expected_2 = 0; $got_2 = $worksheet->get_start_page(); $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_2, $caption ); ############################################################################### # # Test 35, 36. # $caption = "Test left margin"; $worksheet = $workbook->worksheet('Sheet1'); $expected_1 = undef; $got_1 = $worksheet->{LeftMargin}; $got_2 = $worksheet->get_margin_left(); $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 37, 38. # $caption = "Test right margin"; $worksheet = $workbook->worksheet('Sheet1'); $expected_1 = undef; $got_1 = $worksheet->{RightMargin}; $got_2 = $worksheet->get_margin_right(); $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 39, 40. # $caption = "Test top margin"; $worksheet = $workbook->worksheet('Sheet1'); $expected_1 = undef; $got_1 = $worksheet->{TopMargin}; $got_2 = $worksheet->get_margin_top(); $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 41, 42. # $caption = "Test bottom margin"; $worksheet = $workbook->worksheet('Sheet1'); $expected_1 = undef; $got_1 = $worksheet->{BottomMargin}; $got_2 = $worksheet->get_margin_bottom(); $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 43, 44. # $caption = "Test header margin"; $worksheet = $workbook->worksheet('Sheet1'); $expected_1 = 0.5; $got_1 = $worksheet->{HeaderMargin}; $got_2 = $worksheet->get_margin_header(); $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 45, 46. # $caption = "Test footer margin"; $worksheet = $workbook->worksheet('Sheet1'); $expected_1 = 0.5; $got_1 = $worksheet->{FooterMargin}; $got_2 = $worksheet->get_margin_footer(); $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 47, 48. # $caption = "Test center horizontally"; $worksheet = $workbook->worksheet('Sheet1'); $expected_1 = 0; $got_1 = $worksheet->{HCenter}; $got_2 = $worksheet->is_centered_horizontally(); $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 49, 50. # $caption = "Test center vertically"; $worksheet = $workbook->worksheet('Sheet1'); $expected_1 = 0; $got_1 = $worksheet->{VCenter}; $got_2 = $worksheet->is_centered_vertically(); $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 51, 52. # $caption = "Test header"; $worksheet = $workbook->worksheet('Sheet1'); $expected_1 = undef; $got_1 = $worksheet->{Header}; $got_2 = $worksheet->get_header(); $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 53, 54. # $caption = "Test Footer"; $worksheet = $workbook->worksheet('Sheet1'); $expected_1 = undef; $got_1 = $worksheet->{Footer}; $got_2 = $worksheet->get_footer(); $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 55, 56. # $caption = "Test print with gridlines"; $worksheet = $workbook->worksheet('Sheet1'); $expected_1 = 0; $got_1 = $worksheet->{PrintGrid}; $got_2 = $worksheet->is_print_gridlines(); $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 57, 58. # $caption = "Test print with row and column headers"; $worksheet = $workbook->worksheet('Sheet1'); $expected_1 = 0; $got_1 = $worksheet->{PrintHeaders}; $got_2 = $worksheet->is_print_row_col_headers(); $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 59, 60. # $caption = "Test print in black and white"; $worksheet = $workbook->worksheet('Sheet1'); $expected_1 = 0; $got_1 = $worksheet->{NoColor}; $got_2 = $worksheet->is_print_black_and_white(); $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 61, 62. # $caption = "Test print in draft quality"; $worksheet = $workbook->worksheet('Sheet1'); $expected_1 = 0; $got_1 = $worksheet->{Draft}; $got_2 = $worksheet->is_print_draft(); $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 63, 64. # $caption = "Test print comments"; $worksheet = $workbook->worksheet('Sheet1'); $expected_1 = 0; $got_1 = $worksheet->{Notes}; $got_2 = $worksheet->is_print_comments(); $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 65, 66. # $caption = "Test print over then down"; $worksheet = $workbook->worksheet('Sheet1'); $expected_1 = 0; $got_1 = $worksheet->{LeftToRight}; $got_2 = $worksheet->get_print_order(); $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 67, 68. # $caption = "Test horizontal page breaks"; $worksheet = $workbook->worksheet('Sheet1'); $expected_1 = undef; $got_1 = $worksheet->{HPageBreak}; $got_2 = $worksheet->get_h_pagebreaks(); $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 69, 70. # $caption = "Test vertical page breaks"; $worksheet = $workbook->worksheet('Sheet1'); $expected_1 = undef; $got_1 = $worksheet->{VPageBreak}; $got_2 = $worksheet->get_v_pagebreaks(); $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 71, 72. # $caption = "Test merged areas"; $worksheet = $workbook->worksheet('Sheet1'); $expected_1 = undef; $got_1 = $worksheet->{MergedArea}; $got_2 = $worksheet->get_merged_areas(); $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); __END__ Spreadsheet-ParseExcel-0.58/t/05_regression.t 000644 000765 000024 00000044266 11260573025 021140 0 ustar 00John staff 000000 000000 #!/usr/bin/perl ############################################################################### # # A test for Spreadsheet::ParseExcel. # # Regression tests for Worksheet properties and methods. # # The tests are mainly in pairs where direct hash access (old methodology) # is tested along with the method calls (>= version 0.50 methodology). # # The tests in this testsuite are mainly for non-default Worksheet properties. # See also 04_regression.t for testing of default properties. # # reverse(''), January 2009, John McNamara, jmcnamara@cpan.org # use strict; use warnings; use Spreadsheet::ParseExcel; use Test::More tests => 76; ############################################################################### # # Tests setup. # my $file = 't/excel_files/worksheet_01.xls'; my $parser = Spreadsheet::ParseExcel->new(); my $workbook = $parser->Parse($file); my $worksheet; my $got_1; my $got_2; my $expected_1; my $expected_2; my $caption; ############################################################################### # # Test 1, 2 # $caption = "Test cell value"; $worksheet = $workbook->worksheet('Sheet2'); $expected_1 = 'This sheet has:'; $got_1 = $worksheet->{Cells}->[0]->[0]->value(); $got_2 = $worksheet->get_cell( 0, 0 )->value(); $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 3, 4. # $caption = "Test worksheet name"; $worksheet = $workbook->worksheet('Sheet2'); $expected_1 = 'Sheet2'; $got_1 = $worksheet->{Name}; $got_2 = $worksheet->get_name(); $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 5, 6. # $caption = "Test row range"; $worksheet = $workbook->worksheet('Sheet2'); $expected_1 = 0; $expected_2 = 35; $got_1 = ( $worksheet->row_range() )[0]; $got_2 = ( $worksheet->row_range() )[1]; $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_2, $caption ); ############################################################################### # # Test 7, 8. # $caption = "Test col range"; $worksheet = $workbook->worksheet('Sheet2'); $expected_1 = 0; $expected_2 = 9; $got_1 = ( $worksheet->col_range() )[0]; $got_2 = ( $worksheet->col_range() )[1]; $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_2, $caption ); ############################################################################### # # Test 9, 10. # $caption = "Test worksheet number"; $worksheet = $workbook->worksheet('Sheet2'); $expected_1 = 1; $got_1 = $worksheet->{_SheetNo}; $got_2 = $worksheet->sheet_num(); $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 11, 12. # $caption = "Test default row height"; $worksheet = $workbook->worksheet('Sheet2'); $expected_1 = 21; $got_1 = $worksheet->{DefRowHeight}; $got_2 = $worksheet->get_default_row_height; $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 13, 14. # $caption = "Test default column width"; $worksheet = $workbook->worksheet('Sheet2'); $expected_1 = 8.43; $got_1 = $worksheet->{DefColWidth}; $got_2 = $worksheet->get_default_col_width; $caption = " \tWorksheet regression: " . $caption; _is_float( $got_1, $expected_1, $caption ); _is_float( $got_2, $expected_1, $caption ); ############################################################################### # # Test 15, 16. # $caption = "Test row '3' height"; $worksheet = $workbook->worksheet('Sheet2'); $expected_1 = 48.75; $got_1 = $worksheet->{RowHeight}->[2]; $got_2 = ( $worksheet->get_row_heights() )[2]; $caption = " \tWorksheet regression: " . $caption; _is_float( $got_1, $expected_1, $caption ); _is_float( $got_2, $expected_1, $caption ); ############################################################################### # # Test 17, 18. # $caption = "Test column 'A' width"; $worksheet = $workbook->worksheet('Sheet2'); $expected_1 = 31; $got_1 = $worksheet->{ColWidth}->[0]; $got_2 = ( $worksheet->get_col_widths() )[0]; $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 19, 20. # $caption = "Test landscape print setting"; $worksheet = $workbook->worksheet('Sheet2'); $expected_1 = 0; $got_1 = $worksheet->{Landscape}; $got_2 = $worksheet->is_portrait(); $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 21, 22. # $caption = "Test print scale"; $worksheet = $workbook->worksheet('Sheet2'); $expected_1 = 75; $got_1 = $worksheet->{Scale}; $got_2 = $worksheet->get_print_scale(); $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 23, 24. Note, use Sheet3 for counter example. # $caption = "Test print fit to page"; $worksheet = $workbook->worksheet('Sheet3'); $expected_1 = 1; $got_1 = $worksheet->{PageFit}; $expected_2 = '2x3'; $got_2 = join 'x', $worksheet->get_fit_to_pages(); $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_2, $caption ); ############################################################################### # # Test 25, 26. Note, use Sheet3 for counter example. # $caption = "Test print fit to page width"; $worksheet = $workbook->worksheet('Sheet3'); $expected_1 = 2; $got_1 = $worksheet->{FitWidth}; $expected_2 = 2; $got_2 = ( $worksheet->get_fit_to_pages() )[0]; $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_2, $caption ); ############################################################################### # # Test 27, 28. Note, use Sheet3 for counter example. # $caption = "Test print fit to page height"; $worksheet = $workbook->worksheet('Sheet3'); $expected_1 = 3; $got_1 = $worksheet->{FitHeight}; $expected_2 = 3; $got_2 = ( $worksheet->get_fit_to_pages() )[1]; $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_2, $caption ); ############################################################################### # # Test 29, 30. # $caption = "Test paper size"; $worksheet = $workbook->worksheet('Sheet2'); $expected_1 = 11; $got_1 = $worksheet->{PaperSize}; $got_2 = $worksheet->get_paper(); $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 31, 32. # $caption = "Test user defined start page for printing"; $worksheet = $workbook->worksheet('Sheet2'); $expected_1 = 1; $got_1 = $worksheet->{UsePage}; $expected_2 = 2; $got_2 = $worksheet->get_start_page(); $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_2, $caption ); ############################################################################### # # Test 33, 34. # $caption = "Test user defined start page for printing"; $worksheet = $workbook->worksheet('Sheet2'); $expected_1 = 2; $got_1 = $worksheet->{PageStart}; $got_2 = $worksheet->get_start_page(); $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 35, 36. # $caption = "Test left margin"; $worksheet = $workbook->worksheet('Sheet2'); $expected_1 = 1.2; $got_1 = $worksheet->{LeftMargin}; $got_2 = $worksheet->get_margin_left(); $caption = " \tWorksheet regression: " . $caption; _is_float( $got_1, $expected_1, $caption ); _is_float( $got_2, $expected_1, $caption ); ############################################################################### # # Test 37, 38. # $caption = "Test right margin"; $worksheet = $workbook->worksheet('Sheet2'); $expected_1 = 1.4; $got_1 = $worksheet->{RightMargin}; $got_2 = $worksheet->get_margin_right(); $caption = " \tWorksheet regression: " . $caption; _is_float( $got_1, $expected_1, $caption ); _is_float( $got_2, $expected_1, $caption ); ############################################################################### # # Test 39, 40. # $caption = "Test top margin"; $worksheet = $workbook->worksheet('Sheet2'); $expected_1 = 1.1; $got_1 = $worksheet->{TopMargin}; $got_2 = $worksheet->get_margin_top(); $caption = " \tWorksheet regression: " . $caption; _is_float( $got_1, $expected_1, $caption ); _is_float( $got_2, $expected_1, $caption ); ############################################################################### # # Test 41, 42. # $caption = "Test bottom margin"; $worksheet = $workbook->worksheet('Sheet2'); $expected_1 = 1.5; $got_1 = $worksheet->{BottomMargin}; $got_2 = $worksheet->get_margin_bottom(); $caption = " \tWorksheet regression: " . $caption; _is_float( $got_1, $expected_1, $caption ); _is_float( $got_2, $expected_1, $caption ); ############################################################################### # # Test 43, 44. # $caption = "Test header margin"; $worksheet = $workbook->worksheet('Sheet2'); $expected_1 = 0.5; $got_1 = $worksheet->{HeaderMargin}; $got_2 = $worksheet->get_margin_header(); $caption = " \tWorksheet regression: " . $caption; _is_float( $got_1, $expected_1, $caption ); _is_float( $got_2, $expected_1, $caption ); ############################################################################### # # Test 45, 46. # $caption = "Test footer margin"; $worksheet = $workbook->worksheet('Sheet2'); $expected_1 = 1.6; $got_1 = $worksheet->{FooterMargin}; $got_2 = $worksheet->get_margin_footer(); $caption = " \tWorksheet regression: " . $caption; _is_float( $got_1, $expected_1, $caption ); _is_float( $got_2, $expected_1, $caption ); ############################################################################### # # Test 47, 48. # $caption = "Test center horizontally"; $worksheet = $workbook->worksheet('Sheet2'); $expected_1 = 1; $got_1 = $worksheet->{HCenter}; $got_2 = $worksheet->is_centered_horizontally(); $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 49, 50. # $caption = "Test center vertically"; $worksheet = $workbook->worksheet('Sheet2'); $expected_1 = 1; $got_1 = $worksheet->{VCenter}; $got_2 = $worksheet->is_centered_vertically(); $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 51, 52. # $caption = "Test header"; $worksheet = $workbook->worksheet('Sheet2'); $expected_1 = '&CThis is the header'; $got_1 = $worksheet->{Header}; $got_2 = $worksheet->get_header(); $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 53, 54. # $caption = "Test Footer"; $worksheet = $workbook->worksheet('Sheet2'); $expected_1 = '<his is the footer'; $got_1 = $worksheet->{Footer}; $got_2 = $worksheet->get_footer(); $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 55, 56. # $caption = "Test print with gridlines"; $worksheet = $workbook->worksheet('Sheet2'); $expected_1 = 1; $got_1 = $worksheet->{PrintGrid}; $got_2 = $worksheet->is_print_gridlines(); $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 57, 58. # $caption = "Test print with row and column headers"; $worksheet = $workbook->worksheet('Sheet2'); $expected_1 = 1; $got_1 = $worksheet->{PrintHeaders}; $got_2 = $worksheet->is_print_row_col_headers(); $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 59, 60. # $caption = "Test print in black and white"; $worksheet = $workbook->worksheet('Sheet2'); $expected_1 = 1; $got_1 = $worksheet->{NoColor}; $got_2 = $worksheet->is_print_black_and_white(); $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 61, 62. # $caption = "Test print in draft quality"; $worksheet = $workbook->worksheet('Sheet2'); $expected_1 = 1; $got_1 = $worksheet->{Draft}; $got_2 = $worksheet->is_print_draft(); $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 63, 64. # $caption = "Test print comments"; $worksheet = $workbook->worksheet('Sheet2'); $expected_1 = 1; $got_1 = $worksheet->{Notes}; $got_2 = $worksheet->is_print_comments(); $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 65, 66. # $caption = "Test print over then down"; $worksheet = $workbook->worksheet('Sheet2'); $expected_1 = 1; $got_1 = $worksheet->{LeftToRight}; $got_2 = $worksheet->get_print_order(); $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 67, 68. # $caption = "Test horizontal page breaks"; $worksheet = $workbook->worksheet('Sheet2'); $expected_1 = [6, 20]; $got_1 = $worksheet->{HPageBreak}; $got_2 = $worksheet->get_h_pagebreaks(); $caption = " \tWorksheet regression: " . $caption; is_deeply( $got_1, $expected_1, $caption ); is_deeply( $got_2, $expected_1, $caption ); ############################################################################### # # Test 69, 70. # $caption = "Test vertical page breaks"; $worksheet = $workbook->worksheet('Sheet2'); $expected_1 = [2]; $got_1 = $worksheet->{VPageBreak}; $got_2 = $worksheet->get_v_pagebreaks(); $caption = " \tWorksheet regression: " . $caption; is_deeply( $got_1, $expected_1, $caption ); is_deeply( $got_2, $expected_1, $caption ); ############################################################################### # # Test 71, 72. # $caption = "Test merged areas"; $worksheet = $workbook->worksheet('Sheet2'); $expected_1 = [ [29, 1, 30, 4] ]; $got_1 = $worksheet->{MergedArea}; $got_2 = $worksheet->get_merged_areas(); $caption = " \tWorksheet regression: " . $caption; is_deeply( $got_1, $expected_1, $caption ); is_deeply( $got_2, $expected_1, $caption ); ############################################################################### # # Test 73, 74. # $caption = "Test hidden row 34"; $worksheet = $workbook->worksheet('Sheet2'); $expected_1 = 21; $got_1 = $worksheet->{RowHeight}->[33]; $got_2 = ( $worksheet->get_row_heights() )[33]; $caption = " \tWorksheet regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 75, 76. # $caption = "Test column hidden 'A' width"; $worksheet = $workbook->worksheet('Sheet2'); $expected_1 = 10.71; $got_1 = $worksheet->{ColWidth}->[7]; $got_2 = ( $worksheet->get_col_widths() )[7]; $caption = " \tWorksheet regression: " . $caption; _is_float( $got_1, $expected_1, $caption ); _is_float( $got_2, $expected_1, $caption ); ############################################################################### # # _is_float() # # Helper function for float comparison. This is mainly to prevent failing tests # on 64bit systems with extended doubles where the 128bit precision is compared # against Excel's 64bit precision. # sub _is_float { my ( $got, $expected, $caption ) = @_; my $max = 1; $max = abs($got) if abs($got) > $max; $max = abs($expected) if abs($expected) > $max; if ( abs( $got - $expected ) <= 1e-15 * $max ) { ok( 1, $caption ); } else { is( $got, $expected, $caption ); } } __END__ Spreadsheet-ParseExcel-0.58/t/06_regression.t 000644 000765 000024 00000020307 11260573025 021127 0 ustar 00John staff 000000 000000 #!/usr/bin/perl ############################################################################### # # A test for Spreadsheet::ParseExcel. # # Regression tests for Cell properties and methods. # # The tests are mainly in pairs where direct hash access (old methodology) # is tested along with the method calls (>= version 0.50 methodology). # # reverse(''), January 2009, John McNamara, jmcnamara@cpan.org # use strict; use warnings; use Spreadsheet::ParseExcel; use Test::More tests => 32; ############################################################################### # # Tests setup. # my $file = 't/excel_files/worksheet_01.xls'; my $parser = Spreadsheet::ParseExcel->new(); my $workbook = $parser->Parse($file); my $worksheet = $workbook->worksheet('Sheet3'); my $cell; my $format; my $got_1; my $got_2; my $expected_1; my $expected_2; my $caption; ############################################################################### # # Test 1, 2. Unformatted cell value. # $caption = "Test unformatted cell value"; $cell = $worksheet->get_cell( 2, 1 ); $expected_1 = 1; $got_1 = $cell->value(); $got_2 = $cell->Value(); $caption = " \tCell regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 3, 4. Unformatted cell value from a formatted cell. # $caption = "Test unformatted cell value from a formatted cell"; $cell = $worksheet->get_cell( 3, 1 ); $expected_1 = 40177; $got_1 = $cell->unformatted(); $got_2 = $cell->{Val}; $caption = " \tCell regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 5, 6. Formatted cell value. # $caption = "Test formatted cell value"; $cell = $worksheet->get_cell( 3, 1 ); $expected_1 = '2009/12/30'; $got_1 = $cell->value(); $got_2 = $cell->Value; $caption = " \tCell regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 7, 8. Cell format. # $caption = "Test cell format"; $cell = $worksheet->get_cell( 3, 1 ); $expected_1 = 170; $got_1 = $cell->get_format()->{FmtIdx}; $got_2 = $cell->{Format}->{FmtIdx};; $caption = " \tCell regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 9. Cell format. # $caption = "Test cell format string"; $cell = $worksheet->get_cell( 2, 1 ); $expected_1 = '@'; # TODO. Probably should be '' or 'general'. $got_1 = $workbook->{FmtClass}->FmtString( $cell, $workbook ); $caption = " \tCell regression: " . $caption; is( $got_1, $expected_1, $caption ); ############################################################################### # # Test 10. Cell format. # $caption = "Test cell format string"; $cell = $worksheet->get_cell( 3, 1 ); $expected_1 = 'yyyy/mm/dd'; $got_1 = $workbook->{FmtClass}->FmtString( $cell, $workbook ); $caption = " \tCell regression: " . $caption; is( $got_1, $expected_1, $caption ); ############################################################################### # # Test 11, 12. Cell type. # $caption = "Test cell type = Text"; $cell = $worksheet->get_cell( 2, 0 ); $expected_1 = 'Text'; $got_1 = $cell->type(); $got_2 = $cell->{Type}; $caption = " \tCell regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 13, 14. Cell type. # $caption = "Test cell type = Numeric"; $cell = $worksheet->get_cell( 2, 1 ); $expected_1 = 'Numeric'; $got_1 = $cell->type(); $got_2 = $cell->{Type}; $caption = " \tCell regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 15, 16. Cell type. # $caption = "Test cell type = Date"; $cell = $worksheet->get_cell( 3, 1 ); $expected_1 = 'Date'; $got_1 = $cell->type(); $got_2 = $cell->{Type}; $caption = " \tCell regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 17, 18. Cell string encoding. # $caption = "Test cell encoding = Ascii"; $cell = $worksheet->get_cell( 5, 0 ); $expected_1 = 1; $expected_2 = undef; $got_1 = $cell->encoding(); $got_2 = $cell->{Code}; $caption = " \tCell regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_2, $caption ); ############################################################################### # # Test 19, 20. Cell string encoding. # $caption = "Test cell encoding = Unicode"; $cell = $worksheet->get_cell( 5, 1 ); $expected_1 = 2; $expected_2 = 'ucs2'; $got_1 = $cell->encoding(); $got_2 = $cell->{Code}; $caption = " \tCell regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_2, $caption ); ############################################################################### # # Test 21, 22. Cell string encoding. # # Switch file to get native encoding from Excel 5 file. $file = 't/excel_files/Test95J.xls'; $parser = Spreadsheet::ParseExcel->new(); $workbook = $parser->Parse($file); $worksheet = $workbook->worksheet(0); $caption = "Test cell encoding = Native"; $cell = $worksheet->get_cell( 1, 0 ); $expected_1 = 3; $expected_2 = '_native_'; $got_1 = $cell->encoding(); $got_2 = $cell->{Code}; $caption = " \tCell regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_2, $caption ); # Switch back to main test worksheet. $file = 't/excel_files/worksheet_01.xls'; $parser = Spreadsheet::ParseExcel->new(); $workbook = $parser->Parse($file); $worksheet = $workbook->worksheet('Sheet3'); ############################################################################### # # Test 23, 24. Cell is un-merged. # $caption = "Test cell is un-merged"; $cell = $worksheet->get_cell( 6, 0 ); $expected_1 = undef; $got_1 = $cell->is_merged(); $got_2 = $cell->{Merged}; $caption = " \tCell regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 25, 26. Cell is merged. # $caption = "Test cell is merged"; $cell = $worksheet->get_cell( 7, 0 ); $expected_1 = 1; $got_1 = $cell->is_merged(); $got_2 = $cell->{Merged}; $caption = " \tCell regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 27, 28. Cell is merged. # $caption = "Test cell is merged"; $cell = $worksheet->get_cell( 7, 1 ); $expected_1 = 1; $got_1 = $cell->is_merged(); $got_2 = $cell->{Merged}; $caption = " \tCell regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 29, 30. Cell is merged. # $caption = "Test cell is merged"; $cell = $worksheet->get_cell( 7, 1 ); $expected_1 = 1; $got_1 = $cell->is_merged(); $got_2 = $cell->{Merged}; $caption = " \tCell regression: " . $caption; is( $got_1, $expected_1, $caption ); is( $got_2, $expected_1, $caption ); ############################################################################### # # Test 31, 32. Cell contains Rich Text. # $caption = "Test cell containing rich text"; $cell = $worksheet->get_cell( 8, 0 ); $expected_1 = [ 10, 14, 19 ]; $got_1 = $cell->get_rich_text(); $got_2 = $cell->{Rich}; $caption = " \tCell regression: " . $caption; # Just test the indices and not the font objects. $got_1 = [ map { $_->[0] } @$got_1 ]; $got_2 = [ map { $_->[0] } @$got_2 ]; is_deeply( $got_1, $expected_1, $caption ); is_deeply( $got_2, $expected_1, $caption ); __END__ Spreadsheet-ParseExcel-0.58/t/10_error_codes.t 000755 000765 000024 00000005272 11307754562 021270 0 ustar 00John staff 000000 000000 #!/usr/bin/perl -w ############################################################################### # # A test for Spreadsheet::ParseExcel. # # Tests for parse() error handling. # # reverse(''), August 2009, John McNamara, jmcnamara@cpan.org # use strict; use Spreadsheet::ParseExcel; use Test::More tests => 8; ############################################################################### # # Tests setup. # my $file; my $parser; my $workbook; my $got; my $caption; my $error_code; my $error_string; my $expected_code; my $expected_string; ############################################################################### # # Tests 1, 2. Normal file, no errors. # $caption = " \tError codes: Normal file"; $file = 't/excel_files/chart1.xls'; $parser = Spreadsheet::ParseExcel->new(); $workbook = $parser->Parse($file); $error_string = $parser->error(); $error_code = $parser->error_code(); $expected_code = 0; $expected_string = ''; is( $error_code, $expected_code, $caption ); is( $error_string, $expected_string, $caption ); ############################################################################### # # Tests 3, 4. Non existent file. # $caption = " \tError codes: Non existent file"; $file = 'file_doesnt_exist.xls'; $parser = Spreadsheet::ParseExcel->new(); $workbook = $parser->Parse($file); $error_string = $parser->error(); $error_code = $parser->error_code(); $expected_code = 1; $expected_string = 'File not found'; is( $error_code, $expected_code, $caption ); is( $error_string, $expected_string, $caption ); ############################################################################### # # Tests 5, 6. File with no Excel data. # $caption = " \tError codes:File with no Excel data"; $file = 't/00_basic.t'; $parser = Spreadsheet::ParseExcel->new(); $workbook = $parser->Parse($file); $error_string = $parser->error(); $error_code = $parser->error_code(); $expected_code = 2; $expected_string = 'No Excel data found in file'; is( $error_code, $expected_code, $caption ); is( $error_string, $expected_string, $caption ); ############################################################################### # # Tests 7, 8. Encrypted file. # $caption = " \tEncrypted file"; $file = 't/excel_files/encrypted.xls'; $parser = Spreadsheet::ParseExcel->new(); $workbook = $parser->Parse($file); $error_string = $parser->error(); $error_code = $parser->error_code(); $expected_code = 3; $expected_string = 'File is encrypted'; is( $error_code, $expected_code, $caption ); is( $error_string, $expected_string, $caption ); __END__ Spreadsheet-ParseExcel-0.58/t/20_number_format_default.t 000644 000765 000024 00000010264 11247565351 023320 0 ustar 00John staff 000000 000000 #!/usr/bin/perl -w ############################################################################### # # A test for Spreadsheet::ParseExcel. # # Tests for default number format handling using FmtExcel(). See note below. # # reverse('�'), January 2009, John McNamara, jmcnamara@cpan.org # use strict; use Spreadsheet::ParseExcel::Utility 'ExcelFmt'; use Test::More tests => 47; ############################################################################### # # Test cases for default Excel formats. The hex "Index" number is the internal # index used by Excel. The tests are sorted by category rather than index. # my @testcases = ( # No, Index,Number, Expected, Format string, TODO note (if any). [ 1, 0x00, 1234.567, '1234.567', 'General' ], [ 2, 0x01, 1234.567, '1235', '0' ], [ 3, 0x02, 1234.567, '1234.57', '0.00' ], [ 4, 0x03, 1234.567, '1,235', '#,##0' ], [ 5, 0x04, 1234.567, '1,234.57', '#,##0.00' ], [ 6, 0x05, 1234.567, '$1,235', '($#,##0_);($#,##0)' ], [ 7, 0x05, -1234.567, '-$1,235', '($#,##0_);($#,##0)' ], [ 8, 0x06, 1234.567, '$1,235', '($#,##0_);[Red]($#,##0)' ], [ 9, 0x06, -1234.567, '-$1,235', '($#,##0_);[Red]($#,##0)' ], [ 10, 0x07, 1234.567, '$1,234.57', '($#,##0.00_);($#,##0.00)' ], [ 11, 0x07, -1234.567, '-$1,234.57', '($#,##0.00_);($#,##0.00)' ], [ 12, 0x08, 1234.567, '$1,234.57', '($#,##0.00_);[Red]($#,##0.00)' ], [ 13, 0x08, -1234.567, '-$1,234.57', '($#,##0.00_);[Red]($#,##0.00)' ], [ 14, 0x25, 1234.567, '1,235', '(#,##0_);(#,##0)' ], [ 15, 0x25, -1234.567, '-1,235', '(#,##0_);(#,##0)' ], [ 16, 0x26, 1234.567, '1,235', '(#,##0_);[Red](#,##0)' ], [ 17, 0x26, -1234.567, '-1,235', '(#,##0_);[Red](#,##0)' ], [ 18, 0x27, 1234.567, '1,234.57', '(#,##0.00_);(#,##0.00)' ], [ 19, 0x27, -1234.567, '-1,234.57', '(#,##0.00_);(#,##0.00)' ], [ 20, 0x28, 1234.567, '1,234.57', '(#,##0.00_);[Red](#,##0.00)' ], [ 21, 0x28, -1234.567, '-1,234.57', '(#,##0.00_);[Red](#,##0.00)' ], [ 22, 0x29, 1234.567, '1,235', '_(* #,##0_);_(* (#,##0);_(* "-"_);_(@_)' ], [ 23, 0x29, -1234.567, '-1,235', '_(* #,##0_);_(* (#,##0);_(* "-"_);_(@_)' ], [ 24, 0x2A, 1234.567, '$ 1,235', '_($* #,##0_);_($* (#,##0);_($* "-"_);_(@_)' ], [ 25, 0x2A, -1234.567, '-$ 1,235', '_($* #,##0_);_($* (#,##0);_($* "-"_);_(@_)' ], [ 26, 0x2B, 1234.567, '1,234.57', '_(* #,##0.00_);_(* (#,##0.00);_(* "-"??_);_(@_)' ], [ 27, 0x2B, -1234.567, '- 1,234.57', '_(* #,##0.00_);_(* (#,##0.00);_(* "-"??_);_(@_)', 'TODO: Minor difference.' ], [ 28, 0x2C, 1234.567, '$ 1,234.57', '_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)' ], [ 29, 0x0E, 37653.521, '2/1/03', 'm/d/yy' ], [ 30, 0x0F, 37653.521, '1-Feb-03', 'd-mmm-yy' ], [ 31, 0x10, 37653.521, '1-Feb', 'd-mmm' ], [ 32, 0x11, 37653.521, 'Feb-03', 'mmm-yy' ], [ 33, 0x12, 37653.521, '12:30 PM', 'h:mm AM/PM' ], [ 34, 0x13, 37653.521, '12:30:14 PM', 'h:mm:ss AM/PM' ], [ 35, 0x14, 37653.521, '12:30', 'h:mm' ], [ 36, 0x15, 37653.521, '12:30:14', 'h:mm:ss' ], [ 37, 0x16, 37653.521, '2/1/03 12:30', 'm/d/yy h:mm' ], [ 38, 0x2D, 37653.521, '30:14', 'mm:ss' ], [ 39, 0x2E, 3.0141204, '72:20:20', '[h]:mm:ss'], [ 40, 0x2F, 37653.521, '30:14.4', 'mm:ss.0' ], [ 41, 0x30, 1234.567, '1.2E+3', '##0.0E+0' ], [ 42, 0x31, 1234.567, '1234.567', '@' ], [ 43, 0x09, 0.567, '57%', '0%' ], [ 44, 0x0A, 0.567, '56.70%', '0.00%' ], [ 45, 0x0B, 1234.567, '1.23E+03', '0.00E+00' ], [ 46, 0x0C, 0.75, '3/4', '# ?/?' ], [ 47, 0x0D, 0.3125, '5/16', '# ??/??' ], ); ############################################################################### # # Run tests. # for my $test_ref (@testcases) { my $number = $test_ref->[2]; my $expected = $test_ref->[3]; my $format = $test_ref->[4]; my $got = ExcelFmt( $format, $number ); local $TODO = $test_ref->[5] if defined $test_ref->[5]; is( $got, $expected, " \tFormat = $format" ); } __END__ Spreadsheet-ParseExcel-0.58/t/21_number_format_user.t 000644 000765 000024 00000020103 11435052055 022633 0 ustar 00John staff 000000 000000 #!/usr/bin/perl -w ############################################################################### # # A test for Spreadsheet::ParseExcel. # # Tests for number format handling using FmtExcel(). See note below. # # reverse('�'), January 2009, John McNamara, jmcnamara@cpan.org # use strict; use Spreadsheet::ParseExcel::Utility qw( ExcelFmt LocaltimeExcel ); use Test::More tests => 142; my $is_1904 = 1; ############################################################################### # # Test cases for special cases or user supplied format issues. # my @testcases = ( # No, Number, Expected, Format string, Todo # Test for invalid 12-hour clock values. # http://rt.cpan.org/Public/Bug/Display.html?id=41192 [ 1, 0.01023148, '12:14:44 AM', 'hh:mm:ss AM/PM' ], [ 2, 0.01024306, '12:14:45 AM', 'hh:mm:ss AM/PM' ], [ 3, 0.01025463, '12:14:46 AM', 'hh:mm:ss AM/PM' ], # Tests for upper case formats from OpenOffice.org. # http://rt.cpan.org/Public/Bug/Display.html?id=20526 # http://rt.cpan.org/Public/Bug/Display.html?id=31206 # http://rt.cpan.org/Public/Bug/Display.html?id=40307 [ 4, 37653.521, '2/1/03', 'M/D/YY' ], [ 5, 37653.521, '02/01/2003', 'MM/DD/YYYY' ], [ 6, 37653.521, '01/02/2003', 'DD/MM/YYYY' ], [ 7, 37653.521, '20030201', 'YYYYMMDD' ], [ 8, 37653.521, '2003-02-01', 'YYYY-MM-DD' ], [ 9, 0.01023148, '12:14:44 AM', 'HH:MM:SS AM/PM' ], # Tests for overflow hours and minutes formats. [ 10, 0.4, '9:36:00', '[h]:mm:ss' ], [ 11, 1.4, '33:36:00', '[h]:mm:ss' ], [ 12, 2.4, '57:36:00', '[h]:mm:ss' ], [ 13, 0.6, '14:24:00', '[h]:mm:ss' ], [ 14, 1.6, '38:24:00', '[h]:mm:ss' ], [ 15, 2.6, '62:24:00', '[h]:mm:ss' ], [ 16, 0.4, 9, '[h]' ], [ 17, 1.4, 33, '[h]' ], [ 18, 2.4, 57, '[h]' ], [ 19, 0.4, 576, '[mm]' ], [ 20, 1.4, 2016, '[mm]' ], [ 21, 2.4, 3456, '[mm]' ], # Formats that don't overflow. Counter examples of the above. [ 22, 0.4, '9:36:00', 'h:mm:ss' ], [ 23, 1.4, '9:36:00', 'h:mm:ss' ], [ 24, 2.4, '9:36:00', 'h:mm:ss' ], [ 25, 0.6, '14:24:00', 'h:mm:ss' ], [ 26, 1.6, '14:24:00', 'h:mm:ss' ], [ 27, 2.6, '14:24:00', 'h:mm:ss' ], # Test for the examples in the Utility.pm docs. [ 28, 1234.567, '$1,234.57', '$#,##0.00' ], [ 29, 36892.521, '1 Jan 2001 12:30 PM', 'd mmm yyyy h:mm AM/PM' ], [ 30, LocaltimeExcel( 0, 0, 0, 1, 0, 101 ), '1 Jan 2001', 'd mmm yyyy' ], # Tests for locale in format string. # http://rt.cpan.org/Public/Bug/Display.html?id=43638 [ 31, 39814, '1/1/09', 'm/d/yy;@' ], [ 32, 39845, '2/1/09', 'm/d/yy;@' ], [ 33, 39814, 'Jan-09', '[$-409]mmm-yy' ], [ 34, 39845, 'Feb-09', '[$-409]mmm-yy' ], # Tests for three part format strings. # http://rt.cpan.org/Public/Bug/Display.html?id=45009 [ 35, 5, '5.00', '0.00;(0.0);0%' ], [ 36, 0, '0%', '0.00;(0.0);0%' ], [ 37, -3, '-3.0', '0.00;(0.0);0%' ], # Tests for ignoring of all dots except the first in format strings. # http://rt.cpan.org/Public/Bug/Display.html?id=45502 [ 38, 3.5008, '3.5008 oz.', '#.####\ \o\z.' ], [ 39, 3.5008, '3.5.0.0.8', '#.#.#.#.#' ], # Tests for rounding. # http://rt.cpan.org/Public/Bug/Display.html?id=45626 [ 40, 0.05, '0.1', '0.0' ], [ 41, 0.15, '0.2', '0.0' ], [ 42, 0.25, '0.3', '0.0' ], [ 43, 0.35, '0.4', '0.0' ], [ 44, 0.45, '0.5', '0.0' ], [ 45, 0.55, '0.6', '0.0' ], [ 46, 0.65, '0.7', '0.0' ], [ 47, 0.75, '0.8', '0.0' ], [ 48, 0.85, '0.9', '0.0' ], [ 49, 0.95, '1.0', '0.0' ], [ 50, 0.005, '0.01', '0.00' ], [ 51, 0.015, '0.02', '0.00' ], [ 52, 0.025, '0.03', '0.00' ], [ 53, 0.035, '0.04', '0.00' ], [ 54, 0.045, '0.05', '0.00' ], [ 55, 0.055, '0.06', '0.00' ], [ 56, 0.065, '0.07', '0.00' ], [ 57, 0.075, '0.08', '0.00' ], [ 58, 0.085, '0.09', '0.00' ], [ 59, 0.095,, '0.10', '0.00' ], [ 60, 0.0005, '0.001', '0.000' ], [ 61, 0.0015, '0.002', '0.000' ], [ 62, 0.0025, '0.003', '0.000' ], [ 63, 0.0035, '0.004', '0.000' ], [ 64, 0.0045, '0.005', '0.000' ], [ 65, 0.0055, '0.006', '0.000' ], [ 66, 0.0065, '0.007', '0.000' ], [ 67, 0.0075, '0.008', '0.000' ], [ 68, 0.0085, '0.009', '0.000' ], [ 69, 0.0095, '0.010', '0.000' ], [ 70, 0.0005, '0.0005', '0.0000' ], [ 71, 0.0015, '0.0015', '0.0000' ], [ 72, 0.0025, '0.0025', '0.0000' ], [ 73, 0.0035, '0.0035', '0.0000' ], [ 74, 0.0045, '0.0045', '0.0000' ], [ 75, 0.0055, '0.0055', '0.0000' ], [ 76, 0.0065, '0.0065', '0.0000' ], [ 77, 0.0075, '0.0075', '0.0000' ], [ 78, 0.0085, '0.0085', '0.0000' ], [ 79, 0.0095, '0.0095', '0.0000' ], # Tests for valid dates. # http://rt.cpan.org/Public/Bug/Display.html?id=48831 [ 80, 2958465, '31/12/9999', 'dd/mm/yyyy' ], [ 81, 2958466, '2958466', 'dd/mm/yyyy' ], [ 82, 4030433048023, '4030433048023', 'dd/mm/yyyy' ], [ 83, -1, '-1', 'dd/mm/yyyy' ], [ 84, 2957003, '31/12/9999', 'dd/mm/yyyy', undef, $is_1904 ], [ 85, 2957004, '2957004', 'dd/mm/yyyy', undef, $is_1904], # Tests for real names for days and months. [ 86, 36528, 'Mon', 'ddd' ], [ 87, 36529, 'Tue', 'ddd' ], [ 88, 36530, 'Wed', 'ddd' ], [ 89, 36531, 'Thu', 'ddd' ], [ 90, 36532, 'Fri', 'ddd' ], [ 91, 36533, 'Sat', 'ddd' ], [ 92, 36534, 'Sun', 'ddd' ], [ 93, 36535, 'Monday', 'dddd' ], [ 94, 36536, 'Tuesday', 'dddd' ], [ 95, 36537, 'Wednesday', 'dddd' ], [ 96, 36538, 'Thursday', 'dddd' ], [ 97, 36539, 'Friday', 'dddd' ], [ 98, 36540, 'Saturday', 'dddd' ], [ 99, 36541, 'Sunday', 'dddd' ], [ 100, 36526, 'Jan', 'mmm' ], [ 101, 36557, 'Feb', 'mmm' ], [ 102, 36586, 'Mar', 'mmm' ], [ 103, 36617, 'Apr', 'mmm' ], [ 104, 36647, 'May', 'mmm' ], [ 105, 36678, 'Jun', 'mmm' ], [ 106, 36708, 'Jul', 'mmm' ], [ 107, 36739, 'Aug', 'mmm' ], [ 108, 36770, 'Sep', 'mmm' ], [ 109, 36800, 'Oct', 'mmm' ], [ 110, 36831, 'Nov', 'mmm' ], [ 111, 36861, 'Dec', 'mmm' ], [ 112, 36526, 'January', 'mmmm' ], [ 113, 36557, 'February', 'mmmm' ], [ 114, 36586, 'March', 'mmmm' ], [ 115, 36617, 'April', 'mmmm' ], [ 116, 36647, 'May', 'mmmm' ], [ 117, 36678, 'June', 'mmmm' ], [ 118, 36708, 'July', 'mmmm' ], [ 119, 36739, 'August', 'mmmm' ], [ 120, 36770, 'September', 'mmmm' ], [ 121, 36800, 'October', 'mmmm' ], [ 122, 36831, 'November', 'mmmm' ], [ 123, 36861, 'December', 'mmmm' ], [ 124, 36526, 'J', 'mmmmm' ], [ 125, 36557, 'F', 'mmmmm' ], [ 126, 36586, 'M', 'mmmmm' ], [ 127, 36617, 'A', 'mmmmm' ], [ 128, 36647, 'M', 'mmmmm' ], [ 129, 36678, 'J', 'mmmmm' ], [ 130, 36708, 'J', 'mmmmm' ], [ 131, 36739, 'A', 'mmmmm' ], [ 132, 36770, 'S', 'mmmmm' ], [ 133, 36800, 'O', 'mmmmm' ], [ 134, 36831, 'N', 'mmmmm' ], [ 135, 36861, 'D', 'mmmmm' ], [ 136, 1, 'Sun', 'ddd' ], [ 137, 127, 'Sun', 'ddd' ], [ 138, 36898, 'Sun', 'ddd' ], [ 139, 2958103,'Sun', 'ddd' ], # http://rt.cpan.org/Public/Bug/Display.html?id=60547 [ 140, 27400, '$27,400.00', '[$$-409]#,##0.00' ], [ 141, 826331.94, '826,331.94 руб.', '#,##0.00\ [$руб.-419]' ], [ 142, 826331.94, '826,331.94 RUR', '#,##0.00\ [$RUR]' ], ); ############################################################################### # # Run tests. # for my $test_ref (@testcases) { my $number = $test_ref->[1]; my $expected = $test_ref->[2]; my $format = $test_ref->[3]; my $is_1904 = $test_ref->[5]; my $got = ExcelFmt( $format, $number, $is_1904 ); local $TODO = $test_ref->[4] if defined $test_ref->[4]; is( $got, $expected, " \t$number\t+ '$format'\t= $got" ); } __END__ Spreadsheet-ParseExcel-0.58/t/22_number_format_datetime.t 000644 000765 000024 00000054426 11247565351 023502 0 ustar 00John staff 000000 000000 #!/usr/bin/perl -w ############################################################################### # # A test for Spreadsheet::ParseExcel. # # Tests for date and time number format handling using FmtExcel(). # # reverse('�'), January 2009, John McNamara, jmcnamara@cpan.org # use strict; use Spreadsheet::ParseExcel::Utility 'ExcelFmt'; use Test::More tests => 102; ############################################################################## # # Test the time data generated in Excel. # while () { last if /^# stop/; # For debugging next unless /\S/; # Ignore blank lines next if /^#/; # Ignore comments if (/"DateTime">([^<]+)/) { my $date_time = $1; my $line = ; if ($line =~ /"Number">([^<]+)/) { my $number = 0 + $1; my $result = ExcelFmt('yyyy-mm-ddThh:mm:ss.000', $number); is($result, $date_time, " \tDate/Time: $date_time"); } } } __DATA__ # Test data taken from Excel in XML format. # Note. In the first Cell the date has been changed manually from 1899-12-31 to # 1900-01-00 for the sake of testing. These values are substantively the same.