Search in sources :

Example 1 with RowsExceededException

use of jxl.write.biff.RowsExceededException in project cubrid-manager by CUBRID.

the class ExportHostStatusDialog method saveAllData.

private boolean saveAllData() {
    String fileName = saveExcelPath.getText() + saveExcelName.getText() + ".xls";
    WorkbookSettings workbookSettings = new WorkbookSettings();
    workbookSettings.setEncoding(fileCharsetCombo.getText());
    boolean isOK = true;
    try {
        wwb = Workbook.createWorkbook(new File(fileName), workbookSettings);
        /*System info*/
        saveTableData(com.cubrid.cubridmanager.ui.host.Messages.titleServerInfo, editor.getDbServerInfoText().getText(), com.cubrid.cubridmanager.ui.host.Messages.titleServerInfo, 0);
        /*DB info*/
        saveDBInfoData(editor.getDatabaseTable(), com.cubrid.cubridmanager.ui.host.Messages.titleDBInfo, 1);
        /*DB volume info*/
        saveTableData(editor.getVolumeTableViewer().getTable(), com.cubrid.cubridmanager.ui.host.Messages.titleVolumeInfo, 2);
        /*Broker info*/
        saveTableData(editor.getBrokerTableViewer().getTable(), com.cubrid.cubridmanager.ui.host.Messages.titleBrokerInfo, 3);
        /*System status*/
        saveTableData(editor.getServerTableViewer().getTable(), com.cubrid.cubridmanager.ui.host.Messages.titleSystemInfo, 4);
        wwb.write();
    } catch (IOException e) {
        isOK = false;
        LOGGER.error("Export to error", e);
    } catch (RowsExceededException e) {
        isOK = false;
        LOGGER.error("Export to error", e);
    } catch (WriteException e) {
        isOK = false;
        LOGGER.error("Export to error", e);
    } finally {
        if (wwb != null) {
            try {
                wwb.close();
            } catch (Exception ex) {
                LOGGER.error("close excel stream error", ex);
            }
        }
    }
    return isOK;
}
Also used : WriteException(jxl.write.WriteException) WorkbookSettings(jxl.WorkbookSettings) IOException(java.io.IOException) File(java.io.File) WriteException(jxl.write.WriteException) IOException(java.io.IOException) RowsExceededException(jxl.write.biff.RowsExceededException) RowsExceededException(jxl.write.biff.RowsExceededException)

Example 2 with RowsExceededException

use of jxl.write.biff.RowsExceededException in project trainning by fernandotomasio.

the class PLN002XLS method makeReport.

@Override
public void makeReport() {
    PlanningService planningService = (PlanningService) services.get("planningService");
    int ano = (Integer) params.get("ano");
    try {
        WritableWorkbook workbook = Workbook.createWorkbook(os);
        WritableSheet sheet = workbook.createSheet("PLAMENS", 0);
        SolicitacaoPacespDTO[] solicitacoes = planningService.findAllSolicitacoesPacesp(ano, null, null);
        int i = 0;
        for (SolicitacaoPacespDTO dto : solicitacoes) {
            Label numeroMissaoLabel = new Label(0, i, "XX");
            sheet.addCell(numeroMissaoLabel);
            Label organizacaoProponenteLabel = null;
            if (dto.getOrganizacaoProponente() != null) {
                organizacaoProponenteLabel = new Label(1, i, dto.getOrganizacaoProponente().getSigla());
            } else {
                organizacaoProponenteLabel = new Label(1, i, "");
            }
            sheet.addCell(organizacaoProponenteLabel);
            Label anoLabel = new Label(2, i, Integer.toString(dto.getAno()));
            sheet.addCell(anoLabel);
            Label cursoLabel = new Label(3, i, dto.getCurso());
            sheet.addCell(cursoLabel);
            Label localLabel = new Label(4, i, dto.getLocal());
            sheet.addCell(localLabel);
            Label cidadeLabel = new Label(5, i, dto.getCidade());
            sheet.addCell(cidadeLabel);
            Label estadoLabel = new Label(6, i, dto.getEstado());
            sheet.addCell(estadoLabel);
            Label paisLabel = new Label(7, i, "");
            sheet.addCell(paisLabel);
            Label dataInicioLabel = null;
            dataInicioLabel = new Label(8, i, "");
            sheet.addCell(dataInicioLabel);
            Label dataTerminoLabel = null;
            dataTerminoLabel = new Label(9, i, "");
            sheet.addCell(dataTerminoLabel);
            Label duracaoLabel = new Label(10, i, String.valueOf(dto.getDuracao()));
            sheet.addCell(duracaoLabel);
            Label organizacaoSolicitanteLabel = null;
            if (dto.getOrganizacaoSolicitante() != null) {
                organizacaoSolicitanteLabel = new Label(11, i, dto.getOrganizacaoSolicitante().getSigla());
            } else {
                organizacaoSolicitanteLabel = new Label(11, i, "");
            }
            sheet.addCell(organizacaoSolicitanteLabel);
            Label quantidadeVagasLabel = new Label(12, i, String.valueOf(dto.getQuantidadeVagasCivil() + dto.getQuantidadeVagasMilitar()));
            sheet.addCell(quantidadeVagasLabel);
            Label postoIndicadosLabel = new Label(13, i, "");
            sheet.addCell(postoIndicadosLabel);
            Label destinoAposMissaoLabel = new Label(14, i, "");
            sheet.addCell(destinoAposMissaoLabel);
            Label funcaoAposMissaoLabel = new Label(15, i, "");
            sheet.addCell(funcaoAposMissaoLabel);
            Label quantidadeCursosLabel = new Label(16, i, "");
            sheet.addCell(quantidadeCursosLabel);
            Label ajudaCursoLabel = new Label(17, i, "");
            sheet.addCell(ajudaCursoLabel);
            Label diariasLabel = new Label(18, i, "");
            sheet.addCell(diariasLabel);
            Label custoCursoLabel = new Label(19, i, dto.getCustoTotalFormatted());
            sheet.addCell(custoCursoLabel);
            Label transportePessoaLabel = new Label(20, i, "");
            sheet.addCell(transportePessoaLabel);
            Label bagagemLabel = new Label(21, i, "");
            sheet.addCell(bagagemLabel);
            Label outrosLabel = new Label(22, i, "");
            sheet.addCell(outrosLabel);
            Label custoTotalLabel = new Label(23, i, dto.getCustoTotalFormatted());
            sheet.addCell(custoTotalLabel);
            Label anoTomadaPrecosLabel = new Label(24, i, "");
            sheet.addCell(anoTomadaPrecosLabel);
            Label preRequisitosLabel = new Label(25, i, "");
            sheet.addCell(preRequisitosLabel);
            Label justificativaLabel = new Label(26, i, dto.getJustificativa().toUpperCase());
            sheet.addCell(justificativaLabel);
            Label sistemaLabel = new Label(27, i, "");
            sheet.addCell(sistemaLabel);
            Label planoTransmissaoLabel = new Label(28, i, "");
            sheet.addCell(planoTransmissaoLabel);
            Label observacaoLabel = null;
            if (dto.getObservacao() != null) {
                observacaoLabel = new Label(29, i, dto.getObservacao().toUpperCase());
            } else {
                observacaoLabel = new Label(29, i, "");
            }
            sheet.addCell(observacaoLabel);
            Label tipoLabel = new Label(30, i, "");
            sheet.addCell(tipoLabel);
            i++;
        }
        workbook.write();
        workbook.close();
    } catch (RowsExceededException ex) {
        Logger.getLogger(PLN002XLS.class.getName()).log(Level.SEVERE, null, ex);
    } catch (WriteException ex) {
        Logger.getLogger(PLN002XLS.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        Logger.getLogger(PLN002XLS.class.getName()).log(Level.SEVERE, null, ex);
    }
}
Also used : WritableWorkbook(jxl.write.WritableWorkbook) WriteException(jxl.write.WriteException) SolicitacaoPacespDTO(com.tomasio.projects.trainning.dto.SolicitacaoPacespDTO) PlanningService(com.tomasio.projects.trainning.interfaces.PlanningService) Label(jxl.write.Label) WritableSheet(jxl.write.WritableSheet) IOException(java.io.IOException) RowsExceededException(jxl.write.biff.RowsExceededException)

Example 3 with RowsExceededException

use of jxl.write.biff.RowsExceededException in project trainning by fernandotomasio.

the class EXC008XLS method makeReport.

@Override
public void makeReport() {
    AtividadesEnsinoService service = (AtividadesEnsinoService) services.get("atividadesEnsinoService");
    OrganizationalService organizationalService = (OrganizationalService) services.get("organizationalService");
    try {
        WritableWorkbook workbook = Workbook.createWorkbook(os);
        WritableSheet sheet = workbook.createSheet("PLAMENS", 0);
        MatriculaDTO[] matriculas = service.findAllMatriculas();
        Map<Long, TurmaEfetivaDTO> turmasMap = new HashMap<Long, TurmaEfetivaDTO>();
        Map<Long, OrganizacaoDTO> organizacoesMap = new HashMap<Long, OrganizacaoDTO>();
        int i = 0;
        for (MatriculaDTO matriculaDTO : matriculas) {
            OrganizacaoDTO decea = organizationalService.findOrganizacaoBySigla("DECEA");
            TurmaEfetivaDTO turma = turmasMap.get(matriculaDTO.getTurma().getId());
            if (turma == null) {
                turma = service.findTurmaEfetiva(matriculaDTO.getTurma().getId());
                turmasMap.put(matriculaDTO.getTurma().getId(), turma);
            }
            if (!turma.getOrganizacaoGestoraId().equals(decea.getId())) {
                continue;
            }
            if (!turma.getCurso().getCodigo().contains("ATM") && !turma.getCurso().getCodigo().contains("OPM")) {
                continue;
            }
            Label alunoLabel = new Label(0, i, matriculaDTO.getPessoa().getTargetaSimples());
            sheet.addCell(alunoLabel);
            PessoaDTO pessoa = organizationalService.findPessoa(matriculaDTO.getPessoa().getId());
            Label organizacaoAlunoLabel = null;
            if (pessoa.getOrganizacao() != null) {
                organizacaoAlunoLabel = new Label(1, i, pessoa.getOrganizacao().getSigla());
            } else {
                organizacaoAlunoLabel = new Label(1, i, "");
            }
            sheet.addCell(organizacaoAlunoLabel);
            Label cursoLabel = new Label(2, i, turma.getCurso().getCodigo());
            sheet.addCell(cursoLabel);
            Label organizacaoCursoLabel = new Label(3, i, turma.getLocal());
            sheet.addCell(organizacaoCursoLabel);
            Label inicioLabel = new Label(4, i, turma.getDataInicioFormatted());
            sheet.addCell(inicioLabel);
            Label terminoLabel = new Label(5, i, turma.getDataTerminoFormatted());
            sheet.addCell(terminoLabel);
            i++;
        }
        workbook.write();
        workbook.close();
    } catch (RowsExceededException ex) {
        Logger.getLogger(EXC008XLS.class.getName()).log(Level.SEVERE, null, ex);
    } catch (WriteException ex) {
        Logger.getLogger(EXC008XLS.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        Logger.getLogger(EXC008XLS.class.getName()).log(Level.SEVERE, null, ex);
    }
}
Also used : MatriculaDTO(com.tomasio.projects.trainning.dto.MatriculaDTO) WriteException(jxl.write.WriteException) HashMap(java.util.HashMap) Label(jxl.write.Label) WritableSheet(jxl.write.WritableSheet) IOException(java.io.IOException) RowsExceededException(jxl.write.biff.RowsExceededException) WritableWorkbook(jxl.write.WritableWorkbook) TurmaEfetivaDTO(com.tomasio.projects.trainning.dto.TurmaEfetivaDTO) PessoaDTO(com.tomasio.projects.trainning.dto.PessoaDTO) OrganizationalService(com.tomasio.projects.trainning.interfaces.OrganizationalService) OrganizacaoDTO(com.tomasio.projects.trainning.dto.OrganizacaoDTO) AtividadesEnsinoService(com.tomasio.projects.trainning.interfaces.AtividadesEnsinoService)

Example 4 with RowsExceededException

use of jxl.write.biff.RowsExceededException in project trainning by fernandotomasio.

the class PLN003XLS method makeReport.

@Override
public void makeReport() {
    PlanningService planningService = (PlanningService) services.get("planningService");
    try {
        WritableWorkbook workbook = Workbook.createWorkbook(os);
        WritableSheet sheet = workbook.createSheet("PLAMENS", 0);
        SolicitacaoPlamensDTO[] solicitacoes = planningService.findAllSolicitacoesPlamens(0, null, null);
        int i = 0;
        for (SolicitacaoPlamensDTO dto : solicitacoes) {
            Label numeroMissaoLabel = new Label(0, i, "XX");
            sheet.addCell(numeroMissaoLabel);
            Label organizacaoProponenteLabel = null;
            if (dto.getOrganizacaoProponente() != null) {
                organizacaoProponenteLabel = new Label(1, i, dto.getOrganizacaoProponente().getSigla());
            } else {
                organizacaoProponenteLabel = new Label(1, i, "");
            }
            sheet.addCell(organizacaoProponenteLabel);
            Label anoLabel = new Label(2, i, Integer.toString(dto.getAno()));
            sheet.addCell(anoLabel);
            Label cursoLabel = new Label(3, i, dto.getCurso());
            sheet.addCell(cursoLabel);
            Label localLabel = new Label(4, i, dto.getLocal());
            sheet.addCell(localLabel);
            Label cidadeLabel = new Label(5, i, dto.getCidade());
            sheet.addCell(cidadeLabel);
            Label estadoLabel = new Label(6, i, dto.getEstado());
            sheet.addCell(estadoLabel);
            Label paisLabel = new Label(7, i, dto.getPais());
            sheet.addCell(paisLabel);
            Label dataInicioLabel = null;
            if (dto.getDataInicio() != null) {
                dataInicioLabel = new Label(8, i, dto.getDataInicioFormatted());
            } else {
                dataInicioLabel = new Label(8, i, "");
            }
            sheet.addCell(dataInicioLabel);
            Label dataTerminoLabel = null;
            if (dto.getDataTermino() != null) {
                dataTerminoLabel = new Label(9, i, dto.getDataTerminoFormatted());
            } else {
                dataTerminoLabel = new Label(9, i, "");
            }
            sheet.addCell(dataTerminoLabel);
            Label duracaoLabel = new Label(10, i, String.valueOf(dto.getDuracao()));
            sheet.addCell(duracaoLabel);
            Label organizacaoSolicitanteLabel = null;
            if (dto.getOrganizacaoSolicitante() != null) {
                organizacaoSolicitanteLabel = new Label(11, i, dto.getOrganizacaoSolicitante().getSigla());
            } else {
                organizacaoSolicitanteLabel = new Label(11, i, "");
            }
            sheet.addCell(organizacaoSolicitanteLabel);
            Label quantidadeVagasLabel = new Label(12, i, dto.getQuantidadeVagas());
            sheet.addCell(quantidadeVagasLabel);
            Label postoIndicadosLabel = new Label(13, i, dto.getPostoIndicados());
            sheet.addCell(postoIndicadosLabel);
            Label destinoAposMissaoLabel = new Label(14, i, dto.getDestinoAposMissao());
            sheet.addCell(destinoAposMissaoLabel);
            Label funcaoAposMissaoLabel = new Label(15, i, dto.getFuncaoAposMissao());
            sheet.addCell(funcaoAposMissaoLabel);
            Label quantidadeCursosLabel = new Label(16, i, Integer.toString(dto.getQuantidadeCursos()));
            sheet.addCell(quantidadeCursosLabel);
            Label ajudaCursoLabel = new Label(17, i, dto.getAjudaCustoFormatted());
            sheet.addCell(ajudaCursoLabel);
            Label salarioLabel = new Label(18, i, dto.getSalarioFormatted());
            sheet.addCell(salarioLabel);
            Label bagagemLabel = new Label(19, i, dto.getBagagemFormatted());
            sheet.addCell(bagagemLabel);
            Label diariasLabel = new Label(20, i, dto.getDiariasFormatted());
            sheet.addCell(diariasLabel);
            Label transportePessoaLabel = new Label(21, i, dto.getTransportePessoalFormatted());
            sheet.addCell(transportePessoaLabel);
            Label custoCursoLabel = new Label(22, i, dto.getCustoCursoFormatted());
            sheet.addCell(custoCursoLabel);
            Label outrosLabel = new Label(23, i, dto.getOutrosFormatted());
            sheet.addCell(outrosLabel);
            Label custoTotalLabel = new Label(24, i, dto.getCustoTotalFormatted());
            sheet.addCell(custoTotalLabel);
            Label anoTomadaPrecosLabel = new Label(25, i, Integer.toString(dto.getAnoTomadaPrecos()));
            sheet.addCell(anoTomadaPrecosLabel);
            Label taxaCambioLabel = new Label(26, i, "1,87");
            sheet.addCell(taxaCambioLabel);
            Label preRequisitosLabel = new Label(27, i, dto.getPreRequisitos().toUpperCase());
            sheet.addCell(preRequisitosLabel);
            Label justificativaLabel = new Label(28, i, dto.getJustificativa().toUpperCase());
            sheet.addCell(justificativaLabel);
            Label disciplinasLabel = null;
            if (dto.getDisciplinas() != null) {
                disciplinasLabel = new Label(29, i, dto.getDisciplinas().toUpperCase());
            } else {
                disciplinasLabel = new Label(29, i, "");
            }
            sheet.addCell(disciplinasLabel);
            Label planoTransmissaoLabel = new Label(30, i, dto.getPlanoTransmissao().toUpperCase());
            sheet.addCell(planoTransmissaoLabel);
            Label observacaoLabel = null;
            if (dto.getObservacao() != null) {
                observacaoLabel = new Label(31, i, dto.getObservacao().toUpperCase());
            } else {
                observacaoLabel = new Label(31, i, "");
            }
            sheet.addCell(observacaoLabel);
            Label tipoLabel = new Label(32, i, dto.getTipo());
            sheet.addCell(tipoLabel);
            i++;
        }
        workbook.write();
        workbook.close();
    } catch (RowsExceededException ex) {
        Logger.getLogger(PLN003XLS.class.getName()).log(Level.SEVERE, null, ex);
    } catch (WriteException ex) {
        Logger.getLogger(PLN003XLS.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        Logger.getLogger(PLN003XLS.class.getName()).log(Level.SEVERE, null, ex);
    }
}
Also used : WritableWorkbook(jxl.write.WritableWorkbook) WriteException(jxl.write.WriteException) SolicitacaoPlamensDTO(com.tomasio.projects.trainning.dto.SolicitacaoPlamensDTO) PlanningService(com.tomasio.projects.trainning.interfaces.PlanningService) Label(jxl.write.Label) WritableSheet(jxl.write.WritableSheet) IOException(java.io.IOException) RowsExceededException(jxl.write.biff.RowsExceededException)

Aggregations

IOException (java.io.IOException)4 WriteException (jxl.write.WriteException)4 RowsExceededException (jxl.write.biff.RowsExceededException)4 Label (jxl.write.Label)3 WritableSheet (jxl.write.WritableSheet)3 WritableWorkbook (jxl.write.WritableWorkbook)3 PlanningService (com.tomasio.projects.trainning.interfaces.PlanningService)2 MatriculaDTO (com.tomasio.projects.trainning.dto.MatriculaDTO)1 OrganizacaoDTO (com.tomasio.projects.trainning.dto.OrganizacaoDTO)1 PessoaDTO (com.tomasio.projects.trainning.dto.PessoaDTO)1 SolicitacaoPacespDTO (com.tomasio.projects.trainning.dto.SolicitacaoPacespDTO)1 SolicitacaoPlamensDTO (com.tomasio.projects.trainning.dto.SolicitacaoPlamensDTO)1 TurmaEfetivaDTO (com.tomasio.projects.trainning.dto.TurmaEfetivaDTO)1 AtividadesEnsinoService (com.tomasio.projects.trainning.interfaces.AtividadesEnsinoService)1 OrganizationalService (com.tomasio.projects.trainning.interfaces.OrganizationalService)1 File (java.io.File)1 HashMap (java.util.HashMap)1 WorkbookSettings (jxl.WorkbookSettings)1