Content Control

Add-in Express™ Support Service
That's what is more important than anything else

Content Control
C# 
Shai Raiten




Posts: 46
Joined: 2008-01-29
Hello EveryOne,

Some one please can send me an example how to work with content controls in C#.

Thanks
Posted 12 Feb, 2008 17:37:31 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Posted 13 Feb, 2008 09:20:49 Top
Shai Raiten




Posts: 46
Joined: 2008-01-29
Sergey thanks for your time.
I have already saw those documents and I didnt success doing the same in C#.
Can you please post an example for Content Control in C#.

Thanks
Posted 13 Feb, 2008 09:54:15 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Shai, what is the main difficulty? What the example should do?
Posted 13 Feb, 2008 10:05:49 Top
Shai Raiten




Posts: 46
Joined: 2008-01-29
Hello Sergey,

Dim objCC As ContentControl

Set objCC = ActiveDocument.ContentControls _
.Add(wdContentControlDate)

objCC.Range.Text = "January 1, 2007"
objCC.LockContents = True
objCC.LockContentControl = True

Thanks
Posted 14 Feb, 2008 09:53:34 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Shai.

C# code:

private void adxRibbonButton1_OnClick(object sender, AddinExpress.MSO.IRibbonControl control, bool pressed)
{
Word.ContentControl objCC;
object range = Type.Missing;

objCC = WordApp.ActiveDocument.ContentControls.
Add(Microsoft.Office.Interop.Word.WdContentControlType.wdContentControlDate, ref range);

objCC.Range.Text = "January 1, 2007";
objCC.LockContents = true;
objCC.LockContentControl = true;
}
Posted 14 Feb, 2008 12:18:57 Top
Shai Raiten




Posts: 46
Joined: 2008-01-29
Hello Sergey,

I"m missing an assembly reference for the COntent Control and i can't find him.

Please send me the name of the ref.

Thanks
Posted 16 Feb, 2008 15:57:42 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Shai, you just need to use PIAs for Office 2007.
Posted 18 Feb, 2008 09:53:03 Top