日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程语言 > php >内容正文

php

php poi,GitHub - satthi/poi-php: poi-php

發(fā)布時(shí)間:2024/9/27 php 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 php poi,GitHub - satthi/poi-php: poi-php 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

poi-php

varsion 0.1

(2013/10/21)

このプラグインはJavaのpoiをPHPから叩いてエクセルを入出力するプラグインです。

必須要件

jdk1.7.0_40

poi-3.9

opencsv-2.3

使い方

①poi-phpを任意の場(chǎng)所に設(shè)置

②PHPを記述

//デフォルト読み込み

require_once('poi-php.phpのディレクトリパス');

$this->PoiPHP = new PoiPHP();

$this->PoiPHP->settings(array(

'poi_path' => 'poi-3.9のディレクトリパス',

'opencsv_path' => 'opencsv-2.3.jarのファイルパス',

));

//Excel出力

//1シート目の1行目1列にaを文字列として入力

$this->ExcelExport->addString(0,0,0,'a');

//入出力のファイルはフルパスで指定する。

$readfile = dirname(__FILE__) . '/test.xls';

$outFile = dirname(__FILE__) . '/export.xls';

$this->ExcelExport->export($readfile, $outFile);

//Excel入力

//入出力のファイルはフルパスで指定する。

$readfile = dirname(__FILE__) . '/test.xls';

$outFile = dirname(__FILE__) . '/export.csv';

$this->ExcelImport->import($readfile, $outFile, 0, 2, 1, 4);

を記述。

※注意點(diǎn)

Javaのバージョンが合わないと動(dòng)作しません。

/javaディレクトリ內(nèi)には.javaファイルも置いているので、

javaのバージョンを合わせられない場(chǎng)合には自分でコンパイルしたら動(dòng)くかもしれないです。

-----------以下関數(shù)の説明です----------

/*

* addString

* 文字列の追加

* 參照セルの設(shè)定を入れるとスタイルをコピーしてきます。

*

* (int)$sheet シート番號(hào)

* (int)$row 行番號(hào)

* (int)$col 列番號(hào)

* (string)$string 文字列

* (int)$orgrow 參照セルの行番號(hào)

* (int)$orgcol 參照セルの列番號(hào)

* (int)$orgsheet 參照セルのシート番號(hào)

*/

public function addString($sheet,$row,$col,$string,$orgrow = null,$orgcol = null,$orgsheet = null){

/*

* addNumber

* 數(shù)値の追加

* 參照セルの設(shè)定を入れるとスタイルをコピーしてきます。

*

* (int)$sheet シート番號(hào)

* (int)$row 行番號(hào)

* (int)$col 列番號(hào)

* (int)$integer 數(shù)値

* (int)$orgrow 參照セルの行番號(hào)

* (int)$orgcol 參照セルの列番號(hào)

* (int)$orgsheet 參照セルのシート番號(hào)

*/

public function addNumber($sheet,$row,$col,$integer,$orgrow = null,$orgcol = null,$orgsheet = null)

/*

* addFormula

* 數(shù)値の追加

* 參照セルの設(shè)定を入れるとスタイルをコピーしてきます。

*

* (int)$sheet シート番號(hào)

* (int)$row 行番號(hào)

* (int)$col 列番號(hào)

* (string)$formula 関數(shù)

* (int)$orgrow 參照セルの行番號(hào)

* (int)$orgcol 參照セルの列番號(hào)

* (int)$orgsheet 參照セルのシート番號(hào)

*/

public function addFormula($sheet,$row,$col,$formula,$orgrow = null,$orgcol = null,$orgsheet = null)

/*

* setCellMerge

* セルのマージ

*

* (int)$sheet シート番號(hào)

* (int)$rowst 開始行番號(hào)

* (int)$rowen 終了行番號(hào)

* (int)$colst 開始列番號(hào)

* (int)$colen 終了列番號(hào)

*/

public function setCellMerge($sheet,$rowst,$rowen,$colst,$colen)

/*

* addSheet

* シートの追加

*

* (int)$org_sheet 大元のシート番號(hào)

* (int)$count シート追加數(shù)

*/

public function addSheet($org_sheet,$count)

/*

* rmSheet

* シートの削除

*

* (int)$sheet シート番號(hào)

*/

public function rmSheet($sheet)

/*

* setSheetname

* シート名の設(shè)定

*

* (int)$sheet シート番號(hào)

* (int)$sheet シート名

*/

public function setSheetname($sheet,$sheetname)

/*

* copyCell

* セルのコピー

*

* (int)$sheet シート番號(hào)

* (int)$row 行番號(hào)

* (int)$col 列番號(hào)

* (int)$orgrow 參照セルの行番號(hào)

* (int)$orgcol 參照セルの列番號(hào)

* (int)$orgsheet 參照セルのシート番號(hào)

*/

public function copyCell($sheet,$row,$col,$orgsheet,$orgrow,$orgcol)

/*

* copyStyle

* スタイルのコピー

*

* (int)$sheet シート番號(hào)

* (int)$row 行番號(hào)

* (int)$col 列番號(hào)

* (int)$orgrow 參照セルの行番號(hào)

* (int)$orgcol 參照セルの列番號(hào)

* (int)$orgsheet 參照セルのシート番號(hào)

*/

public function copyStyle($sheet,$row,$col,$orgsheet,$orgrow,$orgcol)

/*

* setBorder

* 罫線の設(shè)定

*

* (int)$sheet シート番號(hào)

* (int)$row 行番號(hào)

* (int)$col 列番號(hào)

* (string)$topbstyle 上罫線の設(shè)定

* (string)$topbcolor 上罫線の色

* (string)$leftbstyle 左罫線の設(shè)定

* (string)$leftbcolor 左罫線の色

* (string)$rightbstyle 右罫線の設(shè)定

* (string)$rightbcolor 右罫線の色

* (string)$bottombstyle 下罫線の設(shè)定

* (string)$bottombcolor 下罫線の色

* 色の種類、罫線の種類は下記參照

*/

public function setBorder($sheet,$row,$col,$topbstyle,$topbcolor,$leftbstyle,$leftbcolor,$rightbstyle,$rightbcolor,$bottombstyle,$bottombcolor){

/*

* setCellColor

* セルの色設(shè)定

*

* (int)$sheet シート番號(hào)

* (int)$row 行番號(hào)

* (int)$col 列番號(hào)

* (string)$cellcolor セルの色(前景色)の設(shè)定

* (string)$backcolor 背景色の設(shè)定

* (string)$fillpattern 塗りつぶしパターンの設(shè)定

* 色の種類、塗りつぶしパターンの種類は下記參照

*/

public function setCellColor($sheet,$row,$col,$cellcolor,$backcolor = null,$fillpattern = 'SOLID_FOREGROUND')

/*

* setFontSetting

* セルの色設(shè)定

*

* (int)$sheet シート番號(hào)

* (int)$row 行番號(hào)

* (int)$col 列番號(hào)

* (string)$fontcolor フォントの色設(shè)定

* (int)$fontsize フォントのサイズ

* (string)$font フォントの設(shè)定 (MS コジック)など文字列で

* (bool)$italic イタリックの設(shè)定

* (bool)$bold 太字の設(shè)定

* (bool)$strikeout 打ち消し線の設(shè)定

* (string)$underline 下線の設(shè)定

* 色の種類、下線の種類は下記參照

*/

public function setFontSetting($sheet,$row,$col,$fontcolor = null,$fontsize = null,$font = null,$italic = null,$bold = null,$strikeout = null,$underline = null)

/*

* addImage

* 畫像の追加

* 基本は畫像パスまで。

* それ以降のパスはすべて指定をしないと動(dòng)作しない上、強(qiáng)引に畫像が引き伸ばされるため奇麗に畫像が表示されないので

* resizeは別途行った上で設(shè)置を推奨

*

* (int)$sheet シート番號(hào)

* (int)$row 行番號(hào)

* (int)$col 列番號(hào)

* (string)$image 畫像パス

* (int)$margin_x 左マージン

* (int)$margin_y 上マージン

* (int)$endrow 終端行

* (int)$endcol 終端列

* (int)$margin_rx 右マージン

* (int)$margin_ry 下マージン

*/

public function addImage($sheet,$row,$col,$image,$margin_x = 0,$margin_y = 0,$endrow = null,$endcol = null, $margin_rx = 0,$margin_ry = 0){

/*

* setAlign

* セルの寄せ設(shè)定

*

* (int)$sheet シート番號(hào)

* (int)$row 行番號(hào)

* (int)$col 列番號(hào)

* (string)$align 寄せ

* 寄せの種類は下記參照

*/

public function setAlign($sheet,$row,$col,$align)

/*

* reset

* セットした値のリセット

*/

public function reset()

/*

* excelExport

* Excelの出力。addStringなどの設(shè)定をすべて行って最後に出力をします。

*

* @param readfile 読み込みテンプレートファイル

* @param outFile 出力Excelファイル

*/

public function excelExport($readfile, $outFile)

/*

* excelImport

* Excelの入力。CSVファイルに出力をします。

* 任意のシートの任意の場(chǎng)所から読み込みます。

*

* $readfile 読み込みExcelファイル

* $outFile 出力CSVファイル

* $sheet 読み込むシート番號(hào)

* $rowst 読み込み開始行

* $colst 読み込み開始列

* $colnum 列數(shù)

* $file_encode CSVファイルの文字コード

*/

public function excelImport($readfile, $outFile, $sheet, $rowst, $colst, $colnum,$file_encode = 'UTF-8')

AQUA

AUTOMATIC

BLACK

BLUE

BLUE_GREY

BRIGHT_GREEN

BROWN

CORAL

CORNFLOWER_BLUE

DARK_BLUE

DARK_GREEN

DARK_RED

DARK_TEAL

DARK_YELLOW

GOLD

GREEN

GREY_25_PERCENT

GREY_40_PERCENT

GREY_50_PERCENT

GREY_80_PERCENT

LAVENDER

LEMON_CHIFFON

LIGHT_CORNFLOWER_BLUE

LIGHT_GREEN

LIGHT_ORANGE

LIGHT_TURQUOISE

LIGHT_YELLOW

LIME

MAROON

OLIVE_GREEN

ORANGE

ORCHID

PALE_BLUE

PINK

PLUM

RED

ROSE

ROYAL_BLUE

SEA_GREEN

SKY_BLUE

TAN

TEAL

TURQUOISE

VIOLET

WHITE

YELLOW

AUTOMATIC

罫線

none

thin

medium

dashed

dotted

thick

dobble

hair

medium_dashed

dash_dot

medium_dash_dot

dash_dot_dot

medium_dash_dot_dot

slanted_dash_dot

下線

NONE

SINGLE

DOUBLE

SINGLE_ACCOUNTING

DOUBLE_ACCOUNTING

塗りつぶし

NO_FILL

SOLID_FOREGROUND

FINE_DOTS

ALT_BARS

SPARSE_DOTS

THICK_HORZ_BANDS

THICK_VERT_BANDS

THICK_BACKWARD_DIAG

THICK_FORWARD_DIAG

BIG_SPOTS

BRICKS

THIN_HORZ_BANDS

THIN_VERT_BANDS

THIN_BACKWARD_DIAG

THIN_FORWARD_DIAG

SQUARES

DIAMONDS

寄せ

LEFT

RIGHT

CENTER

GENERAL

FILL

JUSTIFY

CENTER_SELECTION

License

The MIT Lisence

Copyright (c) 2013 Fusic Co., Ltd. (http://fusic.co.jp)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Author

Satoru Hagiwara

創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎(jiǎng)勵(lì)來(lái)咯,堅(jiān)持創(chuàng)作打卡瓜分現(xiàn)金大獎(jiǎng)

總結(jié)

以上是生活随笔為你收集整理的php poi,GitHub - satthi/poi-php: poi-php的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。