当前位置: 首页>>代码示例>>Java>>正文


Java PictureData.getData方法代码示例

本文整理汇总了Java中org.apache.poi.ss.usermodel.PictureData.getData方法的典型用法代码示例。如果您正苦于以下问题:Java PictureData.getData方法的具体用法?Java PictureData.getData怎么用?Java PictureData.getData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.poi.ss.usermodel.PictureData的用法示例。


在下文中一共展示了PictureData.getData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: saveImage

import org.apache.poi.ss.usermodel.PictureData; //导入方法依赖的package包/类
/**
 * 
 * @param object
 * @param picId
 * @param excelParams
 * @param titleString
 * @param pictures
 * @param params
 * @throws Exception
 */
private void saveImage(Object object, String picId, Map<String, ExcelImportEntity> excelParams,
                       String titleString, Map<String, PictureData> pictures,
                       ImportParams params) throws Exception {
    if (pictures == null) {
        return;
    }
    PictureData image = pictures.get(picId);
    if(image == null) {
    	return;
    }
    byte[] data = image.getData();
    String fileName = "pic" + Math.round(Math.random() * 100000000000L);
    fileName += "." + PoiPublicUtil.getFileExtendName(data);
    if (excelParams.get(titleString).getSaveType() == 1) {
        String path = PoiPublicUtil
            .getWebRootPath(getSaveUrl(excelParams.get(titleString), object));
        File savefile = new File(path);
        if (!savefile.exists()) {
            savefile.mkdirs();
        }
        savefile = new File(path + "/" + fileName);
        FileOutputStream fos = new FileOutputStream(savefile);
        try {
            fos.write(data);
        } finally {
            IOUtils.closeQuietly(fos);
        }
        setValues(excelParams.get(titleString), object,
            getSaveUrl(excelParams.get(titleString), object) + "/" + fileName);
    } else {
        setValues(excelParams.get(titleString), object, data);
    }
}
 
开发者ID:rushingpig,项目名称:poix,代码行数:44,代码来源:ExcelImportServer.java

示例2: saveImage

import org.apache.poi.ss.usermodel.PictureData; //导入方法依赖的package包/类
/**
 * 
 * @param object
 * @param picId
 * @param excelParams
 * @param titleString
 * @param pictures
 * @param params
 * @throws Exception
 */
private void saveImage(Object object, String picId, Map<String, ExcelImportEntity> excelParams,
                       String titleString, Map<String, PictureData> pictures,
                       ImportParams params) throws Exception {
    if (pictures == null) {
        return;
    }
    PictureData image = pictures.get(picId);
    byte[] data = image.getData();
    String fileName = "pic" + Math.round(Math.random() * 100000000000L);
    fileName += "." + PoiPublicUtil.getFileExtendName(data);
    if (excelParams.get(titleString).getSaveType() == 1) {
        String path = PoiPublicUtil.getWebRootPath(getSaveUrl(excelParams.get(titleString),
            object));
        File savefile = new File(path);
        if (!savefile.exists()) {
            savefile.mkdirs();
        }
        savefile = new File(path + "/" + fileName);
        FileOutputStream fos = new FileOutputStream(savefile);
        fos.write(data);
        fos.close();
        setValues(excelParams.get(titleString), object,
            getSaveUrl(excelParams.get(titleString), object) + "/" + fileName);
    } else {
        setValues(excelParams.get(titleString), object, data);
    }
}
 
开发者ID:xiaolanglang,项目名称:easypoi,代码行数:38,代码来源:ExcelImportServer.java

示例3: PictureInfo

import org.apache.poi.ss.usermodel.PictureData; //导入方法依赖的package包/类
public PictureInfo(PictureData data, int[] p, String border) {
	StringBuilder buf = new StringBuilder();
	buf.append("data:")
		.append(data.getMimeType())
		.append(";base64,");
	buf.append(Base64.encodeBase64String(data.getData()));
	this.uri = buf.toString();
	this.p = p;
	this.border = border;
	
	this.data = data.getData();
	this.mimeType = data.getMimeType();
	this.ext = data.suggestFileExtension();
}
 
开发者ID:shunjikonishi,项目名称:excel2canvas,代码行数:15,代码来源:ExcelToCanvas.java

示例4: createImageData

import org.apache.poi.ss.usermodel.PictureData; //导入方法依赖的package包/类
public static ImageData createImageData(PictureData pic) {
    return new ImageData(pic.getData(), pic.suggestFileExtension(), pic.getMimeType(), pic.getPictureType());
}
 
开发者ID:bingoohuang,项目名称:excel2javabeans,代码行数:4,代码来源:ExcelImages.java


注:本文中的org.apache.poi.ss.usermodel.PictureData.getData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。