use of jxl.write.WritableCellFormat in project cubrid-manager by CUBRID.
the class ExportTableDefinitionLayoutType method getNormalCenterAlignCellStyle.
/**
* GetNormalCell
*
* @return WritableCellFormat
*/
public static WritableCellFormat getNormalCenterAlignCellStyle() {
WritableFont font = new WritableFont(WritableFont.ARIAL, 10);
WritableCellFormat format = new WritableCellFormat(font);
try {
format.setAlignment(jxl.format.Alignment.CENTRE);
format.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
format.setBorder(Border.ALL, BorderLineStyle.THIN, Colour.BLACK);
format.setWrap(true);
} catch (WriteException e) {
LOGGER.error("", e);
}
return format;
}
use of jxl.write.WritableCellFormat in project cubrid-manager by CUBRID.
the class ExportTableDefinitionLayoutType method getNormalLeftAlignCellStyle.
/**
* GetNormalLeftAlignCellStyle
*
* @return WritableCellFormat
*/
public static WritableCellFormat getNormalLeftAlignCellStyle() {
WritableFont font = new WritableFont(WritableFont.ARIAL, 10);
WritableCellFormat format = new WritableCellFormat(font);
try {
format.setAlignment(jxl.format.Alignment.LEFT);
format.setVerticalAlignment(jxl.format.VerticalAlignment.TOP);
format.setBorder(Border.ALL, BorderLineStyle.THIN, Colour.BLACK);
format.setWrap(true);
} catch (WriteException e) {
LOGGER.error("", e);
}
return format;
}
use of jxl.write.WritableCellFormat in project cubrid-manager by CUBRID.
the class ExportTableDefinitionLayoutType method getBoldCenterAlignCellStyle.
/**
* GetNormalCell
*
* @return WritableCellFormat
*/
public static WritableCellFormat getBoldCenterAlignCellStyle() {
WritableFont font = new WritableFont(WritableFont.ARIAL, 10);
WritableCellFormat format = new WritableCellFormat(font);
try {
font.setBoldStyle(WritableFont.BOLD);
format.setAlignment(jxl.format.Alignment.CENTRE);
format.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
format.setBorder(Border.ALL, BorderLineStyle.THIN, Colour.BLACK);
format.setBackground(jxl.format.Colour.GREY_25_PERCENT);
format.setWrap(true);
} catch (WriteException e) {
LOGGER.error("", e);
}
return format;
}
use of jxl.write.WritableCellFormat in project cubrid-manager by CUBRID.
the class RunSQLEventHandler method getNormalCell.
/**
* Return the normal cell format.
*
* @return WritableCellFormat
*/
public static WritableCellFormat getNormalCell() {
// FIXME logic code move to core module
WritableFont font = new WritableFont(WritableFont.TIMES, 12);
WritableCellFormat format = new WritableCellFormat(font);
try {
format.setAlignment(jxl.format.Alignment.LEFT);
format.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
format.setBorder(Border.ALL, BorderLineStyle.THIN, Colour.BLACK);
format.setWrap(true);
} catch (WriteException e) {
LOGGER.error(e.getMessage(), e);
}
return format;
}
use of jxl.write.WritableCellFormat in project cubrid-manager by CUBRID.
the class ExportErrorDataProgress method run.
/* (non-Javadoc)
* @see org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor)
*/
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
// FIXME logic code move to core module
WritableWorkbook wwb = null;
try {
WorkbookSettings workbookSettings = new WorkbookSettings();
workbookSettings.setEncoding(charset);
wwb = Workbook.createWorkbook(new File(filePath), workbookSettings);
int index = 0;
for (Entry<String, List<SqlRunnerFailed>> entry : failedListMap.entrySet()) {
WritableSheet ws = wwb.createSheet(entry.getKey(), index++);
WritableCellFormat normalCellStyle = getNormalCell();
WritableCellFormat titleCellStyle = getTitleCell();
jxl.write.Label header = new jxl.write.Label(0, 0, Messages.failedSQLlineNumber, titleCellStyle);
ws.addCell(header);
jxl.write.Label header1 = new jxl.write.Label(1, 0, Messages.failedSQL, titleCellStyle);
ws.addCell(header1);
jxl.write.Label header2 = new jxl.write.Label(2, 0, Messages.failedErrorMessage, titleCellStyle);
ws.addCell(header2);
ws.setColumnView(1, 100);
ws.setColumnView(2, 80);
for (int j = 0; j < entry.getValue().size(); j++) {
SqlRunnerFailed failedInfo = entry.getValue().get(j);
int row = j + 1;
jxl.write.Number lineNmuber = new jxl.write.Number(0, row, failedInfo.getLineIndex(), normalCellStyle);
ws.addCell(lineNmuber);
jxl.write.Label sql = new jxl.write.Label(1, row, failedInfo.getSql(), normalCellStyle);
ws.addCell(sql);
jxl.write.Label errMessage = new jxl.write.Label(2, row, failedInfo.getErrorMessage(), normalCellStyle);
ws.addCell(errMessage);
}
}
wwb.write();
success = true;
} catch (Exception e) {
LOGGER.error("write excel error", e);
errMsg = e.getMessage();
} finally {
if (wwb != null) {
try {
wwb.close();
} catch (Exception e) {
LOGGER.error("close excel error", e);
}
}
}
}
Aggregations