1. td上添加属性:formula,无需设定具体值
    1. <table>
    2. <tr>
    3. <td>1</td>
    4. </tr>
    5. <tr>
    6. <td>19</td>
    7. </tr>
    8. <tr>
    9. <td formula>SUM(A1:A2)</td>
    10. </tr>
    11. </table>
    1. td中书写具体的公式即可,如:SUM(A1:A2),需要特别注意的是,公式无需加上=号,如=SUM(A1:A2)

    支持公式如下:

    1. private static Function[] produceFunctions() {
    2. Function[] retval = new Function[368];
    3. retval[0] = new Count();
    4. retval[FunctionID.IF] = new IfFunc(); //nominally 1
    5. retval[2] = LogicalFunction.ISNA;
    6. retval[3] = LogicalFunction.ISERROR;
    7. retval[FunctionID.SUM] = AggregateFunction.SUM; //nominally 4
    8. retval[5] = AggregateFunction.AVERAGE;
    9. retval[6] = AggregateFunction.MIN;
    10. retval[7] = AggregateFunction.MAX;
    11. retval[8] = new RowFunc(); // ROW
    12. retval[9] = new Column();
    13. retval[10] = new Na();
    14. retval[11] = new Npv();
    15. retval[12] = AggregateFunction.STDEV;
    16. retval[13] = NumericFunction.DOLLAR;
    17. retval[14] = new Fixed();
    18. retval[15] = NumericFunction.SIN;
    19. retval[16] = NumericFunction.COS;
    20. retval[17] = NumericFunction.TAN;
    21. retval[18] = NumericFunction.ATAN;
    22. retval[19] = NumericFunction.PI;
    23. retval[20] = NumericFunction.SQRT;
    24. retval[21] = NumericFunction.EXP;
    25. retval[22] = NumericFunction.LN;
    26. retval[23] = NumericFunction.LOG10;
    27. retval[24] = NumericFunction.ABS;
    28. retval[25] = NumericFunction.INT;
    29. retval[26] = NumericFunction.SIGN;
    30. retval[27] = NumericFunction.ROUND;
    31. retval[28] = new Lookup();
    32. retval[29] = new Index();
    33. retval[30] = new Rept();
    34. retval[31] = TextFunction.MID;
    35. retval[32] = TextFunction.LEN;
    36. retval[33] = new Value();
    37. retval[34] = BooleanFunction.TRUE;
    38. retval[35] = BooleanFunction.FALSE;
    39. retval[36] = BooleanFunction.AND;
    40. retval[37] = BooleanFunction.OR;
    41. retval[38] = BooleanFunction.NOT;
    42. retval[39] = NumericFunction.MOD;
    43. // 40: DCOUNT
    44. retval[41] = new DStarRunner(DStarRunner.DStarAlgorithmEnum.DSUM);
    45. // 42: DAVERAGE
    46. retval[43] = new DStarRunner(DStarRunner.DStarAlgorithmEnum.DMIN);
    47. retval[44] = new DStarRunner(DStarRunner.DStarAlgorithmEnum.DMAX);
    48. // 45: DSTDEV
    49. retval[46] = AggregateFunction.VAR;
    50. // 47: DVAR
    51. retval[48] = TextFunction.TEXT;
    52. // 49: LINEST
    53. retval[50] = new Trend();
    54. // 51: LOGEST
    55. // 52: GROWTH
    56. retval[56] = FinanceFunction.PV;
    57. retval[57] = FinanceFunction.FV;
    58. retval[58] = FinanceFunction.NPER;
    59. retval[59] = FinanceFunction.PMT;
    60. retval[60] = new Rate();
    61. retval[61] = new Mirr();
    62. retval[62] = new Irr();
    63. retval[63] = NumericFunction.RAND;
    64. retval[64] = new Match();
    65. retval[65] = DateFunc.instance;
    66. retval[66] = new TimeFunc();
    67. retval[67] = CalendarFieldFunction.DAY;
    68. retval[68] = CalendarFieldFunction.MONTH;
    69. retval[69] = CalendarFieldFunction.YEAR;
    70. retval[70] = WeekdayFunc.instance;
    71. retval[71] = CalendarFieldFunction.HOUR;
    72. retval[72] = CalendarFieldFunction.MINUTE;
    73. retval[73] = CalendarFieldFunction.SECOND;
    74. retval[74] = new Now();
    75. retval[75] = new Areas();
    76. retval[76] = new Rows();
    77. retval[77] = new Columns();
    78. retval[FunctionID.OFFSET] = new Offset(); //nominally 78
    79. retval[82] = TextFunction.SEARCH;
    80. retval[83] = MatrixFunction.TRANSPOSE;
    81. // 86: TYPE
    82. retval[97] = NumericFunction.ATAN2;
    83. retval[98] = NumericFunction.ASIN;
    84. retval[99] = NumericFunction.ACOS;
    85. retval[FunctionID.CHOOSE] = new Choose(); //nominally 100
    86. retval[101] = new Hlookup();
    87. retval[102] = new Vlookup();
    88. retval[105] = LogicalFunction.ISREF;
    89. retval[109] = NumericFunction.LOG;
    90. retval[111] = TextFunction.CHAR;
    91. retval[112] = TextFunction.LOWER;
    92. retval[113] = TextFunction.UPPER;
    93. retval[114] = TextFunction.PROPER;
    94. retval[115] = TextFunction.LEFT;
    95. retval[116] = TextFunction.RIGHT;
    96. retval[117] = TextFunction.EXACT;
    97. retval[118] = TextFunction.TRIM;
    98. retval[119] = new Replace();
    99. retval[120] = new Substitute();
    100. retval[121] = new Code();
    101. retval[124] = TextFunction.FIND;
    102. // 125: CELL
    103. retval[126] = LogicalFunction.ISERR;
    104. retval[127] = LogicalFunction.ISTEXT;
    105. retval[128] = LogicalFunction.ISNUMBER;
    106. retval[129] = LogicalFunction.ISBLANK;
    107. retval[130] = new T();
    108. // 131: N
    109. // 140: DATEVALUE
    110. // 141: TIMEVALUE
    111. // 142: SLN
    112. // 143: SYD
    113. // 144: DDB
    114. retval[FunctionID.INDIRECT] = null; // Indirect.evaluate has different signature
    115. retval[162] = TextFunction.CLEAN;
    116. retval[163] = MatrixFunction.MDETERM;
    117. retval[164] = MatrixFunction.MINVERSE;
    118. retval[165] = MatrixFunction.MMULT;
    119. retval[167] = new IPMT();
    120. retval[168] = new PPMT();
    121. retval[169] = new Counta();
    122. retval[183] = AggregateFunction.PRODUCT;
    123. retval[184] = NumericFunction.FACT;
    124. // 189: DPRODUCT
    125. retval[190] = LogicalFunction.ISNONTEXT;
    126. retval[194] = AggregateFunction.VARP;
    127. // 195: DSTDEVP
    128. // 196: DVARP
    129. retval[197] = NumericFunction.TRUNC;
    130. retval[198] = LogicalFunction.ISLOGICAL;
    131. // 199: DCOUNTA
    132. //204: USDOLLAR (YEN in BIFF3)
    133. //205: FINDB
    134. //206: SEARCHB
    135. //207: REPLACEB
    136. //208: LEFTB
    137. //209: RIGHTB
    138. //210: MIDB
    139. //211: LENB
    140. retval[212] = NumericFunction.ROUNDUP;
    141. retval[213] = NumericFunction.ROUNDDOWN;
    142. //214: ASC
    143. //215: DBCS (JIS in BIFF3)
    144. retval[216] = new Rank();
    145. retval[219] = new Address();
    146. retval[220] = new Days360();
    147. retval[221] = new Today();
    148. //222: VBD
    149. retval[227] = AggregateFunction.MEDIAN;
    150. retval[228] = new Sumproduct();
    151. retval[229] = NumericFunction.SINH;
    152. retval[230] = NumericFunction.COSH;
    153. retval[231] = NumericFunction.TANH;
    154. retval[232] = NumericFunction.ASINH;
    155. retval[233] = NumericFunction.ACOSH;
    156. retval[234] = NumericFunction.ATANH;
    157. retval[235] = new DStarRunner(DStarRunner.DStarAlgorithmEnum.DGET);
    158. // 244: INFO
    159. // 247: DB
    160. // 252: FEQUENCY
    161. retval[252] = Frequency.instance;
    162. retval[FunctionID.EXTERNAL_FUNC] = null; // ExternalFunction is a FreeRefFunction, nominally 255
    163. retval[261] = new Errortype();
    164. retval[269] = AggregateFunction.AVEDEV;
    165. // 270: BETADIST
    166. // 271: GAMMALN
    167. // 272: BETAINV
    168. // 273: BINOMDIST
    169. // 274: CHIDIST
    170. // 275: CHIINV
    171. retval[276] = NumericFunction.COMBIN;
    172. // 277: CONFIDENCE
    173. // 278:CRITBINOM
    174. retval[279] = new Even();
    175. // 280: EXPONDIST
    176. // 281: FDIST
    177. // 282: FINV
    178. // 283: FISHER
    179. // 284: FISHERINV
    180. retval[285] = NumericFunction.FLOOR;
    181. // 286: GAMMADIST
    182. // 287: GAMMAINV
    183. retval[288] = NumericFunction.CEILING;
    184. // 289: HYPGEOMDIST
    185. // 290: LOGNORMDIST
    186. // 291: LOGINV
    187. // 292: NEGBINOMDIST
    188. // 293: NORMDIST
    189. // 294: NORMSDIST
    190. // 295: NORMINV
    191. // 296: NORMSINV
    192. // 297: STANDARDIZE
    193. retval[298] = new Odd();
    194. // 299: PERMUT
    195. retval[300] = NumericFunction.POISSON;
    196. // 301: TDIST
    197. // 302: WEIBULL
    198. retval[303] = new Sumxmy2();
    199. retval[304] = new Sumx2my2();
    200. retval[305] = new Sumx2py2();
    201. // 306: CHITEST
    202. // 307: CORREL
    203. // 308: COVAR
    204. // 309: FORECAST
    205. // 310: FTEST
    206. retval[311] = new Intercept();
    207. // 312: PEARSON
    208. // 313: RSQ
    209. // 314: STEYX
    210. retval[315] = new Slope();
    211. // 316: TTEST
    212. // 317: PROB
    213. retval[318] = AggregateFunction.DEVSQ;
    214. retval[319] = AggregateFunction.GEOMEAN;
    215. // 320: HARMEAN
    216. retval[321] = AggregateFunction.SUMSQ;
    217. // 322: KURT
    218. // 323: SKEW
    219. // 324: ZTEST
    220. retval[325] = AggregateFunction.LARGE;
    221. retval[326] = AggregateFunction.SMALL;
    222. // 327: QUARTILE
    223. retval[328] = AggregateFunction.PERCENTILE;
    224. // 329: PERCENTRANK
    225. retval[330] = new Mode();
    226. // 331: TRIMMEAN
    227. // 332: TINV
    228. retval[336] = TextFunction.CONCATENATE;
    229. retval[337] = NumericFunction.POWER;
    230. retval[342] = NumericFunction.RADIANS;
    231. retval[343] = NumericFunction.DEGREES;
    232. retval[344] = new Subtotal();
    233. retval[345] = new Sumif();
    234. retval[346] = new Countif();
    235. retval[347] = new Countblank();
    236. // 350: ISPMT
    237. // 351: DATEDIF
    238. // 352: DATESTRING
    239. // 353: NUMBERSTRING
    240. retval[354] = new Roman();
    241. // 358: GETPIVOTDATA
    242. retval[359] = new Hyperlink();
    243. // 360: PHONETIC
    244. // 361: AVERAGEA
    245. retval[362] = MinaMaxa.MAXA;
    246. retval[363] = MinaMaxa.MINA;
    247. // 364: STDEVPA
    248. // 365: VARPA
    249. // 366: STDEVA
    250. // 367: VARA
    251. }