poi Excel 추가/읽기 파일 속성 내보내기

1943 단어
속성 추가
 /**
     * 
     * 
     *  :excel 
     * 
     * @param workbook
     *             Excel
     * 
     * @param parameter
     *             
     * 
     * @author qianlei
     * 
     * @since 20160926
     * 
     * @update:[ YYYY-MM-DD][ ][ ]
     */
    public static void set_ExcelProperties(HSSFWorkbook workbook, Map parameter) {
        workbook.createInformationProperties();
        SummaryInformation suminfoInformation = workbook.getSummaryInformation();
        DocumentSummaryInformation docmentIfo = workbook.getDocumentSummaryInformation();
        //  
        suminfoInformation.setComments(" ");
        suminfoInformation.setAuthor("sunlands");
        //  
        CustomProperties customProperties = new CustomProperties();
        Set parSet = parameter.keySet();
        if (parameter != null) {
            for (String setString : parSet) {
                if (!StringUtils.isBlank(setString) && null != parameter.get(setString)) {
                    customProperties.put(setString, parameter.get(setString).toString());
                }
            }
        }
        //  workbook
        docmentIfo.setCustomProperties(customProperties);
    }
    /**
     *
     *  : 
     *
     * @param key  key 
     *
     * @return key 
     *
     * @author  
     *
     * @since 2016 9 29 
     *
     * @update:[ YYYY-MM-DD][ ][ ]
     */
    public String getProperties(String key){
        String uuid = "";
        if (!StringUtils.isBlank(key)) {
            DocumentSummaryInformation docuInfo = wb.getDocumentSummaryInformation();
            CustomProperties customProperties = docuInfo.getCustomProperties();
            Object temp = customProperties.get(key);
            if (null != temp) {
                uuid = temp.toString();
            }
        }
        return uuid;
    }

좋은 웹페이지 즐겨찾기