Warning: Trying to access array offset on value of type bool in /home/feltexco/public_html/felix/wp-content/plugins/google-maps-ready/modules/options/models/options.php on line 16

Warning: Trying to access array offset on value of type bool in /home/feltexco/public_html/felix/wp-content/plugins/google-maps-ready/modules/options/models/options.php on line 16

Warning: Trying to access array offset on value of type bool in /home/feltexco/public_html/felix/wp-content/plugins/google-maps-ready/modules/options/models/options.php on line 16

Warning: Cannot modify header information - headers already sent by (output started at /home/feltexco/public_html/felix/wp-content/plugins/google-maps-ready/modules/options/models/options.php:16) in /home/feltexco/public_html/felix/wp-includes/rest-api/class-wp-rest-server.php on line 1758

Warning: Cannot modify header information - headers already sent by (output started at /home/feltexco/public_html/felix/wp-content/plugins/google-maps-ready/modules/options/models/options.php:16) in /home/feltexco/public_html/felix/wp-includes/rest-api/class-wp-rest-server.php on line 1758

Warning: Cannot modify header information - headers already sent by (output started at /home/feltexco/public_html/felix/wp-content/plugins/google-maps-ready/modules/options/models/options.php:16) in /home/feltexco/public_html/felix/wp-includes/rest-api/class-wp-rest-server.php on line 1758

Warning: Cannot modify header information - headers already sent by (output started at /home/feltexco/public_html/felix/wp-content/plugins/google-maps-ready/modules/options/models/options.php:16) in /home/feltexco/public_html/felix/wp-includes/rest-api/class-wp-rest-server.php on line 1758

Warning: Cannot modify header information - headers already sent by (output started at /home/feltexco/public_html/felix/wp-content/plugins/google-maps-ready/modules/options/models/options.php:16) in /home/feltexco/public_html/felix/wp-includes/rest-api/class-wp-rest-server.php on line 1758

Warning: Cannot modify header information - headers already sent by (output started at /home/feltexco/public_html/felix/wp-content/plugins/google-maps-ready/modules/options/models/options.php:16) in /home/feltexco/public_html/felix/wp-includes/rest-api/class-wp-rest-server.php on line 1758

Warning: Cannot modify header information - headers already sent by (output started at /home/feltexco/public_html/felix/wp-content/plugins/google-maps-ready/modules/options/models/options.php:16) in /home/feltexco/public_html/felix/wp-includes/rest-api/class-wp-rest-server.php on line 1758

Warning: Cannot modify header information - headers already sent by (output started at /home/feltexco/public_html/felix/wp-content/plugins/google-maps-ready/modules/options/models/options.php:16) in /home/feltexco/public_html/felix/wp-includes/rest-api/class-wp-rest-server.php on line 1758
{"id":917,"date":"2014-07-03T20:54:03","date_gmt":"2014-07-03T23:54:03","guid":{"rendered":"http:\/\/www.feltex.com.br\/felix\/?p=917"},"modified":"2014-08-04T11:15:04","modified_gmt":"2014-08-04T14:15:04","slug":"manipulando-planilhas-com-jexcel","status":"publish","type":"post","link":"https:\/\/www.feltex.com.br\/felix\/manipulando-planilhas-com-jexcel\/","title":{"rendered":"Utilizando JExcelAPI para criar arquivos para o Excel"},"content":{"rendered":"

Utilizando JExcelAPI para criar arquivos para o Excel<\/H1>
\nOl\u00e1 Amigos,<\/p>\n

Hoje trabalharemos com o JExcelAPI. Framwework Java Excel. Ele \u00e9 excelente para manipula\u00e7\u00e3o de planilhas eletr\u00f4nicas no formato XLS. A vers\u00e3o que utilizaremos trabalha tamb\u00e9m com o formato XLSX. <\/p>\n

Para quem precisa utlizar java e excel esta \u00e9 uma \u00f3tima ferramenta.<\/p>\n

\u00c9 poss\u00edvel realizar leitura e grava\u00e7\u00e3o de planilhas. Imagine que voc\u00ea precisa fazer exporta\u00e7\u00e3o de uma lista de seu sistema para uma planilha eletr\u00f4nica. Essa \u00e9 uma das solu\u00e7\u00f5es
\nque voc\u00ea deve analisar e testar em Java.<\/p>\n

\"Java<\/a><\/p>\n

<\/p>\n

Ambiente a ser configurado: <\/H2>
\nJDK 7
\nJExcelAPI – 2.7.12 <\/p>\n

Vamos iniciar digitando o c\u00f3digo abaixo em um programa Java b\u00e1sico.<\/p>\n

\r\npackage br.com.feltex.lab.excel;\r\n\r\nimport java.io.File;\r\nimport java.util.Calendar;\r\nimport java.util.Date;\r\nimport java.util.Random;\r\n\r\nimport jxl.Workbook;\r\nimport jxl.format.Colour;\r\nimport jxl.write.DateFormat;\r\nimport jxl.write.DateTime;\r\nimport jxl.write.Label;\r\nimport jxl.write.Number;\r\nimport jxl.write.WritableCell;\r\nimport jxl.write.WritableCellFormat;\r\nimport jxl.write.WritableFont;\r\nimport jxl.write.WritableSheet;\r\nimport jxl.write.WritableWorkbook;\r\n\r\npublic class CriarExcel {\r\n\tpublic static void main(String[] args) {\r\n\t\tSystem.out.println(\"Inicio\");\r\n\t\ttry {\r\n\t\t\tWritableWorkbook planilha = Workbook.createWorkbook(new File(\r\n\t\t\t\t\t\"c:\/temp\/saida.xls\"));\r\n\t\t\t\/\/ Adicionando o nome da aba\r\n\t\t\tWritableSheet aba = planilha.createSheet(\"ListaAlunos\", 0);\r\n\r\n\t\t\t\/\/ Cabe\u00e7alhos\r\n\t\t\tString cabecalho[] = new String[5];\r\n\t\t\tcabecalho[0] = \"ID\";\r\n\t\t\tcabecalho[1] = \"Nome\";\r\n\t\t\tcabecalho[2] = \"Telefone\";\r\n\t\t\tcabecalho[3] = \"E-mail\";\r\n\t\t\tcabecalho[4] = \"Data Cadastro\";\r\n\r\n\t\t\t\/\/ Cor de fundo das celular\r\n\t\t\tColour bckcolor = Colour.DARK_GREEN;\r\n\t\t\tWritableCellFormat cellFormat = new WritableCellFormat();\r\n\t\t\tcellFormat.setBackground(bckcolor);\r\n\r\n\t\t\t\/\/ Cor e tipo de fonte\r\n\t\t\tWritableFont fonte = new WritableFont(WritableFont.ARIAL);\r\n\t\t\tfonte.setColour(Colour.GOLD);\r\n\t\t\tcellFormat.setFont(fonte);\r\n\r\n\t\t\t\/\/ Write the Header to the excel file\r\n\t\t\tfor (int i = 0; i < cabecalho.length; i++) {\r\n\t\t\t\tLabel label = new Label(i, 0, cabecalho[i]);\r\n\t\t\t\taba.addCell(label);\r\n\t\t\t\tWritableCell cell = aba.getWritableCell(i, 0);\r\n\t\t\t\tcell.setCellFormat(cellFormat);\r\n\t\t\t}\r\n\r\n\t\t\tfor (int linha = 1; linha < 10; linha++) { \/\/ N\u00famero da linha\r\n\t\t\t\tRandom numeroAleatorio = new Random();\r\n\r\n\t\t\t\tNumber number = new Number(0, linha,\r\n\t\t\t\t\t\tnumeroAleatorio.nextInt(2000));\r\n\t\t\t\taba.addCell(number);\r\n\r\n\t\t\t\tLabel label = new Label(1, linha, \"Jose da Silva\");\r\n\t\t\t\taba.addCell(label);\r\n\r\n\t\t\t\tlabel = new Label(2, linha, \"2230-6625\");\r\n\t\t\t\taba.addCell(label);\r\n\r\n\t\t\t\tlabel = new Label(3, linha, \"josesilva@feltex.com.br\");\r\n\t\t\t\taba.addCell(label);\r\n\r\n\t\t\t\tDate data = Calendar.getInstance().getTime();\r\n\t\t\t\tDateFormat customDateFormat = new DateFormat(\r\n\t\t\t\t\t\t\"dd MMM yyyy hh:mm:ss\");\r\n\t\t\t\tWritableCellFormat dateFormat = new WritableCellFormat(\r\n\t\t\t\t\t\tcustomDateFormat);\r\n\t\t\t\tDateTime dateCell = new DateTime(4, linha, data, dateFormat);\r\n\t\t\t\taba.addCell(dateCell);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tplanilha.write();\r\n\t\t\t\/\/ Fecha o arquivo\r\n\t\t\tplanilha.close();\r\n\r\n\t\t} catch (Exception e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\tSystem.out.println(\"Fim\");\r\n\t}\r\n}\r\n<\/pre>\n

Conclus\u00e3o <\/H2>
\n Esta API disponibiliza uma gamad de recursos para manipular excel que torna o trabalho de exporta\u00e7\u00e3o de dados bem simples.
\n Para fazer download do Jar do JExcelAPI clique
aqui<\/a><\/p>\n

Abra\u00e7os e bons estudos. Vida que segue!<\/p>\n

Links relacionados<\/H2><\/p>\n

xStream<\/a><\/p>\n

JExcelPIP<\/a><\/p>\n

Gostou do post? Agrade\u00e7a o autor compartilhando nas redes sociais. Clique nos links abaixo:<\/b><\/p>\n","protected":false},"excerpt":{"rendered":"

Utilizando JExcelAPI para criar arquivos para o Excel Ol\u00e1 Amigos, Hoje trabalharemos com o JExcelAPI. Framwework Java Excel. Ele \u00e9 excelente para manipula\u00e7\u00e3o de planilhas eletr\u00f4nicas no formato XLS. A vers\u00e3o que utilizaremos trabalha tamb\u00e9m com o formato XLSX. Para …<\/p>\n

Utilizando JExcelAPI para criar arquivos para o Excel<\/span> Read More »<\/a><\/p>\n

<\/p>\n","protected":false},"author":1,"featured_media":926,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0},"categories":[1],"tags":[],"yoast_head":"\nUtilizando JExcelAPI para criar arquivos para o Excel<\/title>\n<meta name=\"description\" content=\"Trabalhar com Java excel api\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.feltex.com.br\/felix\/manipulando-planilhas-com-jexcel\/\" \/>\n<meta property=\"og:locale\" content=\"pt_BR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Utilizando JExcelAPI para criar arquivos para o Excel\" \/>\n<meta property=\"og:description\" content=\"Trabalhar com Java excel api\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.feltex.com.br\/felix\/manipulando-planilhas-com-jexcel\/\" \/>\n<meta property=\"og:site_name\" content=\"Aprenda Java\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/feltex.br\" \/>\n<meta property=\"article:published_time\" content=\"2014-07-03T23:54:03+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2014-08-04T14:15:04+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.feltex.com.br\/felix\/wp-content\/uploads\/2014\/07\/JExcelAPI.fw_.png\" \/>\n\t<meta property=\"og:image:width\" content=\"520\" \/>\n\t<meta property=\"og:image:height\" content=\"90\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:label1\" content=\"Escrito por\" \/>\n\t<meta name=\"twitter:data1\" content=\"Andr\u00e9 F\u00e9lix\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. tempo de leitura\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.feltex.com.br\/felix\/#website\",\"url\":\"https:\/\/www.feltex.com.br\/felix\/\",\"name\":\"Aprenda Java\",\"description\":\"Cursos de java, SQL e Engenharia de Software\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.feltex.com.br\/felix\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"pt-BR\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.feltex.com.br\/felix\/manipulando-planilhas-com-jexcel\/#primaryimage\",\"inLanguage\":\"pt-BR\",\"url\":\"https:\/\/www.feltex.com.br\/felix\/wp-content\/uploads\/2014\/07\/JExcelAPI.fw_.png\",\"contentUrl\":\"https:\/\/www.feltex.com.br\/felix\/wp-content\/uploads\/2014\/07\/JExcelAPI.fw_.png\",\"width\":520,\"height\":90},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.feltex.com.br\/felix\/manipulando-planilhas-com-jexcel\/#webpage\",\"url\":\"https:\/\/www.feltex.com.br\/felix\/manipulando-planilhas-com-jexcel\/\",\"name\":\"Utilizando JExcelAPI para criar arquivos para o Excel\",\"isPartOf\":{\"@id\":\"https:\/\/www.feltex.com.br\/felix\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.feltex.com.br\/felix\/manipulando-planilhas-com-jexcel\/#primaryimage\"},\"datePublished\":\"2014-07-03T23:54:03+00:00\",\"dateModified\":\"2014-08-04T14:15:04+00:00\",\"author\":{\"@id\":\"https:\/\/www.feltex.com.br\/felix\/#\/schema\/person\/1e49f842c6254b4561b66ccf573c2069\"},\"description\":\"Trabalhar com Java excel api\",\"breadcrumb\":{\"@id\":\"https:\/\/www.feltex.com.br\/felix\/manipulando-planilhas-com-jexcel\/#breadcrumb\"},\"inLanguage\":\"pt-BR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.feltex.com.br\/felix\/manipulando-planilhas-com-jexcel\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.feltex.com.br\/felix\/manipulando-planilhas-com-jexcel\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Utilizando JExcelAPI para criar arquivos para o Excel\"}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.feltex.com.br\/felix\/#\/schema\/person\/1e49f842c6254b4561b66ccf573c2069\",\"name\":\"Andr\\u00e9 F\\u00e9lix\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.feltex.com.br\/felix\/#personlogo\",\"inLanguage\":\"pt-BR\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d2d9cc82cab40245e6f803982b1448e6?s=96&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d2d9cc82cab40245e6f803982b1448e6?s=96&r=g\",\"caption\":\"Andr\\u00e9 F\\u00e9lix\"},\"sameAs\":[\"http:\/\/www.feltex.com.br\"],\"url\":\"https:\/\/www.feltex.com.br\/felix\/author\/andre.felix\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Utilizando JExcelAPI para criar arquivos para o Excel","description":"Trabalhar com Java excel api","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.feltex.com.br\/felix\/manipulando-planilhas-com-jexcel\/","og_locale":"pt_BR","og_type":"article","og_title":"Utilizando JExcelAPI para criar arquivos para o Excel","og_description":"Trabalhar com Java excel api","og_url":"https:\/\/www.feltex.com.br\/felix\/manipulando-planilhas-com-jexcel\/","og_site_name":"Aprenda Java","article_publisher":"https:\/\/www.facebook.com\/feltex.br","article_published_time":"2014-07-03T23:54:03+00:00","article_modified_time":"2014-08-04T14:15:04+00:00","og_image":[{"width":520,"height":90,"url":"https:\/\/www.feltex.com.br\/felix\/wp-content\/uploads\/2014\/07\/JExcelAPI.fw_.png","type":"image\/png"}],"twitter_misc":{"Escrito por":"Andr\u00e9 F\u00e9lix","Est. tempo de leitura":"2 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"https:\/\/www.feltex.com.br\/felix\/#website","url":"https:\/\/www.feltex.com.br\/felix\/","name":"Aprenda Java","description":"Cursos de java, SQL e Engenharia de Software","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.feltex.com.br\/felix\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"pt-BR"},{"@type":"ImageObject","@id":"https:\/\/www.feltex.com.br\/felix\/manipulando-planilhas-com-jexcel\/#primaryimage","inLanguage":"pt-BR","url":"https:\/\/www.feltex.com.br\/felix\/wp-content\/uploads\/2014\/07\/JExcelAPI.fw_.png","contentUrl":"https:\/\/www.feltex.com.br\/felix\/wp-content\/uploads\/2014\/07\/JExcelAPI.fw_.png","width":520,"height":90},{"@type":"WebPage","@id":"https:\/\/www.feltex.com.br\/felix\/manipulando-planilhas-com-jexcel\/#webpage","url":"https:\/\/www.feltex.com.br\/felix\/manipulando-planilhas-com-jexcel\/","name":"Utilizando JExcelAPI para criar arquivos para o Excel","isPartOf":{"@id":"https:\/\/www.feltex.com.br\/felix\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.feltex.com.br\/felix\/manipulando-planilhas-com-jexcel\/#primaryimage"},"datePublished":"2014-07-03T23:54:03+00:00","dateModified":"2014-08-04T14:15:04+00:00","author":{"@id":"https:\/\/www.feltex.com.br\/felix\/#\/schema\/person\/1e49f842c6254b4561b66ccf573c2069"},"description":"Trabalhar com Java excel api","breadcrumb":{"@id":"https:\/\/www.feltex.com.br\/felix\/manipulando-planilhas-com-jexcel\/#breadcrumb"},"inLanguage":"pt-BR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.feltex.com.br\/felix\/manipulando-planilhas-com-jexcel\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.feltex.com.br\/felix\/manipulando-planilhas-com-jexcel\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Utilizando JExcelAPI para criar arquivos para o Excel"}]},{"@type":"Person","@id":"https:\/\/www.feltex.com.br\/felix\/#\/schema\/person\/1e49f842c6254b4561b66ccf573c2069","name":"Andr\u00e9 F\u00e9lix","image":{"@type":"ImageObject","@id":"https:\/\/www.feltex.com.br\/felix\/#personlogo","inLanguage":"pt-BR","url":"https:\/\/secure.gravatar.com\/avatar\/d2d9cc82cab40245e6f803982b1448e6?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d2d9cc82cab40245e6f803982b1448e6?s=96&r=g","caption":"Andr\u00e9 F\u00e9lix"},"sameAs":["http:\/\/www.feltex.com.br"],"url":"https:\/\/www.feltex.com.br\/felix\/author\/andre.felix\/"}]}},"_links":{"self":[{"href":"https:\/\/www.feltex.com.br\/felix\/wp-json\/wp\/v2\/posts\/917"}],"collection":[{"href":"https:\/\/www.feltex.com.br\/felix\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.feltex.com.br\/felix\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.feltex.com.br\/felix\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.feltex.com.br\/felix\/wp-json\/wp\/v2\/comments?post=917"}],"version-history":[{"count":20,"href":"https:\/\/www.feltex.com.br\/felix\/wp-json\/wp\/v2\/posts\/917\/revisions"}],"predecessor-version":[{"id":1248,"href":"https:\/\/www.feltex.com.br\/felix\/wp-json\/wp\/v2\/posts\/917\/revisions\/1248"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.feltex.com.br\/felix\/wp-json\/wp\/v2\/media\/926"}],"wp:attachment":[{"href":"https:\/\/www.feltex.com.br\/felix\/wp-json\/wp\/v2\/media?parent=917"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.feltex.com.br\/felix\/wp-json\/wp\/v2\/categories?post=917"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.feltex.com.br\/felix\/wp-json\/wp\/v2\/tags?post=917"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}