├── .gitattributes
├── .gitignore
├── .gitmodules
├── LICENSE
├── README.md
├── bin
└── as3-xlsx-reader.swc
├── documentation
├── AC_OETags.js
├── LoadXLSXExample.html
├── Main.html
├── all-classes.html
├── all-index-A.html
├── all-index-B.html
├── all-index-C.html
├── all-index-D.html
├── all-index-E.html
├── all-index-F.html
├── all-index-G.html
├── all-index-H.html
├── all-index-I.html
├── all-index-J.html
├── all-index-K.html
├── all-index-L.html
├── all-index-M.html
├── all-index-N.html
├── all-index-O.html
├── all-index-P.html
├── all-index-Q.html
├── all-index-R.html
├── all-index-S.html
├── all-index-T.html
├── all-index-U.html
├── all-index-V.html
├── all-index-W.html
├── all-index-X.html
├── all-index-Y.html
├── all-index-Z.html
├── asdoc.js
├── class-list.html
├── class-summary.html
├── com
│ ├── childoftv
│ │ └── xlsxreader
│ │ │ ├── Worksheet.html
│ │ │ ├── XLSXLoader.html
│ │ │ ├── class-list.html
│ │ │ └── package-detail.html
│ └── deng
│ │ ├── fzip
│ │ ├── FZip.html
│ │ ├── FZipErrorEvent.html
│ │ ├── FZipEvent.html
│ │ ├── FZipFile.html
│ │ ├── FZipLibrary.html
│ │ ├── class-list.html
│ │ └── package-detail.html
│ │ └── utils
│ │ ├── ChecksumUtil.html
│ │ ├── class-list.html
│ │ └── package-detail.html
├── cookies.js
├── help.js
├── images
│ ├── AirIcon12x12.gif
│ ├── P_AlternativeMetadataIndicator_30x28_N.png
│ ├── collapsed.gif
│ ├── detailHeaderRule.jpg
│ ├── detailSectionHeader.jpg
│ ├── expanded.gif
│ ├── inherit-arrow.gif
│ ├── inheritedSummary.gif
│ ├── logo.jpg
│ ├── titleTableBottom.jpg
│ ├── titleTableMiddle.jpg
│ └── titleTableTop.jpg
├── index-list.html
├── index.html
├── override.css
├── package-detail.html
├── package-frame.html
├── package-list.html
├── package-summary.html
├── print.css
├── style.css
└── title-bar.html
├── projects
├── as3-xlsx-reader-example
│ ├── .actionScriptProperties
│ ├── .project
│ ├── assets
│ │ └── Example Spreadsheet.xlsx
│ └── src
│ │ ├── LoadXLSXExample-app.xml
│ │ └── LoadXLSXExample.as
└── as3-xlsx-reader
│ ├── .actionScriptProperties
│ ├── .flexLibProperties
│ └── .project
└── src
└── com
└── childoftv
└── xlsxreader
├── Worksheet.as
├── XLSXLoader.as
└── XLSXUtils.as
/.gitattributes:
--------------------------------------------------------------------------------
1 | *.swf -crlf -diff -merge
2 | *.swc -crlf -diff -merge
3 | *.xlsx binary
4 | * text=auto
5 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .settings/
2 | bin-debug/
3 | *.swf
4 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "libs/fzip"]
2 | path = libs/fzip
3 | url = https://github.com/claus/fzip
4 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | /*
2 | MIT LICENSE:
3 | http://www.opensource.org/licenses/mit-license.php
4 |
5 | Copyright (c) 2011 Ben Morrow
6 |
7 | Permission is hereby granted, free of charge, to any person obtaining a copy
8 | of this software and associated documentation files (the "Software"), to deal
9 | in the Software without restriction, including without limitation the rights
10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | copies of the Software, and to permit persons to whom the Software is
12 | furnished to do so, subject to the following conditions:
13 |
14 | The above copyright notice and this permission notice shall be included in
15 | all copies or substantial portions of the Software.
16 |
17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 | THE SOFTWARE.
24 | */
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | #AS3 (Actionscript 3) XLSX READER
2 |
3 | A reader for excel files in Flash, Flex and Air
4 |
5 | Copyright (c) 2011 Ben Morrow
6 |
7 |
8 |
9 | ##Usage
10 |
11 | ###Easy
12 |
13 | Just add the [swc](bin/as3-xlsx-reader.swc) to your library path
14 |
15 | ###Advanced (for modifying source/building your own)
16 |
17 | 1. Clone master e.g. `git clone git@github.com:childoftv/as3-xlsx-reader.git`
18 | 2. `cd as3-xlsx-reader`
19 | 3. Fetch [Fzip](https://github.com/claus/fzip) using `git submodule foreach git pull origin master`
20 | 4. Now open the projects in the [projects](projects) directories.
21 |
22 | [as3-xlsx-reader](projects/as3-xlsx-reader) is a library project which can be used to build the core (outputs to [bin](bin) folder)
23 |
24 | [as3-xlsx-reader-example](projects/as3-xlsx-reader-example) is an adobe air project which can build a quick example
25 |
26 | ####command line compilation using [Flex SDK](http://www.adobe.com/devnet/flex/flex-sdk-download.html)
27 |
28 | 1. `cd as3-xlsx-reader`
29 | 2. Build the library: `compc -include-sources=src -library-path=libs/fzip/bin/fzip.swc -output bin/as3-xlsx-reader.swc``
30 | 3. Build the Example: `mxmlc -source-path=projects/as3-xlsx-reader-example/src/ -library-path=bin/as3-xlsx-reader.swc -static-link-runtime-shared-libraries=true -use-network=false -debug=true -output=projects/as3-xlsx-reader-example/bin-debug/LoadXLSXExample.swf projects/as3-xlsx-reader-example/src/LoadXLSXExample.as`
31 | 4. Copy the Spreadsheet to the debug folder: `cp projects/as3-xlsx-reader-example/assets/*.xlsx projects/as3-xlsx-reader-example/bin-debug/`
32 | 5. run with fdb: `fdb projects/as3-xlsx-reader-example/bin-debug/LoadXLSXExample.swf`
33 | 6. type `continue` for output
34 |
35 |
36 | ##Example
37 |
38 | Look at [LoadXLSXExample.as](projects/as3-xlsx-reader-example/src/LoadXLSXExample.as) for an example that can be used from flash, flex or with adobe air.
39 |
40 |
41 | ##LICENSE:
42 |
43 | Released under [MIT LICENSE](LICENSE)
44 |
--------------------------------------------------------------------------------
/bin/as3-xlsx-reader.swc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/childoftv/as3-xlsx-reader/156cadbfb60649383deb79756c44b2a635219df9/bin/as3-xlsx-reader.swc
--------------------------------------------------------------------------------
/documentation/AC_OETags.js:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // ADOBE SYSTEMS INCORPORATED
4 | // Copyright 2008 Adobe Systems Incorporated
5 | // All Rights Reserved.
6 | //
7 | // NOTICE: Adobe permits you to use, modify, and distribute this file
8 | // in accordance with the terms of the license agreement accompanying it.
9 | //
10 | ////////////////////////////////////////////////////////////////////////////////
11 |
12 |
13 | //v1.0
14 | function AC_AddExtension(src, ext)
15 | {
16 | if (src.indexOf('?') != -1)
17 | return src.replace(/\?/, ext+'?');
18 | else
19 | return src + ext;
20 | }
21 |
22 | function AC_Generateobj(objAttrs, params, embedAttrs)
23 | {
24 | var str = '';
28 | for (var i in params)
29 | str += ' ';
30 | str += ' ';
34 |
35 | document.write(str);
36 | }
37 |
38 | function AC_FL_RunContent(){
39 | var ret =
40 | AC_GetArgs
41 | ( arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
42 | , "application/x-shockwave-flash"
43 | );
44 | AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
45 | }
46 |
47 | function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
48 | var ret = new Object();
49 | ret.embedAttrs = new Object();
50 | ret.params = new Object();
51 | ret.objAttrs = new Object();
52 | for (var i=0; i < args.length; i=i+2){
53 | var currArg = args[i].toLowerCase();
54 |
55 | switch (currArg){
56 | case "classid":
57 | break;
58 | case "pluginspage":
59 | ret.embedAttrs[args[i]] = args[i+1];
60 | break;
61 | case "src":
62 | case "movie":
63 | args[i+1] = AC_AddExtension(args[i+1], ext);
64 | ret.embedAttrs["src"] = args[i+1];
65 | ret.params[srcParamName] = args[i+1];
66 | break;
67 | case "onafterupdate":
68 | case "onbeforeupdate":
69 | case "onblur":
70 | case "oncellchange":
71 | case "onclick":
72 | case "ondblClick":
73 | case "ondrag":
74 | case "ondragend":
75 | case "ondragenter":
76 | case "ondragleave":
77 | case "ondragover":
78 | case "ondrop":
79 | case "onfinish":
80 | case "onfocus":
81 | case "onhelp":
82 | case "onmousedown":
83 | case "onmouseup":
84 | case "onmouseover":
85 | case "onmousemove":
86 | case "onmouseout":
87 | case "onkeypress":
88 | case "onkeydown":
89 | case "onkeyup":
90 | case "onload":
91 | case "onlosecapture":
92 | case "onpropertychange":
93 | case "onreadystatechange":
94 | case "onrowsdelete":
95 | case "onrowenter":
96 | case "onrowexit":
97 | case "onrowsinserted":
98 | case "onstart":
99 | case "onscroll":
100 | case "onbeforeeditfocus":
101 | case "onactivate":
102 | case "onbeforedeactivate":
103 | case "ondeactivate":
104 | case "type":
105 | case "codebase":
106 | ret.objAttrs[args[i]] = args[i+1];
107 | break;
108 | case "width":
109 | case "height":
110 | case "align":
111 | case "vspace":
112 | case "hspace":
113 | case "class":
114 | case "title":
115 | case "accesskey":
116 | case "name":
117 | case "id":
118 | case "tabindex":
119 | ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
120 | break;
121 | default:
122 | ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
123 | }
124 | }
125 | ret.objAttrs["classid"] = classid;
126 | if (mimeType) ret.embedAttrs["type"] = mimeType;
127 | return ret;
128 | }
129 |
130 |
--------------------------------------------------------------------------------
/documentation/LoadXLSXExample.html:
--------------------------------------------------------------------------------
1 |
LoadXLSXExample
6 | Public Methods
Method Defined By
LoadXLSXExample
public var excel_loader:XLSXLoader
public function LoadXLSXExample()
Mon Jan 31 2011, 02:03 PM -08:00
--------------------------------------------------------------------------------
/documentation/Main.html:
--------------------------------------------------------------------------------
1 | Main
6 |
Sun Jan 30 2011, 06:27 PM -08:00
--------------------------------------------------------------------------------
/documentation/all-classes.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | All Classes - as3-xlsx-reader
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/documentation/all-index-B.html:
--------------------------------------------------------------------------------
1 | B
6 |
Mon Jan 31 2011, 02:03 PM -08:00
--------------------------------------------------------------------------------
/documentation/all-index-E.html:
--------------------------------------------------------------------------------
1 | E
6 |
Mon Jan 31 2011, 02:03 PM -08:00
--------------------------------------------------------------------------------
/documentation/all-index-J.html:
--------------------------------------------------------------------------------
1 | J
6 |
Mon Jan 31 2011, 02:03 PM -08:00
--------------------------------------------------------------------------------
/documentation/all-index-K.html:
--------------------------------------------------------------------------------
1 | K
6 |
Mon Jan 31 2011, 02:03 PM -08:00
--------------------------------------------------------------------------------
/documentation/all-index-M.html:
--------------------------------------------------------------------------------
1 | M
6 |
Mon Jan 31 2011, 02:03 PM -08:00
--------------------------------------------------------------------------------
/documentation/all-index-N.html:
--------------------------------------------------------------------------------
1 | N
6 |
Mon Jan 31 2011, 02:03 PM -08:00
--------------------------------------------------------------------------------
/documentation/all-index-O.html:
--------------------------------------------------------------------------------
1 | O
6 |
Mon Jan 31 2011, 02:03 PM -08:00
--------------------------------------------------------------------------------
/documentation/all-index-Q.html:
--------------------------------------------------------------------------------
1 | Q
6 |
Mon Jan 31 2011, 02:03 PM -08:00
--------------------------------------------------------------------------------
/documentation/all-index-R.html:
--------------------------------------------------------------------------------
1 | R
6 |
Mon Jan 31 2011, 02:03 PM -08:00
--------------------------------------------------------------------------------
/documentation/all-index-U.html:
--------------------------------------------------------------------------------
1 | U
6 |
Mon Jan 31 2011, 02:03 PM -08:00
--------------------------------------------------------------------------------
/documentation/all-index-V.html:
--------------------------------------------------------------------------------
1 | V
6 |
Mon Jan 31 2011, 02:03 PM -08:00
--------------------------------------------------------------------------------
/documentation/all-index-W.html:
--------------------------------------------------------------------------------
1 | W
6 |
Mon Jan 31 2011, 02:03 PM -08:00
--------------------------------------------------------------------------------
/documentation/all-index-X.html:
--------------------------------------------------------------------------------
1 | X
6 |
Mon Jan 31 2011, 02:03 PM -08:00
--------------------------------------------------------------------------------
/documentation/all-index-Y.html:
--------------------------------------------------------------------------------
1 | Y
6 |
Mon Jan 31 2011, 02:03 PM -08:00
--------------------------------------------------------------------------------
/documentation/all-index-Z.html:
--------------------------------------------------------------------------------
1 | Z
6 |
Mon Jan 31 2011, 02:03 PM -08:00
--------------------------------------------------------------------------------
/documentation/class-list.html:
--------------------------------------------------------------------------------
1 | __Global__ - as3-xlsx-reader
--------------------------------------------------------------------------------
/documentation/class-summary.html:
--------------------------------------------------------------------------------
1 | All Classes
6 | Documentation for classes includes syntax, usage information, and code samples for methods, properties, and event handlers and listeners for those APIs that belong to a specific class in ActionScript. The classes are listed alphabetically. If you are not sure to which class a certain method or property belongs, you can look it up in the Index.
Mon Jan 31 2011, 02:03 PM -08:00
--------------------------------------------------------------------------------
/documentation/com/childoftv/xlsxreader/class-list.html:
--------------------------------------------------------------------------------
1 | com.childoftv.xlsxreader - as3-xlsx-reader
--------------------------------------------------------------------------------
/documentation/com/childoftv/xlsxreader/package-detail.html:
--------------------------------------------------------------------------------
1 | com.childoftv.xlsxreader Summary
6 | Classes
Class Description Worksheet
14 | A wrapper class for an individual XLSX Worksheet loaded through an XLSXLoader object
15 | Instances of this class are created by the XLSX.worksheet function. XLSXLoader
16 | A class to load a Microsoft Excel 2007+ .XLSX Spreadsheet (described here: http://en.wikipedia.org/wiki/Office_Open_XML)
17 |
18 |
19 |
20 |
Mon Jan 31 2011, 02:03 PM -08:00
--------------------------------------------------------------------------------
/documentation/com/deng/fzip/class-list.html:
--------------------------------------------------------------------------------
1 | com.deng.fzip - as3-xlsx-reader
--------------------------------------------------------------------------------
/documentation/com/deng/fzip/package-detail.html:
--------------------------------------------------------------------------------
1 | com.deng.fzip Summary
6 | Classes
Class Description FZip
14 | Loads and parses ZIP archives. FZipErrorEvent
15 | FZip dispatches FZipErrorEvent objects when it encounters
16 | errors while parsing the ZIP archive. FZipEvent
17 | FZip dispatches FZipEvent objects when a file contained in the
18 | ZIP archive has finished loading and can be accessed. FZipFile
19 | Represents a file contained in a ZIP archive. FZipLibrary
20 | FZipLibrary works with a FZip instance to load files as
21 | usable instances, like a DisplayObject or BitmapData.
Mon Jan 31 2011, 02:03 PM -08:00
--------------------------------------------------------------------------------
/documentation/com/deng/utils/ChecksumUtil.html:
--------------------------------------------------------------------------------
1 | com.deng.utils.ChecksumUtil
6 | Public Methods
Method Defined By Adler32 (data:ByteArray, start:uint = 0, len:uint = 0):uint
[static]
14 | Calculates an Adler-32 checksum over a ByteArray
15 |
16 |
ChecksumUtil CRC32 (data:ByteArray, start:uint = 0, len:uint = 0):uint
[static]
17 | Calculates a CRC-32 checksum over a ByteArray
18 |
19 |
ChecksumUtil
public static function Adler32(data:ByteArray, start:uint = 0, len:uint = 0):uint
22 | Calculates an Adler-32 checksum over a ByteArray
23 |
24 |
Parameters
data :ByteArray
start :uint
(default = 0
)
len :uint
(default = 0
)
Returns uint
— Adler-32 checksum
25 |
See also
public static function CRC32(data:ByteArray, start:uint = 0, len:uint = 0):uint
26 | Calculates a CRC-32 checksum over a ByteArray
27 |
28 |
Parameters
data :ByteArray
start :uint
(default = 0
)
len :uint
(default = 0
)
Returns uint
— CRC-32 checksum
29 |
See also
Mon Jan 31 2011, 02:03 PM -08:00
--------------------------------------------------------------------------------
/documentation/com/deng/utils/class-list.html:
--------------------------------------------------------------------------------
1 | com.deng.utils - as3-xlsx-reader
--------------------------------------------------------------------------------
/documentation/com/deng/utils/package-detail.html:
--------------------------------------------------------------------------------
1 | com.deng.utils Summary
6 | Classes
Mon Jan 31 2011, 02:03 PM -08:00
--------------------------------------------------------------------------------
/documentation/cookies.js:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // ADOBE SYSTEMS INCORPORATED
4 | // Copyright 2006-2008 Adobe Systems Incorporated
5 | // All Rights Reserved.
6 | //
7 | // NOTICE: Adobe permits you to use, modify, and distribute this file
8 | // in accordance with the terms of the license agreement accompanying it.
9 | //
10 | ////////////////////////////////////////////////////////////////////////////////
11 |
12 | /**
13 | * Read the JavaScript cookies tutorial at:
14 | * http://www.netspade.com/articles/javascript/cookies.xml
15 | */
16 |
17 | /**
18 | * Sets a Cookie with the given name and value.
19 | *
20 | * name Name of the cookie
21 | * value Value of the cookie
22 | * [expires] Expiration date of the cookie (default: end of current session)
23 | * [path] Path where the cookie is valid (default: path of calling document)
24 | * [domain] Domain where the cookie is valid
25 | * (default: domain of calling document)
26 | * [secure] Boolean value indicating if the cookie transmission requires a
27 | * secure transmission
28 | */
29 | function setCookie(name, value, expires, path, domain, secure)
30 | {
31 | document.cookie= name + "=" + escape(value) +
32 | ((expires) ? "; expires=" + expires.toGMTString() : "") +
33 | ((path) ? "; path=" + path : "") +
34 | ((domain) ? "; domain=" + domain : "") +
35 | ((secure) ? "; secure" : "");
36 | }
37 |
38 | /**
39 | * Gets the value of the specified cookie.
40 | *
41 | * name Name of the desired cookie.
42 | *
43 | * Returns a string containing value of specified cookie,
44 | * or null if cookie does not exist.
45 | */
46 | function getCookie(name)
47 | {
48 | var dc = document.cookie;
49 | var prefix = name + "=";
50 | var begin = dc.indexOf("; " + prefix);
51 | if (begin == -1)
52 | {
53 | begin = dc.indexOf(prefix);
54 | if (begin != 0) return null;
55 | }
56 | else
57 | {
58 | begin += 2;
59 | }
60 | var end = document.cookie.indexOf(";", begin);
61 | if (end == -1)
62 | {
63 | end = dc.length;
64 | }
65 | return unescape(dc.substring(begin + prefix.length, end));
66 | }
67 |
68 | /**
69 | * Deletes the specified cookie.
70 | *
71 | * name name of the cookie
72 | * [path] path of the cookie (must be same as path used to create cookie)
73 | * [domain] domain of the cookie (must be same as domain used to create cookie)
74 | */
75 | function deleteCookie(name, path, domain)
76 | {
77 | if (getCookie(name))
78 | {
79 | document.cookie = name + "=" +
80 | ((path) ? "; path=" + path : "") +
81 | ((domain) ? "; domain=" + domain : "") +
82 | "; expires=Thu, 01-Jan-70 00:00:01 GMT";
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/documentation/images/AirIcon12x12.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/childoftv/as3-xlsx-reader/156cadbfb60649383deb79756c44b2a635219df9/documentation/images/AirIcon12x12.gif
--------------------------------------------------------------------------------
/documentation/images/P_AlternativeMetadataIndicator_30x28_N.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/childoftv/as3-xlsx-reader/156cadbfb60649383deb79756c44b2a635219df9/documentation/images/P_AlternativeMetadataIndicator_30x28_N.png
--------------------------------------------------------------------------------
/documentation/images/collapsed.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/childoftv/as3-xlsx-reader/156cadbfb60649383deb79756c44b2a635219df9/documentation/images/collapsed.gif
--------------------------------------------------------------------------------
/documentation/images/detailHeaderRule.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/childoftv/as3-xlsx-reader/156cadbfb60649383deb79756c44b2a635219df9/documentation/images/detailHeaderRule.jpg
--------------------------------------------------------------------------------
/documentation/images/detailSectionHeader.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/childoftv/as3-xlsx-reader/156cadbfb60649383deb79756c44b2a635219df9/documentation/images/detailSectionHeader.jpg
--------------------------------------------------------------------------------
/documentation/images/expanded.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/childoftv/as3-xlsx-reader/156cadbfb60649383deb79756c44b2a635219df9/documentation/images/expanded.gif
--------------------------------------------------------------------------------
/documentation/images/inherit-arrow.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/childoftv/as3-xlsx-reader/156cadbfb60649383deb79756c44b2a635219df9/documentation/images/inherit-arrow.gif
--------------------------------------------------------------------------------
/documentation/images/inheritedSummary.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/childoftv/as3-xlsx-reader/156cadbfb60649383deb79756c44b2a635219df9/documentation/images/inheritedSummary.gif
--------------------------------------------------------------------------------
/documentation/images/logo.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/childoftv/as3-xlsx-reader/156cadbfb60649383deb79756c44b2a635219df9/documentation/images/logo.jpg
--------------------------------------------------------------------------------
/documentation/images/titleTableBottom.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/childoftv/as3-xlsx-reader/156cadbfb60649383deb79756c44b2a635219df9/documentation/images/titleTableBottom.jpg
--------------------------------------------------------------------------------
/documentation/images/titleTableMiddle.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/childoftv/as3-xlsx-reader/156cadbfb60649383deb79756c44b2a635219df9/documentation/images/titleTableMiddle.jpg
--------------------------------------------------------------------------------
/documentation/images/titleTableTop.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/childoftv/as3-xlsx-reader/156cadbfb60649383deb79756c44b2a635219df9/documentation/images/titleTableTop.jpg
--------------------------------------------------------------------------------
/documentation/index-list.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | as3-xlsx-reader
4 |
5 |
6 |
7 |
8 |
9 | Index
10 |
11 |
12 |
17 |
18 | A
19 | N
20 |
21 |
22 | B
23 | O
24 |
25 |
26 | C
27 | P
28 |
29 |
30 | D
31 | Q
32 |
33 |
34 | E
35 | R
36 |
37 |
38 | F
39 | S
40 |
41 |
42 | G
43 | T
44 |
45 |
46 | H
47 | U
48 |
49 |
50 | I
51 | V
52 |
53 |
54 | J
55 | W
56 |
57 |
58 | K
59 | X
60 |
61 |
62 | L
63 | Y
64 |
65 |
66 | M
67 | Z
68 |
69 |
70 |
--------------------------------------------------------------------------------
/documentation/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | as3-xlsx-reader
4 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 | Frame Alert
32 |
33 | This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client.
34 |
35 | Link to Non-frame version.
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/documentation/override.css:
--------------------------------------------------------------------------------
1 | /*
2 | ////////////////////////////////////////////////////////////////////////////////
3 | //
4 | // ADOBE SYSTEMS INCORPORATED
5 | // Copyright 2008 Adobe Systems Incorporated
6 | // All Rights Reserved.
7 | //
8 | // NOTICE: Adobe permits you to use, modify, and distribute this file
9 | // in accordance with the terms of the license agreement accompanying it.
10 | //
11 | ////////////////////////////////////////////////////////////////////////////////
12 | */
--------------------------------------------------------------------------------
/documentation/package-detail.html:
--------------------------------------------------------------------------------
1 | Top Level Constants and Functions Summary
6 | Classes
Mon Jan 31 2011, 02:03 PM -08:00
--------------------------------------------------------------------------------
/documentation/package-frame.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | as3-xlsx-reader
4 |
5 |
6 |
7 |
8 |
9 |
10 | Frame Alert
11 | This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client.
12 |
13 | Link toNon-frame version.
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/documentation/package-list.html:
--------------------------------------------------------------------------------
1 | Package List - as3-xlsx-reader
--------------------------------------------------------------------------------
/documentation/package-summary.html:
--------------------------------------------------------------------------------
1 | All Packages
6 |
Mon Jan 31 2011, 02:03 PM -08:00
--------------------------------------------------------------------------------
/documentation/print.css:
--------------------------------------------------------------------------------
1 | /*
2 | ////////////////////////////////////////////////////////////////////////////////
3 | //
4 | // ADOBE SYSTEMS INCORPORATED
5 | // Copyright 2005-2008 Adobe Systems Incorporated
6 | // All Rights Reserved.
7 | //
8 | // NOTICE: Adobe permits you to use, modify, and distribute this file
9 | // in accordance with the terms of the license agreement accompanying it.
10 | //
11 | ////////////////////////////////////////////////////////////////////////////////
12 | */
13 |
14 | body {
15 | color: #000000;
16 | background: #ffffff;
17 | font-family: "Times New Roman", Times, serif;
18 | font-size: 12pt;
19 | }
20 | a {
21 | text-decoration: none;
22 | color: #000000;
23 | }
24 | pre {
25 | white-space: -moz-pre-wrap; /* Mozilla */
26 | white-space: -pre-wrap; /* Opera 4-6 */
27 | white-space: -o-pre-wrap; /* Opera 7 */
28 | word-wrap: break-word; /* IE */
29 | }
30 | .titleTableTopNav, .titleTableSubNav, .logoImage {
31 | display: none;
32 | }
33 | .packageFrame {
34 | display: none;
35 | }
36 | .titleTableSubTitle {
37 | font-weight: bold;
38 | }
39 | .classHeaderTableLabel {
40 | padding-right: 10px;
41 | vertical-align: top;
42 | }
43 | .showHideLinks {
44 | display: none;
45 | }
46 | html>body code {
47 | font-size: 10pt;
48 | }
49 | .summaryTableTitle, .detailSectionHeader {
50 | font-size: 14pt;
51 | font-weight: bold;
52 | padding-top: 15px;
53 | padding-bottom: 5px;
54 | }
55 | .summaryTable {
56 | border: 1px solid #000000;
57 | border-collapse: collapse;
58 | width: 100%;
59 | }
60 | .summaryTableDescription {
61 | padding-bottom: 20px;
62 | }
63 | .summaryTableSignatureCol, .summaryTableOwnerCol, .summaryTableLastCol, .summaryTableCol {
64 | border: 1px solid #000000;
65 | }
66 | .summaryTablePaddingCol {
67 | border: 1px solid #000000;
68 | border-right: 0px;
69 | }
70 | .summaryTableInheritanceCol, .summaryTableOperatorCol, .summaryTableStatementCol, .summaryTableSecondCol {
71 | border: 1px solid #000000;
72 | border-left: 0px;
73 | }
74 | .summaryTableLastCol {
75 | vertical-align: top;
76 | }
77 | .detailHeader {
78 | font-size: 13pt;
79 | padding-top: 100px;
80 | }
81 | .detailHeaderName {
82 | font-weight: bold;
83 | }
84 | .detailHeaderType {
85 | padding-left: 5px;
86 | }
87 | .detailHeaderRule {
88 | background: #FF0000;
89 | }
90 | .seeAlso {
91 | padding-bottom: 20px;
92 | margin-top: -20px;
93 | }
94 | .innertable {
95 | border-collapse: collapse;
96 | }
97 | .innertable td,.innertable th {
98 | border: 1px solid #000000;
99 | padding-left: 5px;
100 | padding-right: 5px;
101 | }
102 | .listing {
103 | font-size: 10pt;
104 | }
105 | .feedbackLink {
106 | display: none;
107 | }
108 | .copyright {
109 | font-size: 10pt;
110 | }
--------------------------------------------------------------------------------
/documentation/title-bar.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | as3-xlsx-reader
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
21 |
22 |
23 |
24 |
25 |
26 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/projects/as3-xlsx-reader-example/.actionScriptProperties:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/projects/as3-xlsx-reader-example/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | as3-xlsx-reader-example
4 |
5 |
6 |
7 |
8 |
9 | com.adobe.flexbuilder.project.flexbuilder
10 |
11 |
12 |
13 |
14 | com.adobe.flexbuilder.project.apollobuilder
15 |
16 |
17 |
18 |
19 |
20 | com.adobe.flexbuilder.project.apollonature
21 | com.adobe.flexbuilder.project.actionscriptnature
22 |
23 |
24 |
--------------------------------------------------------------------------------
/projects/as3-xlsx-reader-example/assets/Example Spreadsheet.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/childoftv/as3-xlsx-reader/156cadbfb60649383deb79756c44b2a635219df9/projects/as3-xlsx-reader-example/assets/Example Spreadsheet.xlsx
--------------------------------------------------------------------------------
/projects/as3-xlsx-reader-example/src/LoadXLSXExample.as:
--------------------------------------------------------------------------------
1 | /*
2 | MIT LICENSE:
3 | http://www.opensource.org/licenses/mit-license.php
4 | Copyright (c) 2011 Ben Morrow
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 | The above copyright notice and this permission notice shall be included in
12 | all copies or substantial portions of the Software.
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 | */
21 | package
22 | {
23 | import com.childoftv.xlsxreader.Worksheet;
24 | import com.childoftv.xlsxreader.XLSXLoader;
25 |
26 | import flash.display.Sprite;
27 | import flash.events.Event;
28 | import flash.text.TextField;
29 |
30 | public class LoadXLSXExample extends Sprite
31 | {
32 | //Create the Excel Loader
33 | protected var excel_loader:XLSXLoader = new XLSXLoader();
34 | private var textField:TextField = new TextField();
35 |
36 | public function LoadXLSXExample()
37 | {
38 |
39 | setupScreenText();
40 |
41 | //Listen for when the file is loaded
42 | excel_loader.addEventListener(Event.COMPLETE, loadingComplete);
43 |
44 | //Load the file
45 | excel_loader.load("Example Spreadsheet.xlsx");
46 |
47 |
48 | }
49 |
50 | private function setupScreenText():void
51 | {
52 | textField.multiline = true;
53 | textField.height = 100;
54 | textField.width = 400;
55 | addChild(textField);
56 | }
57 | private var log:String = "";
58 | private function logline(s:String):void
59 | {
60 | trace(s);
61 |
62 | var line:String = s + "\n";
63 | textField.appendText(line);
64 |
65 | }
66 |
67 | //Handler for loading complete
68 | private function loadingComplete(e:Event):void
69 | {
70 | //Access a worksheet by name ('Sheet1')
71 | var sheet_1:Worksheet=excel_loader.worksheet("Sheet1");
72 |
73 | //Access a cell in sheet 1 and output to trace
74 | logline("Cell A3=" + sheet_1.getCellValue("A3")) //outputs: Cell A3=Hello World;
75 | logline("Cell A4=" + sheet_1.getCellValue("A4")) //outputs: Cell A4=Hello Excel with colors;
76 | logline("Cell A5=" + sheet_1.getCellValue("A5")) //outputs: Cell A3=Hello Excel with the same color;
77 | }
78 | }
79 | }
--------------------------------------------------------------------------------
/projects/as3-xlsx-reader/.actionScriptProperties:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/projects/as3-xlsx-reader/.flexLibProperties:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/projects/as3-xlsx-reader/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | as3-xlsx-reader
4 |
5 |
6 |
7 |
8 |
9 | com.adobe.flexbuilder.project.flexbuilder
10 |
11 |
12 |
13 |
14 |
15 | com.adobe.flexbuilder.project.aslibnature
16 | com.adobe.flexbuilder.project.actionscriptnature
17 |
18 |
19 |
20 | [source path] src
21 | 2
22 | PARENT-2-PROJECT_LOC/src
23 |
24 |
25 | bin-debug
26 | 2
27 | PARENT-2-PROJECT_LOC/bin
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/src/com/childoftv/xlsxreader/Worksheet.as:
--------------------------------------------------------------------------------
1 | /*
2 | MIT LICENSE:
3 | http://www.opensource.org/licenses/mit-license.php
4 | Copyright (c) 2011 Ben Morrow
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 | The above copyright notice and this permission notice shall be included in
12 | all copies or substantial portions of the Software.
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 | */
21 | package com.childoftv.xlsxreader
22 | {
23 | /**
24 | * A wrapper class for an individual XLSX Worksheet loaded through an XLSXLoader object
25 | * Instances of this class are created by the XLSX.worksheet function.
26 | *
27 | *
28 | *
29 | * @example Loading an Excel file and reading a cell:
30 | *
31 | *
32 | * //Create the Excel Loader
33 | * var excel_loader:XLSXLoader=new XLSXLoader();
34 | *
35 | * //Listen for when the file is loaded
36 | * excel_loader.addEventListener(Event.COMPLETE,function (e:Event) {
37 | *
38 | * //Access a worksheet by name ('Sheet1')
39 | * var sheet_1:Worksheet=excel_loader.worksheet("Sheet1");
40 | *
41 | * //Access a cell in sheet 1 and output to trace
42 | * trace("Cell A3="+sheet_1.getCellValue("A3")) //outputs: Cell A3=Hello World;
43 | *
44 | *
45 | * });
46 | *
47 | * //Load the file
48 | *excel_loader.load("Example Spreadsheet.xlsx");
49 | *
50 | *
51 | *
52 | */
53 | public class Worksheet
54 | {
55 |
56 | private var xml:XML;
57 | private var fileLink:XLSXLoader;
58 | private var ns:Namespace;
59 | private var sheetName:String;
60 |
61 | /**
62 | * Creates a new Worksheet Object from a file loader. This consturctor is designed to be called from the XLSXLoader.worksheet() function only
63 | *
64 | * @param sSheetName worksheet name
65 | * @param FileLink link to the XLSX Loader
66 | * @param input the worksheet as XML
67 | *
68 | */
69 | public function Worksheet(sSheetName:String,FileLink:XLSXLoader,input:XML)
70 | {
71 | sheetName=sSheetName;
72 | xml=input;
73 | fileLink=FileLink;
74 | ns=fileLink.getNamespace();
75 | default xml namespace=ns;
76 | }
77 |
78 | /**
79 | * Returns an XML representation of the worksheet
80 | *
81 | * @return the worksheet as XML
82 | *
83 | */
84 | public function toXML():XML
85 | {
86 | return xml;
87 | }
88 |
89 | /**
90 | * Gets the XML representation of a single cell
91 | *
92 | * @param cellRef a standard spreadsheet single cell reference (e.g. "A:3")
93 | * @return the cell value as XML
94 | *
95 | */
96 | public function getCell(cellRef:String):XMLList
97 | {
98 | cellRef=cellRef.toUpperCase();
99 | var row:Number=Number(cellRef.match(/[0-9]+/)[0]);
100 | var column:String=cellRef.match(/[A-Z]+/)[0];
101 | // trace("getCell:"+cellRef, row, column);
102 |
103 | return getRows(column,row,row);
104 | }
105 | /**
106 | * Gets the String value of a single cell
107 | *
108 | * @param cellRef a standard spreadsheet single cell reference (e.g. "A:3")
109 | * @return the cell value as a string
110 | *
111 | */
112 | public function getCellValue(cellRef:String, htmlText:Boolean=false):String
113 | {
114 | default xml namespace=ns;
115 | var xml:XMLList = getCell(cellRef);
116 | if (htmlText == true)
117 | {
118 | if(xml.htmlText.valueOf())
119 | {
120 | return xml.htmlText.valueOf();
121 | }
122 | }else {
123 | if(xml.v.valueOf())
124 | {
125 | return xml.v.valueOf();
126 | }
127 | }
128 | return null;
129 | }
130 |
131 | public function getCellExtend(col:uint, row:uint, htmlText:Boolean=true):String
132 | {
133 | default xml namespace=ns;
134 | var cellRef:String = XLSXUtils.num2AZ(col) + row;
135 | var xml:XMLList = getCell(cellRef);
136 | if (htmlText == true)
137 | {
138 | if(xml.htmlText.valueOf())
139 | {
140 | return xml.htmlText.valueOf();
141 | }
142 | }else {
143 | if(xml.v.valueOf())
144 | {
145 | return xml.v.valueOf();
146 | }
147 | }
148 | return null;
149 | }
150 |
151 | private function getRawRows(column:String="A",from:Number=1,to:Number=-1):XMLList
152 | {
153 | // returns the raw (ie shared strings not converted)
154 | //rows in a given column within a certain range
155 | default xml namespace=ns;
156 | if(to==-1)
157 | to=xml.sheetData.row.length();
158 | return xml.sheetData.row.(@r>=from && @r<= to).c.(@r.match(/^[A-Z]+/)[0]==column);
159 | }
160 | /**
161 | * Provides an XML list representation of a range of rows in a given column as a list of xml v tags
162 | *
163 | * @param column the column name e.g. "A"
164 | * @param from the row number to start at e.g. 1
165 | * @param to the row number to end at e.g. 10
166 | * @return an XMLList of the requested rows in a single column as a list of xml v tags
167 | *
168 | */
169 | public function getRows(column:String="A",from:Number=1,to:Number=2000):XMLList
170 | {
171 | // returns the converted (ie shared strings are converted)
172 | //rows in a given column within a certain range
173 | return fillRowsWithValues(getRawRows(column,from,to));
174 | }
175 | /**
176 | * Provides an XML list representation of a range of rows in a given column as a list of xml values
177 | *
178 | * @param column the column name e.g. "A"
179 | * @param from the row number to start at e.g. 1
180 | * @param to the row number to end at e.g. 10
181 | * @return an XMLList of the requested rows in a single column as a list of xml values
182 | *
183 | */
184 | public function getRowsAsValues(column:String="A",from:Number=1,to:Number=2000):XMLList
185 | {
186 | // returns the converted (ie shared strings are converted)
187 | //values in a given column within a certain range
188 | default xml namespace=ns;
189 | return getRows(column,from,to).v;
190 | }
191 | private function rowsToValues(rows:XMLList):XMLList
192 | {
193 | //converts a set of rows to values
194 | default xml namespace=ns;
195 | return fillRowsWithValues(rows).v;
196 | }
197 | private function fillRowsWithValues(rows:XMLList):XMLList
198 | {
199 | default xml namespace=ns;
200 | // takes a set of rows and inserts the correct values
201 | var copy:XMLList=rows.copy();
202 | for each (var item:Object in copy)
203 | {
204 | //trace(sharedString(item.v.toString()));
205 | if(item.f.(children().length()!=0)+""=="") // If it's the result of a formula, no need to replace
206 | {
207 | var content:String = "";
208 | var html_content:String = "";
209 | if (item.@t == "str" || item.@t=="s")
210 | {
211 | content = fileLink.sharedString(item.v.toString(), item.s.toString());
212 | html_content = fileLink.sharedString(item.v.toString(), item.s.toString(), true);
213 | }else{
214 | content = item.v.toString();
215 | html_content = item.v.toString();
216 | }
217 | item.v = content;
218 | item.htmlText = html_content;
219 | }
220 | }
221 | return copy;
222 | }
223 |
224 | public function get rows():uint
225 | {
226 | default xml namespace=ns;
227 | var size:String = toXML().dimension.@ref;
228 | var min_max:Array = size.split(":");
229 | var max:String = min_max[1];
230 | if(max==null)
231 | return 0;
232 | var row:Number=Number(max.match(/[0-9]+/)[0]);
233 | var column:String=max.match(/[A-Z]+/)[0];
234 | return row;
235 | }
236 |
237 | public function get cols():uint
238 | {
239 | default xml namespace=ns;
240 | var size:String = String(xml.dimension.@ref);
241 | var min_max:Array = size.split(":");
242 | var max:String = min_max[1];
243 | if(max==null)
244 | return 0;
245 | var row:Number=Number(max.match(/[0-9]+/)[0]);
246 | var column:String=max.match(/[A-Z]+/)[0];
247 | return XLSXUtils.AZ2Num(column);
248 | }
249 |
250 | public function toString():String
251 | {
252 | return xml.toString();
253 | }
254 | public function toXMLString():String
255 | {
256 | return xml.toXMLString();
257 | }
258 |
259 | }
260 | }
261 |
--------------------------------------------------------------------------------
/src/com/childoftv/xlsxreader/XLSXUtils.as:
--------------------------------------------------------------------------------
1 | package com.childoftv.xlsxreader {
2 |
3 | public class XLSXUtils
4 | {
5 | static private const A2Z:Array = ["Z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y"];
6 | static private const A2Z2:Array = ["0","A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y","Z"];
7 | static private const AZ_COUNT:uint = 26;
8 | public function XLSXUtils()
9 | {
10 | }
11 |
12 |
13 | static public function num2AZ(value:Number):String
14 | {
15 | var az:String = "";
16 | {
17 | if (value <= AZ_COUNT)
18 | {
19 | return A2Z[value % AZ_COUNT];
20 | }else {
21 |
22 | var count:Number = 1;
23 | while (count > 0)
24 | {
25 | count = value / AZ_COUNT;
26 | count = Math.floor(count);
27 | var remain:uint = value % AZ_COUNT;
28 | az = A2Z[remain]+az;
29 | value = remain==0&&count>1?count-1:count;
30 | }
31 |
32 | }
33 | }
34 |
35 | return az;
36 | }
37 |
38 | static public function AZ2Num(value:String):Number
39 | {
40 | value ||= "";
41 | var num:Number = 0;
42 |
43 | var char:String = value.charAt(0);
44 | var index:Number = A2Z2.indexOf(char);
45 | if (index== -1)
46 | throw "value must be 'A'-'Z'";
47 | var length:uint = value.length;
48 |
49 | num = index * Math.pow(AZ_COUNT, length-1);
50 | if (length > 1)
51 | {
52 | num += AZ2Num( value.slice(1) );
53 | }
54 |
55 | return num;
56 | }
57 | }
58 | }
--------------------------------------------------------------------------------