|
-
May 13th, 2013, 01:19 AM
#1
Thread Starter
Registered User
Using CTPFactory and CTPFactoryAvailable methods to interact with the ribbon UI
Hi
I am using NetOffice and Visual Studio 2010 Express to develop word COM addins.
Very simple I want to show a custom task pane (CTP) when a check box is ticked in the ribbon UI.
NetOffice cannot directly using the standard custom task pane objects that are available in the visual studio express. It has to rely on CTPFactoryAvailable method to show the CTP.
The following example shows the CTP upon loading up word however I cannot make it more dynamic to only show the CTP when the checkbox is ticked.
Does anyone have any ideas?
Adding the ICustomTaskPaneConsumer to the Implements
Office.ICustomTaskPaneConsumer
And use the CTPFactoryAvailable sub to create the custom task pane.
Public Sub CTPFactoryAvailable(ByVal CTPFactoryInst As Object) Implements NetOffice.OfficeApi.ICustomTaskPaneConsumer.CTPFactoryAvailable
Dim ctpFactory As Office.ICTPFactory = New Office.ICTPFactory(_wordApplication, CTPFactoryInst)
Dim taskPane As Office._CustomTaskPane = ctpFactory.CreateCTP(GetType(Addin).Assembly.GetName().Name + ".SampleControl", "NetOffice Sample Pane(VB4)", Type.Missing)
taskPane.DockPosition = MsoCTPDockPosition.msoCTPDockPositionLeft
taskPane.Width = 300
taskPane.Visible = True
_sampleControl = taskPane.ContentControl
-
Sep 1st, 2013, 08:21 AM
#2
Thread Starter
Registered User
Re: Using CTPFactory and CTPFactoryAvailable methods to interact with the ribbon UI
Hi
This question I posted on the NetOffice Forum posted. Recently the NetOffice got updated and more features were added. The post and replies can be found at
http://netoffice.codeplex.com/discussions/449517
-
Sep 1st, 2013, 04:31 PM
#3
Re: Using CTPFactory and CTPFactoryAvailable methods to interact with the ribbon UI
you should only have to change to use something like
Code:
if checkbox.value = checked then taskPane.Visible = True
'or
taskPane.Visible = checkbox.value
note you will have to use the proper object / values for your ribbon checkbox
you can then call your procedure from the checkbox click event or attached macro, whatever they have, for ribbon controls, to run code when clicked
testing will be required
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|