use of com.genexus.gxoffice.poi.xssf.StylesCache in project JavaClasses by genexuslabs.
the class ExcelDocument method Open.
public short Open(String fileName) {
resetError();
if (fileName.indexOf('.') == -1) {
fileName += ".xlsx";
}
try {
if (!template.equals("")) {
GXFile templateFile = new GXFile(template);
if (templateFile.exists()) {
workBook = new SXSSFWorkbook(new XSSFWorkbook(templateFile.getStream()));
} else {
// Invalid template
errCod = 4;
errDescription = "Invalid template.";
return errCod;
}
} else {
GXFile file = new GXFile("", fileName, Constants.EXTERNAL_UPLOAD_ACL, GxFileInfoSourceType.Unknown);
if (file.exists()) {
// System.out.println("Opening..");
workBook = new SXSSFWorkbook(new XSSFWorkbook(file.getStream()));
} else {
// System.out.println("Creating..");
workBook = new SXSSFWorkbook();
}
}
this.selectFirstSheet();
xlsFileName = fileName.toString();
stylesCache = new StylesCache(workBook);
} catch (Exception e) {
// error creando xlsx file
errCod = 10;
errDescription = "Could not open file.";
System.err.println("GXOffice Error: " + e.toString());
return errCod;
}
return 0;
}
Aggregations