Search in sources :

Example 21 with WritableFont

use of jxl.write.WritableFont 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;
}
Also used : WriteException(jxl.write.WriteException) WritableFont(jxl.write.WritableFont) WritableCellFormat(jxl.write.WritableCellFormat)

Example 22 with WritableFont

use of jxl.write.WritableFont 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;
}
Also used : WriteException(jxl.write.WriteException) WritableFont(jxl.write.WritableFont) WritableCellFormat(jxl.write.WritableCellFormat)

Example 23 with WritableFont

use of jxl.write.WritableFont 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;
}
Also used : WriteException(jxl.write.WriteException) WritableFont(jxl.write.WritableFont) WritableCellFormat(jxl.write.WritableCellFormat)

Example 24 with WritableFont

use of jxl.write.WritableFont in project aws-doc-sdk-examples by awsdocs.

the class WriteExcel method createLabel.

// Create headings in the Excel spreadsheet.
private void createLabel(WritableSheet sheet) throws WriteException {
    // Create a Times font.
    WritableFont times10pt = new WritableFont(WritableFont.TIMES, 10);
    // Define the cell format.
    times = new WritableCellFormat(times10pt);
    // Automatically wrap the cells.
    times.setWrap(true);
    // Create a bold font with underlining.
    WritableFont times10ptBoldUnderline = new WritableFont(WritableFont.TIMES, 10, WritableFont.BOLD, false, UnderlineStyle.SINGLE);
    timesBoldUnderline = new WritableCellFormat(times10ptBoldUnderline);
    // Automatically wrap the cells.
    timesBoldUnderline.setWrap(true);
    CellView cv = new CellView();
    cv.setFormat(times);
    cv.setFormat(timesBoldUnderline);
    cv.setAutosize(true);
    // Write a few headers.
    addCaption(sheet, 0, 0, "Writer");
    addCaption(sheet, 1, 0, "Date");
    addCaption(sheet, 2, 0, "Guide");
    addCaption(sheet, 3, 0, "Description");
    addCaption(sheet, 4, 0, "Status");
}
Also used : WritableFont(jxl.write.WritableFont) WritableCellFormat(jxl.write.WritableCellFormat) CellView(jxl.CellView)

Example 25 with WritableFont

use of jxl.write.WritableFont in project network-monitor by caarmen.

the class ExcelExport method createCellFormats.

/**
 * In order to set text to bold, red, or green, we need to create cell
 * formats for each style.
 */
private void createCellFormats() {
    // Insert a dummy empty cell, so we can obtain its cell. This allows to
    // start with a default cell format.
    Label cell = new Label(0, 0, " ");
    CellFormat cellFormat = cell.getCellFormat();
    try {
        // Center all cells.
        mDefaultFormat = new WritableCellFormat(cellFormat);
        mDefaultFormat.setAlignment(Alignment.CENTRE);
        // Create the bold format
        final WritableFont boldFont = new WritableFont(cellFormat.getFont());
        mBoldFormat = new WritableCellFormat(mDefaultFormat);
        boldFont.setBoldStyle(WritableFont.BOLD);
        mBoldFormat.setFont(boldFont);
        mBoldFormat.setWrap(true);
        mBoldFormat.setAlignment(Alignment.CENTRE);
        // Create the red format
        mRedFormat = new WritableCellFormat(mDefaultFormat);
        final WritableFont redFont = new WritableFont(cellFormat.getFont());
        redFont.setColour(Colour.RED);
        mRedFormat.setFont(redFont);
        // Create the green format
        mGreenFormat = new WritableCellFormat(mDefaultFormat);
        final WritableFont greenFont = new WritableFont(cellFormat.getFont());
        greenFont.setColour(Colour.GREEN);
        mGreenFormat.setFont(greenFont);
        // Create the amber format
        mAmberFormat = new WritableCellFormat(mDefaultFormat);
        final WritableFont amberFont = new WritableFont(cellFormat.getFont());
        amberFont.setColour(Colour.LIGHT_ORANGE);
        mAmberFormat.setFont(amberFont);
    } catch (WriteException e) {
        Log.e(TAG, "createCellFormats Could not create cell formats", e);
    }
}
Also used : WriteException(jxl.write.WriteException) CellFormat(jxl.format.CellFormat) WritableCellFormat(jxl.write.WritableCellFormat) WritableFont(jxl.write.WritableFont) Label(jxl.write.Label) WritableCellFormat(jxl.write.WritableCellFormat)

Aggregations

WritableCellFormat (jxl.write.WritableCellFormat)26 WritableFont (jxl.write.WritableFont)26 WriteException (jxl.write.WriteException)15 CellView (jxl.CellView)5 Label (jxl.write.Label)5 WorkbookSettings (jxl.WorkbookSettings)4 WritableSheet (jxl.write.WritableSheet)4 WritableWorkbook (jxl.write.WritableWorkbook)4 IOException (java.io.IOException)3 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 Date (java.util.Date)2 CellFormat (jxl.format.CellFormat)2 CubridDatabase (com.cubrid.common.ui.spi.model.CubridDatabase)1 DatabaseEditorConfig (com.cubrid.common.ui.spi.model.DatabaseEditorConfig)1 DatabaseInfo (com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo)1 CUBRIDResultSetMetaDataProxy (com.cubrid.jdbc.proxy.driver.CUBRIDResultSetMetaDataProxy)1 CCell (eu.ggnet.lucidcalc.CCell)1 CColumnView (eu.ggnet.lucidcalc.CColumnView)1 CFormat (eu.ggnet.lucidcalc.CFormat)1 CRowView (eu.ggnet.lucidcalc.CRowView)1