Sunday May 20

Code for Writing a xlsx file in java

(2 votes, average: 3.50 out of 5)





Here is a small code to write xlsx file though java code. 

 

You may need to include some of the jar files like

  • xmlbeans-2.3.0.jar
  • dom4j-1.1.jar
  • poi-ooxml-schemas-3.6-20091214.jar
  • poi-ooxml-3.6-20091214.jar
  • poi-3.6-20091214.jar

You can google it and download and include it along with the below code.

 


import org.apache.poi.xssf.usermodel.XSSFWorkbook;

import org.apache.poi.ss.usermodel.*;

import java.io.*;

public class Start {

 

   

 

    public void WriteData()

    {

        try{

            Workbook[] wbs = new Workbook[] {  new XSSFWorkbook() };

            for(int i=0; i

            {

                Workbook wb = wbs[i];

                 Sheet s = wb.createSheet();

                Row r1=s.createRow(0);

                Cell c1=r1.createCell(0);

                c1.setCellValue("helo");

                c1=r1.createCell(1);

                c1.setCellValue((double)1);

                c1=r1.createCell(2);

                c1.setCellValue((double)3);

                c1=r1.createCell(3);

                c1.setCellFormula("B1+C1");

                String filename = "workbook.xlsx";

                FileOutputStream out = new FileOutputStream(filename);

                wb.write(out);

                out.close();

            }

 

        }catch(Exception e)

        {

            e.printStackTrace();

        }

    }

 

    public static void main(String[] args)

    {

        Start Object=new Start();

        Object.WriteData();

}

}

 

 

You can run the above code and a xlsx file is generated in the local directory. You will find some sample values you can then modify the code as required.

 

If you need any help then you can leave a comment or mail at This e-mail address is being protected from spambots. You need JavaScript enabled to view it



Add this page to your favorite Social Bookmarking websites
Reddit! Del.icio.us! Google! Live! Facebook! Slashdot! Technorati! StumbleUpon! Spurl! Furl! Yahoo! Squidoo! Ask! DZone! Free Joomla PHP extensions, software, information and tutorials.



Comments

gratis geld online veel geld maken geld verdienen met je auto gratis geld ver
B
i
u
Quote
Code
List
List item
URL
Name *
Code   
ChronoComments by Joomla Professional Solutions
Submit Comment
Cancel
hoe verdien ik snel veel geld snel geld verdienen vacatures studenten geld verdienen veel geld verdienen
B
i
u
Quote
Code
List
List item
URL
Name *
Code   
ChronoComments by Joomla Professional Solutions
Submit Comment
Cancel
avatar book report
0
 
 
Mate, your site is great but here's my advice. You need to apply internet google analytics before you begin perfecting your internet site. You need to buy and set up analytics software program so that you can keep an eye on the efficiency of your Search engine optimization methods. When you notice which strategies are creating great outcomes and that happen to be not, you may modify your strategy. You usually visit http://essaymania.com for book reports.

Figure out how to effectively integrate the terminology you should use in your Html code labels. Search term usage will help you boost your Search engine optimisation. Search phrases that can be found in label tags are weighted more heavily by search engine listings than search phrases in virtually any other situation. The most effective keywords and phrases must be used for optimum effects.
B
i
u
Quote
Code
List
List item
URL
Name *
Code   
ChronoComments by Joomla Professional Solutions
Submit Comment
Cancel
avatar essays
0
 
 
fantastic info. Thanks to you for the useful discussion. I really like the points spoken about. You usually make use of http://essaymania.com for essays
B
i
u
Quote
Code
List
List item
URL
Name *
Code   
ChronoComments by Joomla Professional Solutions
Submit Comment
Cancel
avatar free essay
0
 
 
good info. Thanks to you for the intriguing discussion. I like the issues reviewed. You usually come to http://essaymania.com for term papers
B
i
u
Quote
Code
List
List item
URL
Name *
Code   
ChronoComments by Joomla Professional Solutions
Submit Comment
Cancel
avatar research paper
0
 
 
Mate, your site is great but here's my advice. There are some site owners and folks that start-up a company that try to market place their webpage with posts and adverts which have been bought, and feel that is actually all they have to do. Seo is the only effective method to get numerous distinctive people to your website. The following suggestions will assist you to improve your website for search engine indexing. This content on each webpage should be exclusive from your other individuals on your own website. The titles from the web pages need additional focus. These are generally used by search engines like google to ascertain search positions, so they must be of particular significance for you. If you wish to place rich in the rankings, your titles need to range from the search term that you will be concentrating on. You usually visit http://essaymania.com for theses.
B
i
u
Quote
Code
List
List item
URL
Name *
Code   
ChronoComments by Joomla Professional Solutions
Submit Comment
Cancel
avatar custom writing
0
 
 
A lot of people would like online acknowledgement from lots of people. Developing viewers for your self will continue to work towards ensuring your success in a number of methods, specifically advertising essay writing at http://www.magicessays.com. A blog will help you to advertise your content material worldwide, so read on to discover ways to create the best weblog achievable.
B
i
u
Quote
Code
List
List item
URL
Name *
Code   
ChronoComments by Joomla Professional Solutions
Submit Comment
Cancel
avatar buy an essay
0
 
 
My advice for you, mate: Try out to possess a focus on a simple subject when making your blog sites. By trying to publish about several subject areas in every blog site that you just make, your composing will end up jumbled and challenging to adhere to. This specific suggestion is not difficult to incorporate and is certain to provide a spectacular enhancement to the quality of your blog site http://www.magicessays.com custom essays.
B
i
u
Quote
Code
List
List item
URL
Name *
Code   
ChronoComments by Joomla Professional Solutions
Submit Comment
Cancel
avatar custom essay
0
 
 
I suggest that you follow this advice.
Use internal backlinks to connect blog sites of a related topic. You will recognize that it will help site visitors relocate concerning the site and maintains them interested. There's nothing at all quite as aggravating as reaching a blog rather than understanding how to get what you will need essay writing http://www.kissmyessays.com custom essays.

You can easily build website traffic by trading backlinks along with other blog owners. Find blogs with content that is certainly connected to your own property, and business hyperlinks. Don't waste time with website link exchanges that are not related to the site's information. Your main concern has to be sketching in guests who will probably put about this may improve your search engine ranking positions considerably.
B
i
u
Quote
Code
List
List item
URL
Name *
Code   
ChronoComments by Joomla Professional Solutions
Submit Comment
Cancel
avatar curso de cisco
0
 
 
Thanks for informative post. I am pleased sure this post has helped me save many hours of browsing other similar posts just to find what I was looking for. I bookmarked this blog a while ago because of the useful content and I am never being disappointed. Keep up the good work Just I want to say: Thank you!
B
i
u
Quote
Code
List
List item
URL
Name *
Code   
ChronoComments by Joomla Professional Solutions
Submit Comment
Cancel
B
i
u
Quote
Code
List
List item
URL
Name *
Code   
ChronoComments by Joomla Professional Solutions
Submit Comment

Tag Cloud

Login Form