I have a requirement where files generated by Apache POI need to produce a fie with the fit all columns on one page setting set. I've tried a bunch of variations with the API but so far I haven't been able to do it. Nor can I really find if it can be done.
It seems like the setFitToPage(true)
function resizes both the height and width not just the width like I want. Using setFitWidth
and setFitHeight
like I find in various other stack overflow questions doesn't seem to affect anything.
Here is what I have so far:
public void setPrintSettings(Sheet sheet) {
sheet.setFitToPage(true); //this will resize both height and width to fit
sheet.getPrintSetup().setLandscape(true);
sheet.getPrintSetup().setFitWidth((short) 1);
sheet.getPrintSetup().setFitHeight((short) 1);
}