Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 03-30-2021, 11:32 PM
Tycho Tycho is offline How to insert custom control into Office Word document - VSTO Windows 10 How to insert custom control into Office Word document - VSTO Office 2019
Novice
How to insert custom control into Office Word document - VSTO
 
Join Date: Mar 2021
Posts: 2
Tycho is on a distinguished road
Question How to insert custom control into Office Word document - VSTO

I want to insert my custom control into the currently opened Word document using VSTO. I have an application that communicates with my already existing VSTO Word plugin over COM. So far I have been using a workaround where I inserted pictures of my custom control as an InlineShape (as images) into the document. This was fine for now, since Word was automatically saving it inside the document, took care of resizing, deleting with the delete key, drag dropping image as a single character, and so on... But now I am encountering some problems regarding adding new functionalities (eg. Right-click on control (image) click). Now I am looking for an alternative, how to insert custom control (probably an ActiveX control?) . I have created an example when i insert a custom control with the Microsoft.Office.Tools.Word.Document.Controls.AddC ontrol() function, but here are some problems:



The control can not be dragged around the range of the document
The control is not saved when the document is closed and reopened
Control does not work when the document zoom is not 100%
See the picture below:


I have also noticed, that i can insert an object into the current word document (insert -> object -> eg. Microsoft Word Document, see picture below)


This inserted object has all the functionality which i need (drag-drop as a single character, saving on document close, resize, functionality when document zoom is not 100%,...) This is exactly what i want to achieve, but instead of another Microsoft Word object, I would like to display my custom control. See the picture below for comparison between MS Word Document object and my custom control inside opened document:


Now i have already spent quite some time googling and doing the research but i am running out of ideas on how to successfully create this to work... If anyone is familiar with the solution of could provide any details on it, it would be extremelly helpful! I have also tried doing something with the new plugins Office add-ins, but keep in mind that i am developing a Windows app, i do not need crossplatform functionality and Word plugin needs to be accessible from the other app (just like current solution, where i access it using COM). Hopefully the explanation was clear enough, i am more than ready to provide additional information if needed!
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I insert a line /specify a custom colour using office online pakoul Word 1 10-22-2019 05:34 AM
Word VSTO Content Control binding to XML issue phyrjc Word 0 03-25-2019 08:56 AM
How to insert custom control into Office Word document - VSTO Create Custom Document Properties with Content Control kschmidt Word VBA 7 02-04-2019 03:09 PM
Word 2017 + VSTO 2015 events ArtKilp Word VBA 0 11-20-2018 08:57 AM
How to insert custom control into Office Word document - VSTO Insert image based on document custom property anandyrh Word 1 08-14-2013 12:08 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:09 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft