Example usage for com.itextpdf.text.pdf PdfPTable setHorizontalAlignment

List of usage examples for com.itextpdf.text.pdf PdfPTable setHorizontalAlignment

Introduction

In this page you can find the example usage for com.itextpdf.text.pdf PdfPTable setHorizontalAlignment.

Prototype

public void setHorizontalAlignment(final int horizontalAlignment) 

Source Link

Document

Sets the horizontal alignment of the table relative to the page.

Usage

From source file:view.RelatorioDescricaoView.java

public void gerarDocumento() throws FileNotFoundException {
    try {/*  w w  w .  j a  v  a 2 s. c om*/

        String descricao = tbeDescricao.getValueAt(tbeDescricao.getSelectedRow(), 0).toString();

        listaPatrimonio = patrimonioDAO.listaTodosPorDescricao(descricao);

        doc = new Document(PageSize.A4, 41.5f, 41.5f, 55.2f, 55.2f);
        String caminho = "C:/Relatorios Descricao/Relatorio "
                + tbeDescricao.getValueAt(tbeDescricao.getSelectedRow(), 0).toString() + ".pdf";
        PdfWriter.getInstance(doc, new FileOutputStream(caminho));
        doc.open();

        Font f1 = new Font(Font.FontFamily.HELVETICA, 14, Font.BOLD);
        Font f2 = new Font(Font.FontFamily.HELVETICA, 12, Font.BOLD);
        Font f3 = new Font(Font.FontFamily.HELVETICA, 12, Font.BOLD);
        Font f4 = new Font(Font.FontFamily.HELVETICA, 10, Font.BOLD);
        Font f5 = new Font(Font.FontFamily.HELVETICA, 10, Font.NORMAL);

        Paragraph titulo1 = new Paragraph("Universidade do Estado de Minas Gerais", f2);
        titulo1.setAlignment(Element.ALIGN_CENTER);
        titulo1.setSpacingAfter(10);

        Paragraph titulo2 = new Paragraph(
                "" + tbeDescricao.getValueAt(tbeDescricao.getSelectedRow(), 0).toString(), f2);
        titulo2.setAlignment(Element.ALIGN_CENTER);
        titulo2.setSpacingAfter(10);

        doc.add(titulo1);
        doc.add(titulo2);

        PdfPTable tabela = new PdfPTable(new float[] { 0.20f, 0.80f, 0.18f, 0.42f });
        tabela.setHorizontalAlignment(Element.ALIGN_CENTER);
        tabela.setWidthPercentage(100f);

        PdfPCell cabecalho1 = new PdfPCell(new Paragraph("Codigo", f3));
        cabecalho1.setHorizontalAlignment(Element.ALIGN_JUSTIFIED);
        cabecalho1.setBorder(0);

        PdfPCell cabecalho2 = new PdfPCell(new Paragraph("Sala", f3));
        cabecalho2.setHorizontalAlignment(Element.ALIGN_JUSTIFIED);
        cabecalho2.setBorder(0);

        PdfPCell cabecalho3 = new PdfPCell(new Paragraph("Estado", f3));
        cabecalho3.setHorizontalAlignment(Element.ALIGN_JUSTIFIED);
        cabecalho3.setBorder(0);

        PdfPCell cabecalho4 = new PdfPCell(new Paragraph("Orgo", f3));
        cabecalho4.setHorizontalAlignment(Element.ALIGN_JUSTIFIED);
        cabecalho4.setBorder(0);

        tabela.addCell(cabecalho1);
        tabela.addCell(cabecalho2);
        tabela.addCell(cabecalho3);
        tabela.addCell(cabecalho4);

        for (PatrimonioM patrimonio : listaPatrimonio) {

            Paragraph p1 = new Paragraph(patrimonio.getCodigo(), f5);
            p1.setAlignment(Element.ALIGN_JUSTIFIED);
            PdfPCell col1 = new PdfPCell(p1);
            col1.setBorder(0);

            Paragraph p2 = new Paragraph(patrimonio.getSala().getDescricao(), f5);
            p2.setAlignment(Element.ALIGN_JUSTIFIED);
            PdfPCell col2 = new PdfPCell(p2);
            col2.setBorder(0);

            Paragraph p3 = new Paragraph(patrimonio.getGrau_conservacao().getDescricao(), f5);
            p3.setAlignment(Element.ALIGN_JUSTIFIED);
            PdfPCell col3 = new PdfPCell(p3);
            col3.setBorder(0);

            Paragraph p4 = new Paragraph(patrimonio.getEntidade().getNome(), f5);
            p4.setAlignment(Element.ALIGN_JUSTIFIED);
            PdfPCell col4 = new PdfPCell(p4);
            col4.setBorder(0);

            tabela.addCell(col1);
            tabela.addCell(col2);
            tabela.addCell(col3);
            tabela.addCell(col4);
        }

        doc.add(tabela);

        doc.close();
        JOptionPane.showMessageDialog(null, "Relatrio salvo com sucesso em C:/Relatorios Decricao/");
        Desktop.getDesktop().open(new File(caminho));
    } catch (DocumentException e) {
        e.printStackTrace();
    } catch (SQLException ex) {
        ex.printStackTrace();
    } catch (IOException exx) {
        exx.printStackTrace();
        JOptionPane.showMessageDialog(null, "Documento de Relatorios aberto. Feche para gerar um novo.");
    }
}

From source file:view.RelatorioSalaView.java

public void gerarDocumento() throws FileNotFoundException {
    try {/*from www.j av  a 2  s  .  c o m*/
        int numeroSala = Integer.parseInt(tbeSala.getValueAt(tbeSala.getSelectedRow(), 0).toString());
        listaPatrimonio = patrimonioDAO.listaTodosSala(numeroSala);
        doc = new Document(PageSize.A4, 41.5f, 41.5f, 55.2f, 55.2f);
        String caminho = "C:/Relatorios Sala/Relatorio "
                + tbeSala.getValueAt(tbeSala.getSelectedRow(), 1).toString() + ".pdf";
        PdfWriter.getInstance(doc, new FileOutputStream(caminho));
        doc.open();

        Font f1 = new Font(Font.FontFamily.HELVETICA, 14, Font.BOLD);
        Font f2 = new Font(Font.FontFamily.HELVETICA, 12, Font.BOLD);
        Font f3 = new Font(Font.FontFamily.HELVETICA, 12, Font.BOLD);
        Font f4 = new Font(Font.FontFamily.HELVETICA, 10, Font.BOLD);
        Font f5 = new Font(Font.FontFamily.HELVETICA, 10, Font.NORMAL);

        Paragraph titulo1 = new Paragraph("Universidade do Estado de Minas Gerais", f2);
        titulo1.setAlignment(Element.ALIGN_CENTER);
        titulo1.setSpacingAfter(10);

        Paragraph titulo2 = new Paragraph("" + tbeSala.getValueAt(tbeSala.getSelectedRow(), 1).toString(), f2);
        titulo2.setAlignment(Element.ALIGN_CENTER);
        titulo2.setSpacingAfter(10);

        doc.add(titulo1);
        doc.add(titulo2);

        PdfPTable tabela = new PdfPTable(new float[] { 0.20f, 0.80f, 0.18f, 0.42f });
        tabela.setHorizontalAlignment(Element.ALIGN_CENTER);
        tabela.setWidthPercentage(100f);

        PdfPCell cabecalho1 = new PdfPCell(new Paragraph("Codigo", f3));
        cabecalho1.setHorizontalAlignment(Element.ALIGN_JUSTIFIED);
        cabecalho1.setBorder(0);

        PdfPCell cabecalho2 = new PdfPCell(new Paragraph("Descrio", f3));
        cabecalho2.setHorizontalAlignment(Element.ALIGN_JUSTIFIED);
        cabecalho2.setBorder(0);

        PdfPCell cabecalho3 = new PdfPCell(new Paragraph("Estado", f3));
        cabecalho3.setHorizontalAlignment(Element.ALIGN_JUSTIFIED);
        cabecalho3.setBorder(0);

        PdfPCell cabecalho4 = new PdfPCell(new Paragraph("Orgo", f3));
        cabecalho4.setHorizontalAlignment(Element.ALIGN_JUSTIFIED);
        cabecalho4.setBorder(0);

        tabela.addCell(cabecalho1);
        tabela.addCell(cabecalho2);
        tabela.addCell(cabecalho3);
        tabela.addCell(cabecalho4);

        for (PatrimonioM patrimonio : listaPatrimonio) {

            if (patrimonio.getKit()) {
                listaComposto = patri.listaTodosExistentes(patrimonio);
                for (PatrimonioCompostoM composto : listaComposto) {
                    Paragraph p1 = new Paragraph(patrimonio.getCodigo(), f5);
                    p1.setAlignment(Element.ALIGN_JUSTIFIED);
                    PdfPCell col1 = new PdfPCell(p1);
                    col1.setBorder(0);

                    Paragraph p2 = new Paragraph(composto.getDescricao(), f5);
                    p2.setAlignment(Element.ALIGN_JUSTIFIED);
                    PdfPCell col2 = new PdfPCell(p2);
                    col2.setBorder(0);

                    Paragraph p3 = new Paragraph(composto.getGrau().getDescricao(), f5);
                    p3.setAlignment(Element.ALIGN_JUSTIFIED);
                    PdfPCell col3 = new PdfPCell(p3);
                    col3.setBorder(0);

                    Paragraph p4 = new Paragraph(patrimonio.getEntidade().getNome(), f5);
                    p4.setAlignment(Element.ALIGN_JUSTIFIED);
                    PdfPCell col4 = new PdfPCell(p4);
                    col4.setBorder(0);

                    tabela.addCell(col1);
                    tabela.addCell(col2);
                    tabela.addCell(col3);
                    tabela.addCell(col4);
                }
            } else {
                Paragraph p1 = new Paragraph(patrimonio.getCodigo(), f5);
                p1.setAlignment(Element.ALIGN_JUSTIFIED);
                PdfPCell col1 = new PdfPCell(p1);
                col1.setBorder(0);

                Paragraph p2 = new Paragraph(patrimonio.getDescricao(), f5);
                p2.setAlignment(Element.ALIGN_JUSTIFIED);
                PdfPCell col2 = new PdfPCell(p2);
                col2.setBorder(0);

                Paragraph p3 = new Paragraph(patrimonio.getGrau_conservacao().getDescricao(), f5);
                p3.setAlignment(Element.ALIGN_JUSTIFIED);
                PdfPCell col3 = new PdfPCell(p3);
                col3.setBorder(0);

                Paragraph p4 = new Paragraph(patrimonio.getEntidade().getNome(), f5);
                p4.setAlignment(Element.ALIGN_JUSTIFIED);
                PdfPCell col4 = new PdfPCell(p4);
                col4.setBorder(0);

                tabela.addCell(col1);
                tabela.addCell(col2);
                tabela.addCell(col3);
                tabela.addCell(col4);
            }
        }

        doc.add(tabela);

        doc.close();
        JOptionPane.showMessageDialog(null, "Relatrio salvo com sucesso em C:/Relatorios Sala/");
        Desktop.getDesktop().open(new File(caminho));
    } catch (DocumentException e) {
        e.printStackTrace();
    } catch (SQLException ex) {
        ex.printStackTrace();
    } catch (IOException exx) {
        exx.printStackTrace();
        JOptionPane.showMessageDialog(null, "Documento de Relatorios aberto. Feche para gerar um novo.");
    }
}

From source file:View.TelaRelatorio.java

public void GerarEntrega(int codigo) throws IOException {
    NegociosCompra nc = new NegociosCompra();
    Compra compra = nc.ConsultarCompra(codigo);

    Document documentoPDF = new Document();
    String output = "C:\\Users\\Marilia Nayara\\Documents\\NetBeansProjects\\SistemaInformao\\Relatorios\\VendasEntrega\\Compra"
            + codigo + ".pdf";
    try {//from  ww  w  .  ja v a 2s  .c  om

        PdfWriter.getInstance(documentoPDF, new FileOutputStream(output));

        documentoPDF.open();

        documentoPDF.setPageSize(PageSize.A4);

        Image imagem = Image.getInstance(
                "C:\\Users\\Marilia Nayara\\Documents\\NetBeansProjects\\SistemaInformao\\src\\View\\image.png");

        imagem.scaleToFit(100, 75);

        imagem.setAlignment(Element.ALIGN_CENTER);

        documentoPDF.add(imagem);

        Font fonte1 = new Font(Font.FontFamily.TIMES_ROMAN, 8, Font.BOLD);

        Paragraph agr = new Paragraph("Aplicao para Gesto de Restaurantes", fonte1);

        agr.setAlignment(Element.ALIGN_CENTER);

        documentoPDF.add(agr);

        Font fonte = new Font(Font.FontFamily.TIMES_ROMAN, 24, Font.BOLD);

        Paragraph cabecalho = new Paragraph("COMPRA ENTREGA", fonte);

        cabecalho.setAlignment(Element.ALIGN_CENTER);

        documentoPDF.add(cabecalho);

        documentoPDF.add(new Paragraph("\n"));

        Cliente c = new NegociosCliente().ProcurarCliente(compra.getCpf_c());

        Timestamp t = compra.getData();
        SimpleDateFormat formato = new SimpleDateFormat("dd/MM/yyyy");
        String a = formato.format(t);

        PdfPTable dadosC = new PdfPTable(new float[] { 0.10f, 0.70f, 0.20f });

        List<String> dados = new ArrayList<String>();

        dados.add("CODIGO DA COMPRA");
        dados.add("CLIENTE");
        dados.add("DATA DA COMPRA");
        dados.add("" + compra.getCodigo());
        dados.add(c.getNome());
        dados.add(a);

        for (String s : dados) {
            dadosC.addCell(s);
        }

        dadosC.setWidthPercentage(110f);
        documentoPDF.add(dadosC);

        documentoPDF.add(new Paragraph("\n"));
        /*documentoPDF.add(new Paragraph(" LISTA DE PRODUTOS COMPRADOS"));
        documentoPDF.add(new Paragraph("\n"));
        documentoPDF.add(new Paragraph("Codigo       Produto                                         Valor Unitrio          Quantidade             Valor   "));
        String tam = "Codigo       Produto                                         Valor Unitrio          Quantidade             Valor   ";
        JOptionPane.showMessageDialog(null, tam.length());
        for(int x=0;x<compra.getLista_prod().size();x++){
        Produto p = new NegociosProduto().ProcurarProduto(compra.getLista_prod().get(x).intValue());
        String cod = ""+p.getCodigo();
        String nome = p.getNome();
        float pv = p.getPvenda();
        String pvs = ""+pv;
        int quant = compra.getQuantidades().get(x).intValue();
        String squant = ""+quant;
        float pf = pv*quant;
        String spf = ""+pf;
                
        int espaco = 13 - cod.length();
        String esp = "";        
            for(int y = 0;y <espaco;y++){
                   esp=esp+" "; 
                }
        cod = cod+esp;
                    
        espaco = 49 - nome.length();
        esp = "";
            for(int y = 0;y <espaco;y++){
                   esp=esp+" "; 
            }
        nome = nome + esp;
                
        espaco = 24 - pvs.length();
        esp = "";
            for(int y = 0;y <espaco;y++){
                       esp=esp+" "; 
            }
        pvs = pvs + esp;
                
        espaco = 23 - squant.length();
        esp = "";
            for(int y = 0;y <espaco;y++){
                       esp=esp+" "; 
            }
        squant = squant + esp;
                
        espaco = 8 - spf.length();
        esp = "";
            for(int y = 0;y <espaco;y++){
                       esp=esp+" "; 
            }
        spf = spf + esp;
                
        String fina = cod+nome+pvs+squant+spf;
        //JOptionPane.showMessageDialog(null, fina.length());
        documentoPDF.add(new Paragraph(fina));
        }*/
        Font fonte3 = new Font(Font.FontFamily.TIMES_ROMAN, 14, Font.NORMAL);

        // Criando uma tabela com 3 colunas
        PdfPTable table = new PdfPTable(new float[] { 0.1f, 0.45f, 0.15f, 0.15f, 0.15f });

        table.setWidthPercentage(110.f);
        // Ttulo para a tabela
        Paragraph tableHeader = new Paragraph("LISTA DE PRODUTOS COMPRADOS", fonte3);

        PdfPCell header = new PdfPCell(tableHeader);
        // Definindo que o header vai ocupar as 3 colunas
        header.setColspan(5);
        // Definindo alinhamento do header
        header.setHorizontalAlignment(Paragraph.ALIGN_CENTER);
        // Adicionando o header  tabela
        table.addCell(header);

        List<String> list = new ArrayList<String>();

        list.add("CODIGO");
        list.add("PRODUTO");
        list.add("VALOR UNIT?RIO");
        list.add("QUANTIDADE");
        list.add("VALOR");

        for (int x = 0; x < compra.getLista_prod().size(); x++) {
            Produto p = new NegociosProduto().ProcurarProduto(compra.getLista_prod().get(x).intValue());
            String cod = "" + p.getCodigo();
            String nome = p.getNome();
            float pv = p.getPvenda();
            String pvs = "" + pv;
            int quant = compra.getQuantidades().get(x).intValue();
            String squant = "" + quant;
            float pf = pv * quant;
            String spf = "" + pf;
            list.add(cod);
            list.add(nome);
            list.add(pvs);
            list.add(squant);
            list.add(spf);
        }

        for (String s : list) {
            table.addCell(s);
        }

        documentoPDF.add(table);

        documentoPDF.add(new Paragraph("\n"));

        Paragraph total = new Paragraph("Total: " + compra.getPreco_final(), fonte3);

        total.setAlignment(Element.ALIGN_RIGHT);

        documentoPDF.add(total);

        documentoPDF.add(new Paragraph("\n"));

        PdfPTable endereco = new PdfPTable(new float[] { 0.30f, 0.80f });

        endereco.setWidthPercentage(60f);

        endereco.setHorizontalAlignment(Element.ALIGN_CENTER);

        Paragraph tableH = new Paragraph("ENDEREO DE ENTREGA", fonte3);

        PdfPCell hea = new PdfPCell(tableH);

        hea.setColspan(2);

        hea.setHorizontalAlignment(Paragraph.ALIGN_CENTER);

        endereco.addCell(hea);

        List<String> dadosE = new ArrayList<String>();

        dadosE.add("LOGRADOURO");
        dadosE.add(c.getEndereco().getRua());
        dadosE.add("NUMERO");
        dadosE.add("" + c.getEndereco().getNumero());
        dadosE.add("BAIRRO");
        dadosE.add(c.getEndereco().getBairro());
        dadosE.add("CIDADE");
        dadosE.add(c.getEndereco().getCidade());
        dadosE.add("ESTADO");
        dadosE.add(c.getEndereco().getEstado());

        for (String s : dadosE) {
            endereco.addCell(s);
        }

        documentoPDF.add(endereco);

        documentoPDF.add(new Paragraph("\n"));

        documentoPDF
                .add(new Paragraph("Assinatura:  __________________________________________________________"));

        Paragraph ass = new Paragraph("(" + c.getNome() + ")", fonte1);

        ass.setAlignment(Element.ALIGN_CENTER);
        documentoPDF.add(ass);

        documentoPDF.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));

        Paragraph comp = new Paragraph("COMPROVANTE DE ENTREGA");

        comp.setAlignment(Element.ALIGN_CENTER);

        documentoPDF.add(comp);

        documentoPDF.add(new Paragraph("\n"));

        documentoPDF.add(dadosC);

        documentoPDF.add(total);

        documentoPDF
                .add(new Paragraph("Assinatura:  __________________________________________________________"));

        documentoPDF.add(ass);

    } catch (DocumentException de) {
        de.printStackTrace();
    } catch (IOException ioe) {
        ioe.printStackTrace();
    } finally {
        documentoPDF.close();
        java.awt.Desktop.getDesktop().open(new File(output));
    }
}

From source file:View.TelaRelatorio.java

public void GerarEntregas() throws DocumentException, FileNotFoundException, BadElementException, IOException {
    NegocioRelatorio nr = new NegocioRelatorio();

    Document documentoPDF = new Document();
    String output = "C:\\Users\\Marilia Nayara\\Documents\\NetBeansProjects\\SistemaInformao\\Relatorios\\MaisVendidos\\EntregasRealizadas.pdf";
    try {//from  w  ww  .j  a v  a  2 s . c  o  m

        PdfWriter.getInstance(documentoPDF, new FileOutputStream(output));

        documentoPDF.open();

        documentoPDF.setPageSize(PageSize.A4);

        Image imagem = Image.getInstance(
                "C:\\Users\\Marilia Nayara\\Documents\\NetBeansProjects\\SistemaInformao\\src\\View\\image.png");

        imagem.scaleToFit(100, 75);

        imagem.setAlignment(Element.ALIGN_CENTER);

        documentoPDF.add(imagem);

        Font fonte1 = new Font(Font.FontFamily.TIMES_ROMAN, 8, Font.BOLD);

        Paragraph agr = new Paragraph("Aplicao para Gesto de Restaurantes", fonte1);

        agr.setAlignment(Element.ALIGN_CENTER);

        documentoPDF.add(agr);

        Font fonte = new Font(Font.FontFamily.TIMES_ROMAN, 24, Font.BOLD);

        Paragraph cabecalho = new Paragraph("ENTREGAS REALIZADAS", fonte);

        cabecalho.setAlignment(Element.ALIGN_CENTER);

        documentoPDF.add(cabecalho);

        documentoPDF.add(new Paragraph("\n\n"));

        List<EntregasRealizadas> ER = nr.EntregasRealizadas();
        SimpleDateFormat formato = new SimpleDateFormat("dd/MM/yyyy");
        int d = 0, se = 0, te = 0, qa = 0, qi = 0, sex = 0, sa = 0;

        for (int x = 0; x < ER.size(); x++) {
            String a = formato.format(ER.get(x).getDatas());
            Calendar cal = Calendar.getInstance();
            cal.setTime(ER.get(x).getDatas());//  ========> Objeto Date  
            int day = cal.get(Calendar.DAY_OF_WEEK);

            if (day == 1) {
                d = d + ER.get(x).getQuant();
            } else if (day == 2) {
                se = se + ER.get(x).getQuant();
            } else if (day == 3) {
                te = te + ER.get(x).getQuant();
            } else if (day == 4) {
                qa = qa + ER.get(x).getQuant();
            } else if (day == 5) {
                qi = qi + ER.get(x).getQuant();
            } else if (day == 6) {
                sex = sex + ER.get(x).getQuant();
            } else if (day == 7) {
                sa = sa + ER.get(x).getQuant();
            }
        }

        PdfPTable dadosC = new PdfPTable(new float[] { 0.50f, 0.50f });

        List<String> dados = new ArrayList<String>();

        dados.add("DIA");
        dados.add("QUANTIDADE");
        dados.add("DOMINGO");
        dados.add("" + d);
        dados.add("SEGUNDA-FEIRA");
        dados.add("" + se);
        dados.add("TERA-FEIRA");
        dados.add("" + te);
        dados.add("QUARTA-FEIRA");
        dados.add("" + qa);
        dados.add("QUINTA-FEIRA");
        dados.add("" + qi);
        dados.add("SEXTA-FEIRA");
        dados.add("" + sex);
        dados.add("SABADO");
        dados.add("" + sa);

        for (String s : dados) {
            dadosC.addCell(s);
        }

        dadosC.setWidthPercentage(60f);
        dadosC.setHorizontalAlignment(Element.ALIGN_CENTER);
        documentoPDF.add(dadosC);

    } catch (DocumentException de) {
        de.printStackTrace();
    } finally {
        documentoPDF.close();
        java.awt.Desktop.getDesktop().open(new File(output));
    }
}

From source file:View.TelaRelatorio.java

public void EntregasPorLocalidade() {
    NegocioRelatorio nr = new NegocioRelatorio();

    Document documentoPDF = new Document();
    String output = "C:\\Users\\Marilia Nayara\\Documents\\NetBeansProjects\\SistemaInformao\\Relatorios\\MaisVendidos\\EntregasPorLocalidades.pdf";
    try {// ww w.  j a  v a  2s. c  o m

        PdfWriter.getInstance(documentoPDF, new FileOutputStream(output));

        documentoPDF.open();

        documentoPDF.setPageSize(PageSize.A4);

        Image imagem = Image.getInstance(
                "C:\\Users\\Marilia Nayara\\Documents\\NetBeansProjects\\SistemaInformao\\src\\View\\image.png");

        imagem.scaleToFit(100, 75);

        imagem.setAlignment(Element.ALIGN_CENTER);

        documentoPDF.add(imagem);

        Font fonte1 = new Font(Font.FontFamily.TIMES_ROMAN, 8, Font.BOLD);

        Paragraph agr = new Paragraph("Aplicao para Gesto de Restaurantes", fonte1);

        agr.setAlignment(Element.ALIGN_CENTER);

        documentoPDF.add(agr);

        Font fonte = new Font(Font.FontFamily.TIMES_ROMAN, 24, Font.BOLD);

        Paragraph cabecalho = new Paragraph("ENTREGAS POR LOCALIDADE", fonte);

        cabecalho.setAlignment(Element.ALIGN_CENTER);

        documentoPDF.add(cabecalho);

        documentoPDF.add(new Paragraph("\n\n"));

        List<Entrega> Entrega = nr.Localidades();

        PdfPTable dadosC = new PdfPTable(new float[] { 0.50f, 0.50f });

        List<String> dados = new ArrayList<String>();

        dados.add("BAIRRO");
        dados.add("TOTAL DE ENTREGAS");

        for (int x = 0; x < Entrega.size(); x++) {
            dados.add(Entrega.get(x).getDia());
            dados.add("" + Entrega.get(x).getQuant());
        }

        for (String s : dados) {
            dadosC.addCell(s);
        }

        dadosC.setWidthPercentage(100f);
        dadosC.setHorizontalAlignment(Element.ALIGN_CENTER);
        documentoPDF.add(dadosC);

    } catch (DocumentException ex) {
        Logger.getLogger(TelaRelatorio.class.getName()).log(Level.SEVERE, null, ex);
    } catch (FileNotFoundException ex) {
        Logger.getLogger(TelaRelatorio.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        Logger.getLogger(TelaRelatorio.class.getName()).log(Level.SEVERE, null, ex);
    } finally {
        documentoPDF.close();
        try {
            java.awt.Desktop.getDesktop().open(new File(output));
        } catch (IOException ex) {
            Logger.getLogger(TelaRelatorio.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}

From source file:Visao.grafico.GraficoRelatorioEstoque.java

private void GerarPDF() throws DocumentException, FileNotFoundException {
    try {//from  w  w w .  ja  v  a 2  s  .  com
        int linha = jTableRelatorioGrafico.getSelectedRow();
        Document document = new Document(PageSize.A4, 10, 10, 10, 10);
        //System.out.println(new File(".").getAbsolutePath());
        String arquivo = new File("RelatorioFaz.").getAbsolutePath() + "pdf";
        PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(arquivo));
        document.open();
        Font font = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD);
        //String titulo = jTableRelatorioEstoquePrincipal.getValueAt(linha, 3).toString()+ " "+jTableRelatorioEstoquePrincipal.getValueAt(linha, 2).toString()+"-"+jTableRelatorioEstoquePrincipal.getValueAt(linha, 0).toString();
        String titulo = "Relatorio";
        Paragraph pgt = new Paragraph(titulo, font);
        pgt.setAlignment(Element.ALIGN_CENTER);
        document.add(pgt);
        document.add(new Paragraph(" "));
        PdfPTable table = new PdfPTable(colunas.length);
        // Definindo uma fonte, com tamanho 20 e negrito
        PdfPCell header = new PdfPCell(new Paragraph(titulo, font));
        header.setColspan(colunas.length);
        table.addCell(header);
        table.setWidthPercentage(100.0f);
        table.setHorizontalAlignment(Element.ALIGN_JUSTIFIED_ALL);
        //System.out.println("Tamanho: "+linhas.size());
        font = new Font(Font.FontFamily.TIMES_ROMAN, 4, Font.NORMAL);
        for (String coluna : colunas) {
            table.addCell(new Paragraph(coluna, font));
        }

        //varias linhas
        for (int i = 0; i < linhas.size(); i++) {//linha
            for (int j = 0; j < colunas.length; j++) {//coluna
                table.addCell(new Paragraph(jTableRelatorioGrafico.getValueAt(i, j).toString(), font));
            }
        }

        document.add(table);

        document.add(new Paragraph(" "));

        font = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD);
        document.add(new Paragraph("Dados Totais", font));
        font = new Font(Font.FontFamily.TIMES_ROMAN, 8, Font.NORMAL);
        document.close();
        JOptionPane.showMessageDialog(null, "PDF: " + arquivo + " gerado!");
    } catch (FileNotFoundException | DocumentException | HeadlessException ex) {
        Logger.getLogger(GerarRelatorioEstoqueBasico.class.getName()).log(Level.SEVERE, null,
                "Erro ao gerar pdf: " + ex);
        JOptionPane.showMessageDialog(null, "Erro ao gerar pdf: " + ex);
    }
}

From source file:Visao.relatorios.GerarRelatorioCarvao.java

private void GerarPDF() throws DocumentException, FileNotFoundException {
    try {//  ww  w  .  j  a  va  2 s.c o  m
        int linha = jTableRelatorioCarvao.getSelectedRow();
        Document document = new Document(PageSize.A4, 10, 10, 10, 10);
        //System.out.println(new File(".").getAbsolutePath());
        String arquivo = new File("Relatorio Carvo Praa.").getAbsolutePath() + "pdf";
        PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(arquivo));
        document.open();
        Font font = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD);
        //String titulo = jTableRelatorioEstoquePrincipal.getValueAt(linha, 3).toString()+ " "+jTableRelatorioEstoquePrincipal.getValueAt(linha, 2).toString()+"-"+jTableRelatorioEstoquePrincipal.getValueAt(linha, 0).toString();
        String titulo = "Relatorio Carvo Praa";
        Paragraph pgt = new Paragraph(titulo, font);
        pgt.setAlignment(Element.ALIGN_CENTER);
        document.add(pgt);
        document.add(new Paragraph(" "));
        /*if(!filtro_matgen.equals("")){
            titulo = "Material genetico "+filtro_matgen;
        }*/
        PdfPTable table = new PdfPTable(colunas.length);
        // Definindo uma fonte, com tamanho 20 e negrito
        PdfPCell header = new PdfPCell(new Paragraph(titulo, font));
        header.setColspan(colunas.length);
        table.addCell(header);
        table.setWidthPercentage(100.0f);
        table.setHorizontalAlignment(Element.ALIGN_JUSTIFIED_ALL);
        //System.out.println("Tamanho: "+linhas.size());
        font = new Font(Font.FontFamily.TIMES_ROMAN, 4, Font.NORMAL);
        for (String coluna : colunas) {
            table.addCell(new Paragraph(coluna, font));
        }

        //varias linhas
        for (int i = 0; i < linhas.size(); i++) {//linha
            for (int j = 0; j < colunas.length; j++) {//coluna
                //table.addCell(jTableRelatorioEstoquePrincipal.getValueAt(i, j).toString());
                table.addCell(new Paragraph(jTableRelatorioCarvao.getValueAt(i, j).toString(), font));
            }
        }

        document.add(table);
        document.add(new Paragraph(" "));

        font = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD);
        document.add(new Paragraph("Dados Totais", font));
        font = new Font(Font.FontFamily.TIMES_ROMAN, 8, Font.NORMAL);
        document.add(new Paragraph(jLabelInfo1.getText(), font));
        document.add(new Paragraph(jLabelVolumeMadeiraTotal.getText(), font));
        document.add(new Paragraph(jLabelVolumeCarvaoTotal.getText(), font));
        document.close();
        JOptionPane.showMessageDialog(null, "PDF: " + arquivo + " gerado!");
    } catch (FileNotFoundException | DocumentException | HeadlessException ex) {
        Logger.getLogger(GerarRelatorioEstoqueBasico.class.getName()).log(Level.SEVERE, null,
                "Erro ao gerar pdf: " + ex);
        JOptionPane.showMessageDialog(null, "Erro ao gerar pdf: " + ex);
    }

}

From source file:Visao.relatorios.GerarRelatorioCarvaoExpedido.java

private void GerarPDF() throws DocumentException, FileNotFoundException {
    try {/*from  ww w  . j  a  v  a  2  s.co  m*/
        int linha = jTableExpedirCarvao.getSelectedRow();
        Document document = new Document(PageSize.A4, 10, 10, 10, 10);
        //System.out.println(new File(".").getAbsolutePath());
        String arquivo = new File("Relatorio Carvo Expedido.").getAbsolutePath() + "pdf";
        PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(arquivo));
        document.open();
        Font font = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD);
        //String titulo = jTableRelatorioEstoquePrincipal.getValueAt(linha, 3).toString()+ " "+jTableRelatorioEstoquePrincipal.getValueAt(linha, 2).toString()+"-"+jTableRelatorioEstoquePrincipal.getValueAt(linha, 0).toString();
        String titulo = "Relatorio Carvo Expedido";
        Paragraph pgt = new Paragraph(titulo, font);
        pgt.setAlignment(Element.ALIGN_CENTER);
        document.add(pgt);
        document.add(new Paragraph(" "));
        /*if(!filtro_matgen.equals("")){
            titulo = "Material genetico "+filtro_matgen;
        }*/
        PdfPTable table = new PdfPTable(colunas.length);
        // Definindo uma fonte, com tamanho 20 e negrito
        PdfPCell header = new PdfPCell(new Paragraph(titulo, font));
        header.setColspan(colunas.length);
        table.addCell(header);
        table.setWidthPercentage(100.0f);
        table.setHorizontalAlignment(Element.ALIGN_JUSTIFIED_ALL);
        //System.out.println("Tamanho: "+linhas.size());
        font = new Font(Font.FontFamily.TIMES_ROMAN, 4, Font.NORMAL);
        for (String coluna : colunas) {
            table.addCell(new Paragraph(coluna, font));
        }

        //varias linhas
        for (int i = 0; i < linhas.size(); i++) {//linha
            for (int j = 0; j < colunas.length; j++) {//coluna
                //table.addCell(jTableRelatorioEstoquePrincipal.getValueAt(i, j).toString());
                table.addCell(new Paragraph(jTableExpedirCarvao.getValueAt(i, j).toString(), font));
            }
        }

        document.add(table);
        document.add(new Paragraph(" "));

        font = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD);
        document.add(new Paragraph("Dados Totais", font));
        font = new Font(Font.FontFamily.TIMES_ROMAN, 8, Font.NORMAL);
        document.add(new Paragraph(jLabelInfo1.getText(), font));
        document.add(new Paragraph(jLabelPesoTotal.getText(), font));
        document.add(new Paragraph(jLabelVolumeTotal.getText(), font));
        document.close();
        JOptionPane.showMessageDialog(null, "PDF: " + arquivo + " gerado!");
    } catch (FileNotFoundException | DocumentException | HeadlessException ex) {
        Logger.getLogger(GerarRelatorioEstoqueBasico.class.getName()).log(Level.SEVERE, null,
                "Erro ao gerar pdf: " + ex);
        JOptionPane.showMessageDialog(null, "Erro ao gerar pdf: " + ex);
    }

}

From source file:Visao.relatorios.GerarRelatorioEstoqueBasico.java

private void GerarPDF() throws DocumentException, FileNotFoundException {
    try {/*  w  w w .j  a  va  2s. c  o  m*/
        /*if(jTableRelatorioEstoquePrincipal.getSelectedRow()>=0) { 
        int linha = jTableRelatorioEstoquePrincipal.getSelectedRow();
        Document document = new Document(PageSize.A4, 10, 10, 10, 10);
        //System.out.println(new File(".").getAbsolutePath());
        String arquivo = new File("RelatorioFaz.").getAbsolutePath()+"pdf";            
        PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(arquivo));
        document.open();
        Font font = new Font(FontFamily.TIMES_ROMAN, 12, Font.BOLD);
        //String titulo = jTableRelatorioEstoquePrincipal.getValueAt(linha, 3).toString()+ " "+jTableRelatorioEstoquePrincipal.getValueAt(linha, 2).toString()+"-"+jTableRelatorioEstoquePrincipal.getValueAt(linha, 0).toString();
        String titulo = "";
        if(!filtro_matgen.equals("")){
            titulo = "do material genetico "+filtro_matgen;
        }
        Paragraph pgt = new Paragraph("Relatorio "+titulo, font);
        pgt.setAlignment(Element.ALIGN_CENTER);
        document.add(pgt);
        document.add(new Paragraph(" "));
        //System.out.println("Colunas "+colunas.length);
        //for(int i=4; i<colunas.length; i++){
            //document.add(new Paragraph(colunas[i]+": "+jTableRelatorioEstoquePrincipal.getValueAt(linha, i).toString()));
        //}           
        //document.add(new Paragraph("Municipio: "+jTableRelatorioEstoquePrincipal.getValueAt(linha, 3).toString()));
                
        PdfPTable table = new PdfPTable(colunas.length);
        // Definindo uma fonte, com tamanho 20 e negrito
        PdfPCell header = new PdfPCell(new Paragraph("Relatorio "+titulo,font));
        header.setColspan(colunas.length);
        table.addCell(header);
        table.setWidthPercentage(100.0f);
        table.setHorizontalAlignment(Element.ALIGN_JUSTIFIED_ALL);
        //System.out.println("Tamanho: "+linhas.size());
        font = new Font(FontFamily.TIMES_ROMAN, 4, Font.NORMAL);
        for (String coluna : colunas) {
            table.addCell(new Paragraph(coluna,font));
        }
                
        //Linha selecionada
        //for(int j=0;j<colunas.length;j++){//coluna
            //table.addCell(jTableRelatorioEstoquePrincipal.getValueAt(linha, j).toString());
            //table.addCell(new Paragraph(jTableRelatorioEstoquePrincipal.getValueAt(linha, j).toString(),font));
        //}
                
        //varias linhas
        for(int i=0;i<linhas.size();i++){//linha
            for(int j=0;j<colunas.length;j++){//coluna
                //table.addCell(jTableRelatorioEstoquePrincipal.getValueAt(i, j).toString());
                table.addCell(new Paragraph(jTableRelatorioEstoquePrincipal.getValueAt(i, j).toString(),font));
            }
        }
                
        document.add(table);
                
        document.add(new Paragraph("Relatorio Geral"));
        document.add(new Paragraph(" "));
        document.add(new Paragraph(jLabelAreaTotal.getText()));
        document.add(new Paragraph(jLabelM3_ha.getText()));
        document.add(new Paragraph(jLabelMDC_ha.getText()));
                
        document.add(new Paragraph(jLabelVolumeMadeiraEstTotal.getText()));
        document.add(new Paragraph(jLabelVolumeMadeiraTranspTotal.getText()));
        document.add(new Paragraph(jLabelVolumeCarvaoEstTotal.getText()));
        document.add(new Paragraph(jLabelVolumeCarvaoTranspTotal.getText()));
                
        document.add(new Paragraph(jLabelToneladaMadeiraEstTotal.getText()));
        document.add(new Paragraph(jLabelToneladaMadeiraTranspTotal.getText()));
        document.add(new Paragraph(jLabelToneladaCarvaoEstTotal.getText()));
        document.add(new Paragraph(jLabelToneladaCarvaoTranspTotal.getText()));
        document.close();
        JOptionPane.showMessageDialog(null, "PDF: "+arquivo+" gerado!");
        }else {
        //Document document = new Document(PageSize.A4, 72, 72, 72, 72);
        Rectangle rect = new Rectangle(1200, 595);
        Document document = new Document(rect);
        String arquivo = new File("RelatorioGeral.").getAbsolutePath()+"pdf";
        PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(arquivo));
        document.open();
        document.add(new Paragraph("Relatorio Geral"));
        document.add(new Paragraph(" "));
        document.add(new Paragraph(jLabelAreaTotal.getText()));
        document.add(new Paragraph(jLabelM3_ha.getText()));
        document.add(new Paragraph(jLabelMDC_ha.getText()));
                
        document.add(new Paragraph(jLabelVolumeMadeiraEstTotal.getText()));
        document.add(new Paragraph(jLabelVolumeMadeiraTranspTotal.getText()));
        document.add(new Paragraph(jLabelVolumeCarvaoEstTotal.getText()));
        document.add(new Paragraph(jLabelVolumeCarvaoTranspTotal.getText()));
                
        document.add(new Paragraph(jLabelToneladaMadeiraEstTotal.getText()));
        document.add(new Paragraph(jLabelToneladaMadeiraTranspTotal.getText()));
        document.add(new Paragraph(jLabelToneladaCarvaoEstTotal.getText()));
        document.add(new Paragraph(jLabelToneladaCarvaoTranspTotal.getText()));
                
        document.close();
        JOptionPane.showMessageDialog(null, "PDF: "+arquivo+" gerado!");
        }*/
        int linha = jTableRelatorioEstoquePrincipal.getSelectedRow();
        Document document = new Document(PageSize.A4, 10, 10, 10, 10);
        //System.out.println(new File(".").getAbsolutePath());
        String arquivo = new File("RelatorioFaz.").getAbsolutePath() + "pdf";
        PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(arquivo));
        document.open();
        Font font = new Font(FontFamily.TIMES_ROMAN, 12, Font.BOLD);
        //String titulo = jTableRelatorioEstoquePrincipal.getValueAt(linha, 3).toString()+ " "+jTableRelatorioEstoquePrincipal.getValueAt(linha, 2).toString()+"-"+jTableRelatorioEstoquePrincipal.getValueAt(linha, 0).toString();
        String titulo = "Relatorio";
        Paragraph pgt = new Paragraph(titulo, font);
        pgt.setAlignment(Element.ALIGN_CENTER);
        document.add(pgt);
        document.add(new Paragraph(" "));
        if (!filtro_matgen.equals("")) {
            titulo = "Material genetico " + filtro_matgen;
        }
        PdfPTable table = new PdfPTable(colunas.length);
        // Definindo uma fonte, com tamanho 20 e negrito
        PdfPCell header = new PdfPCell(new Paragraph(titulo, font));
        header.setColspan(colunas.length);
        table.addCell(header);
        table.setWidthPercentage(100.0f);
        table.setHorizontalAlignment(Element.ALIGN_JUSTIFIED_ALL);
        //System.out.println("Tamanho: "+linhas.size());
        font = new Font(FontFamily.TIMES_ROMAN, 4, Font.NORMAL);
        for (String coluna : colunas) {
            table.addCell(new Paragraph(coluna, font));
        }

        //varias linhas
        for (int i = 0; i < linhas.size(); i++) {//linha
            for (int j = 0; j < colunas.length; j++) {//coluna
                //table.addCell(jTableRelatorioEstoquePrincipal.getValueAt(i, j).toString());
                table.addCell(new Paragraph(jTableRelatorioEstoquePrincipal.getValueAt(i, j).toString(), font));
            }
        }

        document.add(table);

        document.add(new Paragraph(" "));

        font = new Font(FontFamily.TIMES_ROMAN, 12, Font.BOLD);
        document.add(new Paragraph("Dados Totais", font));
        font = new Font(FontFamily.TIMES_ROMAN, 8, Font.NORMAL);
        document.add(new Paragraph(jLabelInfo1.getText(), font));
        document.add(new Paragraph(jLabelAreaTotal.getText(), font));
        document.add(new Paragraph(jLabelM3_ha.getText(), font));
        document.add(new Paragraph(jLabelMDC_ha.getText(), font));
        document.add(new Paragraph(jLabelTotalMadeiraPraca.getText(), font));
        document.add(new Paragraph(jLabelTotalCarvaoPraca.getText(), font));

        document.add(new Paragraph(jLabelInfo2.getText(), font));
        document.add(new Paragraph(jLabelVolumeMadeiraEstTotal.getText(), font));
        document.add(new Paragraph(jLabelVolumeMadeiraTranspTotal.getText(), font));
        document.add(new Paragraph(jLabelToneladaMadeiraEstTotal.getText(), font));
        document.add(new Paragraph(jLabelToneladaMadeiraTranspTotal.getText(), font));

        document.add(new Paragraph(jLabelInfo3.getText(), font));
        document.add(new Paragraph(jLabelVolumeCarvaoEstTotal.getText(), font));
        document.add(new Paragraph(jLabelVolumeCarvaoProdTotal.getText(), font));
        document.add(new Paragraph(jLabelVolumeCarvaoTranspTotal.getText(), font));
        document.add(new Paragraph(jLabelToneladaCarvaoEstTotal.getText(), font));
        document.add(new Paragraph(jLabelToneladaCarvaoProdTotal.getText(), font));
        document.add(new Paragraph(jLabelToneladaCarvaoTranspTotal.getText(), font));
        document.close();
        JOptionPane.showMessageDialog(null, "PDF: " + arquivo + " gerado!");
    } catch (FileNotFoundException | DocumentException | HeadlessException ex) {
        Logger.getLogger(GerarRelatorioEstoqueBasico.class.getName()).log(Level.SEVERE, null,
                "Erro ao gerar pdf: " + ex);
        JOptionPane.showMessageDialog(null, "Erro ao gerar pdf: " + ex);
    }

}

From source file:Visao.relatorios.GerarRelatorioForno.java

private void GerarPDF() throws DocumentException, FileNotFoundException {
    try {/*from  ww  w . j  av  a2s .  co  m*/
        int linha = jTableForno.getSelectedRow();
        Document document = new Document(PageSize.A4, 10, 10, 10, 10);
        //System.out.println(new File(".").getAbsolutePath());
        String arquivo = new File("Relatorio Carvo Expedido.").getAbsolutePath() + "pdf";
        PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(arquivo));
        document.open();
        Font font = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD);
        //String titulo = jTableRelatorioEstoquePrincipal.getValueAt(linha, 3).toString()+ " "+jTableRelatorioEstoquePrincipal.getValueAt(linha, 2).toString()+"-"+jTableRelatorioEstoquePrincipal.getValueAt(linha, 0).toString();
        String titulo = "Relatorio Carvo Expedido";
        Paragraph pgt = new Paragraph(titulo, font);
        pgt.setAlignment(Element.ALIGN_CENTER);
        document.add(pgt);
        document.add(new Paragraph(" "));
        /*if(!filtro_matgen.equals("")){
            titulo = "Material genetico "+filtro_matgen;
        }*/
        PdfPTable table = new PdfPTable(colunas.length);
        // Definindo uma fonte, com tamanho 20 e negrito
        PdfPCell header = new PdfPCell(new Paragraph(titulo, font));
        header.setColspan(colunas.length);
        table.addCell(header);
        table.setWidthPercentage(100.0f);
        table.setHorizontalAlignment(Element.ALIGN_JUSTIFIED_ALL);
        //System.out.println("Tamanho: "+linhas.size());
        font = new Font(Font.FontFamily.TIMES_ROMAN, 4, Font.NORMAL);
        for (String coluna : colunas) {
            table.addCell(new Paragraph(coluna, font));
        }

        //varias linhas
        for (int i = 0; i < linhas.size(); i++) {//linha
            for (int j = 0; j < colunas.length; j++) {//coluna
                //table.addCell(jTableRelatorioEstoquePrincipal.getValueAt(i, j).toString());
                table.addCell(new Paragraph(jTableForno.getValueAt(i, j).toString(), font));
            }
        }

        document.add(table);
        document.add(new Paragraph(" "));

        font = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD);
        document.add(new Paragraph("Dados Totais", font));
        font = new Font(Font.FontFamily.TIMES_ROMAN, 8, Font.NORMAL);
        document.add(new Paragraph(jLabelInfo1.getText(), font));
        document.add(new Paragraph(jLabelFornosCheios.getText(), font));
        document.add(new Paragraph(jLabelFornosVazios.getText(), font));
        document.add(new Paragraph(jLabelFornosCarbonizando.getText(), font));
        document.add(new Paragraph(jLabelFornosResfriando.getText(), font));
        document.add(new Paragraph(jLabelFornosReforma.getText(), font));
        document.add(new Paragraph(jLabelFornosManutencao.getText(), font));
        document.close();
        JOptionPane.showMessageDialog(null, "PDF: " + arquivo + " gerado!");
    } catch (FileNotFoundException | DocumentException | HeadlessException ex) {
        Logger.getLogger(GerarRelatorioEstoqueBasico.class.getName()).log(Level.SEVERE, null,
                "Erro ao gerar pdf: " + ex);
        JOptionPane.showMessageDialog(null, "Erro ao gerar pdf: " + ex);
    }

}