poi给报表中插入目录和图片

package Image;


import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;

public class Images {

/**
* @param args
*/
public static void main(String[] args) {
File files = new File("C:\\Users\\zhaobing\\Pictures");
File[] lists = files.listFiles();
for (int i = 0; i < lists.length; i++) {
BufferedImage bufferedImage = null;
try {
bufferedImage = ImageIO.read(new File(lists[i].toString()));
} catch (IOException e) {
System.out.println(e.toString());
}
try {
if (bufferedImage != null) {
int width = bufferedImage.getWidth();
int height = bufferedImage.getHeight();
System.out.println("图片的宽为:" + width);
System.out.println("图片的高为:" + height);
System.out.println("\n");
}
} catch (NullPointerException e) {
System.out.println(e.toString());
}
}
}
}

你可能感兴趣的:(poi)