使用apache poi的html到ppt不能渲染html

时间:2017-09-20 07:47:06

标签: java html apache-poi powerpoint

我使用以下代码使用apache poi将html转换为ppt,但它只是将html代码复制到ppt中,渲染没有发生。

import org.apache.poi.hslf.model.Slide;
import org.apache.poi.hslf.model.TextBox;
import org.apache.poi.hslf.usermodel.SlideShow;


public class apachePOI {
     public static void main(String[]args){
          try{
           File file = new File("Hello.html");
           FileInputStream fis = null;
           BufferedInputStream bis = null;
           DataInputStream dis = null;
           fis = new FileInputStream(file);
           bis = new BufferedInputStream(fis);
           dis = new DataInputStream(bis);
           String st="";
           while (dis.available() != 0) {
            st+=dis.readLine().toString()+"\n";
           }
           System.out.println(st);
           SlideShow slideShow = new SlideShow();
           Slide slide = slideShow.createSlide();
           TextBox txt = new TextBox();
           txt.setText(st+" ");
           slide.addShape(txt);
           FileOutputStream out = new FileOutputStream("Hello.ppt");
           slideShow.write(out);
           out.close();
           bis.close();
           dis.close();
          }
          catch(Exception e){}
         }
}

有什么建议吗?

0 个答案:

没有答案