org.ttzero.excel.entity.e3.PaneParser 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.75 PANE
*
* This record stores the position of window panes.
* It is part of the Sheet View Settings Block (➜4.5).
* If the sheet does not contain any splits, this record
* will not occur.
*
* A sheet can be split in two different ways, with
* unfrozen panes or with frozen panes. A flag in the WINDOW2
* record (➜5.110)
* specifies, if the panes are frozen, which affects
* the contents of this record.
*
* @author guanquan.wang at 2019-02-01 16:18
*/
public class PaneParser {
public static Pane get(Block block) {
// Size of next data
short size = block.nextShort();
Pane pane = new Pane();
// Position of the vertical split (px, 0 = No vertical split):
// Unfrozen pane: Width of the left pane(s) (in twips = 1/20 of a point)
// Frozen pane: Number of visible columns in left pane(s)
pane.pv = block.nextShort();
// Position of the horizontal split (py, 0 = No horizontal split):
// Unfrozen pane: Height of the top pane(s) (in twips = 1/20 of a point)
// Frozen pane: Number of visible rows in top pane(s)
pane.ph = block.nextShort();
// Index to first visible row in bottom pane(s)
pane.firstRow = block.nextUnsignedShort();
// Index to first visible column in right pane(s)
pane.firstColumn = block.nextShort();
// Identifier of pane with active cell cursor (see below)
pane.id = block.nextByte();
// Not used (BIFF5-BIFF8 only, not written in BIFF2-BIFF4)
pane.nu = block.nextByte();
return pane;
}
public static short getId() {
return ParserIdentifier.PANE;
}
public static class Pane {
short pv;
short ph;
int firstRow;
short firstColumn;
byte id;
byte nu;
public short getPv() {
return pv;
}
public short getPh() {
return ph;
}
public int getFirstRow() {
return firstRow;
}
public short getFirstColumn() {
return firstColumn;
}
public byte getId() {
return id;
}
public byte getNu() {
return nu;
}
@Override
public String toString() {
return
" pv: " + pv +
" ph: " + ph +
" firstRow: " + firstRow +
" firstColumn: " + firstColumn +
" id: " + id +
" nu: " + nu;
}
}
}