c# - Excel interop: _Worksheet or Worksheet? -


I am currently writing about dynamic typing, and I give an example of Excel Interp. I have already reduced any office interop, and it shows the use of the _Worksheet interface for C # 4, but it also has a worksheet interface. I do not know what the difference is.

My unmanned simple demo app (shown below) works fine either - but if the best practice points to one or the other, then I will use it properly. / P>

  using the system; Using System.Linq; Using Excel = Microsoft.Office.Interop.Excel; Class DynamicExcel {static zero main () {var app = new Excel.app {visible = true}; App.Workbooks.Add (); // can use Excel._worksheet instead. Which is good Excel Worksheet Work Sheet = App. ActiveSite; Start Excel.Range = Worksheet Cell [1, 1]; Excel.Range end = workSheet.Cells [1, 20]; WorkSheet.get_Range (start, end) .Value2 = Noteworthy. Category (1, 20) .oir (); }}  

I'm trying to avoid full depth dip in com or office interoperability, just highlighting the new features of C # 4 - but I really do not want to do anything , Really dumb

(In fact, anything can be really dumb in the above code, please let me know in this case, instead of using "different 1 / T cells" instead of "A1: T1" It is easy to see that it is actually a category of 20 cells, and anything else is possibly accidental.)

Therefore, give me the _Worksheet or worksheet < / Code should use>, and why?

If I remember correctly - and my memory is a bit fuzzy, it's a long time Ever since I separated Excel PIA - this is the same.

An event is essentially a method, when an object is called, in .NET, event representatives are simple and simple but in COM, organize a whole group of event callbacks in the interface Too much common to do. So you have two interfaces on a given object - the "incoming" interface, the methods that you expect other people to call you, and the "Outgoing" interface, the methods that you can call on other people in the event Expected.

In Unmanaged Metadata - Type Library - Definitions of three things for a constructive object are: Incoming interface, Outgoing interface and the Caucus, which says, "I use a Creatable object This coming interface And this outgoing interface ".

Now when the type library is automatically translated into metadata, then those relationships, sadly, preserved it would be better for a hand-generated PIA that classes and interfaces in the managed world What do expectations to be more consistent, but sadly, it did not happen. That's why the office PIA appears to be duplicated, where there are two interfaces with every creative object, with the same stuff on them. One of the interfaces represents the interface, and one of them represents the incoming interface for that cocklace.

_Workbook Interface The workbook interface that comes with the workcolor colex is the workbook interface which is the interface that represents the cocalse, and therefore receives from the _Workbook.

Long story short, if you can do this easily, I will use the workbook; _Workbook is a bit of an implementation description.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -