You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ni...@apache.org on 2008/09/01 18:51:09 UTC
svn commit: r691017 -
/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java
Author: nick
Date: Mon Sep 1 09:51:09 2008
New Revision: 691017
URL: http://svn.apache.org/viewvc?rev=691017&view=rev
Log:
DV related fixes from Pierre Lavignotte
Modified:
poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java
Modified: poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java?rev=691017&r1=691016&r2=691017&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java Mon Sep 1 09:51:09 2008
@@ -34,7 +34,14 @@
import org.apache.poi.hssf.model.FormulaParser;
import org.apache.poi.hssf.model.Sheet;
import org.apache.poi.hssf.model.Workbook;
-import org.apache.poi.hssf.record.*;
+import org.apache.poi.hssf.record.CellValueRecordInterface;
+import org.apache.poi.hssf.record.DVRecord;
+import org.apache.poi.hssf.record.EscherAggregate;
+import org.apache.poi.hssf.record.Record;
+import org.apache.poi.hssf.record.RowRecord;
+import org.apache.poi.hssf.record.SCLRecord;
+import org.apache.poi.hssf.record.WSBoolRecord;
+import org.apache.poi.hssf.record.WindowTwoRecord;
import org.apache.poi.hssf.record.aggregates.DataValidityTable;
import org.apache.poi.hssf.record.formula.Ptg;
import org.apache.poi.hssf.record.formula.RefPtg;
@@ -366,6 +373,22 @@
DVRecord dvRecord = dataValidation.createDVRecord(workbook);
dvt.addDataValidation(dvRecord);
}
+
+ /**
+ * Get the DVRecords objects that are associated to this sheet
+ * @return a list of DVRecord instances
+ */
+ public List getDVRecords() {
+ List dvRecords = new ArrayList();
+ List records = sheet.getRecords();
+
+ for(int index=0; index<records.size(); index++) {
+ if(records.get(index) instanceof DVRecord) {
+ dvRecords.add(records.get(index));
+ }
+ }
+ return dvRecords;
+ }
/**
@@ -1254,11 +1277,9 @@
// Since it's a formula cell, process the
// formula string, and look to see if
// it contains any references
- FormulaParser fp = new FormulaParser(c.getCellFormula(), workbook);
- fp.parse();
// Look for references, and update if needed
- Ptg[] ptgs = fp.getRPNPtg();
+ Ptg[] ptgs = FormulaParser.parse(c.getCellFormula(), workbook);
boolean changed = false;
for(int i=0; i<ptgs.length; i++) {
if(ptgs[i] instanceof RefPtg) {
@@ -1275,7 +1296,7 @@
// re-create the formula string
if(changed) {
c.setCellFormula(
- fp.toFormulaString(ptgs)
+ FormulaParser.toFormulaString(workbook, ptgs)
);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org