Java Code Examples for org.apache.poi.xwpf.usermodel.XWPFDocument#PICTURE_TYPE_JPEG

The following examples show how to use org.apache.poi.xwpf.usermodel.XWPFDocument#PICTURE_TYPE_JPEG . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PictureRenderPolicy.java    From poi-tl with Apache License 2.0 6 votes vote down vote up
public static int suggestFileType(String imgFile) {
    int format = 0;

    if (imgFile.endsWith(".emf")) format = XWPFDocument.PICTURE_TYPE_EMF;
    else if (imgFile.endsWith(".wmf")) format = XWPFDocument.PICTURE_TYPE_WMF;
    else if (imgFile.endsWith(".pict")) format = XWPFDocument.PICTURE_TYPE_PICT;
    else if (imgFile.endsWith(".jpeg") || imgFile.endsWith(".jpg"))
        format = XWPFDocument.PICTURE_TYPE_JPEG;
    else if (imgFile.endsWith(".png")) format = XWPFDocument.PICTURE_TYPE_PNG;
    else if (imgFile.endsWith(".dib")) format = XWPFDocument.PICTURE_TYPE_DIB;
    else if (imgFile.endsWith(".gif")) format = XWPFDocument.PICTURE_TYPE_GIF;
    else if (imgFile.endsWith(".tiff")) format = XWPFDocument.PICTURE_TYPE_TIFF;
    else if (imgFile.endsWith(".eps")) format = XWPFDocument.PICTURE_TYPE_EPS;
    else if (imgFile.endsWith(".bmp")) format = XWPFDocument.PICTURE_TYPE_BMP;
    else if (imgFile.endsWith(".wpg")) format = XWPFDocument.PICTURE_TYPE_WPG;
    else {
        throw new RenderException("Unsupported picture: " + imgFile
                + ". Expected emf|wmf|pict|jpeg|png|dib|gif|tiff|eps|bmp|wpg");
    }
    return format;
}
 
Example 2
Source File: PoiPublicUtil.java    From autopoi with Apache License 2.0 5 votes vote down vote up
private static Integer getImageType(String type) {
	if (type.equalsIgnoreCase("JPG") || type.equalsIgnoreCase("JPEG")) {
		return XWPFDocument.PICTURE_TYPE_JPEG;
	}
	if (type.equalsIgnoreCase("GIF")) {
		return XWPFDocument.PICTURE_TYPE_GIF;
	}
	if (type.equalsIgnoreCase("BMP")) {
		return XWPFDocument.PICTURE_TYPE_GIF;
	}
	if (type.equalsIgnoreCase("PNG")) {
		return XWPFDocument.PICTURE_TYPE_PNG;
	}
	return XWPFDocument.PICTURE_TYPE_JPEG;
}
 
Example 3
Source File: PoiPublicUtil.java    From jeasypoi with Apache License 2.0 5 votes vote down vote up
private static Integer getImageType(String type) {
	if (type.equalsIgnoreCase("JPG") || type.equalsIgnoreCase("JPEG")) {
		return XWPFDocument.PICTURE_TYPE_JPEG;
	}
	if (type.equalsIgnoreCase("GIF")) {
		return XWPFDocument.PICTURE_TYPE_GIF;
	}
	if (type.equalsIgnoreCase("BMP")) {
		return XWPFDocument.PICTURE_TYPE_GIF;
	}
	if (type.equalsIgnoreCase("PNG")) {
		return XWPFDocument.PICTURE_TYPE_PNG;
	}
	return XWPFDocument.PICTURE_TYPE_JPEG;
}
 
Example 4
Source File: PoiPublicUtil.java    From easypoi with Apache License 2.0 3 votes vote down vote up
private static Integer getImageType(String type) {
    if (type.equalsIgnoreCase("JPG") || type.equalsIgnoreCase("JPEG")) {
        return XWPFDocument.PICTURE_TYPE_JPEG;
    }
    if (type.equalsIgnoreCase("GIF")) {
        return XWPFDocument.PICTURE_TYPE_GIF;
    }
    if (type.equalsIgnoreCase("BMP")) {
        return XWPFDocument.PICTURE_TYPE_GIF;
    }
    if (type.equalsIgnoreCase("PNG")) {
        return XWPFDocument.PICTURE_TYPE_PNG;
    }
    return XWPFDocument.PICTURE_TYPE_JPEG;
}