ASF Bugzilla – Attachment 33171 Details for
Bug 58452
[PATCH] Set cell formulas containing unregistered function names
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
supporting changes (java docs, add FormulaParsingWorkbook.createName)
supportingChanges-createName.patch (text/plain), 5.11 KB, created by
Javen O'Neal
on 2015-10-06 20:18:56 UTC
(
hide
)
Description:
supporting changes (java docs, add FormulaParsingWorkbook.createName)
Filename:
MIME Type:
Creator:
Javen O'Neal
Created:
2015-10-06 20:18:56 UTC
Size:
5.11 KB
patch
obsolete
>Index: src/java/org/apache/poi/ss/formula/FormulaParsingWorkbook.java >=================================================================== >--- src/java/org/apache/poi/ss/formula/FormulaParsingWorkbook.java (revision 1706948) >+++ src/java/org/apache/poi/ss/formula/FormulaParsingWorkbook.java (working copy) >@@ -19,6 +19,7 @@ > > import org.apache.poi.ss.SpreadsheetVersion; > import org.apache.poi.ss.formula.ptg.Ptg; >+import org.apache.poi.ss.usermodel.Name; > import org.apache.poi.ss.util.AreaReference; > import org.apache.poi.ss.util.CellReference; > >@@ -34,7 +35,15 @@ > * named range name matching is case insensitive > */ > EvaluationName getName(String name, int sheetIndex); >+ >+ /** >+ * Return the underlying workbook >+ */ >+ Name createName(); > >+ /** >+ * Return an external name (named range, function, user-defined function) Ptg >+ */ > Ptg getNameXPtg(String name, SheetIdentifier sheet); > > /** >Index: src/java/org/apache/poi/ss/formula/ptg/NameXPxg.java >=================================================================== >--- src/java/org/apache/poi/ss/formula/ptg/NameXPxg.java (revision 1706948) >+++ src/java/org/apache/poi/ss/formula/ptg/NameXPxg.java (working copy) >@@ -40,6 +40,9 @@ > public NameXPxg(String sheetName, String nameName) { > this(-1, sheetName, nameName); > } >+ public NameXPxg(String nameName) { >+ this(-1, null, nameName); >+ } > > public String toString(){ > StringBuffer sb = new StringBuffer(); >Index: src/java/org/apache/poi/hssf/usermodel/HSSFEvaluationWorkbook.java >=================================================================== >--- src/java/org/apache/poi/hssf/usermodel/HSSFEvaluationWorkbook.java (revision 1706948) >+++ src/java/org/apache/poi/hssf/usermodel/HSSFEvaluationWorkbook.java (working copy) >@@ -62,6 +62,11 @@ > _uBook = book; > _iBook = book.getWorkbook(); > } >+ >+ @Override >+ public HSSFName createName() { >+ return _uBook.createName(); >+ } > > public int getExternalSheetIndex(String sheetName) { > int sheetIndex = _uBook.getSheetIndex(sheetName); >@@ -79,6 +84,10 @@ > int extIx = getSheetExtIx(sheet); > return new Area3DPtg(areaRef, extIx); > } >+ /** >+ * Return an external name (named range, function, user-defined function) Ptg >+ */ >+ @Override > public NameXPtg getNameXPtg(String name, SheetIdentifier sheet) { > int sheetRefIndex = getSheetExtIx(sheet); > return _iBook.getNameXPtg(name, sheetRefIndex, _uBook.getUDFFinder()); >Index: src/ooxml/java/org/apache/poi/xssf/usermodel/BaseXSSFEvaluationWorkbook.java >=================================================================== >--- src/ooxml/java/org/apache/poi/xssf/usermodel/BaseXSSFEvaluationWorkbook.java (revision 1706948) >+++ src/ooxml/java/org/apache/poi/xssf/usermodel/BaseXSSFEvaluationWorkbook.java (working copy) >@@ -130,6 +130,15 @@ > } > } > >+ /** >+ * Return EvaluationName wrapper around the matching XSSFName (named range) >+ * @param name case-aware but case-insensitive named range in workbook >+ * @param sheetIndex index of sheet if named range scope is limited to one sheet >+ * if named range scope is global to the workbook, sheetIndex is -1. >+ * @return If name is a named range in the workbook, returns >+ * EvaluationName corresponding to that named range >+ * Returns null if there is no named range with the same name and scope in the workbook >+ */ > public EvaluationName getName(String name, int sheetIndex) { > for (int i = 0; i < _uBook.getNumberOfNames(); i++) { > XSSFName nm = _uBook.getNameAt(i); >@@ -137,7 +146,7 @@ > int nameSheetindex = nm.getSheetIndex(); > if (name.equalsIgnoreCase(nameText) && > (nameSheetindex == -1 || nameSheetindex == sheetIndex)) { >- return new Name(_uBook.getNameAt(i), i, this); >+ return new Name(nm, i, this); > } > } > return sheetIndex == -1 ? null : getName(name, -1); >@@ -179,6 +188,10 @@ > > } > >+ /** >+ * Return an external name (named range, function, user-defined function) Pxg >+ */ >+ @Override > public NameXPxg getNameXPtg(String name, SheetIdentifier sheet) { > // First, try to find it as a User Defined Function > IndexedUDFFinder udfFinder = (IndexedUDFFinder)getUDFFinder(); >@@ -290,6 +303,10 @@ > int ix = namePtg.getIndex(); > return new Name(_uBook.getNameAt(ix), ix, this); > } >+ @Override >+ public XSSFName createName() { >+ return _uBook.createName(); >+ } > > public UDFFinder getUDFFinder(){ > return _uBook.getUDFFinder(); >Index: src/ooxml/testcases/org/apache/poi/xssf/XSSFTestDataSamples.java >=================================================================== >--- src/ooxml/testcases/org/apache/poi/xssf/XSSFTestDataSamples.java (revision 1706948) >+++ src/ooxml/testcases/org/apache/poi/xssf/XSSFTestDataSamples.java (working copy) >@@ -44,6 +44,9 @@ > */ > public static final String TEST_OUTPUT_DIR = "poi.test.xssf.output.dir"; > >+ public static File getSampleFile(String sampleFileName) { >+ return HSSFTestDataSamples.getSampleFile(sampleFileName); >+ } > public static OPCPackage openSamplePackage(String sampleName) { > try { > return OPCPackage.open(
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 58452
:
33167
|
33168
|
33170
| 33171 |
33172
|
33173