JExcel

Last updated
JExcel
Developer(s) TeamDev
Stable release
1.7
Written in Java
Operating system Cross-platform
Type API to access Microsoft Excel format
License TeamDev [1]
Website https://www.teamdev.com/jexcel

JExcel is a library (API) to read, write, display, and modify Excel files with .xls or .xlsx formats. API can be embedded with Java Swing and AWT. [2] [3] [4]

Contents

JExcel support is discontinued as of May 31, 2020. [5]

Some features

Some main features are as follows:

Usage

Primary usage is handling Excel files through its API.

Example

Sample code for reading/writing workbook attributes, setting password, and saving MS Excel 2003 format, might look like as follows:

importcom.jniwrapper.win32.jexcel.Application;importcom.jniwrapper.win32.jexcel.FileFormat;importcom.jniwrapper.win32.jexcel.GenericWorkbook;importcom.jniwrapper.win32.jexcel.Workbook;importjava.io.File;/** * This sample shows how to read/modify workbook attributes, how to save workbook in Excel 2003 format, * and how to reopen workbook. * * The sample works with MS Excel in non-embedded mode. */publicclassWorkbookSample{publicstaticvoidmain(String[]args)throwsException{//Start MS Excel application, crate workbook and make it visible.// Application starts invisible and without any workbooksApplicationapplication=newApplication();Workbookworkbook=application.createWorkbook("Custom title");printWorkbookAttributes(workbook);modifyWorkbookAttributes(workbook);FilenewFile=newFile("Workbook.xls");//Save workbook in Excel 2003, to save in Excel 2007 format use FileFormat.OPENXMLWORKBOOK// format specificator and *.xlsx extensionworkbook.saveAs(newFile,FileFormat.WORKBOOKNORMAL,true);FileworkbookCopy=newFile("WorkbookCopy.xls");workbook.saveCopyAs(workbookCopy);//Close workbook saving changesworkbook.close(true);//Reopening the workbookworkbook=application.openWorkbook(newFile,true,"xxx001");printWorkbookAttributes(workbook);//Perform cleanup after yourself and close the MS Excel application forcing it to quitapplication.close(true);}/**     * Prints workbook attributes to console     * @param workbook - workbook to print information about     */publicstaticvoidprintWorkbookAttributes(GenericWorkbookworkbook){StringfileName=workbook.getFile().getAbsolutePath();Stringname=workbook.getWorkbookName();Stringtitle=workbook.getTitle();Stringauthor=workbook.getAuthor();System.out.println("\n[Workbook Information]");System.out.println("File path: "+fileName);System.out.println("Name: "+name);System.out.println("Title: "+title);System.out.println("Author: "+author);if(workbook.hasPassword()){System.out.println("The workbook is protected with a password");}else{System.out.println("The workbook is not protected with a password");}if(workbook.isReadOnly()){System.out.println("Read only mode");}}/**     * Modify workbook title, author and set password     * @param workbook - workbook to modify attributes     */publicstaticvoidmodifyWorkbookAttributes(GenericWorkbookworkbook){workbook.setTitle("X-files");workbook.setPassword("xxx001");workbook.setAuthor("Agent Smith");}}

[6]

See also

Related Research Articles

Microsoft Excel Spreadsheet, part of Microsoft Office

Microsoft Excel is a spreadsheet developed by Microsoft for Windows, macOS, Android and iOS. It features calculation, graphing tools, pivot tables, and a macro programming language called Visual Basic for Applications (VBA). It has been a very widely applied spreadsheet for these platforms, especially since version 5 in 1993, and it has replaced Lotus 1-2-3 as the industry standard for spreadsheets. Excel forms part of the Microsoft Office suite of software.

Quine (computing) A self-replicating program

A quine is a computer program which takes no input and produces a copy of its own source code as its only output. The standard terms for these programs in the computability theory and computer science literature are "self-replicating programs", "self-reproducing programs", and "self-copying programs".

In object-oriented programming and software engineering, the visitor design pattern is a way of separating an algorithm from an object structure on which it operates. A practical result of this separation is the ability to add new operations to existing object structures without modifying the structures. It is one way to follow the open/closed principle.

In computing, the Java Remote Method Invocation is a Java API that performs remote method invocation, the object-oriented equivalent of remote procedure calls (RPC), with support for direct transfer of serialized Java classes and distributed garbage-collection.

In software engineering, the adapter pattern is a software design pattern that allows the interface of an existing class to be used as another interface. It is often used to make existing classes work with others without modifying their source code.

In computer programming, lazy initialization is the tactic of delaying the creation of an object, the calculation of a value, or some other expensive process until the first time it is needed. It is a kind of lazy evaluation that refers specifically to the instantiation of objects or other resources.

The memento pattern is a software design pattern that provides the ability to restore an object to its previous state.

In computer programming, standard streams are interconnected input and output communication channels between a computer program and its environment when it begins execution. The three input/output (I/O) connections are called standard input (stdin), standard output (stdout) and standard error (stderr). Originally I/O happened via a physically connected system console, but standard streams abstract this. When a command is executed via an interactive shell, the streams are typically connected to the text terminal on which the shell is running, but can be changed with redirection or a pipeline. More generally, a child process inherits the standard streams of its parent process.

Java syntax

The syntax of Java refers to the set of rules defining how a Java program is written and interpreted.

In computer programming, an entry point is where the first instructions of a program are executed, and where the program has access to command line arguments.

XMLBeans is a Java-to-XML binding framework which is part of the Apache Software Foundation XML project.

In the Java computer programming language, an annotation is a form of syntactic metadata that can be added to Java source code. Classes, methods, variables, parameters and Java packages may be annotated. Like Javadoc tags, Java annotations can be read from source files. Unlike Javadoc tags, Java annotations can also be embedded in and read from Java class files generated by the Java compiler. This allows annotations to be retained by the Java virtual machine at run-time and read via reflection. It is possible to create meta-annotations out of the existing ones in Java.

ExtenXLS is a Java Excel Reporting Toolkit developed by Extentech. It is a Reporting API that allows for the reading in, modifying and creation of spreadsheet-based reports from Java applications.

The Microsoft Office XML formats are XML-based document formats introduced in versions of Microsoft Office prior to Office 2007. Microsoft Office XP introduced a new XML format for storing Excel spreadsheets and Office 2003 added an XML-based format for Word documents.

Sheetster

Sheetster is a GPL open-source Web Spreadsheet and a Java Application Server created by Extentech Inc. The product was created for the enterprise and small and medium-sized businesses as an Open Source alternative to closed document management systems.

FarPoint Spread

This article refers to the last FarPoint Edition of the Spread Product line. Spread is now developed by GrapeCity, Inc. Since the acquisition, Spread for Biztalk Server has been removed from the product line and SpreadJS, a JavaScript version, has been added.

Gson is an open-source Java library to serialize and deserialize Java objects to JSON.

JXL API allows users to read, write, create, and modify sheets in an Excel(.xls) workbook at runtime. It doesn't support .xlsx format.

Castor is a data binding framework for Java with some features like Java to Java-to-XML binding, Java-to-SQL persistence, paths between Java objects, XML documents, relational tables, etc. Castor is one of the oldest data binding projects.

Apache Commons Logging is a Java-based logging utility and a programming model for logging and for other toolkits. It provides APIs, log implementations, and wrapper implementations over some other tools.

References

  1. "JExcel Product Licence Agreement". TeamDev. TeamDev. Retrieved 2 February 2016.
  2. 1 2 "recall". Recall. Retrieved 2 February 2016.
  3. 1 2 "JExcel 1.7". GearDownload. GearDownload. Retrieved 2 February 2016.
  4. 1 2 "JExcel 1.7". Directory of Shareware. Directory of Shareware. Retrieved 2 February 2016.
  5. "JExcel Product Website". TeamDev. TeamDev.
  6. "Reading\writing workbook attributes. Setting password. Saving workbook in MS Excel 2003 format". JExcel Support. JExcel Support. Retrieved 2 February 2016.