poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adile <aidoumaj...@gmail.com>
Subject Re: Same named cells in several sheets
Date Fri, 04 May 2012 08:27:55 GMT
hi, thank you a lot for your reply.

I try your suggestion but that doesn't work...

my example for reading :

InputStream inp = new FileInputStream(file);
HSSFWorkbook wb = new HSSFWorkbook(inp);

HSSFName name = wb.getName("MySheet!aLibellé");
			    
			    if(name != null)
			    	System.out.println("RefersFormula "+name.getRefersToFormula());
			    else
			    	System.out.println("name is null");

when i try with MySheet!aLibellé i have name null and when i try without
MySheet! it's return me the aLibellé adress but in wrong sheet


my example for writting :


                            HSSFName namedCell = wb.createName();
			    namedCell.setNameName("id_product");
			    String reference = "sheet1!$A$1"; // area reference
			    namedCell.setRefersToFormula(reference);
		    
			    Name namedCell2 = wb.createName();
			    namedCell2.setNameName("id_product");
			    String reference2 = "sheet2!$A$1"; // area reference
			    namedCell2.setRefersToFormula(reference2);

this code throw an exception :
java.lang.IllegalArgumentException: The workbook already contains this name:
id_product


thank youu


--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Same-named-cells-in-several-sheets-tp5683541p5685173.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Mime
View raw message