first commit
This commit is contained in:
commit
4d332ef662
27586 changed files with 3281783 additions and 0 deletions
46
rus/WEB-INF/lib/jxl_src/jxl/demo/CSV.java
Normal file
46
rus/WEB-INF/lib/jxl_src/jxl/demo/CSV.java
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
package jxl.demo;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import jxl.Cell;
|
||||
import jxl.Sheet;
|
||||
import jxl.Workbook;
|
||||
|
||||
public class CSV {
|
||||
public CSV(Workbook w, OutputStream out, String encoding, boolean hide) throws IOException {
|
||||
if (encoding == null || !encoding.equals("UnicodeBig"))
|
||||
encoding = "UTF8";
|
||||
try {
|
||||
OutputStreamWriter osw = new OutputStreamWriter(out, encoding);
|
||||
BufferedWriter bw = new BufferedWriter(osw);
|
||||
for (int sheet = 0; sheet < w.getNumberOfSheets(); sheet++) {
|
||||
Sheet s = w.getSheet(sheet);
|
||||
if (!hide || !s.getSettings().isHidden()) {
|
||||
bw.write("*** " + s.getName() + " ****");
|
||||
bw.newLine();
|
||||
Cell[] row = null;
|
||||
for (int i = 0; i < s.getRows(); i++) {
|
||||
row = s.getRow(i);
|
||||
if (row.length > 0) {
|
||||
if (!hide || !row[0].isHidden())
|
||||
bw.write(row[0].getContents());
|
||||
for (int j = 1; j < row.length; j++) {
|
||||
bw.write(44);
|
||||
if (!hide || !row[j].isHidden())
|
||||
bw.write(row[j].getContents());
|
||||
}
|
||||
}
|
||||
bw.newLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
bw.flush();
|
||||
bw.close();
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
System.err.println(e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue