Click here to Skip to main content
15,891,657 members
Please Sign up or sign in to vote.
1.00/5 (1 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

You did not provide enough information. Nevertheless...

Please, refer this: Adding Controls to Office Documents at Run Time[^]
 
Share this answer
 
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.
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.
 
Share this answer
 
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, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900