Java Export Excel sheet page

Source: Internet
Author: User

1. Background of the problem
When you export an Excel table, you first build the sheet page, and the following describes how to build the sheet page

2. Realize the source code
/**
*
* @Project:
* @Title: Excelexport.java
* @Package: Report.utils
* @Description:
* @Author: Youhaidong
* @Date: November 2, 2015 6:29:22
* @Version:
*/
Package report.utils;

Import java.io.FileNotFoundException;
Import Java.io.FileOutputStream;
Import java.io.IOException;

Import Org.apache.poi.hssf.usermodel.HSSFSheet;
Import Org.apache.poi.hssf.usermodel.HSSFWorkbook;

/**
*

Export Excel


* @ClassName: Excelexport
* @Description:
* @Author: Youhaidong
* @Date: November 2, 2015 6:29:22
*
*/
public class Excelexport
{
/**
* @Title: Excelexport
* @Description:
* @param args
* @Date: November 2, 2015 6:29:22
* @return: void
* @throws
*/
@SuppressWarnings ({"Deprecation", "resource"})
public static void Main (string[] args)
{
Hssfworkbook workbook = new Hssfworkbook ();
Set Sheet page name
Hssfsheet sheet = workbook.createsheet ("Student table");
Sheet.setdefaultcolumnwidth ((short) 15);
    FileOutputStream stream;    try     {        //导出Excel学生表        stream = new FileOutputStream("d:/student.xls");        workbook.write(stream);    }     catch (FileNotFoundException e)     {        e.printStackTrace();    }      catch (IOException e)     {        e.printStackTrace();    } }

}

3. Achieve results

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Java Export Excel sheet page

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.