Merged revisions 638786-638802,638805-638811,638813-638814,638816-639230,639233-639241,639243-639253,639255-639486,639488-639601,639603-639835,639837-639917,639919-640056,640058-640710,640712-641156,641158-641184,641186-641795,641797-641798,641800-641933,641935-641963,641965-641966,641968-641995,641997-642230,642232-642562,642564-642565,642568-642570,642572-642573,642576-642736,642739-642877,642879,642881-642890,642892-642903,642905-642945,642947-643624,643626-643653,643655-643669,643671,643673-643830,643832-643833,643835-644342,644344-644472,644474-644508,644510-645347,645349-645351,645353-645559,645561-645565,645568-645951,645953-646193,646195-646311,646313-646404,646406-646665,646667-646853,646855-646869,646871-647151,647153-647185,647187-647277,647279-647566,647568-647573,647575,647578-647711,647714-647737,647739-647823,647825-648155,648157-648202,648204-648273,648275,648277-648302,648304-648333,648335-648588,648590-648622,648625-648673,648675-649141,649144,649146-649556,649558-649795,649799,649801-649910,649912-649913,649915-650128,650131-650132,650134-650137,650140-650914,650916-651991,651993-652284,652286-652287,652289,652291,652293-652297,652299-652328,652330-652425,652427-652445,652447-652560,652562-652933,652935,652937-652993,652995-653116,653118-653124,653126-653483,653487-653519,653522-653550,653552-653607,653609-653667,653669-653674,653676-653831 via svnmerge from
https://svn.apache.org:443/repos/asf/poi/trunk ........ r653815 | nick | 2008-05-06 16:37:45 +0100 (Tue, 06 May 2008) | 1 line Improve JavaDocs about iterators and gaps ........ r653816 | nick | 2008-05-06 16:38:08 +0100 (Tue, 06 May 2008) | 1 line Fix int -> short issues that no longer apply ........ r653831 | nick | 2008-05-06 17:38:34 +0100 (Tue, 06 May 2008) | 1 line Fix up the functionMetadata.txt stuff to be end-to-end UTF8. Was assuming it before, but breaking on some systems, while now it ought to work fine everywhere ........ git-svn-id: https://svn.apache.org/repos/asf/poi/branches/ooxml@653835 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d37e113d8b
commit
1d1cc98024
@ -55,10 +55,10 @@ public class HSSFCellUtil
|
||||
*/
|
||||
public static HSSFRow getRow( int rowCounter, HSSFSheet sheet )
|
||||
{
|
||||
HSSFRow row = sheet.getRow( (short) rowCounter );
|
||||
HSSFRow row = sheet.getRow( rowCounter );
|
||||
if ( row == null )
|
||||
{
|
||||
row = sheet.createRow( (short) rowCounter );
|
||||
row = sheet.createRow( rowCounter );
|
||||
}
|
||||
|
||||
return row;
|
||||
@ -66,7 +66,8 @@ public class HSSFCellUtil
|
||||
|
||||
|
||||
/**
|
||||
* Get a specific cell from a row. If the cell doesn't exist, then create it.
|
||||
* Get a specific cell from a row. If the cell doesn't exist,
|
||||
* then create it.
|
||||
*
|
||||
*@param row The row that the cell is part of
|
||||
*@param column The column index that the cell is in.
|
||||
@ -74,11 +75,11 @@ public class HSSFCellUtil
|
||||
*/
|
||||
public static HSSFCell getCell( HSSFRow row, int column )
|
||||
{
|
||||
HSSFCell cell = row.getCell( (short) column );
|
||||
HSSFCell cell = row.getCell( column );
|
||||
|
||||
if ( cell == null )
|
||||
{
|
||||
cell = row.createCell( (short) column );
|
||||
cell = row.createCell( (short)column );
|
||||
}
|
||||
return cell;
|
||||
}
|
||||
@ -98,7 +99,7 @@ public class HSSFCellUtil
|
||||
{
|
||||
HSSFCell cell = getCell( row, column );
|
||||
|
||||
cell.setCellValue( value );
|
||||
cell.setCellValue(new HSSFRichTextString(value));
|
||||
if ( style != null )
|
||||
{
|
||||
cell.setCellStyle( style );
|
||||
@ -222,7 +223,7 @@ public class HSSFCellUtil
|
||||
public static HSSFCell translateUnicodeValues( HSSFCell cell )
|
||||
{
|
||||
|
||||
String s = cell.getStringCellValue();
|
||||
String s = cell.getRichStringCellValue().getString();
|
||||
boolean foundUnicode = false;
|
||||
|
||||
for ( Iterator i = unicodeMappings.entrySet().iterator(); i.hasNext(); )
|
||||
|
@ -21,6 +21,7 @@ import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
@ -58,7 +59,10 @@ final class FunctionMetadataReader {
|
||||
throw new RuntimeException("resource '" + METADATA_FILE_NAME + "' not found");
|
||||
}
|
||||
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(is));
|
||||
BufferedReader br = null;
|
||||
try {
|
||||
br = new BufferedReader(new InputStreamReader(is,"UTF-8"));
|
||||
} catch(UnsupportedEncodingException e) { /* never happens */ }
|
||||
FunctionDataBuilder fdb = new FunctionDataBuilder(400);
|
||||
|
||||
try {
|
||||
@ -153,7 +157,7 @@ final class FunctionMetadataReader {
|
||||
case 'R': return Ptg.CLASS_REF;
|
||||
case 'A': return Ptg.CLASS_ARRAY;
|
||||
}
|
||||
throw new IllegalArgumentException("Unexpected operand type code '" + code + "'");
|
||||
throw new IllegalArgumentException("Unexpected operand type code '" + code + "' (" + (int)code.charAt(0) + ")");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -498,8 +498,10 @@ public final class HSSFRow implements Comparable, Row {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return cell iterator of the physically defined cells. Note element 4 may
|
||||
* actually be row cell depending on how many are defined!
|
||||
* @return cell iterator of the physically defined cells.
|
||||
* Note that the 4th element might well not be cell 4, as the iterator
|
||||
* will not return un-defined (null) cells.
|
||||
* Call getCellNum() on the returned cells to know which cell they are.
|
||||
*/
|
||||
public Iterator cellIterator()
|
||||
{
|
||||
|
@ -717,6 +717,7 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
|
||||
/**
|
||||
* @return an iterator of the PHYSICAL rows. Meaning the 3rd element may not
|
||||
* be the third row if say for instance the second row is undefined.
|
||||
* Call getRowNum() on each row if you care which one it is.
|
||||
*/
|
||||
public Iterator rowIterator()
|
||||
{
|
||||
|
@ -29,7 +29,7 @@
|
||||
7 MAX 1 30 V R
|
||||
8 ROW 0 1 V R
|
||||
9 COLUMN 0 1 V R
|
||||
10 NA 0 0 V –
|
||||
10 NA 0 0 V –
|
||||
11 NPV 2 30 V V R
|
||||
12 STDEV 1 30 V R
|
||||
13 DOLLAR 1 2 V V V
|
||||
@ -38,7 +38,7 @@
|
||||
16 COS 1 1 V V
|
||||
17 TAN 1 1 V V
|
||||
18 ARCTAN 1 1 V V
|
||||
19 PI 0 0 V –
|
||||
19 PI 0 0 V –
|
||||
20 SQRT 1 1 V V
|
||||
21 EXP 1 1 V V
|
||||
22 LN 1 1 V V
|
||||
@ -53,8 +53,8 @@
|
||||
31 MID 3 3 V V V V
|
||||
32 LEN 1 1 V V
|
||||
33 VALUE 1 1 V V
|
||||
34 TRUE 0 0 V –
|
||||
35 FALSE 0 0 V –
|
||||
34 TRUE 0 0 V –
|
||||
35 FALSE 0 0 V –
|
||||
36 AND 1 30 V R
|
||||
37 OR 1 30 V R
|
||||
38 NOT 1 1 V V
|
||||
@ -80,7 +80,7 @@
|
||||
60 RATE 3 6 V V V V V V V
|
||||
61 MIRR 3 3 V R V V
|
||||
62 IRR 1 2 V R V
|
||||
63 RAND 0 0 V – x
|
||||
63 RAND 0 0 V – x
|
||||
64 MATCH 2 3 V V R R
|
||||
65 DATE 3 3 V V V V
|
||||
66 TIME 3 3 V V V V
|
||||
@ -91,7 +91,7 @@
|
||||
71 HOUR 1 1 V V
|
||||
72 MINUTE 1 1 V V
|
||||
73 SECOND 1 1 V V
|
||||
74 NOW 0 0 V – x
|
||||
74 NOW 0 0 V – x
|
||||
75 AREAS 1 1 V R
|
||||
76 ROWS 1 1 V R
|
||||
77 COLUMNS 1 1 V R
|
||||
@ -170,10 +170,10 @@
|
||||
215 JIS 1 1 V V x
|
||||
219 ADDRESS 2 5 V V V V V V
|
||||
220 DAYS360 2 2 V V V x
|
||||
221 TODAY 0 0 V – x
|
||||
221 TODAY 0 0 V – x
|
||||
222 VDB 5 7 V V V V V V V V
|
||||
227 MEDIAN 1 30 V R …
|
||||
228 SUMPRODUCT 1 30 V A …
|
||||
227 MEDIAN 1 30 V R …
|
||||
228 SUMPRODUCT 1 30 V A …
|
||||
229 SINH 1 1 V V
|
||||
230 COSH 1 1 V V
|
||||
231 TANH 1 1 V V
|
||||
@ -188,7 +188,7 @@
|
||||
247 DB 4 5 V V V V V V
|
||||
252 FREQUENCY 2 2 A R R
|
||||
261 ERROR.TYPE 1 1 V V
|
||||
269 AVEDEV 1 30 V R …
|
||||
269 AVEDEV 1 30 V R …
|
||||
270 BETADIST 3 5 V V V V V V
|
||||
271 GAMMALN 1 1 V V
|
||||
272 BETAINV 3 5 V V V V V V
|
||||
@ -237,12 +237,12 @@
|
||||
315 SLOPE 2 2 V A A
|
||||
316 TTEST 4 4 V A A V V
|
||||
317 PROB 3 4 V A A V V
|
||||
318 DEVSQ 1 30 V R …
|
||||
319 GEOMEAN 1 30 V R …
|
||||
320 HARMEAN 1 30 V R …
|
||||
321 SUMSQ 0 30 V R …
|
||||
322 KURT 1 30 V R …
|
||||
323 SKEW 1 30 V R …
|
||||
318 DEVSQ 1 30 V R …
|
||||
319 GEOMEAN 1 30 V R …
|
||||
320 HARMEAN 1 30 V R …
|
||||
321 SUMSQ 0 30 V R …
|
||||
322 KURT 1 30 V R …
|
||||
323 SKEW 1 30 V R …
|
||||
324 ZTEST 2 3 V R V V
|
||||
325 LARGE 2 2 V R V
|
||||
326 SMALL 2 2 V R V
|
||||
@ -274,10 +274,10 @@
|
||||
358 GETPIVOTDATA 2 30
|
||||
359 HYPERLINK 1 2 V V V
|
||||
360 PHONETIC 1 1 V R
|
||||
361 AVERAGEA 1 30 V R …
|
||||
362 MAXA 1 30 V R …
|
||||
363 MINA 1 30 V R …
|
||||
364 STDEVPA 1 30 V R …
|
||||
365 VARPA 1 30 V R …
|
||||
366 STDEVA 1 30 V R …
|
||||
367 VARA 1 30 V R …
|
||||
361 AVERAGEA 1 30 V R …
|
||||
362 MAXA 1 30 V R …
|
||||
363 MINA 1 30 V R …
|
||||
364 STDEVPA 1 30 V R …
|
||||
365 VARPA 1 30 V R …
|
||||
366 STDEVA 1 30 V R …
|
||||
367 VARA 1 30 V R …
|
||||
|
@ -31,7 +31,7 @@
|
||||
7 MAX 1 30 V R
|
||||
8 ROW 0 1 V R
|
||||
9 COLUMN 0 1 V R
|
||||
10 NA 0 0 V –
|
||||
10 NA 0 0 V –
|
||||
11 NPV 2 30 V V R
|
||||
12 STDEV 1 30 V R
|
||||
13 DOLLAR 1 2 V V V
|
||||
@ -40,7 +40,7 @@
|
||||
16 COS 1 1 V V
|
||||
17 TAN 1 1 V V
|
||||
18 ATAN 1 1 V V
|
||||
19 PI 0 0 V –
|
||||
19 PI 0 0 V –
|
||||
20 SQRT 1 1 V V
|
||||
21 EXP 1 1 V V
|
||||
22 LN 1 1 V V
|
||||
@ -55,8 +55,8 @@
|
||||
31 MID 3 3 V V V V
|
||||
32 LEN 1 1 V V
|
||||
33 VALUE 1 1 V V
|
||||
34 TRUE 0 0 V –
|
||||
35 FALSE 0 0 V –
|
||||
34 TRUE 0 0 V –
|
||||
35 FALSE 0 0 V –
|
||||
36 AND 1 30 V R
|
||||
37 OR 1 30 V R
|
||||
38 NOT 1 1 V V
|
||||
@ -82,7 +82,7 @@
|
||||
60 RATE 3 6 V V V V V V V
|
||||
61 MIRR 3 3 V R V V
|
||||
62 IRR 1 2 V R V
|
||||
63 RAND 0 0 V – x
|
||||
63 RAND 0 0 V – x
|
||||
64 MATCH 2 3 V V R R
|
||||
65 DATE 3 3 V V V V
|
||||
66 TIME 3 3 V V V V
|
||||
@ -93,7 +93,7 @@
|
||||
71 HOUR 1 1 V V
|
||||
72 MINUTE 1 1 V V
|
||||
73 SECOND 1 1 V V
|
||||
74 NOW 0 0 V – x
|
||||
74 NOW 0 0 V – x
|
||||
75 AREAS 1 1 V R
|
||||
76 ROWS 1 1 V R
|
||||
77 COLUMNS 1 1 V R
|
||||
@ -172,10 +172,10 @@
|
||||
215 JIS 1 1 V V x
|
||||
219 ADDRESS 2 5 V V V V V V
|
||||
220 DAYS360 2 2 V V V x
|
||||
221 TODAY 0 0 V – x
|
||||
221 TODAY 0 0 V – x
|
||||
222 VDB 5 7 V V V V V V V V
|
||||
227 MEDIAN 1 30 V R …
|
||||
228 SUMPRODUCT 1 30 V A …
|
||||
227 MEDIAN 1 30 V R …
|
||||
228 SUMPRODUCT 1 30 V A …
|
||||
229 SINH 1 1 V V
|
||||
230 COSH 1 1 V V
|
||||
231 TANH 1 1 V V
|
||||
@ -192,7 +192,7 @@
|
||||
247 DB 4 5 V V V V V V
|
||||
252 FREQUENCY 2 2 A R R
|
||||
261 ERROR.TYPE 1 1 V V
|
||||
269 AVEDEV 1 30 V R …
|
||||
269 AVEDEV 1 30 V R …
|
||||
270 BETADIST 3 5 V V V V V V
|
||||
271 GAMMALN 1 1 V V
|
||||
272 BETAINV 3 5 V V V V V V
|
||||
@ -241,12 +241,12 @@
|
||||
315 SLOPE 2 2 V A A
|
||||
316 TTEST 4 4 V A A V V
|
||||
317 PROB 3 4 V A A V V
|
||||
318 DEVSQ 1 30 V R …
|
||||
319 GEOMEAN 1 30 V R …
|
||||
320 HARMEAN 1 30 V R …
|
||||
321 SUMSQ 0 30 V R …
|
||||
322 KURT 1 30 V R …
|
||||
323 SKEW 1 30 V R …
|
||||
318 DEVSQ 1 30 V R …
|
||||
319 GEOMEAN 1 30 V R …
|
||||
320 HARMEAN 1 30 V R …
|
||||
321 SUMSQ 0 30 V R …
|
||||
322 KURT 1 30 V R …
|
||||
323 SKEW 1 30 V R …
|
||||
324 ZTEST 2 3 V R V V
|
||||
325 LARGE 2 2 V R V
|
||||
326 SMALL 2 2 V R V
|
||||
@ -278,10 +278,10 @@
|
||||
358 GETPIVOTDATA 2 30
|
||||
359 HYPERLINK 1 2 V V V
|
||||
360 PHONETIC 1 1 V R
|
||||
361 AVERAGEA 1 30 V R …
|
||||
362 MAXA 1 30 V R …
|
||||
363 MINA 1 30 V R …
|
||||
364 STDEVPA 1 30 V R …
|
||||
365 VARPA 1 30 V R …
|
||||
366 STDEVA 1 30 V R …
|
||||
367 VARA 1 30 V R …
|
||||
361 AVERAGEA 1 30 V R …
|
||||
362 MAXA 1 30 V R …
|
||||
363 MINA 1 30 V R …
|
||||
364 STDEVPA 1 30 V R …
|
||||
365 VARPA 1 30 V R …
|
||||
366 STDEVA 1 30 V R …
|
||||
367 VARA 1 30 V R …
|
||||
|
@ -25,6 +25,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
@ -354,13 +355,19 @@ public final class ExcelFileFormatDocFunctionExtractor {
|
||||
}
|
||||
|
||||
private static void extractFunctionData(FunctionDataCollector fdc, InputStream is) {
|
||||
System.setProperty("org.xml.sax.driver", "org.apache.crimson.parser.XMLReaderImpl");
|
||||
|
||||
XMLReader xr;
|
||||
|
||||
try {
|
||||
// First up, try the default one
|
||||
xr = XMLReaderFactory.createXMLReader();
|
||||
} catch (SAXException e) {
|
||||
throw new RuntimeException(e);
|
||||
// Try one for java 1.4
|
||||
System.setProperty("org.xml.sax.driver", "org.apache.crimson.parser.XMLReaderImpl");
|
||||
try {
|
||||
xr = XMLReaderFactory.createXMLReader();
|
||||
} catch (SAXException e2) {
|
||||
throw new RuntimeException(e2);
|
||||
}
|
||||
}
|
||||
xr.setContentHandler(new EFFDocHandler(fdc));
|
||||
|
||||
@ -383,7 +390,11 @@ public final class ExcelFileFormatDocFunctionExtractor {
|
||||
} catch (FileNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
PrintStream ps = new PrintStream(os);
|
||||
PrintStream ps = null;
|
||||
try {
|
||||
ps = new PrintStream(os,true, "UTF-8");
|
||||
} catch(UnsupportedEncodingException e) {}
|
||||
|
||||
outputLicenseHeader(ps);
|
||||
Class genClass = ExcelFileFormatDocFunctionExtractor.class;
|
||||
ps.println("# Created by (" + genClass.getName() + ")");
|
||||
|
Loading…
Reference in New Issue
Block a user