Giter Club home page Giter Club logo

j2hee's Introduction

Java 2 Html Excel Export (J2HEE)

Logo

J2HEE is a free open-source library for exporting HTML tables to Excel in most common formats:

  • HTTP Requests URLs with HTML table
  • HTML to Excel transformation
    • Including merge cells
  • Simple Excel formatting

POM Dependencies

<dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.11</version>
      <scope>test</scope>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi</artifactId>
        <version>3.9</version>
    </dependency>
	<!-- https://mvnrepository.com/artifact/org.jsoup/jsoup -->
	<dependency>
		<groupId>org.jsoup</groupId>
		<artifactId>jsoup</artifactId>
		<version>1.16.2</version>
	</dependency>
</dependencies>

Java examples

HttpHelper Process a provided URL and clean the HTML tables, to return a ready-to-use String with the TableHtml

TableHtml Handle the transformation of the HTML table, and provide method to access the table rows and columns. It is used to fetch the WorkbookManager.

As an input, it is possible to use 2 type of streams:

  • The raw HTML table stream (as an String). You can use the FileHelper object as an easy-to-use interface to read and format .html files.
  • The HttpHelper object, used to request and process the HTTP response.

WorkbookManager Receives an TableHtml and provides methods to return an Excel files.

TableHtml table = new TableHtml( FileHelper.readExcelFileFromLocal("/kpi1.html"), false, true);

WorkbookManager wb = new WorkbookManager(table, "Test");
// Save the Excel to a .xls file
wb.saveWorkbookToLocal(path, "kpi1");

// Return the excel file as a Workbook
HSSFWorkbook hssfWorkbook = wb.getWb();

// Return the excel file as a Byte[]
byte[] byteArray = wb.getWbAsByteArray();

j2hee's People

Contributors

albertodlc avatar

Watchers

 avatar

j2hee's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.