Using excel as UI without VB - java

I think every business person would like to have excel UI, however they are forced into using web applications that sometimes look like really bad excel.
Are there any frameworks that help build excel ui without VB? I dont mean framework like POI or JExcel that allows you to generate excel reports.

I've seen many applications built using Excel. All of them were clumsy, error prone, and next to impossible to keep up-to-date.
If the end user needs an application to work like Excel for some grid calculations, then give them a tool to do so, or let them use Excel for that portion.
However using Excel / VBA exclusively to develop big Enterprise worthy applications is heading down the wrong road. It might work well for a while, but it won't be long before issues expose the weak points.
Since you ended talking about reports... yes, by all means have your application export to CSV, HTML, PDF, Excel etc. That way the user that wants to use Excel to generate pretty pie charts, and reformat/search/scan/crop the data can do so with the tool they feel comfortable with.

A combination of the two can work quite well... Excel is not great for inputting data, this is where an app (desktop or web) works better, but excel is great for dynamic reports and analyzing data.
The best approach for dynamic reports I've seen is to write add-ins that add new functions to excel (e.g. to pull in real time data). in the java space you could try XLLoop - this allows you to expose POJO functions in excel (full disclosure: I work on this project).

Obba is an Excel Add-In which allows to instantiate Java objects and work with them directly in Excel (without VBA or any other glue code).
The nice part is that it is fully transparent what the Excel Sheet (UI) does to your Java classes.

I am not sure what you mean by UI here, but if it is for the data presentation (as not data input) you could e.g use SQL Server Reporting Services and export the results to excel format. Alternatively you can parse your data into excel xml format and allow the user to open it as excel file (that is a bit painful though if your data is more complex than a simple table)
EDIT
I went through a pain of presenting and processing data with the use of excel when creating a web system that was replacing old paper work based one - that was a requirement for a transition time.
It is a real pain, all the data validation, ensuring that what is submitted back has not been modified structurewise etc.
My conclusion would be:
use the web system for inputing data
if required provide the excel format for reporting
if really, really required you could implement parsing excel into the web system for inputing data, but then add some human validation as it is humanly impossible to predict all the possible errors one can create in excel

You can look into embedding Excel as an ActiveX control into your application. It will allow you to manipulate the control from your language of choice.
This may point you in the right direction: http://j-integra.intrinsyc.com/support/kb/Article.aspx?id=30421

For java,this one is pretty good.
http://www.jxcell.net

Related

Read manually inserted text from an Excel spreadsheet

I have a .xlsx file containing my university's timetable. I'm working on an application that makes use of the timetable. But I don't want to "copy" the timetable contents from this Excel spreadsheet into a more "programmer-friendly" format, instead, I'd like to write a program/script that would parse this .xlsx table and automatically convert it in the format I need (e.g. in some objects in code).
There's no trouble for me in reading "normal" cells of the spreadsheet. However, instead of simply putting 1 text entry in each cell, the person who created this timetable file manually "divided" some cells into "subcells" and manually inserted some text in each of them. This looks like:
How should this be interpreted: students are divided into 4 groups. At 15.20-16.50 only groups number 1 and 2 will have a specific class. At 17.00-18.30 only groups 1, 3, and 4 will have that class.
As one can see, these "cells" are not real cells — they seem to have been created ("divided") manually, just like the text that is selected in the picture.
The question is: how do I find and read such "cells" (manually inserted text components) like in the picture (preferably also knowing their position so that I can not only read what classes exist, but also when they start (time is stated in the very left of the spreadsheet))?
I tried using Python's xlrd module but haven't been able to achieve what I need. Neither have I had any success with Java's Apache POI — I just can't find how to read such text entries. Solutions on both languages, no matter what libraries and approaches are used, will be fine for me.
Both xls and xslx are proprietary formats. Microsoft went out of their way to explain in court that xslx is open, but unfortunately not one of the judges involved knew anything significant about computer science and the lawyers knew it, so don't get distracted by their misleading case. XSLX has the option for the 'vendor' to add a block of 'custom binary blobs' and the vast majority of the excel features that aren't the most common, lowest level stuff imaginable are in these binary blobs. No doubt this 'stick a text table object into a single cell' thing that's going on here is exactly like that.
Microsoft has never released any documentation on these binary blobs, nor any library that can parse them.
Therefore, Apache POI, xlrd, and all other libraries to read XLS files that do not explicitly require Excel to be installed and running on the computer that's running the 'library' (kind of a tricky thing to pull if you have e.g. a linux-based server!) are based on reverse engineering it, and it's a horrible format. Literally - look up what Apache POI's 'HSSF' stands for. Officially nothing, but etymologically, that H is for Horrible. (Horrible Spread Sheet Format - HSSF).
That's the long way around of saying: Sorry - you probably can't. And it's not the fault of POI or xlrd, it's on microsoft. It is not appropriate to use such a closed, proprietary and undocumented format to transfer anything meaningful. The error lies in whatever process led to the situation that you're now stuck trying to write software to parse a weird excel file.
If you must, most likely a script running within excel can untangle this mess and write out a csv file or json or something in a documented format. Alternatively, you can write something in C#, but it would just be farming out the work to excel, so, you still would not be able to port this code to other platforms.
Apache POI does give you the option of a more low-level approach where you can read the binary blobs. You can attempt to reverse engineer whatever's going on in that 'cell-with-a-table-in-it' yourself, but as neither the xlrd team nor the Apache POI team has bothered, and at least the POI team is on record as saying the format seems to be designed to be obfuscated - that sounds like a job that will take you many, many weeks.
That gets me back to the solution I advised earlier: Unless spending many weeks building an incredibly fragile stack that requires a full blown windows and an excel license is the lesser evil compared to a simple change in human behaviour (unlikely), the fix lies in addressing the process (as in, address that excel is used to transfer this info, or at least make the excel sheet muuuch simpler than this thing), and not by finding out how to read this mess in java or python.

How to manage excel sheets in excel file using java without using 3rd party libraries

I has a excel file with 4 excel sheets in it. Now i want to read or write to required excel sheets using java without using any third party lib.
I know i can read and write data using FileInputStream and FileOutputStream respecitvely. But i can handle the work sheets??
No, you can'not, There is numerous way in Java for reading/writing files, but there is no built-in support for MS Office/Excel spreadsheets. http://poi.apache.org/ - is a key to victory.
If your goal is to interface with data from an excel sheet from your Java application, I'd suggest to use the solutions suggested by other posters, it will save you a lot of work.
If, however, you want to be able to read excel files from Java (or any other programming language for that matter) 'just because you can' then you could take a look at this file and read the instructions on this web-page. I would warn you that it would take considerably more time to implement your own API if you base it only on the file-specs that are publicly available. You might want to check out the work done by the people from the Apache POI project to get an idea of how to approach it. Or (even better) contribute to the project. Here you can find out how to go about doing that

create excel using Java

I am very new to java. I am trying to fetch some data from a database and the result set is displayed in excel. I am able to inetract with database. But how should I go ahead for inserting data into excel sheet.Its simple Java program and in future I would like to generate files in other format say PDF, doc etc.
I am looking for an approach with lesser load on CPU, faster.
thanks in advance for help.
Just spit out a CSV file. It's lightweight and portable. You can grab a csv writer from Apache commons I think but spending the 10 min it would take to write one might be a good learning exercise as well.
If you want a real solution where you want different outputs (eg excel, pdf, rich text etc) then use a reporting tool. There are plenty of opensource tools like ireport which will let you create a template then write a simple java app that renders that to pdf, excel etc. Otherwise you will end up doing it by hand. It's a bit heavyweight but anything more than trival tabular output will be easier.
Apache POI is for you in this case, but you will find it a little bit overwhelmed if you just need to write/read data from an excel file.
Try jExcel instead, the API is simple and straightforward, you can also manipulate sheets within an excel workbook.
The easiest and standard way of doing this is to use POI library:
http://poi.apache.org/spreadsheet/quick-guide.html
The new xlsx format is based on Open-XML and would provide a method of generating these files without any dependency on Microsoft-office COM libraries -- the same could done for docx and pptx formats later, as well as other open-Xml formats like EPUB.
The Apache POI project looks like it might provide one possible solution. There's also an article on the MSDN interop blog that discusses this in some detail.
The key words you should google for are OLE and DDE.
Though, Java is not the best language for interface Microsoft's software.
for generating excel i think you should try simreport in jsimreport.com. in my opinion, it's quite simple to make an excel report, it uses the excel sheet to generate report so easy to config and visually

Automating tasks through java

Here's the problem:
Run a java client as a batch job on a unix box which will connect to Oracle and fetch some data.
Update an excel sheet (on a Windows machine) with the data fetched.
Create a chart/graph from the data in excel sheet.
Send the excel (with data & graph) in an email.
All the above steps must be performed without any manual intervention.
Could there be a better option to excel based solution? The main intent is to have a history of data fetched and have a chart created from that data.
I know there are many open source libraries available for creating charts like JFreeChart, but is there anything in the JDK that allows you to create charts? Could JavaFX be used for this problem?
In short, is it possible to do this with just jdk (without using any open source libraries)?
Any help/suggestion will be appreciated.
You could try google docs spread sheet api to workaround MS-Excel
I think all that is pretty doable from Google docs, and yet, you still have the option of downloading the spread sheet.
From the link:
Spreadsheets Data API
The Spreadsheets Data API lets you access worksheet data within your own application or website. You can view and modify data, create and delete worksheets, issue structured queries, and more.
Spreadsheets Gadgets & Visualization API
Spreadsheets Gadgets take advantage of the Google Visualization API to embed graphical comparisons of of structured data within a spreadsheet.
Sounds like what you need.
Pretty straightforward, just use Hibernate or even jdbc.
You should be able to update the Excel sheet with Apache POI. You could also try Java Excel Designer or http://www.moyosoft.com/jec/
At least one of the above should be able to create charts.
Just use Java Mail
You could wrap the above in ANT tasks as appropriate.

Import for Java or Other Languages that will Generate Flowcharts, Given Data

I'm trying to create an automated "spider diagram" like the ones created by VUE:
http://vue.tufts.edu/
VUE is open source, but the issue is that you create the maps in the program. I want to have a program that will pull the data from an excel sheet and display the map automatically when run.
I know how to open and parse the data in files, so reading the file isn't the issue. I can program the behavior of how I want everything to "link up", but I just don't want to have to create an applet, then develop the software from scratch.
If I made anything unclear, let me know. I'm very tired today, so it's difficult to stay focused very long.
Many thanks!
-Justian
JGraph is a library to do that. You give it the node and edges and it figures out how to present them in a meaningful way. It is kind of like using graphviz but in Java.
For visualization of production runs we use graphviz out of process and show the images generated from that. It works fine, but a single process solution would be better.
Reading an excel as CSV should be straightforward. POI allows you to read directly the Excel files.

Categories

Resources