Home | Ajax | BioInformatics | Dojo | EAI | EJB | Hibernate | J2ME | Java | Java Glossary | Java Servlets | JavaScript | Jboss | JDBC | JDO | Jmeter | JSF | JSP | JUnit | Maven | MySQL | Spring Framework | SQL | Struts | Technology | WAP | Web Services | XML


 
  
 
Programming Tutorials: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML
 

 
Facing Programming Problem?
Ask Questions?, Browse Latest Questions, Question-Answer Guidelines
Java
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification
  Java Applet
Questions
Comments

Find Value of Column

                         

In this program we are going to find the value of row from the column of  an excel sheet using POI3.0 API Event.

The org.apache.poi.hssf.record.NumberRecord class extends Record and implements CellValueRecord interface,  java.lang.Comparable interface.

The methods used in this example:

getRow():
This method is used to get the row from cell.

getColumn():
This method is used to get the column from cell defines within the row. 

getNumStrings():
This method is used to fine the number of strings.

The code of the program is given below:
import java.io.*;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.poifs.filesystem.*;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.eventusermodel.*;
import org.apache.poi.hssf.record.*;
import org.apache.poi.hssf.dev.EFHSSF;
public class FindValuesRowAtColumn implements HSSFListener
{
   public static void main(String[] argsthrows IOException
    {
      
        FileInputStream fin = new FileInputStream(args[0]);
     
        POIFSFileSystem poifs = new POIFSFileSystem(fin);
        InputStream din = poifs.createDocumentInputStream
(
"Workbook");
          HSSFRequest req = new HSSFRequest();
           req.addListenerForAllRecords(new 
FindValuesRowAtColumn());
           HSSFEventFactory factory = new HSSFEventFactory();
          factory.processEvents(req, din);
            fin.close();
             din.close();
        System.out.println("STOP");
    }
  public void processRecord(Record record)
    {
        switch (record.getSid())        {
            
            case NumberRecord.sid:
                NumberRecord numrecord = (NumberRecord
record;

                System.out.println("Cell found with value "
 
+ numrecord.getValue()
                        " at row " + numrecord.getRow() +
 
" and column " + numrecord.getColumn());
                break;
            case SSTRecord.sid:
                SSTRecord sstrecord = (SSTRecordrecord;
                for (int k = 0; k < sstrecord.
getNumUniqueStrings
(); k++)
                {
                    System.out.println("String table value " + k + 
" \t " + sstrecord.getString(k));
                }
                break;
            }
   }    
}

The output of the program is given below:

C:\POI3.0\exmples\execl>java FindValuesRowAtColumn example.xls
String table value 0     Name Of Example
String table value 1     Status
String table value 2     coding is completed
String table value 3     compressedUnicode.java
String table value 4     EventAPIsExample.java
String table value 5     FindNameOfSheet.java
String table value 6     FindRowAtColumn.java
String table value 7     FindStringCellsValues.java
String table value 8     FindValuesRowAtColumn.java
String table value 9     setDataFormat.java
String table value 10    setDataFormatForFullList.java
String table value 11    setNameUnicodeDataFormat.java
String table value 12    setSheetNameUnicodeDataFormat.java
String table value 13    setUnicodeDataFormat.java
String table value 14    TypeOfSheet.java
String table value 15    TypeOfWorkBook.java
Cell found with value 1.11323232E8 at row 14 and column 0
STOP

Download this example.

                         

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Latest Searches:
on clikck radio struts
Enabling and Disabling
getchars
Cinema 4D Model a Glas
JText
How to Validate a File
PhotoshopEffectsHolein
break?ல??ய�ல??
insert data todabase u
exceptions in java
jstl basics tomcat
jdbc examples
PHP Site Navigation Ad
jsf datatree component
Flash Dynamic C...de/d
Flash Dynamic C...de/d
swith statement exampl
how to run applets
Flash Special Effects
nested loops in jsf
JavaMail SpamControlle
server means
how to use an applet i
IllegalStateException
Starburst
Linux Caixa MХ ТÐ??
OutStream
the action class
Quick Sort
toString
convert text file to i
?Ñ?â?£?Ñ?â???Ñ?â???Ñ?â
Copy One Database Tabl
tree
TomcatdeployJSP
Š´??????Š´?????Å Â
maximo
JFileChooser
Sending
source code for chat p
Internet.parseint
struts bean write tag
jQuery To Hide the Div
date operation j2me mi
request.setAttribute
table j2me
velocity
passing value from ser
exception handling in
SAX
code in java for uploa
Struts 2 Ajax
Jaa
à®°??à®°?யà¯?à®°???à
validate radio button
Flash Dynamic Content
SMS in JAVA
java method
Murach???????????????Ã
scroll bar
trigger insert blob
uploaded file
resize image
factory
cell edit JTable
calculatingprimenumber
check whether number
jsp registration form
registration page usin
Html tutorial
call Ñ?â??гÑ?â???Ñ?â?
login code example
hibernate delete
JStatusBar
constructor
loading page
treeview structure in
spring mvc
breakร ย�ย�
bean:message
Java String toLowerCase Example
Java String toCharArray Example
Java String substring Example
Java String indexOf Example
Java String startsWith Example
Java String hashCode Example
Java String matches Example
Java String length Example
Java String lastIndexOf Example
Java String isEmpty Example
Java String equalsIgnoreCase Example
Java String equals Example
Java String endsWith Example
Java String copyValueOf Example
Java String contentEquals Example
  EAI Articles
  Java Certification
Tell A Friend
Your Friend Name
Search Tutorials

 

 
 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.