Convert Set of Images into PPT Presentations Using Java

import java.util.*;
import java.sql.*;
import java.lang.Integer;
import java.text.DecimalFormat;
import java.io.FileInputStream;
import java.io.*;
import java.text.*;

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

import javax.imageio.ImageIO;

import java.awt.image.BufferedImage;
import java.awt.Dimension;

import org.apache.poi.hslf.usermodel.SlideShow;
import org.apache.poi.hslf.model.Slide;
import org.apache.poi.hslf.model.Fill;
import org.apache.poi.hslf.model.Picture;
import org.apache.poi.hslf.model.TextBox;
//import org.apache.commons.codec.binary.Base64;
import org.apache.poi.hslf.HSLFSlideShow;

public class CreatePresentation
{

public DBConnection dbCon;
public Connection c;
public List finallist ;

public List arrList;

public List arrListBullet ;
public List arrListSpark ;

public Vector columnTypeCategorical;
public Vector columnTypeNumeric;

public String strCatFields=””;
public String strNumFields=””;

private SlideShow ppt;
private Slide slide;
private Fill fill;
private int idx;
private FileOutputStream out;

public Vector vcFileName1;

public int i=0;

public void ConnectDatabase()
{
dbCon = new DBConnection();
dbCon.ConnectDB();
c = dbCon.conn;
}

public CreatePresentation()
{
try
{
//create a new empty slide show
ppt = new SlideShow();
ppt.setPageSize(new Dimension(100,50));
out = new FileOutputStream(“/home/ashoka/Desktop/img/slideshow.ppt”);
CreatePresentations123();
}catch(Exception fnfe){}

}

//empty default constructor
public void CreatePresentations123()
{
try
{

//CreatePresentation present = new CreatePresentation();
//for(int k=0;k<SaveImg.vcFileName.size();k++)
for(int k=0;k<10;k++)
{
String tmp ="/home/ashoka/Desktop/img/img"+k+".jpg";
System.out.println(tmp);
createSlideWithChart(tmp);
}
//present.createSlideWithChart("NewSmooth.bmp");
savePPT();
}catch(Exception fnfe){}
}

public void createSlideWithChart(String chartName)
{
try
{
slide = ppt.createSlide();
slide.setFollowMasterBackground(false);
fill = slide.getBackground().getFill();
fill.setFillType(Fill.FILL_PICTURE);
idx = ppt.addPicture(new File(chartName), Picture.PNG);
fill.setPictureData(idx);
}catch(FileNotFoundException fnfe){}
catch(IOException ioe){}
}

public void savePPT()
{
try
{
ppt.write(out);
out.close();
}catch(FileNotFoundException fnfe){}
catch(IOException ioe){}
}

}

About ashokabhat

I am a C,C ,JAVA,Adobe Flex,.NET Programmer Currently working as a Software Developer
This entry was posted in Uncategorized and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s