From ffd6b3f8a09d7dccabcaa6aad106cc93a14b84a8 Mon Sep 17 00:00:00 2001 From: "Andrew C. Oliver" Date: Fri, 2 Mar 2007 03:13:13 +0000 Subject: [PATCH] http://issues.apache.org/bugzilla/show_bug.cgi?id=40548 git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@513605 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/poi/hssf/usermodel/HSSFWorkbook.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java b/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java index 875e261af0..9ce9f171b8 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java @@ -750,11 +750,14 @@ public class HSSFWorkbook NameRecord r = null; while ((r = (NameRecord) workbook.findNextRecordBySid(NameRecord.sid, index)) != null) { - int nameRecordSheetIndex = workbook.getSheetIndexFromExternSheetIndex(r.getEqualsToIndexToSheet() - 1); - if (isRowColHeaderRecord( r ) && nameRecordSheetIndex == sheetIndex) - { - return index; - } + int indexToSheet = r.getEqualsToIndexToSheet() -1; + if(indexToSheet > -1) { //ignore "GLOBAL" name records + int nameRecordSheetIndex = workbook.getSheetIndexFromExternSheetIndex(indexToSheet); + if (isRowColHeaderRecord( r ) && nameRecordSheetIndex == sheetIndex) + { + return index; + } + } index++; } -- 2.39.5