CodeZineç·¨éé¨ã§ã¯ãç¾å ´ã§æ´»èºãããããããã¼ãã¹ã¿ã¼ã«ããããã®ã«ã³ãã¡ã¬ã³ã¹ãDevelopers Summitãããã¨ã³ã¸ãã¢ã®çããã¾ããã¼ã¹ãããããã®ã¤ãã³ããDevelopers Boostããªã©ããã¾ãã¾ãªã«ã³ãã¡ã¬ã³ã¹ãä¼ç»ã»éå¶ãã¦ãã¾ãã
CodeZineç·¨éé¨ã§ã¯ãç¾å ´ã§æ´»èºãããããããã¼ãã¹ã¿ã¼ã«ããããã®ã«ã³ãã¡ã¬ã³ã¹ãDevelopers Summitãããã¨ã³ã¸ãã¢ã®çããã¾ããã¼ã¹ãããããã®ã¤ãã³ããDevelopers Boostããªã©ããã¾ãã¾ãªã«ã³ãã¡ã¬ã³ã¹ãä¼ç»ã»éå¶ãã¦ãã¾ãã
ã¯ããã« POIã¯JavaããMicrosoftã®ããã¥ã¡ã³ããæä½ããããã®APIã§ã2007å¹´6æããApache Software Foundationã®ãããã¬ãã«ããã¸ã§ã¯ãã«æ ¼ä¸ãããã¾ããããªã¼ãã³ã½ã¼ã¹ã¨ãã¦æä¾ããã¦ããã®ã§èª°ã§ãç¡åã§å©ç¨ãããã¨ãã§ãã¾ãã ãªãåæã®ãªãªã¼ã¹å¾ã7年以ä¸ãçµéããå¤ãã®æ å ±ãåå¨ããPOIãä»åããããã¦åãä¸ãããã¨ã«ãããã¨è¨ãã¨ã2009å¹´9æãªãªã¼ã¹ã®Version 3.5ã§Office Open XMLå½¢å¼ï¼ä»¥éãOOXMLå½¢å¼ï¼ã¸ã®å¯¾å¿ã¨ãã大ããªå¤æ´ãå ãã£ãããã§ãã åãããããããã¨2007å½¢å¼ã®Excelï¼xlsxï¼ãWordï¼docxï¼ã®ãã¡ã¤ã«ãæ±ããããã«ãªã£ãã¨ãããã¨ã§ãã æ¬é£è¼ã§ã¯ãPOIã®ä¸ããExcelãæä½ããã³ã³ãã¼ãã³ãï¼HSSF/XSSFï¼ã«å¯¾è±¡ãçµããä¸è¨ã®äºå®ã§ç´¹ä»ãã¦ããã¾ãã æº
JavaããMicrosoftã®ããã¥ã¡ã³ããæä½ããããã®APIãPOIãã®ææ°çã§ã¯ãOffice 2007å½¢å¼ã®ãã¡ã¤ã«ãæ±ããããã«ãªãã¾ãããæ¬ç¨¿ã§ã¯ååã«å¼ãç¶ããååã®å®ç¾©ãè¨ç®å¼ãå³å½¢ãç»åã®å©ç¨ç¨ãªã©ãUsermodel APIã®ä½¿ç¨æ¹æ³ã確èªãã¦ããã¾ãã ã¯ããã« POIã¯JavaããMicrosoftã®ããã¥ã¡ã³ããæä½ããããã®APIã§ã2007å¹´6æããApache Software Foundationã®ãããã¬ãã«ããã¸ã§ã¯ãã«æ ¼ä¸ãããã¾ããããªã¼ãã³ã½ã¼ã¹ã¨ãã¦æä¾ããã¦ããã®ã§èª°ã§ãç¡åã§å©ç¨ãããã¨ãã§ãã¾ãã ãªãåæã®ãªãªã¼ã¹å¾ã7年以ä¸ãçµéããå¤ãã®æ å ±ãåå¨ããPOIãä»åããããã¦åãä¸ãããã¨ã«ãããã¨è¨ãã¨ã2009å¹´9æãªãªã¼ã¹ã® Version 3.5ã§Office Open XMLå½¢å¼ï¼ä»¥éãOOXMLå½¢å¼ï¼ã¸ã®å¯¾å¿ã¨ãã大ããª
import java.io.FileOutputStream; import org.apache.poi.ss.usermodel.IndexedColors; import org.apache.poi.xssf.usermodel.XSSFCell; import org.apache.poi.xssf.usermodel.XSSFCellStyle; import org.apache.poi.xssf.usermodel.XSSFFont; import org.apache.poi.xssf.usermodel.XSSFRow; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; public class XSSFSample {
ã¯ããã« POIã¯JavaããMicrosoftã®ããã¥ã¡ã³ããæä½ããããã®APIã§ã2007å¹´6æããApache Software Foundationã®ãããã¬ãã«ããã¸ã§ã¯ãã«æ ¼ä¸ãããã¾ããããªã¼ãã³ã½ã¼ã¹ã¨ãã¦æä¾ããã¦ããã®ã§èª°ã§ãç¡åã§å©ç¨ãããã¨ãã§ãã¾ãã ãªãåæã®ãªãªã¼ã¹å¾ã7年以ä¸ãçµéããå¤ãã®æ å ±ãåå¨ããPOIãä»åããããã¦åãä¸ãããã¨ã«ãããã¨è¨ãã¨ã2009å¹´9æãªãªã¼ã¹ã®Version 3.5ã§Office Open XMLå½¢å¼ï¼ä»¥éãOOXMLå½¢å¼ï¼ã¸ã®å¯¾å¿ã¨ãã大ããªå¤æ´ãå ãã£ãããã§ãã åãããããããã¨2007å½¢å¼ã®Excelï¼xlsxï¼ãWordï¼docxï¼ã®ãã¡ã¤ã«ãæ±ããããã«ãªã£ãã¨ãããã¨ã§ãã æ¬é£è¼ã§ã¯ãPOIã®ä¸ããExcelãæä½ããã³ã³ãã¼ãã³ãï¼HSSF/XSSFï¼ã«å¯¾è±¡ãçµããä¸è¨ã®äºå®ã§ç´¹ä»ãã¦ããã¾ãã æº
Webã¯ãã¼ã¿ã§æºã¡ã¦ããããã¼ã¿ãæ¤ç´¢ãã¦è¡¨ç¤ºããã«ã¯ãã£ã¦ããã®ã¡ãã£ã¢ã§ãããããå¤ãã®å ´åããã©ã¦ã¶ã¯ãã¼ã¿åæã«é©ãããã¼ã«ã¨ã¯è¨ãã¾ããã以åã®è¨äºãReading Excel Files with Apache POI HSSFãã§ã¯ãExcelããã¯ã使ã£ã¦Javaã¢ããªã±ã¼ã·ã§ã³ã«ãã¼ã¿ãæä¾ããæ¹æ³ã解説ãã¾ãããä»åã¯ãåãå½¢å¼ã§ã¦ã¼ã¶ã¼ã«ãã¼ã¿ãæä¾ããæ¹æ³ãè¦ã¦ã¿ã¾ãããã ã¯ããã« Webã¯ãã¼ã¿ã§æºã¡ã¦ããããã¼ã¿ãæ¤ç´¢ãã¦è¡¨ç¤ºããã«ã¯ãã£ã¦ããã®ã¡ãã£ã¢ã§ããå¤ãã®ã¦ã¼ã¶ã¼ã¯ããã¼ã¿ãè¦ã¤ããã¨ãèªåã®æèããã»ã¹ã«åã£ãæ¹æ³ã§ãã¼ã¿ãåæãããã¨èãã¾ããä¸é¨ã®Webã¢ããªã±ã¼ã·ã§ã³ã¯ããã¼ã¿è¡¨ç¤ºãªãã·ã§ã³ãã©ãã©ãå¢ãããã¨ã§ããã®ãã¼ãºã«å¿ãããã¨ãã¦ãã¾ãããããé©åãªå ´åãããã¾ããä¾ãã°ãä¾¡æ ¼ã¨æ©è½ãæ¯è¼ã§ããEã³ãã¼ã¹ãµã¤ããªã©ã§ãããã以å¤ã®
Javaã«é¢ãããã¾ãã¾ãªã½ããã¦ã§ã¢ããªã¼ãã³ã½ã¼ã¹ã§éçºãã¦ããJakartaããã¸ã§ã¯ããããªãåºã¾ã£ã¦ãã¦ãæè¿ã§ã¯ãããã°ã©ã ãçµãã¨ãã«ãJakartaããã¸ã§ã¯ãã®ãµã¤ãããã§ãã¯ãã¦ããä½ãæ¹ãä½ããã®ã決ãããã¨ããæ¹ãå¤ãã®ã§ã¯ãªãã§ããããã ãã®Jakartaããã¸ã§ã¯ãã®ãµãããã¸ã§ã¯ãã®1ã¤ã«ãMicrosoft Officeã®ExcelãWordãã¡ã¤ã«ãèªã¿æ¸ãããããã®ãPOI注1ã¨ããã©ã¤ãã©ãªãããã¾ãã ç¾ç¶ã§ã¯ã¾ã ãExcelãã¡ã¤ã«ã®èªã¿æ¸ããã§ããããã«ãªã£ãã°ããã§ãããããã°ã©ã ãçµãã¨ãã«Excelã使ããã¨ããã¾ãã¾ãªä¾¿å©ãªæ©è½ãå®è£ ãããã¨ãã§ãã¾ãã Webã¢ããªã±ã¼ã·ã§ã³ã®å ´åã¯ããã¼ã¿ã®ä¸æ¬ç»é²ããã¼ã¿ä¸è¦§ã®ãã¦ã³ãã¼ããã¾ãã帳票åãã®å°å·ç¨æ´å½¢ãã¡ã¤ã«ãªã©ã¨ãã¦ãExcelãã¡ã¤ã«ã使ããã¨ãã§ããããã«ãªãã¾ã
Apache POI(以åã¯Jakarta POIã¨å¼ã°ãã¦ãã¾ãã)ã¯Javaã¢ããªã±ã¼ã·ã§ã³ããExcelãWordãªã©ã®Microsoft製åã®ãã©ã¼ããããã¡ã¤ã«ãèªã¿æ¸ãããããã®APIã§ãã ä»åã¯ç¹ã«Excelã®ãã¡ã¤ã«ã対象ã¨ãã¦è©¦ãã¦ããã¾ãããExcelã®ãã¡ã¤ã«ã®èªã¿æ¸ãã§ã¯Apache POIã®ä¸ã®HSSFã¨XSSFã使ç¨ãã¾ããHSSFã¯Excel2003ã¾ã§ã®ãã¡ã¤ã«ãã©ã¼ãããã«å¯¾å¿ãããã®ã§ãXSSFã¯Excel2007ã®OOXML(.xlsx)ãã¡ã¤ã«ãã©ã¼ãããã«å¯¾å¿ãããã®ã§ãã Apache POI 3.6ã®ãã¦ã³ãã¼ã Apache POI 3.6ã®ã¤ã³ã¹ãã¼ã« ã¯ã©ã¹ãã¹ã®è¨å®
EXCELãã¡ã¤ã«ã®ãã©ã³ãã®å¤æ´ [ POI 3.0 ]ã»Javaã®å°æããµã³ãã«ããã¥ã¼ã¹ãªã©ãç´¹ä»ãã¦ããã¾ããã¿ããªã§åèã«ãã¦ãã ããã EXCELãã¡ã¤ã«ã®æåãã©ã³ããå¤æ´ãããµã³ãã«ã§ãã http://www.apache.org/dyn/closer.cgi/jakarta/poi/ããã©ã¤ãã©ãªããã¦ã³ãã¼ããã¾ãã ãµã³ãã«ã¯ 3.0alpha ã使ç¨ãã¦ãã¾ãã ãµã³ãã«ã§ã¯ããã©ã³ãåããµã¤ãºãè²ãå¤æ´ãã¦ãã¾ãã ãã©ã³ãåã¯ãâï¼ï¼³ ã´ã·ãã¯âãâï¼ï¼³ ï¼°ææâãªã©ãæå®ãã¾ãã String tmp = System.getProperty("java.io.tmpdir"); if (tmp.charAt(tmp.length()-1) != '/') tmp = tmp+"/"; String filename = tmp + "test.xls";
CodeZineç·¨éé¨ã§ã¯ãç¾å ´ã§æ´»èºãããããããã¼ãã¹ã¿ã¼ã«ããããã®ã«ã³ãã¡ã¬ã³ã¹ãDevelopers Summitãããã¨ã³ã¸ãã¢ã®çããã¾ããã¼ã¹ãããããã®ã¤ãã³ããDevelopers Boostããªã©ããã¾ãã¾ãªã«ã³ãã¡ã¬ã³ã¹ãä¼ç»ã»éå¶ãã¦ãã¾ãã
HOMMEZ(ãªã ãº)ã¯ãã¹ã¦ã®ç·æ§ã®æ©ã¿ã«å¯ãæ·»ããå¿ã¨èº«ä½ã®å¥åº·ãæ¯æ´ããç·æ§ã¨ãã¦ã®åã³ã享åã§ãã社ä¼ãç®æãã¦ãã¾ãã人ã«ã¯ç¸è«ãã¥ããAGAããã¤ã¨ãããEDãå¦æ´»ã«ã¾ã¤ããç·æ§ç¹æã®æ©ã¿ã«å¯¾ããæ å ±ãã½ãªã¥ã¼ã·ã§ã³ãæä¾ãããã¨ã§ç·æ§ãååãã«èªåãããçãããã幸ããå®ç¾ãã¾ãã
ãã¼ã¿å ¥åãè¡ãã«ã¯ãWebãã©ã¦ã¶ãå°ç¨ã®GUIç»é¢ã使ç¨ãããã¨ãä¸è¬çã§ãããç¨éã«ãã£ã¦ã¯ãMicrosoft Excelã§ä½æãããã¡ã¤ã«ãããã¼ã¿ã®èªã¿è¾¼ã¿ãæ±ãããããã¨ãããã¾ããããã§ãæ¬ç¨¿ã§ã¯ãPOIãã使ç¨ãã¦ãExcelãã¡ã¤ã«ãèªã¿è¾¼ãæ¹æ³ãç´¹ä»ãã¾ãããªããPOIã®åºæ¬ã«ã¤ãã¦ã¯ããPOIã使ç¨ãã¦JavaããExcelåºåãè¡ãããã覧ãã ããã ä»åã¯ãExcelãã¡ã¤ã«ãèªã¿è¾¼ã¿åè¨å¤ãåºåããã¨ãããµã³ãã«ãå®è¡ãã¾ãã package to.msn.wings; import java.io.FileInputStream; import java.text.SimpleDateFormat; import java.util.Date; import org.apache.poi.hssf.usermodel.*; import org.apache
表形å¼ã®ãã¼ã¿ä¿åã«ã¯ãCSVå½¢å¼ã®ããã¹ããã¡ã¤ã«ãç¨ããã®ãä¸è¬çã§ããããããç¨éã«ãã£ã¦ã¯ãMicrosoft Excelã§ä½æãããããªè¦æ ãã®è¯ã表形å¼ã§ã®åºåãæ±ãããããã¨ãããã¾ãã ããã§ãæ¬ç¨¿ã§ã¯ãPOIãã¨å¼ã°ããJavaã®ã©ã¤ãã©ãªã使ç¨ãã¦ãExcelãã¡ã¤ã«ãåºåããæ¹æ³ãç´¹ä»ãã¾ããPOIã¯ãExcelãWordãªã©ã®ãMicrosoft OLE 2è¤åããã¥ã¡ã³ãå½¢å¼ãã«æºæ ãããã¡ã¤ã«ãJavaã§æ±ãããã®API群ã§ããããã§ã¯ãPOIã®ä¸ã§Excelåºåãè¡ããHSSFãã¨å¼ã°ããã³ã³ãã¼ãã³ãã使ç¨ããä¾ãç´¹ä»ãã¾ãã package to.msn.wings; import java.io.FileOutputStream; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apa
The Javadocs for the latest (development) version of Apache POI can be accessed online here, or build from a source code checkout by running the javadocs Ant task. The latest (development) Javadocs are generally updated every few weeks, so may lag the most recent development slightly. For recent releases, the Javadocs for the latest stable release each the family can also be browsed online: Apache
POIããã¸ã§ã¯ãã¯ãMicrosoft OLE 2è¤åããã¥ã¡ã³ãå½¢å¼ã«åºã¥ããæ§ã ãªãã¡ã¤ã«å½¢å¼ã100%Javaã§åãæ±ãããã®API群ããæãç«ã¤ããã¸ã§ã¯ãã§ãã Microsoft OLE 2è¤åããã¥ã¡ã³ãå½¢å¼ã«ã¯ã XLS ã DOC ã¨ãã£ãæ®ã©ã®Microsoft Office ãã¡ã¤ã«ãå«ã¾ãã¾ãã ååã¨ãã¦ãåºæ¥ãéãä»ã®(Jakartaãªã©ã®)ããã¸ã§ã¯ãã¨é£æºãããã®æ©è½ãæä¾ãã¦ããããã¨èãã¦ãã¾ããä¾ãã°ï¼Cocoonã«ã¦ãæã ã®ããã¸ã§ã¯ãç±æ¥ã® generator ã serializer ãããã«è¦ã¤ãããã¨æãã¾ã - OpenOffice.orgï¼è¨³æ³¨ï¼Microsoft Office製åã¨äºææ§ãããç¨åº¦æããOfficeã¹ã¤ã¼ãã§ããªã¼ãã³ã½ã¼ã¹ã¨ãã¦å ¬éããéçºããã¦ãããç¡æã®ãªãã£ã¹ã½ããã¦ã§ã¢ - Javaãåºèª¿ã¨ãã¦ããï¼ã¨
ã©ã³ãã³ã°
ã©ã³ãã³ã°
ã©ã³ãã³ã°
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}