All Downloads are FREE. Search and download functionalities are using the official Maven repository.

kz.greetgo.msoffice.xlsx.gen.PageSetup Maven / Gradle / Ivy

There is a newer version: 0.5.9
Show newest version
package kz.greetgo.msoffice.xlsx.gen;

import java.io.PrintStream;

public class PageSetup {

  private Integer fitToWidth;
  private Integer fitToHeight;
  private Orientation orientation = Orientation.PORTRAIT;
  private PaperSize paperSize;

  public enum Orientation {
    PORTRAIT, //
    LANDSCAPE
  }

  public enum PaperSize {

    A4(9), //
    A5(11), //
    A6(70), //
    Legal(5), //
    Executive(7), //
    B5_JIS(13), //
    Letter(-1);

    private int code;

    PaperSize(int code) {
      this.code = code;
    }
  }

  public void setFitToWidth(Integer fitToWidth) {
    this.fitToWidth = fitToWidth;
  }

  public void setFitToHeight(Integer fitToHeight) {
    this.fitToHeight = fitToHeight;
  }

  public void setOrientation(Orientation orientation) {
    this.orientation = orientation;
  }

  public void setPaperSize(PaperSize paperSize) {

    if (paperSize == PaperSize.Letter) {
      this.paperSize = null;
      return;
    }

    this.paperSize = paperSize;
  }

  boolean printHeader(PrintStream out) {
    if (fitToWidth == null && fitToHeight == null) return false;

    out.append("");
    return true;
  }

  void print(PrintStream out) {

    StringBuffer sb = new StringBuffer();

    sb.append("");

    out.println(sb.toString());
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy