Calc/Features/Calc name range enchancement(step1)

From Apache OpenOffice Wiki
< Calc‎ | Features
Jump to: navigation, search

Issue 120478

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 uses 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 enchancement 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.

The export content in xml file.


If save a file to ODF file,the named range in a sheet will be added in the area of "<<[table:table]>>", the named range in a workbook will be added in the area of "<office:spreadsheet>".

What has been done in this item:

1. Support load duplicate names from MS 2003 file.

2. Support save duplicate names to MS 2003 file.

3. Support load duplicate names from MS 2007 file.

4. Support load duplicate names form ODF file.

5. Support save duplicate names to ODF file.


1. If a formula references a name that is defined in other workbook or a global range,

such formula can not be interpreted by Aoo.

2. Can not create duplicate named range in UI dialog.

Personal tools