当前位置: 首页>>代码示例>>Java>>正文


Java XSSFReader.getSharedStringsTable方法代码示例

本文整理汇总了Java中org.apache.poi.xssf.eventusermodel.XSSFReader.getSharedStringsTable方法的典型用法代码示例。如果您正苦于以下问题:Java XSSFReader.getSharedStringsTable方法的具体用法?Java XSSFReader.getSharedStringsTable怎么用?Java XSSFReader.getSharedStringsTable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.poi.xssf.eventusermodel.XSSFReader的用法示例。


在下文中一共展示了XSSFReader.getSharedStringsTable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: process

import org.apache.poi.xssf.eventusermodel.XSSFReader; //导入方法依赖的package包/类
/**
 * 遍历工作簿中所有的电子表格
 * 
 * @param filename string
 * @throws Exception  if an error occurred
 */
public void process(String filename) throws Exception {
	OPCPackage pkg = OPCPackage.open(filename);
	XSSFReader r = new XSSFReader(pkg);
	SharedStringsTable sst = r.getSharedStringsTable();
	XMLReader parser = fetchSheetParser(sst);
	Iterator<InputStream> sheets = r.getSheetsData();
	while (sheets.hasNext()) {
		curRow = 0;
		sheetIndex++;
		InputStream sheet = sheets.next();
		InputSource sheetSource = new InputSource(sheet);
		parser.parse(sheetSource);
		sheet.close();
	}
}
 
开发者ID:iBase4J,项目名称:iBase4J-Common,代码行数:22,代码来源:Excel2007Reader.java

示例2: process

import org.apache.poi.xssf.eventusermodel.XSSFReader; //导入方法依赖的package包/类
/**
 * 遍历工作簿中所有的电子表格
 * 
 * @param filename
 * @throws Exception
 */
public void process(String filename) throws Exception {
	OPCPackage pkg = OPCPackage.open(filename);
	XSSFReader r = new XSSFReader(pkg);
	SharedStringsTable sst = r.getSharedStringsTable();
	XMLReader parser = fetchSheetParser(sst);
	Iterator<InputStream> sheets = r.getSheetsData();
	while (sheets.hasNext()) {
		curRow = 0;
		sheetIndex++;
		InputStream sheet = sheets.next();
		InputSource sheetSource = new InputSource(sheet);
		parser.parse(sheetSource);
		sheet.close();
	}
}
 
开发者ID:guokezheng,项目名称:automat,代码行数:22,代码来源:Excel2007Reader.java

示例3: process

import org.apache.poi.xssf.eventusermodel.XSSFReader; //导入方法依赖的package包/类
/**
 * 遍历工作簿中所有的电子表格
 * 
 * @param filename
 * @throws Exception
 */
public void process(InputStream stream) throws Exception {
	OPCPackage pkg = OPCPackage.open(stream);
	XSSFReader r = new XSSFReader(pkg);
	SharedStringsTable sst = r.getSharedStringsTable();
	XMLReader parser = fetchSheetParser(sst);
	Iterator<InputStream> sheets = r.getSheetsData();
	while (sheets.hasNext()) {
		curRow = 0;
		sheetIndex++;
		InputStream sheet = sheets.next();
		InputSource sheetSource = new InputSource(sheet);
		parser.parse(sheetSource);
		sheet.close();
	}
}
 
开发者ID:tb544731152,项目名称:iBase4J,代码行数:22,代码来源:Excel2007Reader.java

示例4: processAll

import org.apache.poi.xssf.eventusermodel.XSSFReader; //导入方法依赖的package包/类
private void processAll(OPCPackage pkg)
		throws IOException, OpenXML4JException, InvalidFormatException, SAXException {
	XSSFReader xssfReader = new XSSFReader(pkg);
	mStylesTable = xssfReader.getStylesTable();
	SharedStringsTable sst = xssfReader.getSharedStringsTable();
	XMLReader parser = this.fetchSheetParser(sst);
	Iterator<InputStream> sheets = xssfReader.getSheetsData();
	while (sheets.hasNext()) {
		mCurrentRowIndex = 0;
		mSheetIndex++;
		InputStream sheet = sheets.next();
		InputSource sheetSource = new InputSource(sheet);
		parser.parse(sheetSource);
		sheet.close();
	}
	pkg.close();
}
 
开发者ID:wuwz,项目名称:ExcelKit,代码行数:18,代码来源:XlsxReader.java

示例5: processBySheet

import org.apache.poi.xssf.eventusermodel.XSSFReader; //导入方法依赖的package包/类
private void processBySheet(int sheetIndex, OPCPackage pkg)
		throws IOException, OpenXML4JException, InvalidFormatException, SAXException {
	XSSFReader r = new XSSFReader(pkg);
	SharedStringsTable sst = r.getSharedStringsTable();

	XMLReader parser = fetchSheetParser(sst);

	// rId2 found by processing the Workbook
	// 根据 rId# 或 rSheet# 查找sheet
	InputStream sheet = r.getSheet("rId" + (sheetIndex + 1));
	mSheetIndex++;
	InputSource sheetSource = new InputSource(sheet);
	parser.parse(sheetSource);
	sheet.close();
	pkg.close();
}
 
开发者ID:wuwz,项目名称:ExcelKit,代码行数:17,代码来源:XlsxReader.java

示例6: execute

import org.apache.poi.xssf.eventusermodel.XSSFReader; //导入方法依赖的package包/类
public void execute(InputStream inputStream, IParseExcelRowMapper parseExcelRowMapper) throws Exception {
	OPCPackage pkg = OPCPackage.open(inputStream);
	XSSFReader xssfReader = new XSSFReader(pkg);
	sst = xssfReader.getSharedStringsTable();
	stylesTable = xssfReader.getStylesTable();

	SAXParserFactory saxFactory = SAXParserFactory.newInstance();
	SAXParser saxParser = saxFactory.newSAXParser();
	XMLReader parser = saxParser.getXMLReader();
	parser.setContentHandler(new XSSFParserHandler());

	this.parseExcelRowMapper = parseExcelRowMapper;

	XSSFReader.SheetIterator iter = (XSSFReader.SheetIterator) xssfReader.getSheetsData();
	while (iter.hasNext()) {
		curRow = 0;
		sheetIndex++;
		InputStream sheet = iter.next();
		sheetName = iter.getSheetName();
		InputSource sheetSource = new InputSource(sheet);
		parser.parse(sheetSource);
		sheet.close();
	}

}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:26,代码来源:XSSFParser.java

示例7: readExcel

import org.apache.poi.xssf.eventusermodel.XSSFReader; //导入方法依赖的package包/类
private <T> List<T> readExcel(OPCPackage opcPackage, Class<?> pojoClass, ImportParams params,
                              ISaxRowRead rowRead, IExcelReadRowHanlder hanlder) {
    try {
        XSSFReader xssfReader = new XSSFReader(opcPackage);
        SharedStringsTable sst = xssfReader.getSharedStringsTable();
        if (rowRead == null) {
            rowRead = new SaxRowRead(pojoClass, params, hanlder);
        }
        XMLReader parser = fetchSheetParser(sst, rowRead);
        Iterator<InputStream> sheets = xssfReader.getSheetsData();
        int sheetIndex = 0;
        while (sheets.hasNext() && sheetIndex < params.getSheetNum()) {
            sheetIndex++;
            InputStream sheet = sheets.next();
            InputSource sheetSource = new InputSource(sheet);
            parser.parse(sheetSource);
            sheet.close();
        }
        return rowRead.getList();
    } catch (Exception e) {
        LOGGER.error(e.getMessage(), e);
        throw new ExcelImportException("SAX导入数据失败");
    }
}
 
开发者ID:rushingpig,项目名称:poix,代码行数:25,代码来源:SaxReadExcel.java

示例8: processOneSheet

import org.apache.poi.xssf.eventusermodel.XSSFReader; //导入方法依赖的package包/类
public void processOneSheet(String filename, int sheetId) throws Exception {
	OPCPackage pkg = OPCPackage.open(filename);
	XSSFReader r = new XSSFReader(pkg);
	SharedStringsTable sst = r.getSharedStringsTable();

	XMLReader parser = fetchSheetParser(sst);

	// rId2 found by processing the Workbook
	// 根据 rId# 或 rSheet# 查找sheet
	InputStream sheet2 = r.getSheet("rId" + sheetId);
	sheetIndex++;
	InputSource sheetSource = new InputSource(sheet2);
	parser.parse(sheetSource);
	sheet2.close();
	pkg.close();
}
 
开发者ID:RayleighChen,项目名称:Improve,代码行数:17,代码来源:XxlsAbstract.java

示例9: process

import org.apache.poi.xssf.eventusermodel.XSSFReader; //导入方法依赖的package包/类
/**
 * 遍历 excel 文件
 */
public void process(String filename) throws Exception {
	OPCPackage pkg = OPCPackage.open(filename);
	XSSFReader r = new XSSFReader(pkg);
	SharedStringsTable sst = r.getSharedStringsTable();

	XMLReader parser = fetchSheetParser(sst);

	Iterator<InputStream> sheets = r.getSheetsData();
	while (sheets.hasNext()) {
		curRow = 0;
		sheetIndex++;
		InputStream sheet = sheets.next();
		InputSource sheetSource = new InputSource(sheet);
		parser.parse(sheetSource);
		sheet.close();
	}
	pkg.close();
}
 
开发者ID:RayleighChen,项目名称:Improve,代码行数:22,代码来源:XxlsAbstract.java

示例10: readOneSheet

import org.apache.poi.xssf.eventusermodel.XSSFReader; //导入方法依赖的package包/类
/** 
 * 读取第一个工作簿的入口方法 
 * @param path 
 */  
public List<?> readOneSheet(InputStream input,String excelType) throws Exception {  
    OPCPackage pkg = OPCPackage.open(input);    
    XSSFReader r = new XSSFReader(pkg);  
    SharedStringsTable sst = r.getSharedStringsTable();  
    
    if(excelType.equals(Constant.ENITY_TYPE_ROLEPERSIONAL)){
    	
    	lists = new ArrayList<AuthRoleUser>();
    }
    
    XMLReader parser = fetchSheetParser(sst);  
          
    InputStream sheet = r.getSheet("rId1");  
  
    InputSource sheetSource = new InputSource(sheet);  
    parser.parse(sheetSource);  
    
    
    if(excelType.equals(Constant.ENITY_TYPE_ROLEPERSIONAL)){

    	return lists;
    }
    sheet.close();        
    return lists;
}
 
开发者ID:lz84,项目名称:bachelor,代码行数:30,代码来源:ParseBigDatasExcel.java

示例11: process

import org.apache.poi.xssf.eventusermodel.XSSFReader; //导入方法依赖的package包/类
/** 
 * 读取所有工作簿的入口方法 
 * @param path 
 * @throws Exception 
 */  
public void process(String path) throws Exception {  
    OPCPackage pkg = OPCPackage.open(path);  
    XSSFReader r = new XSSFReader(pkg);  
    SharedStringsTable sst = r.getSharedStringsTable();  
  
    XMLReader parser = fetchSheetParser(sst);  
  
    Iterator<InputStream> sheets = r.getSheetsData();  
    while (sheets.hasNext()) {  
        curRow = 0;  
        sheetIndex++;  
        InputStream sheet = sheets.next();  
        InputSource sheetSource = new InputSource(sheet);  
        parser.parse(sheetSource);  
        sheet.close();  
    }  
}
 
开发者ID:lz84,项目名称:bachelor,代码行数:23,代码来源:ParseBigDatasExcel.java

示例12: XlsxSheetToRowsHandler

import org.apache.poi.xssf.eventusermodel.XSSFReader; //导入方法依赖的package包/类
public XlsxSheetToRowsHandler(XlsxRowCallback callback, XSSFReader xssfReader, ExcelConfiguration configuration)
        throws Exception {
    _callback = callback;
    _configuration = configuration;

    _sharedStringTable = xssfReader.getSharedStringsTable();
    _stylesTable = xssfReader.getStylesTable();

    _value = new StringBuilder();
    _style = new StyleBuilder();
    _rowValues = new ArrayList<String>();
    _styles = new ArrayList<Style>();
    _rowNumber = -1;
    _inCell = false;
    _inFormula = false;
}
 
开发者ID:apache,项目名称:metamodel,代码行数:17,代码来源:XlsxSheetToRowsHandler.java

示例13: processOneSheet

import org.apache.poi.xssf.eventusermodel.XSSFReader; //导入方法依赖的package包/类
/**
 * 只遍历一个电子表格,其中sheetId为要遍历的sheet索引,从1开始,1-3
 * 
 * @param filename
 * @param sheetId
 * @throws Exception
 */
public void processOneSheet(String filename, int sheetId) throws Exception {
	OPCPackage pkg = OPCPackage.open(filename);
	XSSFReader r = new XSSFReader(pkg);
	SharedStringsTable sst = r.getSharedStringsTable();
	XMLReader parser = fetchSheetParser(sst);

	// 根据 rId# 或 rSheet# 查找sheet
	InputStream sheet2 = r.getSheet("rId" + sheetId);
	sheetIndex++;
	InputSource sheetSource = new InputSource(sheet2);
	parser.parse(sheetSource);
	sheet2.close();
}
 
开发者ID:iBase4J,项目名称:iBase4J-Common,代码行数:21,代码来源:Excel2007Reader.java

示例14: StAXBasedParser

import org.apache.poi.xssf.eventusermodel.XSSFReader; //导入方法依赖的package包/类
/**
 * Create instance
 * @param inputStream sheet input stream
 * @param pluginConfig config options
 * @param writer {@link VectorContainerWriter} for writing values into vectors.
 * @param managedBuf Workspace buffer.
 */
public StAXBasedParser(final InputStream inputStream, final ExcelFormatPluginConfig pluginConfig,
                       final VectorContainerWriter writer, final ArrowBuf managedBuf,
                       final HashSet<String> columnsToProject) throws Exception {
  pkgInputStream = OPCPackage.open(inputStream);
  this.writer = writer.rootAsMap();
  this.managedBuf = managedBuf;

  final XSSFReader xssfReader = new XSSFReader(pkgInputStream);

  // Find the sheet id of the given sheet name in workbook
  try (final InputStream wbInputStream = xssfReader.getWorkbookData()) {
    final String sheetId = ExcelUtil.getSheetId(wbInputStream, pluginConfig.sheet);
    if (sheetId == null) {
      throw new SheetNotFoundException();
    }

    // Open the InputStream for sheet
    sheetInputStream = xssfReader.getSheet(sheetId);
  }


  // WARNING: XSSFReader can actually return null instances of sst and styles
  sst = xssfReader.getSharedStringsTable();
  styles = checkNotNull(xssfReader.getStylesTable(), "Expected a valid styles table instance");

  init(pluginConfig.extractHeader, pluginConfig.hasMergedCells);

  this.columnsToProject = columnsToProject;
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:37,代码来源:StAXBasedParser.java

示例15: processSheet

import org.apache.poi.xssf.eventusermodel.XSSFReader; //导入方法依赖的package包/类
public void processSheet(InputStream inputStream, DataTable dataTable, PrintWriter tempOut) throws Exception {
    dbglog.info("entering processSheet");
    OPCPackage pkg = OPCPackage.open(inputStream);
    XSSFReader r = new XSSFReader(pkg);
    SharedStringsTable sst = r.getSharedStringsTable();

    XMLReader parser = fetchSheetParser(sst, dataTable, tempOut);

    // rId2 found by processing the Workbook
    // Seems to either be rId# or rSheet#
    InputStream sheet1 = r.getSheet("rId1");
    InputSource sheetSource = new InputSource(sheet1);
    parser.parse(sheetSource);
    sheet1.close();
}
 
开发者ID:pengchengluo,项目名称:Peking-University-Open-Research-Data-Platform,代码行数:16,代码来源:XLSXFileReader.java


注:本文中的org.apache.poi.xssf.eventusermodel.XSSFReader.getSharedStringsTable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。