zhao
2021-07-19 8347f2fbddbd25369359dcb2da1233ac48a19fdc
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
using System;
using System.Collections.Generic;
using System.Text;
using HH.WMS.Utils.NPOI.SS.Util;
 
namespace HH.WMS.Utils.NPOI.SS
{
    /**
     * This enum allows spReadsheets from multiple Excel versions to be handled by the common code.
     * Properties of this enum correspond to attributes of the <i>spReadsheet</i> that are easily
     * discernable to the user.  It is not intended to deal with low-level issues like file formats.
     * <p/>
     *
     * @author Josh Micich
     * @author Yegor Kozlov
     */
    public class SpreadsheetVersion
    {
        /**
         * Excel97 format aka BIFF8
         * <ul>
         * <li>The total number of available columns is 256 (2^8)</li>
         * <li>The total number of available rows is 64k (2^16)</li>
         * <li>The maximum number of arguments to a function is 30</li>
         * <li>Number of conditional format conditions on a cell is 3</li>
         * <li>Length of text cell contents is unlimited </li>
         * <li>Length of text cell contents is 32767</li>
         * </ul>
         */
        public static SpreadsheetVersion EXCEL97 = new SpreadsheetVersion(0x10000, 0x0100, 30, 3, 32767);
 
        /**
         * Excel2007
         *
         * <ul>
         * <li>The total number of available columns is 16K (2^14)</li>
         * <li>The total number of available rows is 1M (2^20)</li>
         * <li>The maximum number of arguments to a function is 255</li>
         * <li>Number of conditional format conditions on a cell is unlimited
         * (actually limited by available memory in Excel)</li>
         * <li>Length of text cell contents is unlimited </li>
         * </ul>
         */
        public static SpreadsheetVersion EXCEL2007 = new SpreadsheetVersion(0x100000, 0x4000, 255, Int32.MaxValue, Int32.MaxValue);
 
        private int _maxRows;
        private int _maxColumns;
        private int _maxFunctionArgs;
        private int _maxCondFormats;
        private int _maxTextLength;
 
        private SpreadsheetVersion(int maxRows, int maxColumns, int maxFunctionArgs, int maxCondFormats, int maxText)
        {
            _maxRows = maxRows;
            _maxColumns = maxColumns;
            _maxFunctionArgs = maxFunctionArgs;
            _maxCondFormats = maxCondFormats;
            _maxTextLength = maxText;
        }
 
        /**
         * @return the maximum number of usable rows in each spReadsheet
         */
        public int MaxRows
        {
            get
            {
                return _maxRows;
            }
        }
 
        /**
         * @return the last (maximum) valid row index, equals to <code> GetMaxRows() - 1 </code>
         */
        public int LastRowIndex
        {
            get
            {
                return _maxRows - 1;
            }
        }
 
        /**
         * @return the maximum number of usable columns in each spReadsheet
         */
        public int MaxColumns
        {
            get
            {
                return _maxColumns;
            }
        }
 
        /**
         * @return the last (maximum) valid column index, equals to <code> GetMaxColumns() - 1 </code>
         */
        public int LastColumnIndex
        {
            get
            {
                return _maxColumns - 1;
            }
        }
 
        /**
         * @return the maximum number arguments that can be passed to a multi-arg function (e.g. COUNTIF)
         */
        public int MaxFunctionArgs
        {
            get
            {
                return _maxFunctionArgs;
            }
        }
 
        /**
         *
         * @return the maximum number of conditional format conditions on a cell
         */
        public int MaxConditionalFormats
        {
            get
            {
                return _maxCondFormats;
            }
        }
 
        /**
         *
         * @return the last valid column index in a ALPHA-26 representation
         *  (<code>IV</code> or <code>XFD</code>).
         */
        public String LastColumnName
        {
            get
            {
                return CellReference.ConvertNumToColString(LastColumnIndex);
            }
        }
 
        /**
         * @return the maximum length of a text cell
         */
        public int MaxTextLength
        {
            get
            {
                return _maxTextLength;
            }
        }
 
    }
 
}