Linking an Excel File with the Application tool
I have to link an excel file with a application software which I am developing.I have this code which is only able to open a Jpanel to select the file.After I select the file nothing is happening.I wanted to be able to generate a template based on the questions that are in the excel file like extracting the questions from the excel file and creating a template from it which I have to upload on the web later.could you please help me with this?
import java.io.*;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.filechooser.*;
public class SelectFile extends JFrame{
public static void main(String[]args){
JFrame frame = new JFrame();
frame.setLayout(null);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setTitle("Select File for Linking");
frame.setSize(400, 100);
Container container = frame.getContentPane();
container.setLayout(new GridBagLayout());
final JTextField text=new JTextField(20);
JButton b=new JButton("Select File");
text.setBounds(20,20,120,20);
b.setBounds(150,20,80,20);
// b.setText("<html><font color='blue'><u>Select File</u></font></html>");
b.setHorizontalAlignment(SwingConstants.LEFT);
//b.setBorderPainted(false);
//b.setOpaque(false);
// b.setBackground(Color.lightGray);
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e){
JFileChooser fc = new JFileChooser();
fc.addChoosableFileFilter(new OnlyExt());
int returnval = fc.showOpenDialog(null);
if (returnval == JFileChooser.APPROVE_OPTION) {
File file = fc.getSelectedFile();
text.setText(file.getPath());
}
}
});
container.add(text);
container.add(b);
frame.setVisible(true);
}
}
class OnlyExt extends javax.swing.filechooser.FileFilter{
public boolean accept(File file) {
if (file.isDirectory()) return false;
String name = file.getName().toLowerCase();
return (name.endsWith(".xls"));
}
public String getDescription() { return "Excel ( *.xls)"; }
}
View Answers
Ads
Related Tutorials/Questions & Answers:
Linking an Excel File with the Application tool
Linking an
Excel File with the
Application tool I have to link an
excel file with a
application software which I am developing.I have this code... on the questions that are in the
excel file like extracting the questions from the
excel file
Linking excel file with a application tool using swing
Linking excel file with a
application tool using swing I have to link an
excel file with my
application software using java swing.As soon as i click on the link button a window should open for selecting the
excel file(just like
Advertisements
Reading an excel file into array
Reading an
excel file into array Hi,
I'm trying to read in an
excel file, search a column for containing key words (entered by a user) and then displaying the matching rows in a table. I'm fairly new to JavaScript. Can anyone
importing excel file
importing
excel file Hi All
I am developing a java
application whre we upload a
excel file in to database and
all
excel value should import...
it is not showing real
excel sheet value.
please suggest good way to solve this problem
Create and Save Excel File in JSP
and saving
Excel file from JSP
application.
In this example we are going to create a new
excel sheet using JSP. Our
application consists of two JSP files... Create and Save
Excel File in JSP
 
excel file using JDBC java.?
excel file using JDBC java.? hey, i am a telecomm. engineer , and i am try to develop a
tool which reads from a
excel file and then appends the same
excel file as required. i am writing my code on notepad and have successfully
swing application to import a object in a excel
swing
application to import a object in a excel Hi sir, I want to make a swing
application where I can import a object in a cell of a
excel... to do it. please help.
The details of the
excel operation which i want to do
Excel file Handling in Java
Excel file Handling in Java Hello Sir,
I am new to Java, I have Started Java Core by myself. I want to make a project which include 3-4
Excel file to handle.Please explain how to read and write
Excel file in Java.Is it tough
Reading and querying an Excel file in JavaScript
Reading and querying an
Excel file in JavaScript Hi,
I'm trying to read in an
excel file, search a column for containing key words (entered by a user) and then displaying the matching rows in a table. I'm fairly new
write excel file into the oracle database
write
excel file into the oracle database dear sir,
i need the jsp code that reads the
excel file and stores it into the oracle database table..and also i need the code to connect oracle database?
thank u in advance
Excel file wriring using java
Excel file wriring using java i have one predefined bill format in
excel
i want to append values in it using java apche POI or Jexcel
i tried it but it overwrites
file and lost previous contents what can i do
Javap Tool application
Javap
Tool application import java.awt.*;
import java.lang.reflect.*;
import java.awt.event.*;
import java.awt.event.WindowListener.*;
class Javap...;
TextField tf;
Javap(){
Frame f=new Frame();
Label l=new Label("Welcome to javap
tool
Insert data in Excel File from Database using JSP
developed a
application to
insert data in
excel file from database in JSP. We...
Insert data in
Excel File from Database using
JSP ... the data from database, create an
excel file and data
insert into newly
JavaScript get excel file data
JavaScript get
excel file data...;
By the use of JavaScript we can get the
excel file data as well. Here is the
example which gets the data from the
excel file with the cell and row index
how to display the excel file content in the jsp
how to display the
excel file content in the jsp How to present the content of the newly created
excel file in the following jsp to the web browser...="
application/vnd.ms-
excel" %>
<%@ page import="java.io.*" %>
<
insert values from excel file into database
insert values from
excel file into database hi i want to insert values from
Excel file into database.Whatever field and contents are there in
excel... the following link:
Insert values from
excel file to database
how to display the excel file in the web browser.
how to display the
excel file in the web browser. > %@ page...="org.apache.poi.xssf.usermodel.XSSFWorkbook"%>
> <%@ page
> contentType="
application/vnd.ms-
excel"
> %> <%@ page import="java.io.*" %> <%
>
To read & write a excel file using the core java
To read & write a
excel file using the core java Hai,
I'm new to JavaProgram.But now i need java program to read & write a
excel file so, can anyone help me to learn the above mentioned topic(link for the portion
application context file problem
application context
file problem how to configure junit
application context
file with struts........?
it is not finding sessionfactory method