C. Customizing think-cell

This chapter describes how to customize think-cell, i.e., how to change default colors and other default properties; this is done via think-cell's style files, which are treated in the first four sections.

The fifth section, C.5 Setting a default agenda slide layout, explains how to create custom Agenda slide layouts, and the sixth, C.6 Ribbon customization, explains how to customize think-cell's user interface using PowerPoint's Ribbon customization options.

The following properties can be changed using style files:

  • The list of available colors and patterns (see 3.8.1 Color and fill).

    List of colors and patterns available for customization.

  • The list of available color schemes (see 3.8.2 Color scheme).

    List of color schemes available for customization.

  • The colors of Harvey ball and checkbox (see 20.2 Checkbox and Harvey ball).

    Colors of Harvey ball and checkbox available for customization.

  • Predefined slide layouts for placing charts (see D.7 Predefining slide layouts for placing charts). These slide layouts will be shown as thumbnails in the top left corner of the slide view when a chart of the relevant type is selected for insertion or dragged on the slide, and clicking on, or dragging it to, one of the rectangular areas in the thumbnail will place the chart with that position and size. This can be used together with slide templates to ensure consistent positioning of charts.

    Slide thumbnails showing predefined layouts for inserting charts.

  • The option to use a fiscal calendar in Gantt charts (see 13.1.2 Scale display).

    Scales menu of Gantt chart with Fiscal Year enabled.

  • The list of available lines styles (see 3.8.6 Line style).
  • The list of available markers for line charts and scatter charts (see 3.8.9 Marker shape).

The first three sections describe creating and loading a style file and explain how to deploy it in an organization. An understanding of these tasks is required in any case. Afterwards, you may either follow the C.4 Style file tutorial to create your own style file or go through the format reference in D. Style file format.

C.1 Creating a think-cell style

Simple modifications to an existing style file can be made using any text editor. A new think-cell style file should be created using a dedicated XML editor. It will support you by automatically checking for errors and making suggestions on how to solve them. Our recommendation for such an editor and tips for setting it up is described at

KB0191: Recommended setup for editing think-cell style files

A dedicated XML editor will typically highlight errors in your document, and with a keyboard shortcut such as Ctrl-Spacebar you can trigger auto completion: the editor will offer a choice of tags, attributes or values applicable to the current context (position of the text cursor). If you move the mouse over highlighted errors, you will get a tooltip with a detailed explanation of the error.

Several sample style files are delivered together with think-cell and you can find them in the subdirectory styles of the think-cell installation directory. First, find out the location of the installation directory. It is shown when you click About in the Tools menu icon. Tools menu.

Finding the installation folder.

Open this directory and go to the subdirectory styles, e.g.,

C:\Program Files (x86)\think-cell\styles

Open the file generic style.xml. It should look like this:

The default style file loaded in Visual Studio Express for Web.

The editor automatically checks your file for errors. You can display an error list by clicking on View > Error List:

Empty error list window in Visual Studio Express for Web.

Make sure that there are no warnings or errors indicated before you save an edited style file.

Of course, any other editor that supports XML also works. The file needs to be saved with an .xml extension.

C.2 Loading style files

To load a style file, choose Load Style File... from the menu Tools menu icon. Tools. In the dialog, navigate to the location of the style file, choose the file and click Open. It is used for any new charts in the current presentation.

For example, after you load the sample style file example_style_complex.xml from the styles directory in think-cell’s installation directory, the color and color scheme property controls will include customized items.

Changed color and color scheme list after loading a complex example style.

If you want to apply a style’s colors or color schemes in existing charts, you need to do so manually.

C.2.1 Loading style files programmatically

You can also load style files programmatically, for example as part of a workflow that prepares new or updated templates. The greater precision of API calls also enables to specify additional options when loading a style file, like targeting a specific custom layout or even restricting the style to a rectangular region of a custom layout, as well as removing them from custom layouts and inspecting the name of the style loaded into a master or custom layout.

think-cell's API is integrated into the Office Automation model, so it can be accessed from any language with which you can program Office, such as Visual Basic for Applications (VBA) or C#. See F.1 Getting started for detailed instructions.

Suppose you have a custom layout that uses different background colors for the left and right side of the slide. The right side matches the background of the rest of your presentation, so it is fine that the style set in the master applies here. However, the left side uses a different background, for which a modified style is appropriate. In this situation, you would use LoadStyle to set one style file for the whole presentation. Next, you would use LoadStyleForRegion to set a different style for only the left side of the appropriate custom layout.

The following sections describe the available API calls. They are methods of the think-cell add-in object in PowerPoint.

C.2.2 LoadStyle

C.2.2.1 Signature

VBA
tcPpAddIn.LoadStyle( _ 
    CustomLayoutOrMaster As Object, _ 
    FileName As String 
)
C#
void tcPpAddIn.LoadStyle(
    object CustomLayoutOrMaster,
    string FileName
);

C.2.2.2 Description

This function loads the style contained in the style file at FileName into a master or custom layout, specified via the parameter CustomLayoutOrMaster.

CustomLayoutOrMaster must be a CustomLayout or Master.

When applied to a custom layout where a regional style has been set (see C.2.3 LoadStyleForRegion), the regional style will be removed. This means that you need to load the style that should apply on the rest of the slide using this function before you load a style restricted to a region.

When applied to a master, any styles loaded into the custom layouts contained in that master, regional and unrestricted, will be removed. This means that you need to load the style that should apply to custom layouts without a specific style into the master before loading a style applying to a specific custom layout using this function.

C.2.2.3 Example

To use this sample, add the following code to a module in PowerPoint (see F.1.1 Visual Basic for Applications for details).

Option Explicit
	
Sub LoadStyle_Sample() 

	' Get the think-cell add-in object 
	Dim tcPpAddIn As Object 
	Set tcPpAddIn = Application.COMAddIns("thinkcell.addin").Object 

	Dim master As Master
	Set master = Application.ActivePresentation.Designs(1).SlideMaster

	Dim style As String
	style = "C:\some\path\styles\style.xml"

	Call tcPpAddIn.LoadStyle(master, style)
End Sub

C.2.3 LoadStyleForRegion

C.2.3.1 Signature

VBA
tcPpAddIn.LoadStyleForRegion( _ 
	CustomLayout As PowerPoint.CustomLayout, _ 
	FileName As String, _
	Left as Single, _
	Top as Single, _
	Width as Single, _
	Height as Single _
)
C#
void tcPpAddIn.LoadStyleForRegion(
	PowerPoint.CustomLayout CustomLayout,
	string FileName,
	float Left,
	float Top,
	float Width,
	float Height
);

C.2.3.2 Description

This function loads the style file at FileName into the custom layout CustomLayout and restricts it to a region given by Left, Top, Width, Height. On the rest of the slide, the style loaded into the master, or the one previously loaded into the custom layout with LoadStyle applies.

The parameters Left, Top, Width, Height are given in PowerPoint points. Left and Top specify the distance of the left and top edges of the region from the left and top edges of the custom layout, respectively. Usually you will set them as fractions of the total slide height and width. For example, for a region covering the right two thirds of the custom layout, you would set

Left = CustomLayout.Width / 3
Top = 0
Width = CustomLayout.Width * 2 / 3
Height = CustomLayout.Height

You can also manually add a shape to a slide or custom layout, query its properties Left, Top, Width, Height programmatically and use the values with LoadStyleForRegion to restrict the style to the same region covered by the shape.

think-cell supports a maximum of two styles per custom layout. One is set with LoadStyle and covers everything not restricted to a region, the other is set with LoadStyleForRegion.

C.2.3.3 Example

To use this sample, add the following code to a module in PowerPoint (see F.1.1 Visual Basic for Applications for details).

Option Explicit
	
Sub LoadStyleForRegion_Sample() 

	' Get the think-cell add-in object 
	Dim tcPpAddIn As Object 
	Set tcPpAddIn = Application.COMAddIns("thinkcell.addin").Object 

	Dim layout As CustomLayout
	Set layout = Application.ActivePresentation.Designs(1).SlideMaster.CustomLayouts(2)

	' Define a region covering the left half of the custom layout
	Dim left, top, width, height As Single
	left = 0
	top = 0
	width = layout.Width / 2
	height = layout.Height

	Dim style As String
	style = "C:\some\path\styles\style.xml"

	Call tcPpAddIn.LoadStyleForRegion(layout, style, left, top, width, height)
End Sub

C.2.4 RemoveStyles

C.2.4.1 Signature

VBA
tcPpAddIn.RemoveStyles( _ 
	CustomLayout As PowerPoint.CustomLayout _ 
)
C#
void tcPpAddIn.RemoveStyles(
	PowerPoint.CustomLayout CustomLayout
);

C.2.4.2 Description

This function removes all styles from the custom layout CustomLayout. Afterwards, the style loaded into the master applies. Potentially, there can be a style loaded into the custom layout and another style restricted to a specific region of the custom layout. As RemoveStyles removes all styles, both will be removed. The style loaded into a master cannot be removed, as there always needs to be a valid style associated with a master. It can be overwritten with a different style file.

C.2.4.3 Example

To use this sample, add the following code to a module in PowerPoint (see F.1.1 Visual Basic for Applications for details).

Option Explicit
	
Sub RemoveStyles_Sample() 

	' Get the think-cell add-in object 
	Dim tcPpAddIn As Object 
	Set tcPpAddIn = Application.COMAddIns("thinkcell.addin").Object 

	Dim layout As CustomLayout
	Set layout = Application.ActivePresentation.Designs(1).SlideMaster.CustomLayouts(2)

	Call tcPpAddIn.RemoveStyles(layout)
End Sub

C.2.5 GetStyleName

Supported in think-cell 13 and later.

C.2.5.1 Signature

VBA
tcPpAddIn.GetStyleName( _ 
    CustomLayoutOrMaster As Object _ 
) As String
C#
string tcPpAddIn.GetStyleName(
    object CustomLayoutOrMaster
);

C.2.5.2 Description

This function returns the name of the style loaded into the CustomLayout or Master or CustomLayoutOrMaster. This is the same name that is specified in the name attribute of the <style> element of the corresponding style file (see D.2.1 style).

It returns an empty string when no style is loaded into CustomLayoutOrMaster. Note that a master always has a style loaded into it when think-cell is active and that the name of a style cannot be empty.

If a name is returned for a CustomLayout, it is the name of the style loaded into it with C.2.2 LoadStyle, not of the one loaded with C.2.3 LoadStyleForRegion, if any.

C.2.5.3 Example

To use this sample, add the following code to a module in PowerPoint (see F.1.1 Visual Basic for Applications for details).

Option Explicit

Sub GetStyleName_Sample()

    ' Get the think-cell add-in object 
    Dim tcPpAddIn As Object
    Set tcPpAddIn = Application.COMAddIns("thinkcell.addin").Object
    
    ' Get the Master of the first slide of the current presentation
    Dim master As Master
    Set master = Application.ActivePresentation.Slides(1).Master
    
    ' Print the name of the style loaded to the debug console
    Dim name As String
    name = tcPpAddIn.GetStyleName(master)
    Debug.Print name
End Sub

C.3 Deploying think-cell styles

Load Style File... in the Tools menu icon. Tools menu in the think-cell toolbar loads a style file into the master slide of the current presentation. When the presentation is distributed as a PowerPoint template, the think-cell style is implicitly distributed as well. Switching between styles is accomplished by switching between PowerPoint templates. It should not be necessary to give a think-cell style file to individual users.

We recommend to distribute your think-cell style together with your PowerPoint template. Typically both are needed to implement your corporate design and deploying them as one is the easiest option for users.

If it is not possible to follow our recommendation to deploy the think-cell style as part of your PowerPoint template, a default style file can be specified with the defaultstyle configuration parameter (see A.2.1 Configuration parameters). The parameter value is the path name to a valid style file. The path can either be absolute or relative to the styles subdirectory of the think-cell installation directory.

The default style file is loaded automatically on two occasions:

  1. When a new presentation is created.
  2. When an existing presentation is opened that does not currently contain a style. When this presentation is saved and subsequently opened again, it will now contain a style, so the default style is not loaded again.

The default style file that will be loaded automatically is highlighted with an appended (default) in the list of available and recently loaded style files:

Load Style File menu command with list of available and recently used styles.

C.4 Style file tutorial

In think-cell’s installation directory (usually C:\Program Files\think-cell), in the subdirectory styles, you can find the style file generic style.xml. This style mirrors the colors and color schemes that are available immediately after installation when no style is loaded. Therefore:

  1. Make a copy of generic style.xml and load it into an XML editor (see C.1 Creating a think-cell style for choosing a suitable editor).
  2. Walk through the file from top to bottom making the changes described in the following steps.
  3. Remove any unneeded colors from the list inside the fillLst element. You will find solidFill, pattFill and separator elements corresponding to the items in the color list displayed in think-cell (see 3.8.1 Color and fill). To remove, e.g., a solidFill element, remove everything between and including the opening tag <solidFill ...> and the closing tag </solidFill>.
  4. Optionally, create a new section for your own colors. To do this, insert a separator tag by writing <separator/> at the appropriate location in the color list. Also, feel free to use line breaks, indentation and empty lines to structure the XML code in the style file for your own convenience. Spaces and linebreaks have no effect on the resulting style.
  5. Add your own colors using the solidFill element. Your color needs a name and values for the red, green and blue channels. You should have these values from the specification document for your company’s corporate identity. If the color’s name should be “Light Green”, the decimal value for the red channel 170, for green 255 and for blue 42, then it should look like this:
    <solidFill name="Light Green"> 
      <sdrgbClr r="170" g="255" b="42"/> 
    </solidFill>
    
  6. Remove any unneeded color schemes from the list inside the fillSchemeLst element. You will find fillScheme elements corresponding to the items in the color scheme list displayed in think-cell (see 3.8.2 Color scheme. To remove a fillScheme element, remove everything between and including the opening tag <fillScheme ...> and the closing tag </fillScheme>.
  7. Optionally, modify an existing color scheme. You can
    • remove one or multiple colors from the scheme by removing the respective fillRef elements or
    • reorder the existing colors by reordering fillRef elements or
    • include one of your own colors by adding a fillRef element inside the fillScheme element at the appropriate place. If you wish to include the color defined above, add the following line:
      <fillRef name="Light Green"/>
      

    Note that you can only use colors that have been defined in the fillLst section (see steps 3.-5.) above. In particular, if you removed any colors in step 3., you must remove those colors from the color schemes, too.

  8. Optionally, create a new color scheme using the fillScheme element. Your scheme needs a name, e.g., “Green Scheme”, a color reference to be used by the other series in the required attribute fillSchemeLst, and a list of color references as fillRef elements. If you had defined the colors “Orange”, “Dark Green”, and “Medium Green” in addition to “Light Green” above, your color scheme might look like this:
    <fillScheme name="Green Scheme" fillRefOtherSeries="Orange"> 
      <fillRef name="Dark Green"/> 
      <fillRef name="Medium Green"/> 
      <fillRef name="Light Green"/> 
    </fillScheme>
    
  9. Check the contents of the fillSchemeRefDefault element. The name attribute specifies the color scheme that is used by default when inserting new charts. If you wish to set your own color scheme as the new default, modify the code like this:
    <fillSchemeRefDefault name="Green scheme"/>
    
  10. Save the modified style file, load it (see C.2 Loading style files) and test it.
  11. Deploy the new style in your organization as described in C.3 Deploying think-cell styles. In particular, it is not necessary to send the XML file to your colleagues, but you should of course keep it for your own reference.

C.5 Setting a default agenda slide layout

The think-cell agenda can use a specific custom layout in your presentation to define the agenda position and other shapes on an agenda slide like headers or pictures. By adding this custom layout to a template, you can define these settings for a whole organization.

  1. In PowerPoints slide master view, create a new custom layout. Typically, you will duplicate one of the existing custom layouts that best match the desired look of a think-cell agenda slide.
  2. Name the new custom layout “think-cell agenda”. think-cell will only use this custom layout, if it exactly matches this name, which is case-sensitive.
  3. Only include shapes on the “think-cell agenda” custom layout that should appear like this on every agenda slide.
  4. While editing the custom layout, choose image.  Agenda Placeholder from the Elements menu. This element is only available when editing a custom layout. It adds an agenda placeholder on the current custom layout.
  5. Choose the agenda placeholder position as described in 19.3 Placing the agenda.

When a custom layout created this way and named “think-cell agenda” is found in the current presentation, image.  Chapter will use this custom layout, including any additional shapes on it and place the agenda at the pre-set position.

C.6 Ribbon customization

think-cell makes all of its functionality available via Ribbon commands, which can be customized just like PowerPoint's own via File > Options > Customize Ribbon. See here for general information on how to do this.

You can find a list of all available think-cell commands in the Customize the Ribbon dialog by selecting Main Tabs from the Choose commands from: dropdown menu, and going to think-cell Commands > think-cell Commands.

PowerPoint Ribbon Customization dialog.

Note: Due to a restriction in Office, you cannot add or remove commands to or from built-in groups. So to add commands to a built-in tab you have to create a custom group within it by clicking New Group. The think-cell groups in the built-in Insert, Design and Review tabs behave like built-in groups in this regard. You can, however take whole built-in groups, including the think-cell groups just mentioned, and add them to (or remove them from) arbitrary tabs.

Note: The think-cell commands tab and group are merely containers for convenient access to all think-cell Ribbon elements. They cannot themselves be placed on the Ribbon, and selecting or deselecting them on the right-hand side of the Customize the Ribbon dialog has no effect.

It is also possible to modify the placement of the main think-cell Ribbon group (Insert > think-cell by default) during installation. For instructions on how to do this see A.2.2.4 Ribbon.

Share