VS2005 beta1 first experience (on integration with Office)

xiaoxiao2021-03-06  83

I listened to the online broadcast on Tuesday. I tried it today. I didn't try it out, I 5555555

However, telling the truth, I used the VS2003 for a while, I feel that the integration of the VS2005 Beta1 to Office is much better than before.

Let me write a small example of myself:

First, open the vs2005 beta1 // seems to be nonsense?

1 Create a project (C # -> Office -> Word Application) as shown below:

2 Write a few words in the Word document, "Hello World", but also a classic, and pull a Button control over.

3 Select the word, which is "Hello World", pull a Bookmark to the document in the toolbox in Word Controls.

4 Add a UserControl and put a Button1 and TextBox1 in UserControl1

Let's start writing simple code:

1. INITIALIZE event under thisDocument.cs:

// The purpose is to run the time plus UserControl1

Private void thisdocument_initialize (Object Sender, System.EventArgs E)

{

Globals.thisDocument.Anactionspane.controls.add (New UserControl1 ());

}

2. Bookmark1 SelectionChange Event:

// The purpose is to play a message box when it triggers this event.

Private void bookmark1_selectionchange (Object sender, microsoft.office.tools.word.selectionEventArgs e)

{

Messagebox.show ("My God!", "Note");

}

3. In the Click event of Button:

/

Private void button1_click (Object Sender, Eventargs E)

{

Globals.thisDocument.button1.text = "zhangzs";

}

4. UserControl1.cs under the Click event of Button:

// The purpose is to click, make the font in the document to TextBox1.Text

Private void button1_click (Object Sender, Eventargs E)

{

Globals.thisDocument.bookmark1.text = textbox1.text;

}

- The final result: // The function has been said before

转载请注明原文地址:https://www.9cbs.com/read-106841.html

New Post(0)