FileDocCategorySizeDatePackage
PrintSetupRecord.javaAPI DocApache Poi 3.0.112121Mon Jan 01 12:39:40 GMT 2007org.apache.poi.hssf.record

PrintSetupRecord

public class PrintSetupRecord extends Record
Title: Print Setup Record

Description: Stores print setup options -- bogus for HSSF (and marked as such)

REFERENCE: PG 385 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)

author
Andrew C. Oliver (acoliver at apache dot org)
author
Jason Height (jheight at chariot dot net dot au)
version
2.0-pre

Fields Summary
public static final short
sid
private short
field_1_paper_size
private short
field_2_scale
private short
field_3_page_start
private short
field_4_fit_width
private short
field_5_fit_height
private short
field_6_options
private static final BitField
lefttoright
private static final BitField
landscape
private static final BitField
validsettings
private static final BitField
nocolor
private static final BitField
draft
private static final BitField
notes
private static final BitField
noOrientation
private static final BitField
usepage
private short
field_7_hresolution
private short
field_8_vresolution
private double
field_9_headermargin
private double
field_10_footermargin
private short
field_11_copies
Constructors Summary
public PrintSetupRecord()


     
    
    
public PrintSetupRecord(RecordInputStream in)
Constructs a PrintSetup (SETUP) record and sets its fields appropriately.

param
id id must be 0xa1 or an exception will be throw upon validation
param
size the size of the data area of the record
param
data data of the record (should not contain sid/len)

        super(in);
    
Methods Summary
public java.lang.Objectclone()

      PrintSetupRecord rec = new PrintSetupRecord();
      rec.field_1_paper_size = field_1_paper_size;
      rec.field_2_scale = field_2_scale;
      rec.field_3_page_start = field_3_page_start;
      rec.field_4_fit_width = field_4_fit_width;
      rec.field_5_fit_height = field_5_fit_height;
      rec.field_6_options = field_6_options;
      rec.field_7_hresolution = field_7_hresolution;
      rec.field_8_vresolution = field_8_vresolution;
      rec.field_9_headermargin = field_9_headermargin;
      rec.field_10_footermargin = field_10_footermargin;
      rec.field_11_copies = field_11_copies;
      return rec;
    
protected voidfillFields(org.apache.poi.hssf.record.RecordInputStream in)

        field_1_paper_size    = in.readShort();
        field_2_scale         = in.readShort();
        field_3_page_start    = in.readShort();
        field_4_fit_width     = in.readShort();
        field_5_fit_height    = in.readShort();
        field_6_options       = in.readShort();
        field_7_hresolution   = in.readShort();
        field_8_vresolution   = in.readShort();
        field_9_headermargin  = in.readDouble();
        field_10_footermargin = in.readDouble();
        field_11_copies       = in.readShort();
    
public shortgetCopies()

        return field_11_copies;
    
public booleangetDraft()

        return draft.isSet(field_6_options);
    
public shortgetFitHeight()

        return field_5_fit_height;
    
public shortgetFitWidth()

        return field_4_fit_width;
    
public doublegetFooterMargin()

        return field_10_footermargin;
    
public shortgetHResolution()

        return field_7_hresolution;
    
public doublegetHeaderMargin()

        return field_9_headermargin;
    
public booleangetLandscape()

        return landscape.isSet(field_6_options);
    
public booleangetLeftToRight()

        return lefttoright.isSet(field_6_options);
    
public booleangetNoColor()

        return nocolor.isSet(field_6_options);
    
public booleangetNoOrientation()

        return noOrientation.isSet(field_6_options);
    
public booleangetNotes()

        return notes.isSet(field_6_options);
    
public shortgetOptions()

        return field_6_options;
    
public shortgetPageStart()

        return field_3_page_start;
    
public shortgetPaperSize()

        return field_1_paper_size;
    
public intgetRecordSize()

        return 38;
    
public shortgetScale()

        return field_2_scale;
    
public shortgetSid()

        return sid;
    
public booleangetUsePage()

        return usepage.isSet(field_6_options);
    
public shortgetVResolution()

        return field_8_vresolution;
    
public booleangetValidSettings()

        return validsettings.isSet(field_6_options);
    
public intserialize(int offset, byte[] data)

        LittleEndian.putShort(data, 0 + offset, sid);
        LittleEndian.putShort(data, 2 + offset, ( short ) 34);
        LittleEndian.putShort(data, 4 + offset, getPaperSize());
        LittleEndian.putShort(data, 6 + offset, getScale());
        LittleEndian.putShort(data, 8 + offset, getPageStart());
        LittleEndian.putShort(data, 10 + offset, getFitWidth());
        LittleEndian.putShort(data, 12 + offset, getFitHeight());
        LittleEndian.putShort(data, 14 + offset, getOptions());
        LittleEndian.putShort(data, 16 + offset, getHResolution());
        LittleEndian.putShort(data, 18 + offset, getVResolution());
        LittleEndian.putDouble(data, 20 + offset, getHeaderMargin());
        LittleEndian.putDouble(data, 28 + offset, getFooterMargin());
        LittleEndian.putShort(data, 36 + offset, getCopies());
        return getRecordSize();
    
public voidsetCopies(short copies)

        field_11_copies = copies;
    
public voidsetDraft(boolean d)

        field_6_options = draft.setShortBoolean(field_6_options, d);
    
public voidsetFitHeight(short height)

        field_5_fit_height = height;
    
public voidsetFitWidth(short width)

        field_4_fit_width = width;
    
public voidsetFooterMargin(double footermargin)

        field_10_footermargin = footermargin;
    
public voidsetHResolution(short resolution)

        field_7_hresolution = resolution;
    
public voidsetHeaderMargin(double headermargin)

        field_9_headermargin = headermargin;
    
public voidsetLandscape(boolean ls)

        field_6_options = landscape.setShortBoolean(field_6_options, ls);
    
public voidsetLeftToRight(boolean ltor)

        field_6_options = lefttoright.setShortBoolean(field_6_options, ltor);
    
public voidsetNoColor(boolean mono)

        field_6_options = nocolor.setShortBoolean(field_6_options, mono);
    
public voidsetNoOrientation(boolean orientation)

        field_6_options = noOrientation.setShortBoolean(field_6_options, orientation);
    
public voidsetNotes(boolean printnotes)

        field_6_options = notes.setShortBoolean(field_6_options, printnotes);
    
public voidsetOptions(short options)

        field_6_options = options;
    
public voidsetPageStart(short start)

        field_3_page_start = start;
    
public voidsetPaperSize(short size)

        field_1_paper_size = size;
    
public voidsetScale(short scale)

        field_2_scale = scale;
    
public voidsetUsePage(boolean page)

        field_6_options = usepage.setShortBoolean(field_6_options, page);
    
public voidsetVResolution(short resolution)

        field_8_vresolution = resolution;
    
public voidsetValidSettings(boolean valid)

        field_6_options = validsettings.setShortBoolean(field_6_options, valid);
    
public java.lang.StringtoString()

        StringBuffer buffer = new StringBuffer();

        buffer.append("[PRINTSETUP]\n");
        buffer.append("    .papersize      = ").append(getPaperSize())
            .append("\n");
        buffer.append("    .scale          = ").append(getScale())
            .append("\n");
        buffer.append("    .pagestart      = ").append(getPageStart())
            .append("\n");
        buffer.append("    .fitwidth       = ").append(getFitWidth())
            .append("\n");
        buffer.append("    .fitheight      = ").append(getFitHeight())
            .append("\n");
        buffer.append("    .options        = ").append(getOptions())
            .append("\n");
        buffer.append("        .ltor       = ").append(getLeftToRight())
            .append("\n");
        buffer.append("        .landscape  = ").append(getLandscape())
            .append("\n");
        buffer.append("        .valid      = ").append(getValidSettings())
            .append("\n");
        buffer.append("        .mono       = ").append(getNoColor())
            .append("\n");
        buffer.append("        .draft      = ").append(getDraft())
            .append("\n");
        buffer.append("        .notes      = ").append(getNotes())
            .append("\n");
        buffer.append("        .noOrientat = ").append(getNoOrientation())
            .append("\n");
        buffer.append("        .usepage    = ").append(getUsePage())
            .append("\n");
        buffer.append("    .hresolution    = ").append(getHResolution())
            .append("\n");
        buffer.append("    .vresolution    = ").append(getVResolution())
            .append("\n");
        buffer.append("    .headermargin   = ").append(getHeaderMargin())
            .append("\n");
        buffer.append("    .footermargin   = ").append(getFooterMargin())
            .append("\n");
        buffer.append("    .copies         = ").append(getCopies())
            .append("\n");
        buffer.append("[/PRINTSETUP]\n");
        return buffer.toString();
    
protected voidvalidateSid(short id)

        if (id != sid)
        {
            throw new RecordFormatException(
                "NOT A valid PrintSetup record RECORD");
        }