From c1196ff362246da02a47fb9bf99b95cac6d09dfa Mon Sep 17 00:00:00 2001 From: "Amol S. Deshmukh" Date: Wed, 20 Jul 2005 14:11:38 +0000 Subject: [PATCH] [35799] getXFIndexForColAt(short ) added git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353752 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/poi/hssf/model/Sheet.java | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/src/java/org/apache/poi/hssf/model/Sheet.java b/src/java/org/apache/poi/hssf/model/Sheet.java index fcfc5edff5..cd9754413d 100644 --- a/src/java/org/apache/poi/hssf/model/Sheet.java +++ b/src/java/org/apache/poi/hssf/model/Sheet.java @@ -822,7 +822,7 @@ public class Sheet implements Model //Add the references to the DBCells in the IndexRecord (one for each block) int blockCount = rows.getRowBlockCount(); //Calculate the size of this IndexRecord - int indexRecSize = index.getRecordSizeForBlockCount(blockCount); + int indexRecSize = IndexRecord.getRecordSizeForBlockCount(blockCount); int rowBlockOffset = 0; int cellBlockOffset = 0; @@ -1833,6 +1833,37 @@ public class Sheet implements Model } return retval; } + + /** + * get the index to the ExtendedFormatRecord "associated" with + * the column at specified 0-based index. (In this case, an + * ExtendedFormatRecord index is actually associated with a + * ColumnInfoRecord which spans 1 or more columns) + *
+ * Returns the index to the default ExtendedFormatRecord (0xF) + * if no ColumnInfoRecord exists that includes the column + * index specified. + * @param column + * @return index of ExtendedFormatRecord associated with + * ColumnInfoRecord that includes the column index or the + * index of the default ExtendedFormatRecord (0xF) + */ + public short getXFIndexForColAt(short column) { + short retval = 0; + ColumnInfoRecord ci = null; + if (columns != null) { + for (Iterator iterator = columns.getIterator(); iterator.hasNext();) { + ci = (ColumnInfoRecord) iterator.next(); + if ((ci.getFirstColumn() <= column) + && (column <= ci.getLastColumn())) { + break; + } + ci = null; + } + } + retval = (ci != null) ? ci.getXFIndex() : 0xF; + return retval; + } /** * set the width for a given column in 1/20th of a character width units -- 2.39.5