package com.taover.easyexcel.analysis.v07.handlers; import org.xml.sax.Attributes; import org.xml.sax.SAXException; import com.taover.easyexcel.constant.ExcelXmlConstants; import com.taover.easyexcel.context.xlsx.XlsxReadContext; import com.taover.easyexcel.exception.SheetNotSelectedException; /** * Cell Handler * * @author jipengfei */ public class SheetViewHandler extends AbstractXlsxTagHandler { @Override public void startElement(XlsxReadContext xlsxReadContext, String name, Attributes attributes) throws SAXException { //whether just read selected sheet Boolean readJustSelected = xlsxReadContext.readWorkbookHolder().getReadJustSelected(); if(ExcelXmlConstants.SHEET_VIEW_TAG.equals(name) && readJustSelected != null && readJustSelected && !"1".equals(attributes.getValue(ExcelXmlConstants.ATTRIBUTE_TAB_SELECTED))) { throw new SAXException("not selected sheet, just read selected sheet", new SheetNotSelectedException()); } } }