jxl.write.WritableCell Java Examples
The following examples show how to use
jxl.write.WritableCell.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ExcelUtil.java From ctsms with GNU Lesser General Public License v2.1 | 5 votes |
public static void writeCell(WritableSheet spreadSheet, int c, int r, Class returnType, Object value, ExcelCellFormat f, HashMap<String, WritableCellFormat> cellFormats) throws Exception { if (spreadSheet != null) { WritableCell cell = createCell(returnType, c, r, value, f, cellFormats); addCell(cell, spreadSheet, c, r, f); } }
Example #2
Source File: ExcelUtil.java From ctsms with GNU Lesser General Public License v2.1 | 5 votes |
public static void writeHead(WritableSheet spreadSheet, int c, int r, String columnName, ExcelCellFormat f, HashMap<String, WritableCellFormat> cellFormats) throws Exception { if (spreadSheet != null) { WritableCell cell; if (f.isOverrideFormat()) { cell = new jxl.write.Label(c, r, columnName, getHeadCellFormat(f, cellFormats)); } else { cell = new jxl.write.Label(c, r, columnName); } addCell(cell, spreadSheet, c, r, f); } }
Example #3
Source File: ExportChart.java From High-Frequency-Data-Order-Book-Analyser with GNU General Public License v2.0 | 5 votes |
public void addData(int date, double bid, double ask) { String tmp; WritableCell cell; if (nrows == 1) { if (bid == 0) { list_data.add(new Number(0, 1, date)); list_data.add(new Number(1, 1, ask)); list_data.add(new Number(2, 1, ask)); last_bid = ask; last_ask = ask; } else { list_data.add(new Number(0, 1, date)); list_data.add(new Number(1, 1, bid)); list_data.add(new Number(2, 1, bid)); last_bid = bid; last_ask = bid; } } else { if (bid == 0) { list_data.add(new Number(0, nrows, date)); list_data.add(new Number(1, nrows, last_bid)); list_data.add(new Number(2, nrows, ask)); last_ask = ask; } else { list_data.add(new Number(0, nrows, date)); list_data.add(new Number(1, nrows, bid)); list_data.add(new Number(2, nrows, last_ask)); last_bid = bid; } } nrows++; }
Example #4
Source File: TableOutputter.java From morf with Apache License 2.0 | 4 votes |
/** * Outputs the data headings row. * * @param workSheet to add the row to * @param table to fetch metadata from * @param startRow to add the headings at * @param helpTextRowNumbers - the map of column names to row index for each * bit of help text * @throws WriteException if any of the writes to workSheet failed * @return the row to carry on inserting at */ private int outputDataHeadings(WritableSheet workSheet, Table table, final int startRow, final Map<String, Integer> helpTextRowNumbers) throws WriteException { int currentRow = startRow; int columnNumber = 0; final WritableCellFormat columnHeadingFormat = getBoldFormat(); columnHeadingFormat.setBackground(Colour.VERY_LIGHT_YELLOW); WritableFont font = new WritableFont(WritableFont.ARIAL, 8, WritableFont.BOLD); font.setColour(Colour.BLUE); font.setUnderlineStyle(UnderlineStyle.SINGLE); columnHeadingFormat.setFont(font); for (Column column : table.columns()) { if(columnNumber < MAX_EXCEL_COLUMNS && !column.getName().equals("id") && !column.getName().equals("version")) { // Data heading is a link back to the help text WritableHyperlink linkToHelp = new WritableHyperlink( columnNumber, currentRow, spreadsheetifyName(column.getName()), workSheet, 0, helpTextRowNumbers.get(column.getName())); workSheet.addHyperlink(linkToHelp); WritableCell label = workSheet.getWritableCell(columnNumber, currentRow); label.setCellFormat(columnHeadingFormat); // Update the help text such that it is a link to the heading Cell helpCell = workSheet.getCell(0, helpTextRowNumbers.get(column.getName())); WritableHyperlink linkFromHelp = new WritableHyperlink( 0, helpTextRowNumbers.get(column.getName()), helpCell.getContents(), workSheet, columnNumber, currentRow); workSheet.addHyperlink(linkFromHelp); columnNumber++; } } currentRow++; return currentRow; }