Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache POI PPT SLide Page setup option

I am wondering if by any mean, i can set the 'Slide sized for ' as On-ScreenShow (16:9). i mean is there any method in master object in apache poi hslf? I couldn't find it. I have added the image for the reference.

enter image description here

like image 211
user3768904 Avatar asked Sep 13 '25 20:09

user3768904


1 Answers

You can only have one page size per file.

To set the page dimension call SlideShow.setPageSize().

To find out which page dimensions 4:3, 16:9 or any other formats are, just create a PPT manually via Powerpoint and check its dimension - or use a Cross-multiplication:

import java.io.File;
import java.io.IOException;

import org.apache.poi.sl.usermodel.SlideShow;
import org.apache.poi.sl.usermodel.SlideShowFactory;

public class SlideSizes {
    public static void main(String[] args) throws IOException {
        String files[] = { "dim_4_3.ppt", "dim_16_9.ppt" };
        for (String f : files) {
            SlideShow<?,?> ppt = SlideShowFactory.create(new File(f));
            System.out.println(ppt.getPageSize());
        }
    }
}
like image 189
kiwiwings Avatar answered Sep 15 '25 10:09

kiwiwings