Java write excel with Apache Poi Java API

Java escribir excel con Apache Poi Java API

In any application or development is often necessary to process Excel files or other spreadsheets, in this case, we will focus on Microsoft’s OLE 2 documents, and manipulate them in this case using Apache POI – the Java API for Microsoft Documents,that provides access to different file types Microsoft that use this structure as Excel, Word or Powerpoint, there are other projects in this API to Visio and Publisher for example all these the more developed Excel Workbooks.

We’ll explain how to create a new excel sheet, how to add cells, modify its content and modify its content and definitely manipulate data according to need using the POI-HSSF and POI-XSSF – Java API To Access Microsoft library, where HSSF is the POI project full implementation in Java for excel.

We will introduce the elements of this library that we will use to read and create an Excel spreadsheet.

  • HSSFWorkbook: High level representation of a workbook. This is the first object will construct whether they are reading or writing a workbook.
  • HSSFSheet: high level representation of a worksheet, we can choose the sheet using the HSSFWorkBook.
  • HSSFRow: representation of a row of a spreadsheet, only rows that have cells should be added to a Sheet.
  • HSSFCell: representation of a cell in a row of a spreadsheet, we use to manage the contents of the cell.

Make attention for use this library you need to add it to the project that you are working on, download the library API Apache Poi Java to add it, here I explain how to add it to a Netbeans project, also It can be useful with other IDEs because is do it in a similar way.

 
Continue reading Java write excel with Apache Poi Java API

Java read excel with Apache Poi Java API

Java leer excel con Apache Poi Java API

In any application or development is often necessary to process Excel files or other spreadsheets, in this case, we will focus on Microsoft’s OLE 2 documents, and manipulate them in this case using Apache POI – the Java API for Microsoft Documents,that provides access to different file types Microsoft that use this structure as Excel, Word or Powerpoint, there are other projects in this API to Visio and Publisher for example all these the more developed Excel Workbooks.

Performed the introduction, we will introduce the elements of this library that we will use to read and create an Excel spreadsheet.

  • HSSFWorkbook: High level representation of a workbook. This is the first object will construct whether they are reading or writing a workbook.
  • HSSFSheet: high level representation of a worksheet, we can choose the sheet using the HSSFWorkBook.
  • HSSFRow: representation of a row of a spreadsheet, only rows that have cells should be added to a Sheet.
  • HSSFCell: representation of a cell in a row of a spreadsheet, we use to manage the contents of the cell.

Adding de library Apache Poi Java API

After all we need to download the Apache Poi Java API, then we add it to our project, I’m going to explain how to do it in the IDE I’m using for this example: Netbeans, in other IDEs this will be similar.
Continue reading Java read excel with Apache Poi Java API

Netbeans add library Apache Poi Java API

We are going to add the library Apache POI – the Java API for Microsoft Documents, that provides access to different file types Microsoft that use this structure as Excel, Word or Powerpoint, there are other projects in this API to Visio and Publisher for example all these the more developed Excel Workbooks.
 

Netbeans add library Apache Poi Java API

Continue reading Netbeans add library Apache Poi Java API

Spring Roo basic example with PostgreSQL

Proyecto Spring Roo con PostgreSQL en 6 pasos

Let’s do some initial tests with Spring Roo Project to see if we include it in the project development environments Learning Project. To make a development as quickly as possible and make an assessment we will use a single table from those reflected in the draft here you have all the information.

Spring Roo

A next-generation rapid application development tool for Java developers. With Roo you can easily build full Java applications in minutes.Spring Roo

Ultimately we will see that we can generate CRUD application with Spring Roo for the customerdbroo database where we will create the cb_language table with the following database structure:

Esquema de la tabla cb_language

Esquema de la tabla cb_language

cb_language

Table with the languages on the application, it could be related to multiple tables.

In this tutorial we will learn to make a Web application from scratch using Spring Roo, what we do:

Continue reading Spring Roo basic example with PostgreSQL

Java read files of a directory – Java I/O


IN TRANSLATION PROCESS it will be available as soon as posible.


Vamos a seguir descubriendo métodos básicos de Java I/O, en este caso crearemos un método para explicar como leer todos los ficheros del directorio que se indique en Java, creamos un paquete org.xulescode.javaio para nuestra clase que llamaremos JavaIOUtils, clase que estoy utilizando en las explicaciones de nuevas funcionalidades de Java I/O, aquí iremos añadiendo para darles utilizad en futuros ejemplos.

Java leer ficheros

Usamos la clase java.io.File que nos proporciona una representación abstracta de un fichero o directorio, con métodos para el manejo de ficheros y directorios.Código Xules

 
Creamos el método public boolean readFolderFiles(String folder) donde implementamos la funcionalidad de Java leer ficheros, usando:

  • Usamos el paquete java.io: donde se encuentran la mayor parte de las clases para el manejo de archivos
  • Usamos java.io.File: representación abstracta de un fichero o el nombre de una ruta, aquí encontraremos los métodos para saber si existe el directorio que nos pasan en la ruta, y también, un método para leer los ficheros del directorio.

Continue reading Java read files of a directory – Java I/O