Hi,
I have created a own ribbon and having one button in it using VSTO word add-in C#. Could anyone send me sample code how to create own style panel when click on the button from the own ribbon group in ms-word using VSTO word Add-in programatically in c#. Thanks .
Jayanthi MPosted Apr 4, 2025, 12:04 PM
Hi Sophia,
Thanks for your reply. But, I am expecting I need to create my own dynamic styles(might be more than 1 style names) in the new style task panel(no need to display the default word styles in my own style task panel) in word doc uisng VSTO. When I click on the particular style name from the customized new style task panel then need to add a sample paragraph with the style applied. Kindly do the needfull. Thanks.
Sophia CarterPosted Apr 4, 2025, 11:21 AM
It's great to hear about your interest in creating an own style panel in MS Word using VSTO Word Add-in programmatically in C#! Here's a guide on how you can achieve this:
When a button in your custom ribbon group is clicked, you can handle that event in your VSTO Word Add-in code and programmatically create your own style panel. Below is a general outline of how you can approach this:
1. Handle the button click event in your VSTO Word Add-in code:
2. Within the event handler, you can access the Word application instance and manipulate the document to create your style panel. Here's a basic example to get you started:
This is just a starting point, and you can expand upon this code to tailor your own style panel to meet your specific needs. Remember to test and refine the functionality as per your design. If you have any specific requirements or need further assistance, feel free to ask!
I hope this information helps you kickstart the creation of your own style panel in MS Word using VSTO Word Add-in programmatically in C#. Good luck with your project, and don't hesitate to reach out if you have more questions!