POI 생성된 excel 파일 속성

1253 단어 javaweb
import org.apache.poi.hpsf.CustomProperties; import org.apache.poi.hpsf.DocumentSummaryInformation; import org.apache.poi.hpsf.SummaryInformation; import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import java.io.FileOutputStream; import java.io.OutputStream;
public class Test {
public static void main(String args[]) throws Exception {
    OutputStream out = null;
    // ,ip, 
    try {
        HSSFWorkbook workbook = new HSSFWorkbook();
        workbook.createInformationProperties();
        SummaryInformation suminfoInformation = workbook.getSummaryInformation();
        DocumentSummaryInformation info = workbook.getDocumentSummaryInformation();
        // 
        suminfoInformation.setComments("beizhu");
        suminfoInformation.setAuthor("zhangsan");
        // 
        CustomProperties customProperties = new CustomProperties();
        customProperties.put("IP","172.193.444");
        info.setCustomProperties(customProperties);
        out = new FileOutputStream("F://2.xls");
        workbook.write(out);
    } catch (Exception e) {
        e.printStackTrace();
    }finally{
        if (out!=null) {
            out.close();
        }
    }
}

}

좋은 웹페이지 즐겨찾기