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

org.ttzero.excel.entity.e3.PageSetupParser Maven / Gradle / Ivy

/*
 * Copyright (c) 2019-2020, [email protected] All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.ttzero.excel.entity.e3;

/**
 * 5.73 PAGESETUP
 * 

* This record is part of the Page Settings Block (➜4.4). * It stores the page format settings of the current sheet. * The pages may be scaled in percent or by using an * absolute number of pages. *

* This setting is located in the SHEETPR * record (➜5.97). * If pages are scaled in percent, the scaling factor * in this record is used, otherwise the “Fit to pages” values. * One of the “Fit to pages” values may be 0. In this case * the sheet is scaled to fit only to the other value. * * @author guanquan.wang at 2019-02-01 15:28 */ public class PageSetupParser { public static PageSetup get(Block block) { // Size of next data short size = block.nextShort(); PageSetup pageSetup = new PageSetup(); // Paper size pageSetup.pagerSize = block.nextShort(); // Scaling factor in percent pageSetup.scalingFactor = block.nextShort(); // Start page number pageSetup.startPageNumber = block.nextShort(); // Fit worksheet width to this number of pages (0 = use as many as needed) pageSetup.fitWidth = block.nextShort(); // Fit worksheet height to this number of pages (0 = use as many as needed) pageSetup.fitHeight = block.nextShort(); // Option flags pageSetup.option = Option.of(block.nextShort()); // Print resolution in dpi pageSetup.pr = block.nextShort(); // Vertical print resolution in dpi pageSetup.vpr = block.nextShort(); // Header margin (IEEE 754 floating-point value, 64-bit double precision) pageSetup.headerMargin = block.nextDouble(); // Footer margin (IEEE 754 floating-point value, 64-bit double precision) pageSetup.footerMargin = block.nextDouble(); // Number of copies to print pageSetup.noc = block.nextShort(); return pageSetup; } public static short getId() { return ParserIdentifier.PAGESETUP; } public static class PageSetup { short pagerSize; short scalingFactor; short startPageNumber; short fitWidth; short fitHeight; Option option; short pr; // Print resolution in dpi short vpr; // Vertical print resolution in dpi double headerMargin; double footerMargin; short noc; // Number of copies to print public short getPagerSize() { return pagerSize; } public short getScalingFactor() { return scalingFactor; } public short getStartPageNumber() { return startPageNumber; } public short getFitWidth() { return fitWidth; } public short getFitHeight() { return fitHeight; } public Option getOption() { return option; } public short getPr() { return pr; } public short getVpr() { return vpr; } public double getHeaderMargin() { return headerMargin; } public double getFooterMargin() { return footerMargin; } public short getNoc() { return noc; } @Override public String toString() { return " pagerSize: " + pagerSize + " scalingFactor: " + scalingFactor + " startPageNumber: " + startPageNumber + " fitWidth: " + fitWidth + " fitHeight: " + fitHeight + " option: " + option + " pr: " + pr + " vpr: " + vpr + " headerMargin: " + headerMargin + " footerMargin: " + footerMargin + " noc: " + noc; } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy