diff --git a/src/java/org/apache/poi/hssf/model/FormulaParser.java b/src/java/org/apache/poi/hssf/model/FormulaParser.java index 2141b53ed0..229aff2c89 100644 --- a/src/java/org/apache/poi/hssf/model/FormulaParser.java +++ b/src/java/org/apache/poi/hssf/model/FormulaParser.java @@ -129,7 +129,7 @@ public class FormulaParser { /** Recognize an Alpha Character */ private boolean IsAlpha(char c) { - return Character.isLetter(c) || c == '$'; + return Character.isLetter(c) || c == '$' || c=='_'; } diff --git a/src/testcases/org/apache/poi/hssf/model/TestFormulaParser.java b/src/testcases/org/apache/poi/hssf/model/TestFormulaParser.java index 1e69ce0ed3..812a42d71c 100644 --- a/src/testcases/org/apache/poi/hssf/model/TestFormulaParser.java +++ b/src/testcases/org/apache/poi/hssf/model/TestFormulaParser.java @@ -388,6 +388,21 @@ public class TestFormulaParser extends TestCase { assertTrue("IntPtg",(ptgs[1] instanceof IntPtg)); assertTrue("DividePtg",(ptgs[2] instanceof DividePtg)); } + + /** bug 35027, underscore in sheet name*/ + public void testUnderscore() { + HSSFWorkbook wb = new HSSFWorkbook(); + + wb.createSheet("Cash_Flow");; + + HSSFSheet sheet = wb.createSheet("Test"); + HSSFRow row = sheet.createRow(0); + HSSFCell cell; + + cell = row.createCell((short)0); + cell.setCellFormula("Cash_Flow!A1"); + + } public static void main(String [] args) { System.out.println("Testing org.apache.poi.hssf.record.formula.FormulaParser");