org.ttzero.excel.entity.e3.RKParser 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.AllInOneCell;
/**
* 5.87 RK
*
* This record represents a cell that contains an RK value
* (encoded integer or floating-point value). If a
* floating-point value cannot be encoded to an RK value,
* a NUMBER record (➜5.71)
* will be written.
*
* This record replaces the record INTEGER (➜5.60) written
* in BIFF2.
*
* @see RK
* @author guanquan.wang at 2019-01-31 09:35
*/
public class RKParser {
public static RK get(Block block) {
block.skip(2);
RK rk = new RK();
// Index to row Offset 0 Size 2
rk.row = block.nextUnsignedShort();
// Index to column Offset 2 Size 2
rk.column = block.nextShort();
// Index to XF record (➜5.115) Offset 4 Size 2
rk.xf = block.nextShort();
// RK value (➜2.5.5)
rk.value = RKValue.valueOf(block.nextInt());
return rk;
}
public static void get(Block block, AllInOneCell cell) {
block.skip(2);
// Index to row Offset 0 Size 2
cell.row = block.nextUnsignedShort();
// Index to column Offset 2 Size 2
cell.column = block.nextShort();
// Index to XF record (➜5.115) Offset 4 Size 2
cell.xf = block.nextShort();
// RK value (➜2.5.5)
cell.getOrNewRKValue().initWith(block.nextInt());
}
public static short getId() {
return ParserIdentifier.RK;
}
}