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


Java Row.iterator方法代码示例

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


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

示例1: writeRow

import org.apache.poi.ss.usermodel.Row; //导入方法依赖的package包/类
private void writeRow(final Row row, final XMLStreamWriter out, final Map<String, String> columns) {
	try {
		int rowIndex = row.getRowNum();
		out.writeStartElement("row");
		final String rowNum = String.valueOf(rowIndex);
		out.writeAttribute("row", rowNum);
		int count = 0;
		Iterator<Cell> cellIterator = row.iterator();
		while (cellIterator.hasNext()) {
			Cell cell = cellIterator.next();
			int columnIndex = cell.getColumnIndex();
			if (this.exportEmptyCells) {
				while (count < columnIndex) {
					this.writeAnyCell(rowIndex, count, null, out, columns);
					count++;
				}
			}
			this.writeCell(cell, out, columns);
			count++;
		}
		out.writeEndElement();
	} catch (XMLStreamException e) {
		e.printStackTrace();
	}

}
 
开发者ID:Stwissel,项目名称:Excel2XML,代码行数:27,代码来源:E2xCmdline.java

示例2: parseRow

import org.apache.poi.ss.usermodel.Row; //导入方法依赖的package包/类
public void parseRow(Row row, SheetFormat sf, Object obj) throws RowParsingException {

		Iterator<Cell> cellItr = row.iterator();
		cellItr.next(); // for sr. no. column skip
		for (ColumnFormat field : sf.getColumns())
			if (cellItr.hasNext()) {
				Cell cell = cellItr.next();
				try {
					set(obj, field.getName(), getValue(cell, field.getType()));
				} catch (CellParsingException e) {
					throw new RowParsingException(e.getMessage() + " , at row " + row.getRowNum());
				}
			}
	}
 
开发者ID:NeebalLearningPvtLtd,项目名称:Excel-to-POJO,代码行数:15,代码来源:RowParser.java

示例3: writeFirstRow

import org.apache.poi.ss.usermodel.Row; //导入方法依赖的package包/类
/**
 * Gets field names from column titles and writes the titles element with
 * columns out
 *
 * @param row
 *            the row to parse
 * @param columns
 *            the map with the values
 */
private void writeFirstRow(Row row, final XMLStreamWriter out, final Map<String, String> columns) {
	Iterator<Cell> cellIterator = row.iterator();
	int count = 0;
	try {
		out.writeStartElement("columns");
		while (cellIterator.hasNext()) {
			Cell cell = cellIterator.next();
			// Generate empty headers if required
			if (this.exportEmptyCells) {
				int columnIndex = cell.getColumnIndex();
				while (count < columnIndex) {
					String noLabel = "NoLabel" + String.valueOf(count);
					columns.put(String.valueOf(count), noLabel);
					out.writeStartElement("column");
					out.writeAttribute("empty", "true");
					out.writeAttribute("col", String.valueOf(count));
					out.writeAttribute("title", noLabel);
					out.writeEndElement();
					count++;
				}
			}

			final String cellValue = this.getCellValue(cell, count);
			if (cellValue != null) {
				columns.put(String.valueOf(cell.getColumnIndex()), cellValue);
				out.writeStartElement("column");
				out.writeAttribute("title", cellValue);
				out.writeAttribute("col", String.valueOf(cell.getColumnIndex()));
				out.writeEndElement();
			}
			count++;
		}
		out.writeEndElement();
	} catch (XMLStreamException e) {
		e.printStackTrace();
	}
}
 
开发者ID:Stwissel,项目名称:Excel2XML,代码行数:47,代码来源:E2xCmdline.java


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