jxl.write.WriteException Java Examples

The following examples show how to use jxl.write.WriteException. 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: ResultExport.java    From yeti with MIT License 8 votes vote down vote up
public static void ExportCertToXLS(String filename, ArrayList<Object> data) throws IOException {
    try {
        WritableFont titleFont = new WritableFont(WritableFont.ARIAL, 10, WritableFont.BOLD, true);
        WritableCellFormat titleformat = new WritableCellFormat(titleFont);
        WritableWorkbook workbook = Workbook.createWorkbook(new File(filename));
        WritableSheet sheet = workbook.createSheet("SSLCert CN", 0);
        sheet.addCell(new Label(0, 0, "IP address", titleformat));
        sheet.addCell(new Label(1, 0, "Host name", titleformat));
        sheet.addCell(new Label(2, 0, "Domain name", titleformat));
        int nextRow = 1;
        Iterator i = data.iterator();
        while (i.hasNext()) {
            CertResult res = (CertResult) i.next();
            sheet.addCell(new Label(0, nextRow, res.getIpAddress()));
            sheet.addCell(new Label(1, nextRow, res.getHostName()));
            sheet.addCell(new Label(2, nextRow, res.getDomainName()));
            nextRow++;
        }
        workbook.write();
        workbook.close();
    } catch (WriteException ex) {
        Logger.getLogger("resultExport.ExportForwardLookupsToXLS").log(Level.SEVERE, null, ex);
    }
}
 
Example #2
Source File: DownloadFileService.java    From pacbot with Apache License 2.0 8 votes vote down vote up
/**
 * Adds the cell.
 *
 * @param writablesheet the writablesheet
 * @param issueDetail the issue detail
 * @param cellFormat the cell format
 * @param columnIndex the column index
 * @param columns the columns
 * @throws WriteException the write exception
 */
private void addCell(WritableSheet writablesheet, JsonObject issueDetail, WritableCellFormat cellFormat,
        int columnIndex,List<String>columns) throws WriteException {
    int rowIndex = 0;

    for (String clm : columns) {
        if (issueDetail.has(clm)) {
            if (issueDetail.get(clm).isJsonNull()) {
                writablesheet.addCell(new Label(rowIndex++, 1 + columnIndex, "No Data", cellFormat));
            } else {
                writablesheet.addCell(new Label(rowIndex++, 1 + columnIndex, issueDetail.get(clm).getAsString(),
                        cellFormat));
            }

        }
    }
}
 
Example #3
Source File: DownloadFileService.java    From pacbot with Apache License 2.0 8 votes vote down vote up
/**
 * Format writable sheet.
 *
 * @param writablesheet the writable sheet
 * @param columns the columns
 * @throws WriteException the write exception
 */
private void formatWritableSheet(WritableSheet writablesheet,List<String>columns) throws WriteException {
    WritableFont cellFonts = new WritableFont(WritableFont.createFont("Calibri"), ELEVEN, WritableFont.BOLD, false,
            UnderlineStyle.NO_UNDERLINE, jxl.format.Colour.BLACK);
    WritableCellFormat cellFormats = new WritableCellFormat(cellFonts);
    cellFormats.setBorder(Border.ALL, BorderLineStyle.THIN);
    cellFormats.setBackground(Colour.WHITE);
    int labelIndex = 0;
    for (String clm : columns) {
        writablesheet.addCell(new Label(labelIndex, 0, clm.replaceAll("_", ""), cellFormats));
        CellView cell = writablesheet.getColumnView(labelIndex);
        cell.setAutosize(true);
        writablesheet.setColumnView(labelIndex, cell);
        labelIndex++;
    }
}
 
Example #4
Source File: ResultExport.java    From yeti with MIT License 8 votes vote down vote up
public static void ExportTLDToXLS(String filename, ArrayList<Object> data) throws IOException {
    try {
        WritableFont titleFont = new WritableFont(WritableFont.ARIAL, 10, WritableFont.BOLD, true);
        WritableCellFormat titleformat = new WritableCellFormat(titleFont);
        WritableWorkbook workbook = Workbook.createWorkbook(new File(filename));
        WritableSheet sheet = workbook.createSheet("TLD Expand", 0);
        sheet.addCell(new Label(0, 0, "Domain name", titleformat));
        sheet.addCell(new Label(1, 0, "Name server", titleformat));
        sheet.addCell(new Label(2, 0, "Admin name", titleformat));
        sheet.addCell(new Label(3, 0, "Registrant", titleformat));
        int nextRow = 1;
        Iterator i = data.iterator();
        while (i.hasNext()) {
            DomainResult res = (DomainResult) i.next();
            sheet.addCell(new Label(0, nextRow, res.getDomainName()));
            sheet.addCell(new Label(1, nextRow, res.getNameServer()));
            sheet.addCell(new Label(2, nextRow, res.getAdminName()));
            sheet.addCell(new Label(3, nextRow, res.getRegistrant()));
            nextRow++;
        }
        workbook.write();
        workbook.close();
    } catch (WriteException ex) {
        Logger.getLogger("resultExport.ExportForwardLookupsToXLS").log(Level.SEVERE, null, ex);
    }
}
 
Example #5
Source File: ResultExport.java    From yeti with MIT License 8 votes vote down vote up
public static void ExportForwardLookupsToXLS(String filename, List<Object> data) throws IOException {
    try {
        WritableFont titleFont = new WritableFont(WritableFont.ARIAL, 10, WritableFont.BOLD, true);
        WritableCellFormat titleformat = new WritableCellFormat(titleFont);
        WritableWorkbook workbook = Workbook.createWorkbook(new File(filename));
        WritableSheet sheet = workbook.createSheet("Forward lookups", 0);
        sheet.addCell(new Label(0, 0, "Domain name", titleformat));
        sheet.addCell(new Label(1, 0, "Host name", titleformat));
        sheet.addCell(new Label(2, 0, "IP address", titleformat));
        sheet.addCell(new Label(3, 0, "Type", titleformat));
        int nextRow = 1;
        Iterator i = data.iterator();
        while (i.hasNext()) {
            ForwardLookupResult res = (ForwardLookupResult) i.next();
            sheet.addCell(new Label(0, nextRow, res.getDomainName()));
            sheet.addCell(new Label(1, nextRow, res.getHostName()));
            sheet.addCell(new Label(2, nextRow, res.getIpAddress()));
            sheet.addCell(new Label(3, nextRow, res.getLookupType()));
            nextRow++;
        }
        workbook.write();
        workbook.close();
    } catch (WriteException ex) {
        Logger.getLogger("resultExport.ExportForwardLookupsToXLS").log(Level.SEVERE, null, ex);
    }
}
 
Example #6
Source File: ResultExport.java    From yeti with MIT License 7 votes vote down vote up
public static void ExportReverseToXLS(String filename, ArrayList<Object> data) throws IOException {
    try {
        WritableFont titleFont = new WritableFont(WritableFont.ARIAL, 10, WritableFont.BOLD, true);
        WritableCellFormat titleformat = new WritableCellFormat(titleFont);
        WritableWorkbook workbook = Workbook.createWorkbook(new File(filename));
        WritableSheet sheet = workbook.createSheet("Bing IP search", 0);
        sheet.addCell(new Label(0, 0, "IP address", titleformat));
        sheet.addCell(new Label(1, 0, "Domain name", titleformat));
        sheet.addCell(new Label(2, 0, "Host name", titleformat));
        int nextRow = 1;
        Iterator i = data.iterator();
        while (i.hasNext()) {
            ReverseLookupResult res = (ReverseLookupResult) i.next();
            sheet.addCell(new Label(0, nextRow, res.getIpAddress()));
            sheet.addCell(new Label(1, nextRow, res.getDomainName()));
            sheet.addCell(new Label(2, nextRow, res.getHostName()));
            nextRow++;
        }
        workbook.write();
        workbook.close();
    } catch (WriteException ex) {
        Logger.getLogger("resultExport.ExportReverseToXLS").log(Level.SEVERE, null, ex);
    }
}
 
Example #7
Source File: CreateFilePane.java    From pattypan with MIT License 7 votes vote down vote up
private WikiPane setActions() {
  fileName.textProperty().addListener((observable, oldValue, newValue) -> {
    createButton.setDisable(newValue.isEmpty());
  });

  createButton.setOnAction(event -> {
    try {
      createSpreadsheet();
      showOpenFileButton();
      Settings.saveProperties();
    } catch (IOException | BiffException | WriteException ex) {
      addElement(new WikiLabel("create-file-error"));
      Session.LOGGER.log(Level.WARNING, 
          "Error occurred during creation of spreadsheet file: {0}",
          new String[]{ex.getLocalizedMessage()}
      );
    }
  });

  return this;
}
 
Example #8
Source File: ExcelFontMap.java    From hop with Apache License 2.0 6 votes vote down vote up
public static WritableCellFormat getAlignment( int transformValue, WritableCellFormat format ) throws WriteException {
  if ( transformValue != ExcelOutputMeta.FONT_ALIGNMENT_LEFT ) {
    switch ( transformValue ) {
      case ExcelOutputMeta.FONT_ALIGNMENT_RIGHT:
        format.setAlignment( jxl.format.Alignment.RIGHT );
        break;
      case ExcelOutputMeta.FONT_ALIGNMENT_CENTER:
        format.setAlignment( jxl.format.Alignment.CENTRE );
        break;
      case ExcelOutputMeta.FONT_ALIGNMENT_FILL:
        format.setAlignment( jxl.format.Alignment.FILL );
        break;
      case ExcelOutputMeta.FONT_ALIGNMENT_GENERAL:
        format.setAlignment( jxl.format.Alignment.GENERAL );
        break;
      case ExcelOutputMeta.FONT_ALIGNMENT_JUSTIFY:
        format.setAlignment( jxl.format.Alignment.JUSTIFY );
        break;
      default:
        break;
    }
  }
  return format;
}
 
Example #9
Source File: ExcelFontMap.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public static WritableCellFormat getAlignment( int stepValue, WritableCellFormat format ) throws WriteException {
  if ( stepValue != ExcelOutputMeta.FONT_ALIGNMENT_LEFT ) {
    switch ( stepValue ) {
      case ExcelOutputMeta.FONT_ALIGNMENT_RIGHT:
        format.setAlignment( jxl.format.Alignment.RIGHT );
        break;
      case ExcelOutputMeta.FONT_ALIGNMENT_CENTER:
        format.setAlignment( jxl.format.Alignment.CENTRE );
        break;
      case ExcelOutputMeta.FONT_ALIGNMENT_FILL:
        format.setAlignment( jxl.format.Alignment.FILL );
        break;
      case ExcelOutputMeta.FONT_ALIGNMENT_GENERAL:
        format.setAlignment( jxl.format.Alignment.GENERAL );
        break;
      case ExcelOutputMeta.FONT_ALIGNMENT_JUSTIFY:
        format.setAlignment( jxl.format.Alignment.JUSTIFY );
        break;
      default:
        break;
    }
  }
  return format;
}
 
Example #10
Source File: ExportChart.java    From High-Frequency-Data-Order-Book-Analyser with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void handleBestBid(DataOrderBook data) {

    if (bool) {
        if (this.i <= size) {
            if (this.i == size) {
                try {
                    this.endExport();
                } catch (IOException | WriteException ex) {
                    Logger.getLogger(ExportChart.class.getName()).log(Level.SEVERE, null, ex);
                }

            } else {
                this.addData(data.getTime(), data.getPrice(), 0);
            }
            this.i++;
        }

    }
}
 
Example #11
Source File: ExportChart.java    From High-Frequency-Data-Order-Book-Analyser with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void handleBestAsk(DataOrderBook data) {

    if (bool) {
        if (this.i <= size) {
            if (this.i == size) {
                try {
                    this.endExport();
                } catch (IOException | WriteException ex) {
                    Logger.getLogger(ExportChart.class.getName()).log(Level.SEVERE, null, ex);
                }
            } else {
                this.addData(data.getTime(), 0, data.getPrice());
            }
            this.i++;

        }
    }
}
 
Example #12
Source File: Main.java    From High-Frequency-Data-Order-Book-Analyser with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws IOException, InterruptedException, WriteException {

        
        //Paramètres
        SimulationParameters simulationParameters = new SimulationParameters();
        RefineryUtilities.centerFrameOnScreen(simulationParameters);
        simulationParameters.setVisible(true);

        while (simulationParametersComplete == false) {
            sleep(1);
            // Get user selected time and file to open
            if (hDep == null || resultFile == null) {
                simulationParametersComplete = false;
            } else {
                simulationParametersComplete = true;
            }
        }

        //App Controller
        AppController ac = new AppController(hDep, resultFile);
        //Lancement des threads
        ac.launch();

    }
 
Example #13
Source File: ExportChartSpread.java    From High-Frequency-Data-Order-Book-Analyser with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void handleBestBid(DataOrderBook data) {

    if (bool) {
        if (this.i <= size) {
            if (this.i == size) {
                try {
                    this.endExport();
                     window.getSE_BA().setEnabled(true);
                     window.getEE_BA().setEnabled(false);
                } catch (IOException | WriteException ex) {
                    Logger.getLogger(ExportChartSpread.class.getName()).log(Level.SEVERE, null, ex);
                }

            } else {
                this.addData(data.getTime(), data.getPrice(), 0);
            }
            this.i++;
        }

    }
}
 
Example #14
Source File: ExportChartSpread.java    From High-Frequency-Data-Order-Book-Analyser with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void handleBestAsk(DataOrderBook data) {

    if (bool) {
        if (this.i <= size) {
            if (this.i == size) {
                try {
                    this.endExport();
                     window.getSE_BA().setEnabled(true);
                     window.getEE_BA().setEnabled(false);
                } catch (IOException | WriteException ex) {
                    Logger.getLogger(ExportChartSpread.class.getName()).log(Level.SEVERE, null, ex);
                }
            } else {
                this.addData(data.getTime(), 0, data.getPrice());
            }
            this.i++;

        }
    }
}
 
Example #15
Source File: ExportChartVolume.java    From High-Frequency-Data-Order-Book-Analyser with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void handleBestLast(int time, double price, int volume) {

    if (bool) {
        if (this.i <= size) {
            if (this.i == size) {
                try {

                    this.endExport();
                    window.getSE_EXE().setEnabled(true);
                    window.getEE_EXE().setEnabled(false);

                } catch (IOException | WriteException ex) {
                    Logger.getLogger(ExportChartSpread.class.getName()).log(Level.SEVERE, null, ex);
                }
            } else {
                this.addData(time, price, volume);
            }
            this.i++;

        }
    }
}
 
Example #16
Source File: WriteExcel.java    From aws-doc-sdk-examples with Apache License 2.0 6 votes vote down vote up
public java.io.InputStream write( List<WorkItem> list) throws IOException, WriteException {
    java.io.OutputStream os = new java.io.ByteArrayOutputStream() ;
    WorkbookSettings wbSettings = new WorkbookSettings();

    wbSettings.setLocale(new Locale("en", "EN"));

    // Create a Workbook - pass the OutputStream
    WritableWorkbook workbook = Workbook.createWorkbook(os, wbSettings);
    workbook.createSheet("Work Item Report", 0);
    WritableSheet excelSheet = workbook.getSheet(0);
    createLabel(excelSheet) ;
    int size = createContent(excelSheet, list);

    // Close the workbook
    workbook.write();
    workbook.close();

    // Get an inputStram that represents the Report
    java.io.ByteArrayOutputStream stream = new java.io.ByteArrayOutputStream();
    stream = (java.io.ByteArrayOutputStream)os;
    byte[] myBytes = stream.toByteArray();
    java.io.InputStream is = new java.io.ByteArrayInputStream(myBytes) ;

    return is ;
}
 
Example #17
Source File: DownloadFileService.java    From pacbot with Apache License 2.0 6 votes vote down vote up
/**
 * Gets the file bytes.
 *
 * @param issueDetails the issue details
 * @param methodType the method type
 * @param columns the columns
 * @return the file bytes
 * @throws WriteException the write exception
 * @throws IOException Signals that an I/O exception has occurred.
 */
private byte[] getFileBytes(JsonArray issueDetails, String methodType, List<String>columns) throws WriteException, IOException {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    WritableWorkbook workbook = Workbook.createWorkbook(baos);
    WritableSheet writablesheet = workbook.createSheet(methodType, 0);
    formatWritableSheet(writablesheet,columns);
    addWritableSheetCells(writablesheet, issueDetails,columns);
    workbook.write();
    workbook.close();
    return baos.toByteArray();
}
 
Example #18
Source File: ExcelUtil.java    From Android_Excel with Apache License 2.0 6 votes vote down vote up
public static WritableCellFormat getHeader() {
	WritableFont font = new WritableFont(WritableFont.TIMES, 10,
			WritableFont.BOLD);// 定义字体
	try {
		font.setColour(Colour.BLUE);// 蓝色字体
	} catch (WriteException e1) {
		e1.printStackTrace();
	}
	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.setBackground(Colour.YELLOW);// 黄色背景
	} catch (WriteException e) {
		e.printStackTrace();
	}
	return format;
}
 
Example #19
Source File: ExcelFontMap.java    From hop with Apache License 2.0 5 votes vote down vote up
public static WritableCellFormat getOrientation( int transformValue, WritableCellFormat cellFormat ) throws WriteException {
  if ( transformValue != ExcelOutputMeta.FONT_ORIENTATION_HORIZONTAL ) {
    switch ( transformValue ) {
      case ExcelOutputMeta.FONT_ORIENTATION_MINUS_45:
        cellFormat.setOrientation( jxl.format.Orientation.MINUS_45 );
        break;
      case ExcelOutputMeta.FONT_ORIENTATION_MINUS_90:
        cellFormat.setOrientation( jxl.format.Orientation.MINUS_90 );
        break;
      case ExcelOutputMeta.FONT_ORIENTATION_PLUS_45:
        cellFormat.setOrientation( jxl.format.Orientation.PLUS_45 );
        break;
      case ExcelOutputMeta.FONT_ORIENTATION_PLUS_90:
        cellFormat.setOrientation( jxl.format.Orientation.PLUS_90 );
        break;
      case ExcelOutputMeta.FONT_ORIENTATION_STACKED:
        cellFormat.setOrientation( jxl.format.Orientation.STACKED );
        break;
      case ExcelOutputMeta.FONT_ORIENTATION_VERTICAL:
        cellFormat.setOrientation( jxl.format.Orientation.VERTICAL );
        break;
      default:
        break;
    }
  }
  return cellFormat;
}
 
Example #20
Source File: WriteExcel.java    From aws-doc-sdk-examples with Apache License 2.0 5 votes vote down vote up
public java.io.InputStream exportExcel( List<WorkItem> list) {

        try {
            java.io.InputStream is = write( list);
            return is ;
        } catch(WriteException | IOException e) {
            e.printStackTrace();
        }
        return null;
    }
 
Example #21
Source File: ExcelFontMap.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public static WritableCellFormat getOrientation( int stepValue, WritableCellFormat cellFormat ) throws WriteException {
  if ( stepValue != ExcelOutputMeta.FONT_ORIENTATION_HORIZONTAL ) {
    switch ( stepValue ) {
      case ExcelOutputMeta.FONT_ORIENTATION_MINUS_45:
        cellFormat.setOrientation( jxl.format.Orientation.MINUS_45 );
        break;
      case ExcelOutputMeta.FONT_ORIENTATION_MINUS_90:
        cellFormat.setOrientation( jxl.format.Orientation.MINUS_90 );
        break;
      case ExcelOutputMeta.FONT_ORIENTATION_PLUS_45:
        cellFormat.setOrientation( jxl.format.Orientation.PLUS_45 );
        break;
      case ExcelOutputMeta.FONT_ORIENTATION_PLUS_90:
        cellFormat.setOrientation( jxl.format.Orientation.PLUS_90 );
        break;
      case ExcelOutputMeta.FONT_ORIENTATION_STACKED:
        cellFormat.setOrientation( jxl.format.Orientation.STACKED );
        break;
      case ExcelOutputMeta.FONT_ORIENTATION_VERTICAL:
        cellFormat.setOrientation( jxl.format.Orientation.VERTICAL );
        break;
      default:
        break;
    }
  }
  return cellFormat;
}
 
Example #22
Source File: JExcelIntegrationTest.java    From tutorials with MIT License 5 votes vote down vote up
@Before
public void generateExcelFile() throws IOException, WriteException {

    File currDir = new File(".");
    String path = currDir.getAbsolutePath();
    fileLocation = path.substring(0, path.length() - 1) + FILE_NAME;

    jExcelHelper = new JExcelHelper();
    jExcelHelper.writeJExcel();

}
 
Example #23
Source File: DownloadFileService.java    From pacbot with Apache License 2.0 5 votes vote down vote up
/**
 * Adds the writable sheet cells.
 *
 * @param writablesheet the writablesheet
 * @param issueDetails the issue details
 * @param columns the columns
 * @throws WriteException the write exception
 */
private void addWritableSheetCells(WritableSheet writablesheet, JsonArray issueDetails,List<String>columns) throws WriteException {
    WritableFont cellFont = new WritableFont(WritableFont.createFont("Calibri"), TWELVE);
    cellFont.setColour(Colour.BLACK);
    WritableCellFormat cellFormat = new WritableCellFormat(cellFont);
    cellFormat.setBackground(Colour.WHITE);
    cellFormat.setBorder(Border.ALL, BorderLineStyle.THIN, Colour.GRAY_25);
    for (int columnIndex = 0; columnIndex < issueDetails.size(); columnIndex++) {
        JsonObject issueDetail = issueDetails.get(columnIndex).getAsJsonObject();
        addCell(writablesheet, issueDetail, cellFormat, columnIndex,columns);
    }
}
 
Example #24
Source File: ExcelUtil.java    From ctsms with GNU Lesser General Public License v2.1 5 votes vote down vote up
private static void setBgColor(WritableCellFormat cellFormat, Color bgColor) {
	Colour colour = convertColor(bgColor);
	if (colour != null) {
		try {
			cellFormat.setBackground(colour);
		} catch (WriteException e) {
		}
	}
}
 
Example #25
Source File: TableOutputter.java    From morf with Apache License 2.0 5 votes vote down vote up
/**
 * @return the format to use for bold cells
 * @throws WriteException if the format could not be created
 */
private WritableCellFormat getBoldFormat() throws WriteException {
  WritableFont boldFont = new WritableFont(WritableFont.ARIAL, 8, WritableFont.BOLD);
  WritableCellFormat boldHeading = new WritableCellFormat(boldFont);
  boldHeading.setBorder(Border.BOTTOM, BorderLineStyle.MEDIUM);
  boldHeading.setVerticalAlignment(VerticalAlignment.CENTRE);
  boldHeading.setBackground(Colour.GRAY_25);


  WritableCellFormat boldFormat = new WritableCellFormat(boldFont);
  boldFormat.setVerticalAlignment(VerticalAlignment.TOP);
  return boldFormat;
}
 
Example #26
Source File: TableOutputter.java    From morf with Apache License 2.0 5 votes vote down vote up
/**
 * Outputs the example data rows.
 *
 * @param numberOfExamples to output
 * @param workSheet to add the data rows to
 * @param table to get metadata from
 * @param startRow to start adding the example rows at
 * @param records to add as examples
 * @return the new row to carry on outputting at
 * @throws WriteException if any of the writes to workSheet fail
 */
private int outputExampleData(final Integer numberOfExamples, WritableSheet workSheet, Table table, final int startRow, Iterable<Record> records) throws WriteException {
  int currentRow = startRow;

  int rowsOutput = 0;
  for (Record record : records) {

    if (currentRow >= MAX_EXCEL_ROWS) {
      continue;
    }

    if (numberOfExamples != null && rowsOutput >= numberOfExamples) {
      // Need to continue the loop rather than break as we need to close
      // the connection which happens at the end of iteration...
      continue;
    }

    record(currentRow, workSheet, table, record);
    rowsOutput++;
    currentRow++;
  }

  if (currentRow >= MAX_EXCEL_ROWS) {
    // This is a fix for WEB-56074. It will be removed if/when WEB-42351 is developed.
    throw new RowLimitExceededException("Output for table '" + table.getName() + "' exceeds the maximum number of rows (" + MAX_EXCEL_ROWS + ") in an Excel worksheet. It will be truncated.");
  }

  currentRow++;
  return currentRow;
}
 
Example #27
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 endExport() throws IOException, WriteException {

        Date mydate = new Date();

        try {
            outWorkBook = Workbook.createWorkbook(new File("TemplateChart-" + mydate.getHours() + "h" + mydate.getMinutes() + ".xls"));
            out = outWorkBook.createSheet("Data", 0);
            // Récupération de l'onglet courant (le premier onglet)
            out = outWorkBook.getSheet(0);
            Label labelD = new Label(0, 0, "Date");
            Label labelB = new Label(1, 0, "Bid");
            Label labelA = new Label(2, 0, "Ask");

            //Ajout des cellules 
            out.addCell(labelD);
            out.addCell(labelB);
            out.addCell(labelA);

        } catch (IOException ex) {
            Logger.getLogger(ExportChart.class.getName()).log(Level.SEVERE, null, ex);

        }
        this.WriteData();
        outWorkBook.write();
        outWorkBook.close();

    }
 
Example #28
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 endExport() throws IOException, WriteException {

        Date mydate = new Date();
        String file = "Export\\Spread\\TemplateChart-Spread-" + mydate.getHours() + "h" + mydate.getMinutes() + ".xls";
        File f = new File(file);
        f.getParentFile().mkdir();
        f.createNewFile();

        try {
            outWorkBook = Workbook.createWorkbook(f);
            out = outWorkBook.createSheet("Data", 0);
            // Récupération de l'onglet courant (le premier onglet)
            out = outWorkBook.getSheet(0);
            Label labelD = new Label(0, 0, "Date");
            Label labelB = new Label(1, 0, "Bid");
            Label labelA = new Label(2, 0, "Ask");

            //Ajout des cellules 
            out.addCell(labelD);
            out.addCell(labelB);
            out.addCell(labelA);

        } catch (IOException ex) {
            Logger.getLogger(ExportChartSpread.class.getName()).log(Level.SEVERE, null, ex);

        }
        this.WriteData();
        outWorkBook.write();

        outWorkBook.close();

    }
 
Example #29
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 endExport() throws IOException, WriteException {

        Date mydate = new Date();
        //String file = "C:/Users/Nicolas_2/Desktop/bachir V4/Nico/Export/TemplateChart-Spread-" + mydate.getHours() + "h" + mydate.getMinutes() + ".xls";
        String file = "Export\\Volume\\TemplateChart-Volume" + mydate.getHours() + "h" + mydate.getMinutes() + ".xls";
        File f = new File(file);
        f.getParentFile().mkdir();
        f.createNewFile();

        try {
            outWorkBook = Workbook.createWorkbook(f);
            out = outWorkBook.createSheet("Data", 0);
            // Récupération de l'onglet courant (le premier onglet)
            out = outWorkBook.getSheet(0);
            Label labelD = new Label(0, 0, "Date");
            Label labelP = new Label(1, 0, "Price");
            Label labelS = new Label(2, 0, "Shares");

            //Ajout des cellules 
            out.addCell(labelD);
            out.addCell(labelP);
            out.addCell(labelS);

        } catch (IOException ex) {
            Logger.getLogger(ExportChartSpread.class.getName()).log(Level.SEVERE, null, ex);

        }
        this.WriteData();
        outWorkBook.write();

        outWorkBook.close();

    }
 
Example #30
Source File: CreateFilePane.java    From pattypan with MIT License 5 votes vote down vote up
/**
 *
 * @param workbook
 * @throws WriteException
 */
private void createTemplateSheet(WritableWorkbook workbook) throws WriteException {
  WritableSheet templateSheet = workbook.createSheet("Template", 1);
  templateSheet.addCell(new Label(0, 0, "'" + Session.WIKICODE));
  //                                    ^^
  // leading apostrophe prevents turning wikitext into formula in Excel

  autoSizeColumn(0, templateSheet);
}