| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
package org.wiztools.xml2spreadsheet; |
| 11 |
|
|
| 12 |
|
import java.io.File; |
| 13 |
|
import java.io.FileInputStream; |
| 14 |
|
import java.io.FileNotFoundException; |
| 15 |
|
import java.io.FileOutputStream; |
| 16 |
|
import java.io.IOException; |
| 17 |
|
import java.io.InputStream; |
| 18 |
|
import java.io.OutputStream; |
| 19 |
|
import org.wiztools.xml2spreadsheet.exception.XML2XLSFatalException; |
| 20 |
|
|
| 21 |
|
|
| 22 |
|
|
| 23 |
|
|
| 24 |
|
|
| 25 |
|
public final class XML2SpreadSheet { |
| 26 |
|
|
| 27 |
|
|
| 28 |
0 |
private XML2SpreadSheet() { |
| 29 |
0 |
} |
| 30 |
|
|
| 31 |
|
|
| 32 |
|
|
| 33 |
|
|
| 34 |
|
|
| 35 |
|
public static void convert(InputStream in, OutputStream out) |
| 36 |
|
throws FileNotFoundException, |
| 37 |
|
IOException, |
| 38 |
|
XML2XLSFatalException{ |
| 39 |
|
|
| 40 |
12 |
WorkBookCreator wbc = WorkBookCreatorFactory.getWorkBookCreator(); |
| 41 |
12 |
XML2XLSGenerator gen = new XML2XLSGenerator(); |
| 42 |
|
|
| 43 |
12 |
gen.parse((WorkBookGenerationHandler)wbc, in); |
| 44 |
12 |
WorkBook workBook = wbc.getWorkBook(); |
| 45 |
12 |
workBook.write(out); |
| 46 |
|
|
| 47 |
12 |
} |
| 48 |
|
|
| 49 |
|
|
| 50 |
|
|
| 51 |
|
|
| 52 |
|
|
| 53 |
|
public static void convert(File in, File out) |
| 54 |
|
throws FileNotFoundException, |
| 55 |
|
IOException, |
| 56 |
|
XML2XLSFatalException{ |
| 57 |
0 |
FileInputStream is_in = new FileInputStream(in); |
| 58 |
0 |
FileOutputStream is_out = new FileOutputStream(out); |
| 59 |
0 |
convert(is_in, is_out); |
| 60 |
0 |
} |
| 61 |
|
|
| 62 |
|
} |