wordpress hit counter
Welcome to OpenXML Developer Sign in | Join | Help

Custom UI Editor Tool

LASTEST VERSION OF THE CUSTOM UI EDITOR - updated to work with the RTM build of Office 2007 and Beta build of Office 2010 - ATTACHED TO THIS POST

The 2007 Microsoft Office System has an all-new "ribbon" interface which developers can customize in many ways. One of the ways to extend the ribbon is to insert an XML part into an Office Open XML document that defines your custom UI. With this approach, you can add new groups and controls, hide existing ribbon elements, and define callbacks to handlers that you write in managed code.

The XML part is not part of the Open XML format itself but could be added to any XML document by using a new namespace. The Open XML file formats are fully extensible, so applications can store information like workflow, metadata, custom XML, or even custom UI behaviors in a document that aren't necessarily tied to the document content.

Adding your custom-UI part to an Office Open XML document requires that you create a folder within the package, drop in your part, then define a relationship to the new part. For more information about how it all works, check out this technical artice or the "Extending the Office 2007 UI with a Custom Ribbon" screencast on this page.

custom UI editor

Attached to this post is a great utility for working with ribbon customizations stored in Office Open XML documents: Trang Luu's custom UI editor. It's a Windows tool that automates the process of putting your custom UI part into the package and defining a relationship to it: that's all handled by a single mouse click.

You open an existing document with File/Open, then enter your custom UI XML into the main edit box. (Click the image to the right for a full screen shot.) Other options include inserting icons for your custom control, generating callbacks, and validating your custom XML.

Install the tool and try it out, and if you have any questions about using it you can post them right here.

Comments

 

pdanes said:

Looks great, a fantastic idea, but it doesn't work for me. I followed the instructions to the letter, but the new tab doesn't appear in the document.
November 26, 2009 2:07 PM
 

JSRW said:

This version doesn't seem to work for me either. The previous version worked great.
December 20, 2009 12:24 PM
 

moses said:

Excellent tool. Worked gr8 by me. Note that any mistake will cause the new tab not to appear. The best way is to check each new line of code piecemeal, i.e. add a tab and then check it in Office, add a group and check it, etc.
December 21, 2009 10:49 AM
 

Dirus said:

The new tool did not work for me either, but I found a workaround.  When you add a new UI part you will notice that it is named customUI14.xml on the left hand side.  If you were using the schema with dates 2006/01 you will  need to add another UI part and it will be named customUI.xml.  I removed the initial UI part and used the correctly named customUI.xml one and I was fine going forward.
January 6, 2010 11:05 AM
 

abhinav said:

The sample xml templates provided with the tool are targeted only for Office 2010 documents. Adding one more set of sample xml files for Office 2007 would help avoid ambiguity and namespace mismatch errors that lot of users currently face.
Also, the screenshot of the tool's UI needs updatiion :)
January 7, 2010 4:41 PM
 

snoopen said:

Would be great if you could release the source under GPL licence or something similar. I'm sure there are a few people who would be willing to add more functionality to the editor! Such as a Find function :)
January 31, 2010 11:31 PM
 

snoopen said:

I will also point out that there is a bug in this. If the "Samples" folder is missing the program will crash when expanding the Insert menu.
February 2, 2010 5:54 PM
 

peterennis said:

Windows 7 64bit Ultimate. Installed 32 bit Office 2010 RC.
Installed latest Custom UI Editor.
Open / Sample / Excel...
"Corrupted data..."

Insert Sample XML,
"Unhandled exception..."
for any data sample.

Seems like the latest RC breaks the program.
February 6, 2010 10:07 PM
 

bgale said:

I also downloaded and just installed the lasted attachment.
If you start the application, and try to insert sample XML you will get an error.
In my case I fixed this by opening an Excel workbook first.  Then the sample XML insertion works fine.

The Insert Sample XML menu item should be disabled until there is something valid to insert it into.
February 14, 2010 7:39 AM
 

bgale said:

Opening an existing Excel workbook, I inserted some sample XML, then overwrote it with the following:

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" >
 <ribbon startFromScratch="false" >
   <tabs>
     <tab id="CustomTab" label="My Tab" >
       <group id="SimpleControls" label="My Group">
         <toggleButton id="ToggleButton1"
           size="large" label="Large Toggle Button"/>
         <button id="Button2" label="My Button " />
         <comboBox id="Combo1" label="ComboBox">
           <item id="Month1" label="January" />
           <item id="Month2" label="February" />
           <item id="Month3" label="March" />
         </comboBox>
       </group>
     </tab>
   </tabs>
 </ribbon>
</customUI>

This code was modified from: http://msdn.microsoft.com/en-us/aa338202.aspx so that the new tab added "MyTab" is appended to the existing tabs rather than replacing them.

The only caveat with the editor is that you have to close the workbook to save edits, then reopen it.   But given how much tedium this removes, this is a small inconvenience.

Thanks Trang!!
February 14, 2010 8:03 AM
 

DannyBones said:

First, I don't even understand what XML is.  I am just trying to find a way to create icons that are assigned to macros that I put on the quick launch bar of Word 2007.  I followed the article (and one from http://msdn.microsoft.com/en-us/library/cc501317%28office.11%29.aspx) and the suggestions here, and got it to work.  Only problem is, that as soon as I close the sample.docm, that I opened from the Custom UI editor, the neat icons I made disappear in all the .docx windows (Am I making sense?).

It may seem like an ignorant question (and please dumb down the answer for me!) but can I make the Icons I loaded into the Custom UI editor stick to non-.docm's?  Maybe this isn't the right place to even post this Q, that's how clueless I am!
February 24, 2010 3:21 AM
 

GriZlore said:

@  DannyBones

"can I make the Icons I loaded into the Custom UI editor stick to non-.docm's? "

The way i understand it, no!

Office 2007 does not allow such things in DocX files. You would have to save them as DocM files. If you try and save a file which had code in as ".docx" then I think Word2007 warns you of this.

March 16, 2010 5:53 AM
 

insurance quotes said:

Thank you for the tutorial.
March 24, 2010 4:06 PM
 

Tmdean said:

Thanks. It would be nice if it would open the document specified in the command line, so we can add this utility to an "Open With" action for Office documents.
April 28, 2010 4:00 PM
 

starcrwzr said:

For the most part, this utility works great, but I was unable to use my own icons.  If I use the imageMso = "HappyFace", those icons appear in my tabs, but If I use image = "myicon.png" and insert the icon into the file, it only appears as a blank in the tab when I open a file.  I've tried all the various flavors of icons, to no avail, any ideas?
May 14, 2010 4:24 PM
 

CindyMeister said:

Since RTM release the Editor doesn't recognize the namespace correctly for Office 2010 customizations. It should be
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" >
So checking whether the Custom XML is well-formed does not work. Since there does not appear to be any updated documentation available about the correct construction of all the XML Parts, as there was for 2007 (the three part series, for example) it becomes very difficult to use this tool for customizations if it's not going to be updated to RTM standard. Thank you.
May 15, 2010 5:25 AM
 

kdock said:

I installed the updated Editor today (msi file dated today, 9:15 am) and received an error when trying to insert any of the sample XML --

"Unhandled exception has occurred in your application.  If you click Continue, the application will ignore this error and attempt to continue.  If you click Quit, the application will close immediately."

     "Object reference not set to an instance of an object."

When I click Continue, nothing is inserted.  I am able to open files.
FYI, I just installed VS2010Pro Trial version.

Thank you.
May 27, 2010 12:43 PM
 

kdock said:

You know, additionally, the UI Editor I installed doesn't look like your screenshot -- it says "Insert" instead of "Sample" and Office 2007 UI is greyed out on the Insert menu, even though this computer only has Office 2007.  I've also looked back at the earliest version I have and it, too, says "Insert"

Where can I get the Custom UI Editor you have illustrated here?

Thank you.
May 27, 2010 1:35 PM
 

kdock said:

Well, OK, I've found a whole lot of other stuff scattered around the internet and it looks as if I do have the latest, and the latest says "Insert" rather than "Sample".  And the reason I was getting an error seemed to be because I didn't have a project loaded.

The reason Office 2007 UI is greyed is because I already had a customUI module in my project.  Clicking Office 2010 UI added a customUI14 module which will presumable allow me to create the code for 2010 within the same project.

Has anyone written any documentation about this whole subject?  How cool would that be?  I find that searching on this subject scatters me all over the internet.  And I'm easily distracted...

Best, kdock
May 27, 2010 5:32 PM
 

danvarela said:

Como lo descargo
June 12, 2010 9:04 PM
 

kdock said:

Is anyone else having this issue?  When my XML code is long enough that it doesn't fit in the window and the scroll bar appears, the display becomes "jittery" and whatever line I'm working on is forced to the bottom of the window.  With each letter I type, the text hops slightly up and down in the window.

Thanks, kdock
June 30, 2010 10:21 PM
 

positiveguy1960 said:

I am trying to do something similar to what DannyBones referred to "First, I don't even understand what XML is.  I am just trying to find a way to create icons that are assigned to macros", but in my case - I am trying to assign permanent custom icons to the Excel 2010 "Quick Access Toolbar" that are assigned to a macro I have created in the personal.xls file so I don't want the custom icons to disappear when I close out any given workbook.  Any help would be appreciated.

Thanks,
Chet
July 12, 2010 12:29 PM
 

MajorWalrus said:

First of all, thank you for this tool. It really makes Office UI development far easier than it would otherwise be.

However, I'm sadden to see that there is some basic functionality that is missing from it, as well as what seem to be a bugs.

Missing functions-
  - Undo. Ctrl+Z doesn't work.
  - Smart tabbing. New lines wrap around to the very beginning of the text field, instead of start at the tab position of the line preceeding (a lot like this text box).
  (Ideally, new lines would start here.) This makes for very messy code that must be manually tabbed in order to be aligned.

Bugs-
  - The text field automatically scrolls to position the cursor at the bottom of the field when there is more than one page of code.
  - The above bug seems to be triggered when every a key is pressed. This can make it difficult to keep an eye on what is being typed because the page is jerking to the bottom with every keystroke.

Again, thank you for this tool. My only aim with these comments is to help you make it even better.
July 27, 2010 12:28 PM
 

ricol said:

I get "attribute not defined" when trying to use getImageMso for a toggleButton control, but the documentation on MSDN says it is defined. Is this a bug?
August 3, 2010 8:33 AM
Anonymous comments are disabled