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

<span class="mw-page-title-main">Microsoft Excel</span> Spreadsheet editor, part of Microsoft 365

Microsoft Excel is a spreadsheet editor developed by Microsoft for Windows, macOS, Android, iOS and iPadOS. It features calculation or computation capabilities, graphing tools, pivot tables, and a macro programming language called Visual Basic for Applications (VBA). Excel forms part of the Microsoft 365 suite of software.

<span class="mw-page-title-main">Quine (computing)</span> Self-replicating program

A quine is a computer program that 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".

A visitor pattern is a software design pattern that separates the algorithm from the object structure. Because of this separation, new operations can be added to existing object structures without modifying the structures. It is one way to follow the open/closed principle in object-oriented programming and software engineering.

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.

<span class="mw-page-title-main">Java syntax</span> Set of rules defining correctly structured program

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

In computer programming, an entry point is the place in a program where the execution of a program begins, and where the program has access to command line arguments.

A dynamic-link library (DLL) is a shared library in the Microsoft Windows or OS/2 operating system.

In computer programming, the term hooking covers a range of techniques used to alter or augment the behaviour of an operating system, of applications, or of other software components by intercepting function calls or messages or events passed between software components. Code that handles such intercepted function calls, events or messages is called a hook.

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.

Platform Invocation Services, commonly referred to as P/Invoke, is a feature of Common Language Infrastructure implementations, like Microsoft's Common Language Runtime, that enables managed code to call native code.

Jakarta Mail is a Jakarta EE API used to send and receive email via SMTP, POP3 and IMAP. Jakarta Mail is built into the Jakarta EE platform, but also provides an optional package for use in Java SE.

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.

JFugue is an open source programming library that allows one to program music in the Java programming language without the complexities of MIDI. It was first released in 2002 by David Koelle. Version 2 was released under a proprietary license. Versions 3 and 4 were released under the LGPL-2.1-or-later license. The current version, JFugue 5.0, was released in March 2015, under the Apache-2.0 license. Brian Eubanks has described JFugue as "useful for applications that need a quick and easy way to play music or to generate MIDI files."

In database management systems (DBMS), a prepared statement, parameterized statement, or parameterized query is a feature where the database pre-compiles SQL code and stores the results, separating it from data. Benefits of prepared statements are:

<span class="mw-page-title-main">Java Excel API</span>

Java Excel 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. Archived from the original on 2 February 2016. 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.