How to view data from excel in flex app? - java

I have a flex-application deployed on tomcat with blazeds. User constantly selects ranges excel-document. Now, a user enters a cell addresses in text fields (for example, C1: C20). But it is very inconvenient! How to display excel-data as a table in my application? I think, I can parse excel-document using Apach POI and transmit these data to the Flex-application. But there are other ways?

Generally, Adobe Flex doesn't provide direct way to bring the Microsoft Excel data into a Flex component and if you try to implement Excel system with DataGrid component, you will found a great pain.
I googled around and found a component that might solve your problem, flexuscalculus or Flex spreadsheet.
Hope they can help you. :)

i think you should use a java library for example http://jexcelapi.sourceforge.net/ to parse the excel file in the server side and then return a collection of objects to the flex client in order to render the data into a datagrid for example...

Related

Plot Graph In web application

I am developing a web application using Spring. I need to plot graphs and display them to the user. The values are stored in a database. How do I achieve this?
You have to decide where do you want to create the charts. You have two options:
Creating the chart on the server and send them to the client as image or pdf.
Sending raw data to the client and let them render the charts via html, flash or javascript
Each way has its own advantages and limitations - you have to decide for your specific use case.
If you render the charts on server side you are limited regarding interactivity but you clients don't need much performance to render the charts. Here you have to think about caching to protect your server performance.
On the client side you have to deal with diffent browsers and must think about the client render performance.
If 2. is ok for you, I would recommend using javascript - so your users don't need to install any plugins like flash and you have a lot of possibilites to create nice charts.
There are some nice frameworks to create charts using javascript, for example:
HighCharts
gRaphaƫl
JS Charts
...
I have used Google Charts with Spring MVC before. Normally whenever I have needed to display chart, I have always displayed tabular data along side the chart as well. So, I just take jQuery, parse the html table for data and pass it to google Chart API. You may want to look at the Google Chart pages for examples. It is quite nice.
As #aiolos said, you can generate your chart image in the client or in the Server. I haven't work with JavaScript enabled charts, but when I have to generate charts the server-side way i'll go with Cewolf. It's a Java Library based of JFreeChart that has some useful tags to embed charts in JSP pages.
I tested it in Spring Applications and works like a charm.

Can we save data from the textarea into a text file?

I am developing a web application using Adobe Flex. I would like to retrieve the data entered in the text area and save them into a new text file.
Can anyone please let me know the details to write data into a text file ?
Thanks,
Serenity.
Where are you trying to store the data? on the server or client side? You will have have access to client's file system to write a file (due to security reasons). If you need to create the file on server, you will have to submit the data onto a servlet, jsp or some controller action (for frameworks like spring,struts etc). And then write it onto your server's file system.
Update: Since, you are a beginner, I suggest you read: Create Flex 4 and Java Web applications . The tutorial is actually saving data into database. You can instead, save the contents into a file. And you might want to change the field types in the flex form. But this tutorial can give you a start :)

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.

GWT document format converter

I am searching on ways to make a small app using GWT for converting documents
from one format to other.
Mainly these formats .doc , .pdf , .odt , .rtf.. and maybe a couple
more.
Has anyone tried this before??
I came across the library JODConverter but it needs open office to be
already installed and i don't really know how many people have used it
with gwt in past.
Please give me some starting pointers, or if anyone has experience
with this kind of app, do share.
Thanks and regards,
Rohit
I was looking into implementing something like this a few month ago.
Since GWT compiles your code to JavaScript there is no way for you to do that on the client side, JavaScript can't access the file system.
So you would need to upload the file to the server first and do the conversion on the server side and send the converted file back.
I have never heard of JODConverter before, the the library I wanted to use was Apache POI . Unfortunately I can't tell you anything about it, because I haven't tried it yet.
It sounds like JOD Converter is precisely what you need since you're looking at multi format conversions from Java. You would install OpenOffice on your server and link it up with JOD Converter. When a document is uploaded, your application would call JOD Converter to perform the conversion and stream the converted document back to the caller. Alternatively you can put the file somewhere, and send a link (URL) back to the caller so they can fetch the document. You can also look at JOD Reports or Docmosis if you need to manipulate the documents.
GWT is mostly a client side toolkit. Are you trying to make a tool that does all the conversion on the client side, with no help from the server? In that case, you should be looking for JavaScript libraries that can read/convert all those formats. If you are planning to have the user upload their files to the server, then you can use whatever technology you want on the server, and just use GWT for the UI.

Using excel as UI without VB

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

Categories

Resources