2

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.

vwfreak
  • 369
  • 2
  • 5
  • 18

1 Answers1

3

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;

"When I copy in a sheet from another workbook, the scope is limited to that worksheet"

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.

I hope this helps.

MoonKnight
  • 23,214
  • 40
  • 145
  • 277
  • Thank you. I had gotten a little bit further in my investigation, and was just at the point where the clarification of this concept is what I needed. – vwfreak Dec 06 '12 at 18:56
  • What other spreadsheet controls are you comparing SpreadsheetGear to? We are evaluating SpreadsheetGear, ComponentOne, and SyncFusion spreadsheet controls. SpreadsheetGear seems to be the most performant and best. – BrokeMyLegBiking Dec 07 '12 at 11:43
  • SSG worksheet IO is unparralelled. It is by far the fastet for anything spreadsheet orientated. We have been using it for three years now and it is awsome for both development (great API) and performance wise. – MoonKnight Dec 07 '12 at 11:52