[VB.Net] Adding custom color to standard font color dialog

Add-in Express™ Support Service
That's what is more important than anything else

[VB.Net] Adding custom color to standard font color dialog
 
Christian Fasold




Posts: 45
Joined: 2013-11-27
Hello everybody,

how can I add (via VB.Net) custom colors to the standard font color dialog of PowerPoint?
Like in this picture here:
User added an image

I have tried to find s.th. but to no avail... I only found "ExtraColors" but they only add colors
as "last used colors" and will so be overwritten by the user when he uses other colors...

==> Help ;-)

Thanks a lot and best regards,

Chris
Posted 20 Feb, 2014 06:02:57 Top
Andrei Smolin


Add-in Express team


Posts: 14137
Joined: 2006-05-11
Hello Chris,

A tricky question ) There's nothing in the PowerPoint object model that would let you achieve this.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 20 Feb, 2014 09:29:35 Top
Christian Fasold




Posts: 45
Joined: 2013-11-27
Hello Andrei,

thanks a lot for your help!

What a shame :-(

So how would I manage to get a color picker into my ribbon? Can you help me out here how to accomplish that?

It would be perfect if it would look like the "standard" one from Office, but only with defined colors in it...

Thanks a lot and best regards,

Chris
Posted 21 Feb, 2014 03:38:41 Top
Andrei Smolin


Add-in Express team


Posts: 14137
Joined: 2006-05-11
Christian Fasold writes:
So how would I manage to get a color picker into my ribbon?


You can add a built-in Ribbon control onto your tab:


Add-in Express Ribbon components provide the IdMso property; if you leave it empty the component will create a custom Ribbon control. To refer to a built-in Ribbon control, you set the IdMso property of the component to the ID of the built-in Ribbon control. For instance, you can add a custom Ribbon group to a built-in tab. To do this, you add a Ribbon tab component onto the add-in module and set its IdMso to the ID of the required built-in Ribbon tab. Then you add your custom group to the tab and populate it with controls. Note that the Ribbon does not allow adding a custom control to a built-in Ribbon group.


On how to find the ID of a built-in control see the section Referring to Built-in Ribbon Controls in the PDF file in the folder {Add-in Express}\Docs on your development PC.

Defined colors? I have an impression all color pickers in the PP UI share the same set of colors.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 21 Feb, 2014 03:48:25 Top
Christian Fasold




Posts: 45
Joined: 2013-11-27
Hello Andrei,

thanks a lot for your quick reply :)

I am afraid I didn't explain myself very well *g*
What I wanted to achieve was to "clone" the built in ColorPicker of Office to get an "empty" one and hopefully be able to add my own colors to it.
Because the problem is that if I open another color picker (e.g. when a button on the ribbon is clicked) that I have to program all functions like changing the color of the text you are writing manually... And I hoped not to have to do that if I used a built in control...

Would that be possible?

Thanks a lot and best regards,

Chris
Posted 21 Feb, 2014 03:54:45 Top
Andrei Smolin


Add-in Express team


Posts: 14137
Joined: 2006-05-11
Chris,

You cannot create an "empty" color picker.

You can clone a built-in color picker by creating a Ribbon control of the corresponding type and setting its IdMso property to the IdMso of the corresponding Ribbon control. Note that this procedure actually means using a built-in Ribbon control on your own Ribbon tab/group/menu whatever.

Christian Fasold writes:
Because the problem is that if I open another color picker (e.g. when a button on the ribbon is clicked) that I have to program all functions like changing the color of the text you are writing manually...


I don't understand this. The built-in Ribbon control used on your Ribbon tab pertains its functionality: if you duplicate the Fill button in this way, it will do just what the end user expects it to do - fill the selected shape(s) with the specified color.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 21 Feb, 2014 06:31:06 Top
Christian Fasold




Posts: 45
Joined: 2013-11-27
Hello Andrei,

thanks for your reply :)

Could you give me a small example how to clone that default Office font color picker?
Will I then have a change of "clearing" the cloned one of all colors and add my own?
I am sorry if I ask "simple" questions here, I just not yet so experienced with that kind of IdMso and Office programming :-(

Where could I find out the available functions for the Office default font color picker?

Thanks again a lot for all your help! :)

Best regards,

Chris
Posted 21 Feb, 2014 06:38:36 Top
Andrei Smolin


Add-in Express team


Posts: 14137
Joined: 2006-05-11
Christian Fasold writes:
Will I then have a change of "clearing" the cloned one of all colors and add my own?


You'll get a fully-functional instance of the font color picker. You will not be able to "clear" it.

Steps:
- put a Ribbon tab component onto the add-in module's designer surface and select it
- use the inplace designer to add a group
- now add a gallery to the group
- set the gallery's IdMso property to "FontColorPicker" without quotes

Christian Fasold writes:
Where could I find out the available functions for the Office default font color picker?


You cannot customize it because it is missing on the Office object model.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 21 Feb, 2014 06:51:06 Top
Christian Fasold




Posts: 45
Joined: 2013-11-27
Andrei,

ah ok, thanks!

That again is unfortunate news for me :(
Somehow I begin to think that the whole Ribbon topic is quite "limited" to what you can do ;-)

So now I can only think of one solution (and I am not sure if there is an easy way to do that):
- Create a button inside the Ribbon which then opens a "Color Picker" (-> that's easy)
- Imitate the functionality of the Office default font color picker, e.h. applying the color to text which
will be typed or to text if some is selected (-> is there an easy way to achieve this functionality?)

Thanks AGAIN for your help Andrei! :)

Best regards,

Chris
Posted 21 Feb, 2014 06:56:45 Top
Andrei Smolin


Add-in Express team


Posts: 14137
Joined: 2006-05-11
Yes, Office controls are limited.

Christian Fasold writes:
is there an easy way to achieve this functionality?


You'll need to study the PowerPoint object model. Unfortunately, they don't provide Macro Recorder in PP 2007-2013.

Start with studying the Selection object, see http://msdn.microsoft.com/en-us/library/office/ff745871%28v=office.15%29.aspx. Pay attention to Selection.type - it looks like it allows checking if there's selected text.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 21 Feb, 2014 07:05:50 Top