You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.1 KiB
34 lines
1.1 KiB
package com.alibaba.excel.analysis.v07.handlers; |
|
|
|
import org.xml.sax.Attributes; |
|
|
|
import com.alibaba.excel.constant.ExcelXmlConstants; |
|
import com.alibaba.excel.context.xlsx.XlsxReadContext; |
|
import com.alibaba.excel.enums.CellExtraTypeEnum; |
|
import com.alibaba.excel.metadata.CellExtra; |
|
import com.alibaba.excel.util.StringUtils; |
|
|
|
/** |
|
* Cell Handler |
|
* |
|
* @author Jiaju Zhuang |
|
*/ |
|
public class MergeCellTagHandler extends AbstractXlsxTagHandler { |
|
|
|
@Override |
|
public boolean support(XlsxReadContext xlsxReadContext) { |
|
return xlsxReadContext.readWorkbookHolder().getExtraReadSet().contains(CellExtraTypeEnum.MERGE); |
|
} |
|
|
|
@Override |
|
public void startElement(XlsxReadContext xlsxReadContext, String name, Attributes attributes) { |
|
String ref = attributes.getValue(ExcelXmlConstants.ATTRIBUTE_REF); |
|
if (StringUtils.isEmpty(ref)) { |
|
return; |
|
} |
|
CellExtra cellExtra = new CellExtra(CellExtraTypeEnum.MERGE, null, ref); |
|
xlsxReadContext.readSheetHolder().setCellExtra(cellExtra); |
|
xlsxReadContext.analysisEventProcessor().extra(xlsxReadContext); |
|
} |
|
|
|
}
|
|
|