Jump to content

BIRT Developer Center Download


Photo
- - - - -

Invalid formula syntax. when using setDefinedName


  • Please log in to reply
No replies to this topic

#1 meindert

meindert

    Junior Member

  • Members
  • Pip
  • 6 posts

Posted 29 November 2011 - 03:44 AM

I have a strange issue with setDefinedName on a excel 2003 template.
The function works when using a blank excel sheet, but when I copy and past a sheet from excel 2010 it doesn't.
I have removed this sheet from the template but still the function is not working.
Attached is the 'corrupted' excel template. Can anybody debug the setDefinedName function to figure out why this is happening?

Here is my junit test case:
public class Actuate extends TestCase {
	
	@Test 
	public void testExcel2003(){
		File exceltemplate = new File("C:/Source Code/eclipse/esos/war/reports/blank.xls");
		Document doc=null;
		try {
			doc = new Document(new Group(), exceltemplate, null);
			doc.getBook().setAutoRecalc(false);
			CellFormat cf = doc.getBook().getCellFormat(0, 0, 0, 0, 0, 0);
			BookModel book = BookModel.Factory.create(doc.getBook());

			book.setDefinedName("NAMEDCELL", "'Sheet1'!$B$2");
		}catch(Exception ex){
			ex.printStackTrace();
		}
	}
}

Attached Files