你怎么能设置编程使用的SpreadsheetGear定义名称范围有多大? [英] How can you set the scope for a defined name programmatically using SpreadsheetGear?

查看:454
本文介绍了你怎么能设置编程使用的SpreadsheetGear定义名称范围有多大?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用的SpreadsheetGear定义名称的工作的支持是不能作为Excel的其他部件一样好。

The support for working with defined names in SpreadsheetGear isn't as good as for other components of Excel.

可以这样做?如果是这样,怎么样?

Can this be done? If so, how?

当我从另一个工作簿一张纸上复印,范围仅限于工作表,我希望能够将它应用到整个工作簿。

When I copy in a sheet from another workbook, the scope is limited to that worksheet, and I'd like to be able to apply it to the whole workbook.

推荐答案

这是你如何定义的名称与工作簿范围

This is how you define a name with workbook scope

SpreadsheetGear.IWorkbook workbook = workbookView.ActiveWorkbook;
SpreadsheetGear.INames definedNames = workbook.Names;
definedNames.Add(name, refTo, SpreadsheetGear.ReferenceStyle.A1);
definedNames[name].Comment = "SomeComment";
definedNames[name].Visible = true;

当我从另一个工作簿一张纸上复印,范围仅限于工作表

如果我理解你correclty,你不能做你想做的,这在逻辑上是不可能的。该定义的名称总是应该有工作簿范围,也就是说,它是 workbook.Names 保存定义的名称信息。现在,基于这个事实,如果复制从workbookA到workbookB片,板材持有一无所知的定义的工作簿的名称( workbookA.Names ),因此,它永远不可能持有其引用。

If I understand you correclty, you cannot do what you want and it is logically impossible. The defined names always should have 'workbook scope', that is, it is workbook.Names that holds the defined names information. Now based on this fact, if you copy a sheet from workbookA to workbookB, the sheet holds nothing about the defined names of that workbook (workbookA.Names), thus it can never hold their references.

我希望这有助于。

这篇关于你怎么能设置编程使用的SpreadsheetGear定义名称范围有多大?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆