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


Java XSSFSheet.getSheetName方法代码示例

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


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

示例1: parseExcel

import org.apache.poi.xssf.usermodel.XSSFSheet; //导入方法依赖的package包/类
@SuppressWarnings("resource")
private List<Map<String,Object>> parseExcel(InputStream stream) throws Exception {
	List<Map<String,Object>> mapList=new ArrayList<Map<String,Object>>();
	XSSFWorkbook wb = new XSSFWorkbook(stream);
	for (int i = 0; i < wb.getNumberOfSheets(); i++) {
		XSSFSheet sheet = wb.getSheetAt(i);
		if (sheet == null) {
			continue;
		}
		String name = sheet.getSheetName();
		Map<String,Object> map=new HashMap<String,Object>();
		map.put("name",name);
		map.put("data", buildVariables(sheet));
		mapList.add(map);
	}
	return mapList;
}
 
开发者ID:youseries,项目名称:urule,代码行数:18,代码来源:PackageServletHandler.java

示例2: export

import org.apache.poi.xssf.usermodel.XSSFSheet; //导入方法依赖的package包/类
/**
 * Exports a single sheet to a file
 *
 * @param sheet
 * @throws FactoryConfigurationError
 * @throws XMLStreamException
 * @throws UnsupportedEncodingException
 * @throws FileNotFoundException
 */
private void export(final XSSFSheet sheet, final XMLStreamWriter out)
		throws UnsupportedEncodingException, XMLStreamException, FactoryConfigurationError, FileNotFoundException {
	boolean isFirst = true;
	final Map<String, String> columns = new HashMap<String, String>();
	final String sheetName = sheet.getSheetName();
	System.out.print(sheetName);
	out.writeStartElement("sheet");
	out.writeAttribute("name", sheetName);
	Iterator<Row> rowIterator = sheet.rowIterator();
	while (rowIterator.hasNext()) {
		Row row = rowIterator.next();
		if (isFirst) {
			isFirst = false;
			this.writeFirstRow(row, out, columns);
		} else {
			this.writeRow(row, out, columns);
		}
	}
	out.writeEndElement();
	System.out.println("..");
}
 
开发者ID:Stwissel,项目名称:Excel2XML,代码行数:31,代码来源:E2xCmdline.java

示例3: XSLXSource

import org.apache.poi.xssf.usermodel.XSSFSheet; //导入方法依赖的package包/类
public XSLXSource(Resource resource, XSSFWorkbook workbook) {
    this.resource = resource;
    this.workbook = workbook;
    String fragment = resource.getFragment();
    XSSFSheet sheet;
    if (fragment == null) {
        sheet = workbook.getSheetAt(0);
    } else {
        sheet = workbook.getSheet(fragment);
        if (sheet == null) {
            throw new IllegalArgumentException("Unable to find Sheet named '" + fragment + "'");
        }
    }
    this.sheet = sheet;
    this.rows = this.sheet.iterator();
    if (!rows.hasNext()) {
        throw new IllegalArgumentException(sheet.getSheetName() + " is empty");
    }
    XSSFRow row = nextRow();
    this.firstColumn = row.getFirstCellNum();
    this.headers = readHeaders(row, this.firstColumn);

}
 
开发者ID:theysay,项目名称:preceive-batch,代码行数:24,代码来源:XLSXSourceProvider.java

示例4: readPatients

import org.apache.poi.xssf.usermodel.XSSFSheet; //导入方法依赖的package包/类
/**
 * Parse the list of patients from the workbook.
 *
 * @return A list of {@link Patient} objects.
 */
private List<Patient> readPatients() throws DataProviderException {
	XSSFSheet sheet = readRequiredSheet("patient");
	String sheetName = sheet.getSheetName();
	List<Patient> result = new ArrayList<>();
	Iterator<Row> rows = sheet.rowIterator();
	rows.next(); // skip header row
	while (rows.hasNext()) {
		Row row = rows.next();
		Patient patient = new Patient();
		patient.setId(readLongValue(sheetName, row.getCell(0)));
		patient.setFirstName(readStringValue(sheetName, row.getCell(1)));
		patient.setLastName(readStringValue(sheetName, row.getCell(2)));
		patient.setDateOfBirth(readDateValue(sheetName, row.getCell(3)));
		patient.setLanguage(readStringValue(sheetName, row.getCell(4)));
		patient.setMaritalStatus(readStringValue(sheetName, row.getCell(5)));
		patient.setRace(readStringValue(sheetName, row.getCell(6)));
		patient.setGender(readStringValue(sheetName, row.getCell(7)));
		result.add(patient);
	}
	return result;
}
 
开发者ID:eurekaclinical,项目名称:eureka,代码行数:27,代码来源:XlsxDataProvider.java

示例5: readProviders

import org.apache.poi.xssf.usermodel.XSSFSheet; //导入方法依赖的package包/类
/**
 * Parse the list of providers in the workbook.
 *
 * @return A list of {@link Provider} objects.
 */
private List<Provider> readProviders() throws DataProviderException {
	XSSFSheet sheet = readRequiredSheet("provider");
	String sheetName = sheet.getSheetName();
	List<Provider> result = new ArrayList<>();
	Iterator<Row> rows = sheet.rowIterator();
	rows.next(); // skip header row
	while (rows.hasNext()) {
		Row row = rows.next();
		Provider provider = new Provider();
		provider.setId(readLongValue(sheetName, row.getCell(0)));
		provider.setFirstName(readStringValue(sheetName, row.getCell(1)));
		provider.setLastName(readStringValue(sheetName, row.getCell(2)));
		result.add(provider);
	}
	return result;
}
 
开发者ID:eurekaclinical,项目名称:eureka,代码行数:22,代码来源:XlsxDataProvider.java

示例6: readEncounters

import org.apache.poi.xssf.usermodel.XSSFSheet; //导入方法依赖的package包/类
/**
 * Parse the list of encounters in the workbook.
 *
 * @return A list of {@link Encounter} objects.
 */
private List<Encounter> readEncounters() throws DataProviderException {
	XSSFSheet sheet = readRequiredSheet("encounter");
	String sheetName = sheet.getSheetName();
	List<Encounter> result = new ArrayList<>();
	Iterator<Row> rows = sheet.rowIterator();
	LOGGER.debug("Encounter iterator: {}", Integer.valueOf(rows.hashCode()));
	rows.next(); // skip header row
	while (rows.hasNext()) {
		Row row = rows.next();
		Encounter encounter = new Encounter();
		encounter.setId(readLongValue(sheetName, row.getCell(0)));
		encounter.setPatientId(readLongValue(sheetName, row.getCell(1)));
		encounter.setProviderId(readLongValue(sheetName, row.getCell(2)));
		encounter.setStart(readDateValue(sheetName, row.getCell(3)));
		encounter.setEnd(readDateValue(sheetName, row.getCell(4)));
		encounter.setType(readStringValue(sheetName, row.getCell(5)));
		encounter.setDischargeDisposition(readStringValue(sheetName, row.getCell(6)));
		result.add(encounter);
	}
	return result;
}
 
开发者ID:eurekaclinical,项目名称:eureka,代码行数:27,代码来源:XlsxDataProvider.java

示例7: readCpts

import org.apache.poi.xssf.usermodel.XSSFSheet; //导入方法依赖的package包/类
/**
 * Parse the list of CPT codes in the workbook.
 *
 * @return A list of {@link CPT} objects.
 */
private List<CPT> readCpts() throws DataProviderException {
	XSSFSheet sheet = this.workbook.getSheet("eCPT");
	List<CPT> result = new ArrayList<>();
	if (sheet != null) {
		String sheetName = sheet.getSheetName();
		Iterator<Row> rows = sheet.rowIterator();
		rows.next(); // skip header row
		while (rows.hasNext()) {
			Row row = rows.next();
			CPT cpt = new CPT();
			cpt.setId(readStringValue(sheetName, row.getCell(0)));
			cpt.setEncounterId(readLongValue(sheetName, row.getCell(1)));
			cpt.setTimestamp(readDateValue(sheetName, row.getCell(2)));
			cpt.setEntityId(readStringValue(sheetName, row.getCell(3)));
			result.add(cpt);
		}
	}
	return result;
}
 
开发者ID:eurekaclinical,项目名称:eureka,代码行数:25,代码来源:XlsxDataProvider.java

示例8: readIcd9Procedures

import org.apache.poi.xssf.usermodel.XSSFSheet; //导入方法依赖的package包/类
/**
 * Parse the list of ICD9 Procedure codes present in the workbook.
 *
 * @return A list of {@link Icd9Procedure} objects.
 */
private List<Icd9Procedure> readIcd9Procedures() throws DataProviderException {
	XSSFSheet sheet = this.workbook.getSheet("eICD9P");
	List<Icd9Procedure> result = new ArrayList<>();
	if (sheet != null) {
		String sheetName = sheet.getSheetName();
		Iterator<Row> rows = sheet.rowIterator();
		rows.next(); // skip header row
		while (rows.hasNext()) {
			Row row = rows.next();
			Icd9Procedure procedure = new Icd9Procedure();
			procedure.setId(readStringValue(sheetName, row.getCell(0)));
			procedure.setEncounterId(readLongValue(sheetName, row.getCell(1)));
			procedure.setTimestamp(readDateValue(sheetName, row
					.getCell(2)));
			procedure.setEntityId(readStringValue(sheetName, row
					.getCell(3)));
			result.add(procedure);
		}
	}
	return result;
}
 
开发者ID:eurekaclinical,项目名称:eureka,代码行数:27,代码来源:XlsxDataProvider.java

示例9: readMedications

import org.apache.poi.xssf.usermodel.XSSFSheet; //导入方法依赖的package包/类
/**
 * Parse the list of medications present in the workbook.
 *
 * @return A list of {@link Medication} objects.
 */
private List<Medication> readMedications() throws DataProviderException {
	XSSFSheet sheet = this.workbook.getSheet("eMEDS");
	List<Medication> result = new ArrayList<>();
	if (sheet != null) {
		String sheetName = sheet.getSheetName();
		Iterator<Row> rows = sheet.rowIterator();
		rows.next(); // skip header row
		while (rows.hasNext()) {
			Row row = rows.next();
			Medication medication = new Medication();
			medication.setId(readStringValue(sheetName, row.getCell(0)));
			medication.setEncounterId(readLongValue(sheetName, row
					.getCell(1)));
			medication.setTimestamp(readDateValue(sheetName, row
					.getCell(2)));
			medication.setEntityId(readStringValue(sheetName, row
					.getCell(3)));
			result.add(medication);
		}
	}
	return result;
}
 
开发者ID:eurekaclinical,项目名称:eureka,代码行数:28,代码来源:XlsxDataProvider.java

示例10: readLabs

import org.apache.poi.xssf.usermodel.XSSFSheet; //导入方法依赖的package包/类
/**
 * Parse the list of labs present in the workbook's "eLABS" worksheet.
 *
 * @return A list of {@link Lab} objects.
 */
private List<Lab> readLabs() throws DataProviderException {
	XSSFSheet sheet = this.workbook.getSheet("eLABS");
	List<Lab> result = new ArrayList<>();
	if (sheet != null) {
		String sheetName = sheet.getSheetName();
		Iterator<Row> rows = sheet.rowIterator();
		rows.next(); // skip header row
		while (rows.hasNext()) {
			Row row = rows.next();
			Lab lab = new Lab();
			lab.setId(readStringValue(sheetName, row.getCell(0)));
			lab.setEncounterId(readLongValue(sheetName, row.getCell(1)));
			lab.setTimestamp(readDateValue(sheetName, row.getCell(2)));
			lab.setEntityId(readStringValue(sheetName, row.getCell(3)));
			lab.setResultAsStr(readStringValue(sheetName, row.getCell(4)));
			lab.setResultAsNum(readDoubleValue(sheetName, row.getCell(5)));
			lab.setUnits(readStringValue(sheetName, row.getCell(6)));
			lab.setFlag(readStringValue(sheetName, row.getCell(7)));
			result.add(lab);
		}
	}
	return result;
}
 
开发者ID:eurekaclinical,项目名称:eureka,代码行数:29,代码来源:XlsxDataProvider.java

示例11: readVitals

import org.apache.poi.xssf.usermodel.XSSFSheet; //导入方法依赖的package包/类
/**
 * Parse the list of vitals present in the workbook's "eVITALS" worksheet.
 *
 * @return A list of {@link Vital} objects.
 */
private List<Vital> readVitals() throws DataProviderException {
	XSSFSheet sheet = this.workbook.getSheet("eVITALS");
	List<Vital> result = new ArrayList<>();
	if (sheet != null) {
		String sheetName = sheet.getSheetName();
		Iterator<Row> rows = sheet.rowIterator();
		rows.next(); // skip header row
		while (rows.hasNext()) {
			Row row = rows.next();
			Vital vital = new Vital();
			vital.setId(readStringValue(sheetName, row.getCell(0)));
			vital.setEncounterId(readLongValue(sheetName, row.getCell(1)));
			vital.setTimestamp(readDateValue(sheetName, row.getCell(2)));
			vital.setEntityId(readStringValue(sheetName, row.getCell(3)));
			vital.setResultAsStr(readStringValue(sheetName, row.getCell(4)));
			vital.setResultAsNum(readDoubleValue(sheetName, row.getCell(5)));
			vital.setUnits(readStringValue(sheetName, row.getCell(6)));
			vital.setFlag(readStringValue(sheetName, row.getCell(7)));
			result.add(vital);
		}
	}
	return result;
}
 
开发者ID:eurekaclinical,项目名称:eureka,代码行数:29,代码来源:XlsxDataProvider.java

示例12: getXMLWriter

import org.apache.poi.xssf.usermodel.XSSFSheet; //导入方法依赖的package包/类
private XMLStreamWriter getXMLWriter(XSSFSheet sheet)
		throws FileNotFoundException, UnsupportedEncodingException, XMLStreamException {
	final String outputSheetName = this.outputFileName + "." + sheet.getSheetName() + OUTPUT_EXTENSION;
	final File outFile = new File(outputSheetName);
	if (outFile.exists()) {
		outFile.delete();
	}
	OutputStream outputStream = new FileOutputStream(outFile);
	return this.getXMLWriter(outputStream);
}
 
开发者ID:Stwissel,项目名称:Excel2XML,代码行数:11,代码来源:E2xCmdline.java

示例13: readSheet

import org.apache.poi.xssf.usermodel.XSSFSheet; //导入方法依赖的package包/类
protected XSSFSheet readSheet(int index, String name) {
    XSSFSheet sheet = workbook.getSheetAt(index);
    if (!sheet.getSheetName().equals(name)) {
        throw new IllegalArgumentException("The sheet (" + sheet.getSheetName() + ") at index (" + index
                + ") is expected to have another name (" + name + ")");
    }
    return sheet;
}
 
开发者ID:xmlking,项目名称:ml-experiments,代码行数:9,代码来源:AbstractXlsxSolutionImporter.java

示例14: readAllSheets

import org.apache.poi.xssf.usermodel.XSSFSheet; //导入方法依赖的package包/类
private void readAllSheets(XSSFWorkbook workbook, ExpowFileLib expowFile) {
	//
	int sheetCount = workbook.getNumberOfSheets();
	for (int index = 0; index < sheetCount; index++) {
		XSSFSheet sheet = workbook.getSheetAt(index);
		ExpowSheet expowSheet = new ExpowSheetLib(index, sheet.getSheetName());
		fillSheet(sheet, expowSheet);
		expowFile.addSheet(expowSheet);
	}
}
 
开发者ID:nextreesoft,项目名称:expow,代码行数:11,代码来源:ExpowFileReaderLib.java

示例15: readSheet

import org.apache.poi.xssf.usermodel.XSSFSheet; //导入方法依赖的package包/类
private void readSheet(XSSFWorkbook workbook, ExpowFileLib expowFile, int sheetIndex) {
	//
	int sheetCount = workbook.getNumberOfSheets();
	for (int index = 0; index < sheetCount; index++) {
		if (index != sheetIndex) {
			continue; 
		}
		
		XSSFSheet sheet = workbook.getSheetAt(index);
		ExpowSheet expowSheet = new ExpowSheetLib(index, sheet.getSheetName());
		fillSheet(sheet, expowSheet); 
		expowFile.addSheet(expowSheet);
		break; 
	}
}
 
开发者ID:nextreesoft,项目名称:expow,代码行数:16,代码来源:ExpowFileReaderLib.java


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