Named cell

Jul 7, 2010 at 6:38 PM

Hi all,

First of all, really great work Tim !

Looks like this stuff actually works, and very good as well (-:

I have a small question, searched it up quite a bit but failed to find an answer:

How can I use SetCellValue to a Named cell on the worksheet?

suppose I have a cell called "Report name". I really don't want to refer to it as "cell A5", but rather by it's "logical" name.

Many thanks in advance!

 

Coordinator
Jul 7, 2010 at 8:47 PM
Edited Jul 7, 2010 at 8:52 PM
Hi itai_me, Thanks for you comments and for your interest in ExtremeML. I completely agree with you that using named cells is more robust than absolute cell references, especially since it provides loose coupling between the template and the code, which is always advisable if there is any possibility that a user might tamper with the template. Unfortunately, ExtremeML doesn't currently support this mode of operation although, from memory, it is not a huge leap to add this type of functionality to the library. You might want to read the following thread ... http://extrememl.codeplex.com/Thread/View.aspx?ThreadId=81305 ... which covers some of the background to this issue and explains its current status. Sorry not to be able to give you a more positive answer and thanks for your continued interest and support. Tim
Jul 8, 2010 at 5:51 AM
Thanks for the fast reply, Indeed, defined names are kept inside xl\workbook.xml,, as: - <definedNames> <definedName name="cellPie1">גליון1!$P$9</definedName> <definedName name="cellTotal">גליון1!$P$17</definedName> </definedNames> only question is where does extremeML allows access to this data. Take care, Itai
Jul 8, 2010 at 5:58 AM
got it myself: ((ExtremeML.Core.WrapperBase<DocumentFormat.OpenXml.Spreadsheet.DefinedName>)(package.WorkbookPart.Workbook.DefinedNames.DefinedNames[0])).Wrapped (-:
Jul 8, 2010 at 2:52 PM

small fix - had to use

string sLocation = (((DocumentFormat.OpenXml.OpenXmlLeafTextElement)(((ExtremeML.Core.WrapperBase<DocumentFormat.OpenXml.Spreadsheet.DefinedName>)(package.WorkbookPart.Workbook.DefinedNames.DefinedNames[0])).Wrapped))).InnerText;

fast and dirty - changed some internal classes to public to gain access for the line above.