jxl.write.Number Java Examples

The following examples show how to use jxl.write.Number. 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: ExportChartVolume.java    From High-Frequency-Data-Order-Book-Analyser with GNU General Public License v2.0 5 votes vote down vote up
public void addData(int date, double price, double shares) {

        list_data.add(new Number(0, nrows, date));
        list_data.add(new Number(1, nrows, price));
        list_data.add(new Number(2, nrows, shares));

        nrows++;
    }
 
Example #2
Source File: ExportChartSpread.java    From High-Frequency-Data-Order-Book-Analyser with GNU General Public License v2.0 5 votes vote down vote up
public void addData(int date, double bid, double ask) {

        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 #3
Source File: ExportChart.java    From High-Frequency-Data-Order-Book-Analyser with GNU General Public License v2.0 5 votes vote down vote up
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: JExcelHelper.java    From tutorials with MIT License 5 votes vote down vote up
public void writeJExcel() throws IOException, WriteException {
    WritableWorkbook workbook = null;
    try {
        File currDir = new File(".");
        String path = currDir.getAbsolutePath();
        String fileLocation = path.substring(0, path.length() - 1) + "temp.xls";

        workbook = Workbook.createWorkbook(new File(fileLocation));

        WritableSheet sheet = workbook.createSheet("Sheet 1", 0);

        WritableCellFormat headerFormat = new WritableCellFormat();
        WritableFont font = new WritableFont(WritableFont.ARIAL, 16, WritableFont.BOLD);
        headerFormat.setFont(font);
        headerFormat.setBackground(Colour.LIGHT_BLUE);
        headerFormat.setWrap(true);
        Label headerLabel = new Label(0, 0, "Name", headerFormat);
        sheet.setColumnView(0, 60);
        sheet.addCell(headerLabel);

        headerLabel = new Label(1, 0, "Age", headerFormat);
        sheet.setColumnView(0, 40);
        sheet.addCell(headerLabel);

        WritableCellFormat cellFormat = new WritableCellFormat();
        cellFormat.setWrap(true);

        Label cellLabel = new Label(0, 2, "John Smith", cellFormat);
        sheet.addCell(cellLabel);
        Number cellNumber = new Number(1, 2, 20, cellFormat);
        sheet.addCell(cellNumber);
			
        workbook.write();
    } finally {
        if (workbook != null) {
            workbook.close();
        }
    }

}
 
Example #5
Source File: ExportChartVolume.java    From High-Frequency-Data-Order-Book-Analyser with GNU General Public License v2.0 4 votes vote down vote up
private void WriteData() throws WriteException {
    for (Number e : list_data) {
        out.addCell(e);
    }
}
 
Example #6
Source File: ExportChartSpread.java    From High-Frequency-Data-Order-Book-Analyser with GNU General Public License v2.0 4 votes vote down vote up
private void WriteData() throws WriteException {
    for (Number e : list_data) {
        out.addCell(e);
    }
}
 
Example #7
Source File: ExportChart.java    From High-Frequency-Data-Order-Book-Analyser with GNU General Public License v2.0 4 votes vote down vote up
private void WriteData() throws WriteException {
    for (Number e : list_data) {
        out.addCell(e);
    }
}