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

org.ttzero.excel.entity.e3.SelectionParser 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;

import org.ttzero.excel.reader.Dimension;

import java.util.Arrays;

/**
 * 5.93 SELECTION
 * 

* This record contains the addresses of all selected cell ranges * and the position of the active cell for a pane in the current sheet. * It is part of the Sheet View Settings Block (➜4.5). * There is one SELECTION record for each pane in the sheet. * * @author guanquan.wang at 2019-02-05 */ public class SelectionParser { public static Selection get(Block block) { // Size of next data short size = block.nextShort(); Selection selection = new Selection(); // Pane identifier (see PANE record, ➜5.75) selection.paneId = block.nextByte(); // Index to row of the active cell selection.row = block.nextUnsignedShort(); // Index to column of the active cell selection.column = block.nextShort(); // TODO Index into the following cell range list to the entry that contains the active cell block.nextShort(); short sz = (short) (size - 7 >> 3); Dimension[] cellRanges = new Dimension[sz]; for (short i = 0; i < sz; i++) { cellRanges[i] = DimensionParser.get(block); } selection.cellRanges = cellRanges; return selection; } public static short getId() { return ParserIdentifier.SELECTION; } public static class Selection extends BIFF8Cell { byte paneId; Dimension[] cellRanges; @Override public String toString() { return "paneId: " + paneId + " row: " + row + " column: " + column + " cellRanges: " + Arrays.toString(cellRanges); } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy