Calc/Features/Calc name range enchancement(step1)

From Apache OpenOffice Wiki
< Calc‎ | Features
Revision as of 07:03, 14 August 2012 by Zhaoshzh (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

MS Excel can support worksheet/workbook scope defined name. User can use same string to create new name if the 2 names are in different ranges.

Ms name range.JPG

When AOO loading a xlsx file which has duplicated defined name, AOO will only change the name. But any other place which use the defined name is not changed, which will cause problems. For example,in VBA project, if it used a name with “aaa” in the range of workbook,if there is also a name with “aaa” in the range of worksheet,Aoo will change the name to “aaa_1”. The reference to the second one will be changed to an invalid name. And it can be checked in the define names dialog, there are 2 items, one is “aaa” and the second is changed to “aaa_1”.

Old name range.JPG

This enchancemnet will support (1)loading worksheet scope defined name from MS xlsx/xls and ods file. (2)export defined name to MS xls(2003) and ods file.


if MS office defined range names with a sheet or a work book,import it in Aoo, make the name of work sheet to the original,but with a flag of sheet name,for example,the name is "aaa" in the range of work sheet, it will be "aaa (sheet1)" in the define name dialog , and the name “aaa” will be as its' original one if it is in the range of workbook.

New name range.JPG

Add functions in interface XNamedRange: com::sun::star::container::XNamed

1.string getScopeName();
//Return the name of the range.
2.void setScopeAndRangeName( [in] string aScopeName, [in] string aRangeName );
//Set the range name and the scope name.

Add functions in interface XNamedRanges: com::sun::star::container::XNameAccess

1. void addNewByScopeName(
			[in] string aScopeName,
			[in] string aRangeName,
			[in] string aContent,
			[in] com::sun::star::table::CellAddress aPosition,
			[in] long nType );
//Add a scope named range to the name range list.
2. void removeByScopeName( [in] string aScopeName, [in] string aRangeName );
//Remove a defined range from the name range list.	
3. boolean hasByScopeName( [in] string aScopeName, [in] string aRangeName );
//IF there is already a name range with name of aRangeName and the scope of aScopeName.
4. any getByScopeName( [in] string aScopeName, [in] string aRangeName )
			raises( com::sun::star::container::NoSuchElementException, 
					com::sun::star::lang::WrappedTargetException ); 
//Return a name range by scope name and range name.					
5.sequence<RangeScopeName> getElementScopeNames();
//Return all name ranges.
</blockquote>
Personal tools