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

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

/*
 * Copyright (c) 2017-2021, [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.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.ttzero.excel.reader.ExcelReadException;

/**
 * 2.4.138 HFPicture
 * 

* The HFPicture record specifies a picture used by a sheet header or footer. * The picture MUST be specified in either an OfficeArtDgContainer or * OfficeArtDggContainer record as specified in [MSODRAW]. *

* The picture can be continued across multiple HFPicture records. The * OfficeArtClientAnchor structure mentioned in [MS-ODRAW] refers to * OfficeArtClientAnchorHF. * * @author guanquan.wang at 2021-07-06 19:59 */ public class HFPictureParser { private static final Logger LOGGER = LoggerFactory.getLogger(HFPictureParser.class); public static void get(Block block) { block.ready(); // (12 bytes): An FrtHeader structure. The frtHeader.rt field MUST be 0x0866. FrtHeader frtHeader = FrtHeaderParser.get(block); if (frtHeader.rt != getId()) { throw new ExcelReadException("[HFPicture] the frtHeader.rt field MUST be 0x0866."); } Option o = Option.of(block.nextInt()); /* A - fIsDrawing (1 bit): A bit that specifies whether rgDrawing is an OfficeArtDgContainer record as specified in [MS-ODRAW]. MUST be a value from the following table: Value | Meaning ------|------------------------------------------------------ 0 | rgDrawing is an OfficeArtDggContainer record as | specified in [MS-ODRAW] and fIsDrawingGroup MUST be 1. ------|------------------------------------------------------ 1 | rgDrawing is an OfficeArtDgContainer record as | specified in [MS-ODRAW] and fIsDrawingGroup MUST be 0. */ if (o.get(0) == 0) { LOGGER.debug("[OfficeArtDggContainer] record"); } else { LOGGER.debug("[OfficeArtDgContainer] record"); } /* B - fIsDrawingGroup (1 bit): A bit that specifies whether rgDrawing is an OfficeArtDggContainer record as specified in [MS-ODRAW]. MUST be a value from the following table: Value | Meaning ------|------------------------------------------------------ 0 | rgDrawing is an OfficeArtDgContainer record as | specified in [MS-ODRAW] and fIsDrawing MUST be 1. ------|------------------------------------------------------ 1 | rgDrawing is an OfficeArtDggContainer record as | specified in [MS-ODRAW] and fIsDrawing MUST be 0. */ if (o.get(1) == 0 && o.get(0) == 0) { throw new ExcelReadException("rgDrawing is an OfficeArtDgContainer record and fIsDrawing MUST be 1."); } if (o.get(1) == 1 && o.get(0) == 1) { throw new ExcelReadException("rgDrawing is an OfficeArtDggContainer record and fIsDrawing MUST be 0."); } // C - fContinue (1 bit): A bit that specifies whether this record is continuing the // previous HFPicture record. The value 0 means it is the first HFPicture record. LOGGER.debug("fContinue: {}", o.get(2)); block.commit(); } public static short getId() { return ParserIdentifier.HFPICTURE; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy