第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

java 實(shí)現(xiàn)execl導(dǎo)出 我應(yīng)該怎么實(shí)現(xiàn)。希望是細(xì)致的說(shuō)法,有完整的實(shí)例更好

java 實(shí)現(xiàn)execl導(dǎo)出 我應(yīng)該怎么實(shí)現(xiàn)。希望是細(xì)致的說(shuō)法,有完整的實(shí)例更好

不負(fù)相思意 2019-02-24 13:34:32
我現(xiàn)在要做一個(gè)execl的導(dǎo)出,所用的.jar我已經(jīng)弄好了,現(xiàn)在我不知道要怎么實(shí)現(xiàn)這個(gè)功能,還請(qǐng)細(xì)致回答。不要湊數(shù)的評(píng)論。謝謝大家。 網(wǎng)上的例子都是 半截拉快的 實(shí)在不知從哪開(kāi)始。 我點(diǎn)擊按鈕之后,到后臺(tái),然后怎么弄。。。excel里面的列名字都是自己根據(jù)需要寫(xiě)死的嗎,還是怎么弄,需要展現(xiàn)的數(shù)據(jù),是在先查 還是已經(jīng)存在一個(gè)集合里面直接循環(huán)出來(lái)了,,,
查看完整描述

4 回答

?
慕絲7291255

TA貢獻(xiàn)1859條經(jīng)驗(yàn) 獲得超6個(gè)贊

poi版本。

<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi</artifactId>
    <version>3.9</version>
</dependency>

Hello World 示例

import java.io.FileOutputStream;
import java.util.HashMap;
import java.util.Map;

import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellUtil;

/**
 * @author Kevin Zou (kevinz@weghst.com)
 */
public class HelloWorld {

    public static void main(String[] args) throws Exception {
        Workbook workbook = new HSSFWorkbook();
        Sheet sheet = workbook.createSheet("HELLO");
        Map<String, Object> properties = new HashMap<>();

        // border around a cell
        properties.put(CellUtil.BORDER_TOP, CellStyle.BORDER_MEDIUM);
        properties.put(CellUtil.BORDER_BOTTOM, CellStyle.BORDER_MEDIUM);
        properties.put(CellUtil.BORDER_LEFT, CellStyle.BORDER_MEDIUM);
        properties.put(CellUtil.BORDER_RIGHT, CellStyle.BORDER_MEDIUM);
        // Give it a color (RED)
        properties.put(CellUtil.TOP_BORDER_COLOR, IndexedColors.RED.getIndex());
        properties.put(CellUtil.BOTTOM_BORDER_COLOR, IndexedColors.RED.getIndex());
        properties.put(CellUtil.LEFT_BORDER_COLOR, IndexedColors.RED.getIndex());
        properties.put(CellUtil.RIGHT_BORDER_COLOR, IndexedColors.RED.getIndex());

        // Apply the borders to the cell at B2
        Row row = sheet.createRow(1);
        Cell cell = row.createCell(1);

        for (Map.Entry<String, Object> e : properties.entrySet()) {
            CellUtil.setCellStyleProperty(cell, workbook, e.getKey(), e.getValue());
        }
        cell.setCellValue("First"); // 單元格值

        // Apply the borders to a 3x3 region starting at D4
        for (int ix = 3; ix <= 5; ix++) {
            row = sheet.createRow(ix);
            for (int iy = 3; iy <= 5; iy++) {
                cell = row.createCell(iy);
                for (Map.Entry<String, Object> e : properties.entrySet()) {
                    CellUtil.setCellStyleProperty(cell, workbook, e.getKey(), e.getValue());
                }

                cell.setCellValue(ix + " * " + iy); // 單元格值
            }
        }

        FileOutputStream fileOut = new FileOutputStream("C:/helloworld.xls");
        workbook.write(fileOut);
        fileOut.close();
        System.out.println("The end.");
    }
}

poi Quick Guide

查看完整回答
反對(duì) 回復(fù) 2019-03-01
?
ITMISS

TA貢獻(xiàn)1871條經(jīng)驗(yàn) 獲得超8個(gè)贊

查看完整回答
反對(duì) 回復(fù) 2019-03-01
?
素胚勾勒不出你

TA貢獻(xiàn)1827條經(jīng)驗(yàn) 獲得超9個(gè)贊

我現(xiàn)在都是JS導(dǎo)出(Chrome),不過(guò)有一個(gè)利用Java反射導(dǎo)出Excel的工具類(lèi),分享給題主~

Java POI 導(dǎo)出EXCEL經(jīng)典實(shí)現(xiàn) Java導(dǎo)出ExceL

查看完整回答
反對(duì) 回復(fù) 2019-03-01
  • 4 回答
  • 0 關(guān)注
  • 523 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)