本文整理了Java中org.apache.poi.hssf.usermodel.HSSFWorkbook.getNumberOfSheets()
方法的一些代码示例,展示了HSSFWorkbook.getNumberOfSheets()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HSSFWorkbook.getNumberOfSheets()
方法的具体详情如下:
包路径:org.apache.poi.hssf.usermodel.HSSFWorkbook
类名称:HSSFWorkbook
方法名:getNumberOfSheets
[英]get the number of spreadsheets in the workbook (this will be three after serialization)
[中]获取工作簿中的电子表格数(序列化后为三个)
代码示例来源:origin: org.apache.poi/poi
/**
* Specifies if the defined name is a local name, and if so, which sheet it is on.
*
* @param index if greater than 0, the defined name is a local name and the value MUST be a 0-based index
* to the collection of sheets as they appear in the workbook.
* @throws IllegalArgumentException if the sheet index is invalid.
*/
public void setSheetIndex(int index){
int lastSheetIx = _book.getNumberOfSheets() - 1;
if (index < -1 || index > lastSheetIx) {
throw new IllegalArgumentException("Sheet index (" + index +") is out of range" +
(lastSheetIx == -1 ? "" : (" (0.." + lastSheetIx + ")")));
}
_definedNameRec.setSheetNumber(index + 1);
}
代码示例来源:origin: org.apache.poi/poi
private static List<Integer> getSheetsIndexes(String[] params, HSSFWorkbook workbook) {
List<Integer> list = new ArrayList<>();
list.addAll(getIndexesByIdArray(params));
list.addAll(getIndexesByName(params, workbook));
if (0 == list.size()) {
int size = workbook.getNumberOfSheets();
for (int i = 0; i < size; i++) {
list.add(i);
}
}
return list;
}
代码示例来源:origin: org.apache.poi/poi
System.out.println("done");
for(int i = 0; i < wb.getNumberOfSheets(); i++){
HSSFSheet sheet = wb.getSheetAt(i);
if(initDrawing) {
代码示例来源:origin: org.apache.poi/poi
for(int i=0;i<_wb.getNumberOfSheets();i++) {
HSSFSheet sheet = _wb.getSheetAt(i);
if(sheet == null) { continue; }
代码示例来源:origin: org.apache.poi/poi
private void updateFormulasForShift(FormulaShifter formulaShifter) {
int sheetIndex = _workbook.getSheetIndex(this);
short externSheetIndex = _book.checkExternSheet(sheetIndex);
// update formulas on this sheet that point to rows which have been moved
_sheet.updateFormulasAfterCellShift(formulaShifter, externSheetIndex);
// update formulas on other sheets that point to rows that have been moved on this sheet
int nSheets = _workbook.getNumberOfSheets();
for (int i = 0; i < nSheets; i++) {
InternalSheet otherSheet = _workbook.getSheetAt(i).getSheet();
if (otherSheet == this._sheet) {
continue;
}
short otherExtSheetIx = _book.checkExternSheet(i);
otherSheet.updateFormulasAfterCellShift(formulaShifter, otherExtSheetIx);
}
_workbook.getWorkbook().updateNamesAfterCellShift(formulaShifter);
}
代码示例来源:origin: org.apache.poi/poi
for(int sheetNum=0; sheetNum<workbook.getNumberOfSheets(); sheetNum++) {
HSSFSheet s = workbook.getSheetAt(sheetNum);
for (Row row : s) {
代码示例来源:origin: org.apache.poi/poi
for (int sheetNum = 0; sheetNum < workbook.getNumberOfSheets(); sheetNum++) {
HSSFSheet s = workbook.getSheetAt(sheetNum);
for (Row row : s) {
for (int sheetNum = 0; sheetNum < workbook.getNumberOfSheets(); sheetNum++) {
HSSFSheet s = workbook.getSheetAt(sheetNum);
for (Row row : s) {
代码示例来源:origin: FenixEdu/fenixedu-academic
private String[] getAllSpreadsheets(HSSFWorkbook wb) {
String[] spreadsheets = new String[wb.getNumberOfSheets()];
for (int i = 0; i < wb.getNumberOfSheets(); i++) {
spreadsheets[i] = wb.getSheetName(i);
}
return spreadsheets;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi
private static List<Integer> getSheetsIndexes(String[] params, HSSFWorkbook workbook) {
List<Integer> list = new ArrayList<>();
list.addAll(getIndexesByIdArray(params));
list.addAll(getIndexesByName(params, workbook));
if (0 == list.size()) {
int size = workbook.getNumberOfSheets();
for (int i = 0; i < size; i++) {
list.add(i);
}
}
return list;
}
代码示例来源:origin: com.haulmont.thirdparty/poi
private static List<Integer> getSheetsIndexes(String[] params, HSSFWorkbook workbook) {
List<Integer> list = new ArrayList<Integer>();
list.addAll(getIndexesByIdArray(params));
list.addAll(getIndexesByName(params, workbook));
if (0 == list.size()) {
int size = workbook.getNumberOfSheets();
for (int i = 0; i < size; i++) {
list.add(i);
}
}
return list;
}
代码示例来源:origin: stackoverflow.com
public static List<String> getCellOfAllSheets (File file, int row, int cell) throws IOException {
HSSFWorkbook workbook = new HSSFWorkbook(new FileInputStream(file));
List<String> rows = new ArrayList<>(workbook.getNumberOfSheets());
for (int numberOfSheet = 0; numberOfSheet < workbook.getNumberOfSheets(); numberOfSheet++) {
HSSFSheet sheet = workbook.getSheetAt(numberOfSheet);
rows.add(sheet.getRow(row).getCell(cell).getStringCellValue());
}
return rows;
}
代码示例来源:origin: stackoverflow.com
public static void main( String [] args ) {
try {
InputStream input = POIExample.class.getResourceAsStream( "qa.xls" );
POIFSFileSystem fs = new POIFSFileSystem( input );
HSSFWorkbook wb = new HSSFWorkbook(fs);
for (int i = 0; i < wb.getNumberOfSheets(); i++) {
HSSFSheet sheet = wb.getSheetAt(i);
// Do your stuff
}
} catch ( IOException ex ) {
ex.printStackTrace();
}
}
代码示例来源:origin: org.seasar.dao-codegen/s2dao-codegen-core
protected Map<String, Table> readCodeData(HSSFWorkbook book) {
Map<String, Table> tableMap = new LinkedHashMap<String, Table>();
for (int i = 0; i < book.getNumberOfSheets(); ++i) {
HSSFSheet sheet = book.getSheetAt(i);
Table table = getTable(sheet);
if (table != null) {
tableMap.put(table.getTableName(), table);
}
}
setupChildLinks(tableMap);
return tableMap;
}
代码示例来源:origin: cuba-platform/yarg
protected void copyPictures() {
for (int sheetNumber = 0; sheetNumber < templateWorkbook.getNumberOfSheets(); sheetNumber++) {
HSSFSheet templateSheet = templateWorkbook.getSheetAt(sheetNumber);
HSSFSheet resultSheet = resultWorkbook.getSheetAt(sheetNumber);
copyPicturesFromTemplateToResult(templateSheet, resultSheet);
}
}
代码示例来源:origin: com.haulmont.yarg/yarg
protected void copyPictures() {
for (int sheetNumber = 0; sheetNumber < templateWorkbook.getNumberOfSheets(); sheetNumber++) {
HSSFSheet templateSheet = templateWorkbook.getSheetAt(sheetNumber);
HSSFSheet resultSheet = resultWorkbook.getSheetAt(sheetNumber);
copyPicturesFromTemplateToResult(templateSheet, resultSheet);
}
}
代码示例来源:origin: com.haulmont.thirdparty/poi
void initDrawings(){
DrawingManager2 mgr = workbook.findDrawingGroup();
if(mgr != null) {
for(int i=0; i < getNumberOfSheets(); i++) {
getSheetAt(i).getDrawingPatriarch();
}
} else {
workbook.createDrawingGroup();
}
}
代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev
void initDrawings(){
DrawingManager2 mgr = workbook.findDrawingGroup();
if(mgr != null) {
for(int i=0; i < getNumberOfSheets(); i++) {
getSheetAt(i).getDrawingPatriarch();
}
} else {
workbook.createDrawingGroup();
}
}
代码示例来源:origin: org.apache.poi/poi-contrib
public void actionPerformed(ActionEvent e) {
//Create a new sheet then search for the sheet and make sure that the
//sheetPane shows it.
HSSFSheet newSheet = wb.createSheet();
for (int i=0; i<wb.getNumberOfSheets();i++) {
HSSFSheet sheet = wb.getSheetAt(i);
if (newSheet == sheet) {
sheetPane.insertTab(wb.getSheetName(i), null, makeSheetView(sheet), null, i);
}
}
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi
public void actionPerformed(ActionEvent e) {
//Create a new sheet then search for the sheet and make sure that the
//sheetPane shows it.
HSSFSheet newSheet = wb.createSheet();
for (int i=0; i<wb.getNumberOfSheets();i++) {
HSSFSheet sheet = wb.getSheetAt(i);
if (newSheet == sheet) {
sheetPane.insertTab(wb.getSheetName(i), null, makeSheetView(sheet), null, i);
}
}
}
}
代码示例来源:origin: ckpoint/CheckPoint
private void createReqUrlSheet(PoiWorkBook workBook, ReqUrl reqUrl) {
PoiWorkSheet sheet = workBook.createSheet(reqUrl.getSheetName(workBook.getWorkBook().getNumberOfSheets()));
sheet.nextRow();
sheet.createTitleCells(1.5, reqUrl.getMethod(), reqUrl.getUrl());
sheet.nextRow(2);
for (ParamType paramType : ParamType.values()) {
if (this.createParamSheet(sheet, paramType, reqUrl)) {
sheet.nextRow(3);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!