NaamaV

Hi,

I added a control in run time to Word document, and I saved its location in a Bookmark. After closing, when the document is loading again I create the control again and add it to the document.

It takes a lot of time. I'm using this code:

Globals.ThisDocument.Controls.AddControl(def.Deflbl, rng, def.Deflbl.Width, def.Deflbl.Height, def.Deflbl.Name + lblid);

How I can cause it to be loaded faster



Re: Visual Studio Tools for Office Add Control to Word Document Take a lot of Time, Why?

Geoff Darst - MSFT

Hi,

There really isn't anything you can do to cause the line of code mentioned above to execute faster. If the load time is really where you are seeing unacceptable performance, about the only option I can suggest would be to use a static control. Since you say you are recreating the control on the document every time, this may be a possibility. If you need to simulate a dynamic control, you might try using the Visible property to hide and unhide the control as necessary.

Sincerely,

Geoff Darst

Microsoft VSTO Team





Re: Visual Studio Tools for Office Add Control to Word Document Take a lot of Time, Why?

NaamaV

What do you mean a static control

I have to create it any time the document is loading in the location the user added it before.

How I can use static control in this situation