How to use c# to access the names that defined in excels?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi:
I would like to use c# to access the names that defined in components
axspreedsheet. But I can not accomplish. why? the code like the followings:
System.Collections.IEnumerator myEnumerator =
Spreadsheet1.Names.GetEnumerator();
Console.WriteLine("The Array contains the following
values:");
int i = 0;
while ((myEnumerator.MoveNext()) && (myEnumerator.Current !=
null))
Console.WriteLine("[{0}] {1}", i++,
myEnumerator.Current);

the results only list "System._ComObject". why?
Is it can not access just because the type is protected?
 
The enumerator you are using is not returning strings to you. It is returning
an object (probably of type name). I would suggest looking at the object in
the debugger and seeing what property it may have to access the name.
 
I know it is a Object type. But it located at final level. It has no
property. How can i access to it?
--
marxi


Ciaran O''Donnell said:
The enumerator you are using is not returning strings to you. It is returning
an object (probably of type name). I would suggest looking at the object in
the debugger and seeing what property it may have to access the name.


--
Ciaran O''Donnell
http://wannabedeveloper.spaces.live.com


marxi said:
Hi:
I would like to use c# to access the names that defined in components
axspreedsheet. But I can not accomplish. why? the code like the followings:
System.Collections.IEnumerator myEnumerator =
Spreadsheet1.Names.GetEnumerator();
Console.WriteLine("The Array contains the following
values:");
int i = 0;
while ((myEnumerator.MoveNext()) && (myEnumerator.Current !=
null))
Console.WriteLine("[{0}] {1}", i++,
myEnumerator.Current);

the results only list "System._ComObject". why?
Is it can not access just because the type is protected?
 
can you helpl me? this problem have confused me many days! thank you very much!
--
marxi


marxi said:
I know it is a Object type. But it located at final level. It has no
property. How can i access to it?
--
marxi


Ciaran O''Donnell said:
The enumerator you are using is not returning strings to you. It is returning
an object (probably of type name). I would suggest looking at the object in
the debugger and seeing what property it may have to access the name.


--
Ciaran O''Donnell
http://wannabedeveloper.spaces.live.com


marxi said:
Hi:
I would like to use c# to access the names that defined in components
axspreedsheet. But I can not accomplish. why? the code like the followings:
System.Collections.IEnumerator myEnumerator =
Spreadsheet1.Names.GetEnumerator();
Console.WriteLine("The Array contains the following
values:");
int i = 0;
while ((myEnumerator.MoveNext()) && (myEnumerator.Current !=
null))
Console.WriteLine("[{0}] {1}", i++,
myEnumerator.Current);

the results only list "System._ComObject". why?
Is it can not access just because the type is protected?
 
Back
Top