
org.ttzero.excel.entity.e3.Window2Parser 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.110 WINDOW2
*
* This record contains additional settings for the document
* window (BIFF2-BIFF4) or for the window of a specific
* worksheet (BIFF5-BIFF8).
* It is part of the Sheet View Settings Block (➜4.5).
*
* @author guanquan.wang on 2019-02-06
*/
public class Window2Parser {
public static Window2 get(Block block) {
// Size of next data
short size = block.nextShort();
Window2 window = new Window2();
// Option flags (see below)
window.option = Option.of(block.nextShort());
// Index to first visible row
window.row = block.nextUnsignedShort();
// Index to first visible column
window.column = block.nextShort();
// Colour index of grid line colour (➜5.74).
// Note that in BIFF2-BIFF5 an RGB colour is written instead.
window.colourIndex = block.nextShort();
// Not used
block.skip(2);
// Cached magnification factor in page break preview (in percent); 0 = Default (60%)
window.pageBreak = block.nextShort();
// Cached magnification factor in normal view (in percent); 0 = Default (100%)
window.normalView = block.nextShort();
// Not used
block.skip(4);
return window;
}
public static short getId() {
return ParserIdentifier.WINDOW2;
}
public static class Window2 extends BIFF8Cell {
Option option;
short colourIndex;
short pageBreak;
short normalView;
@Override
public String toString() {
return "option: " + option +
" row: " + row +
" column: " + column +
" colourIndex: " + colourIndex +
" pageBreak: " + pageBreak +
" normalView: " + normalView
;
}
}
}