Click here to Skip to main content
14,366,745 members
Rate this:
Please Sign up or sign in to vote.
I make a word addin to print vouchers. that contains a custom control called BarcodeWithZXing. the BarcodeWithZXing is written by C# and build to a Dll file. the addin reference to that.
the question is :

how to add the BarcodeWithZXing to document. I try the method "doc.shapes.addolecontrol ", but I didn't know the classType of BarcodeWithZXing.

Is there any method to finish my idea? thanks !
by the way, I was use the Microsoft access barcode 9.0 to do by VBA. but that work is not good after reopen the file.

How to add a cusotucontrol to word document [ C# Word addin ] on MSDN [^]
Posted
Rate this:
Please Sign up or sign in to vote.

Solution 1

You did not provide enough information. Nevertheless...

Please, refer this: Adding Controls to Office Documents at Run Time[^]
   
Comments
Jeff Lyu 29-Sep-15 23:48pm
   
this link is enough. thanks.
Maciej Los 30-Sep-15 1:46am
   
You're very welcome. Please, accept my answer as a solution - formally - to remove your question from unanswered list.
Rate this:
Please Sign up or sign in to vote.

Solution 2

You can use:
var newContentControl = currentRange.ContentControls.Add();
newContentControl.SetPlaceholderText(null, null, "Empty");
newContentControl.Title = elementType.ToString();

You must set the range to the location where you want to insert the content control or use WordApplication.Selection.Range to get the current range.
   
Comments
Jeff Lyu 29-Sep-15 23:41pm
   
Thanks ! let me try.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100