RibbonCustomizer™
Customize your Office 2007 Ribbon (Office Fluent™)with only a few mouse clicks! Works with Microsoft® Access™, Excel®, Outlook®, PowerPoint® and Word 2007.

Buy for $29.99

Download free Starter Edition

Subscribe | Subscribe by Email |

Categories

Archive


Administrative: Comment Spam

June 29th, 2006 by Patrick Schmid

I would like to apologize to all of my readers for the increased level of comment spam recently. I am going to watch it for a few more days. If it doesn’t get any better, I’ll be forced to switch to moderated comments only to get rid of the spam.

Patrick Schmid

OT: When the world comes to Bethlehem

June 27th, 2006 by Patrick Schmid

This one is really off-topic…

As some of you might know, I am a Ph.D. Candidate at Lehigh University in Bethlehem, Pennsylvania, USA. Every year, the Iacocca Institute at Lehigh (Lee Iacocca, the former CEO of Chrysler is a Lehigh alumn) hosts the “Global Village for Future Leaders in Business and Industry” here. It is a six week intensive summer program with classes, a project for a real-world client, meetings with executives and lots of other things. I did the program back in 2002.

The most amazing part about the Global Village though is its people. This year, there are 88 people from 41 countries living together in the same dorm, spending basically every waking minute of their long days together. In six weeks, those 88 people will leave to go back home having made lifetime friends and maybe having had a life-changing experience. The average age this year is 25, with an almost 50:50 women:men balance.

If you are into football (soccer) at all, imagine watching the France vs. Spain World Cup game with people from France and Spain. Or imagine watching the 2002 World Cup final between Germany and Brazil with your new best friends from many different countries and someone from Brazil among them (everyone but me was cheering for the team that played nicer football, Brazil, though). Imagine me as a German national walking through the Holocaust Museum in Washington D.C. together with an Israeli and a Swedish Jew. Or, imagine Israelis crying their eyes out when their new Arab friend is leaving at the end of the six weeks (he cried too).

They had their Opening Ceremony last night and my legs still hurt from dancing (yes, I don’t get out of my chair in front of my computer very often…). The next six weeks will be a blast for them, and as an alumni of the Village, I get to hang out with them from time to time as well. I’m looking forward to that! :)

Official Story on User Customization

June 27th, 2006 by Patrick Schmid

Archival Notice: This post is no longer current and has been moved to the archive. Please read the new post replacing this one. Images and links in this post are not guaranteed to work.


Jensen posted a very good post today on the UI blog telling the official story on user customization. For readers of this blog, the story shouldn’t be too much a surprise, but he fills in many details and gives a good overview of why Office 2007 ended up with the current customization model. He also announced a few new things in post-Beta 2:

  • “ability to query for the icon of a command”
  • “execute it [a command] directly from code”

I will be eagerly looking forward to those changes!

The personal highlight of my day though was this sentence: “Patrick Schmid has illustrated many of the techniques necessary to make this work on his blog”, complete with a link back to my website.

Thank you Jensen for that and for this great post!

Word StyleChooser - Optimization & VB.NET

June 16th, 2006 by Patrick Schmid

Quick Links

If you hoped that my last post would have been step-by-step explained how to create a COM Add-In with Visual Studio, then you should consult Microsoft’s Frank Rice’s post of the same day. Ironically, he posted a tutorial on how to create a managed C# COM-Add-In as well. He doesn’t seem to like any comments advertising my blog though, as all of my comments to that effect have been deleted so far.

As promised, I am providing the VB.NET version of the StyleChooser add-in today. Let me first though share with you feedback I received on the first version:

  • There were several setup-related issues. My VS setup project didn’t provide very meaningful information about itself to the user nor did it install itself in the expected folder. Version 1.1 that I quickly posted fixed those issues. (from Bob Buckland)
  • The location of the add-in on the Home tab wasn’t the most useful one. I moved it with V1.1 to the right of the Styles group. (from Bob Buckland)
  • “One of the key advantages of the old dialog was that you could run the width out to full screen so that when you had a style of Normal+Blue+13pt+Tahmoa+Bold you saw all of that when you turned on the option to track formatting. There’s no room for that width in the ribbon, but a tooltip, perhaps?” (from Bob Buckland)
  • “One thing I always disliked about the Styles dropdown is that it didn’t show the type of style. How can users be expected to apply proper styles if they don’t even know if it is a paragraph style or a character style? So maybe it would be possible to add ¶ for paragraph styles, ª for character styles, and ¶ª for those new linked styles?” (from Klaus Linke)
  • “Maybe it could be made to reflect the styles chosen to be displayed in the styles pane… If Word is used properly, that should only show a handful of styles.” (from Klaus Linke)
  • “Any way to assign Ctrl+Shift+S to it?” That shortcut opens the drop-down in Word 2003. (from Herb Tyson)
  • The users that complained about the inadequacy of the style choosing UI in Word 2007 (all of them Word or other MVPs by the way) probably could do without that huge Style group on the Home tab. Therefore it might be helpful to have an option to completely hide the MS Style group.

Conversion to VB.NET

Someone commented to me that VB developers generally don’t read C# examples, whereas C# developers have no problem reading and using VB.NET examples, I’ll switch this add-in to VB.NET only. It’s easier for me as well to maintain one code base only. For C#, you can download the V1.1 source code.

VB.NET can cast objects automatically for you. However, as I am firmly implanted nowadays in the C++/C#/Java world, I am very distrustful of automatic casting. Therefore, my VB.NET code uses “Option Strict On”.

The only surprise I had in converting the code was that VB.NET is not case-sensitive for variable names, while C# is. Took me a bit to remember that and fix the code appropriately. While testing the add-in, I discovered that if you change the style with the Styles Group and don’t move the cursor after that, the text field of the combo box displays the old style still. I looked through the Word Object Model, but couldn’t find any event that would be triggered if the style is changed. Unless someone points me to the correct event, the add-in will always have this issue.

You can download V1.1 of the VB.NET source code.

Changes

Showing the modifications to the current style requires a lot more effort. It seems that the formatting of the selection has to be compared to the formatting of the style and then the differences shown. I don’t see any easier way of doing that. That is a lot of work and therefore I won’t do it this time around.

Adding the information whether a style is a character, paragraph or linked paragraph style is rather straightforward. The information is nicely encoded in the Object Model, so it is only a question of formatting the string returned to Word correctly.

As I mentioned in my last post, the performance of the drop-down list is rather bad. The key performance issue is that the Hashtable containing all styles is created from scratch every time after the control was invalidated (which is after any cursor move, selection change). In order to speed this up, I implemented an optimization strategy. In this new version, the Hashtable is only rebuilt if the number of all styles reported by Word changed. That means, unless a style was removed or added, the Hashtable won’t be rebuilt. The downside is that if the user adds and removes a style without triggering any selection change in between the two operations, the drop-down list won’t reflect this change. Similarly, the drop-down list won’t catch any renaming of styles. The performance gain is so dramatic though that these two handicaps are acceptable.

The drop-down list should reflect the styles that are currently In-Use. However this doesn’t seem to work and might point to a bug in Word 2007 B2.

I still need to look into the shortcut issue.

Replacing the built-in Styles group

Why would a user still need the Styles group, if he or she has this particular add-in installed? For one thing, the user might like to still be able to access the Quick Style gallery and use the functionality provided by the Change Styles menu. That means, if the add-in was to replace the entire Styles group, those two items have to be replicated in order for the user to keep all functionality.

If you read my UI Style Guide post, you should be screaming “NOOO” at this point. I was very explicit about not hiding MS groups and controls, and especially not replacing them. I’ll weaken my own statement at this point a bit. In this case, I can actually replace the Styles group because I expect the users of this add-in to be only power users who know what they are doing. In addition, and even more importantly, the add-in will very visibly tell the user that the MS group is being hidden, and allow the user to change that. Also, the default behavior will be to NOT hide the MS group. This is one of those situations where I will violate the MS-group and the dynamic alteration of the ribbon rule, because anything else is a real waste of ribbon space. I’d love to hear your comments on how this add-in addresses both issues.

RibbonX code

The first change in the RibbonX is that the Styles Group is now included with a “getVisible” callback. This callback will either return true or false, depending on whether the group should be shown or not.

The second change is that I introduced a check box to let the user pick whether to show or hide the MS Styles group. The “getPressed” callback tells Office whether it is checked or not while the “onAction” callback is executed when the user changes the checkmark.

I modified the comboBox slightly as well by introducing the “sizeString” attribute. The comboBox will be as wide as necessary to display that particular string in the text field.

Last but not least, I added the QuickStyles gallery as a large button and the Change Styles button as well. I should note that ChangeStyles is a dynamicMenu and the RibbonX XML Schema requires a dynamicMenu to have a “getContent” callback. As this gallery is provided by Microsoft, I obviously cannot provide a callback function for this, which is why I specified an empty attribute. However, a string of length 0 (”") is not accepted by Office. Therefore the string is of length 1 (” “). Quite corky and I’ll submit a bug on this.

These are all the changes needed in the RibbonX code. I won’t discuss the implementation of the “getVisible” and “getPressed” callbacks, as that is straightforward. The add-in saves the visibility state in the registry and retrieves it from there as well. When the user clicks the checkbox, “onAction” is triggered. “onAction” saves the changed state to the registry and invalidates all my custom UI elements. Therefore all callbacks are executed again and the change in visibility is applied. Apparently Beta 2 still has bugs with the dynamicMenu. Once the “getVisible” callback was executed one time for it, it will not be called again. That means, if you click the checkbox, the “Change Styles” button will stay (if it was visible at startup) or never appear (if it was not visible at startup). Also, it is rather curious that “getVisible” is executed whenever you switch from another window to Word.

Conclusion

As conclusion, I know for sure that I will do all my add-ins in C#. VB.NET is somewhat unwieldly to sue for me. To give you a taste what the add-in looks like, here is a screenshot of the add-in with the Styles group visible:

screenshot of Home tab with Styles group visible

If you hide the MS-group, the Home tab now looks like this:

Screenshot of Home tab with Styles group hidden

All the screenshots were taken on my desktop with a 1280×1024 resolution. The tab will look quite different with a lower resolution.

Downloads

Edited to update setup file to V1.2.1 which runs on .Net Framework 2.0 and supports Vista. No source code changes made

Edited to include workaround for a Word 2007 bug into V1.2.2

OT: Upgrading hard drives & Windows Vista

June 16th, 2006 by Patrick Schmid

Who would have thought that upgrading hard drives could be such a nightmare? The easy part was installing a new 400 GB drive in my desktop and moving all my data to it. The hard part was upgrading my 40 GB tablet hard drive to a 100 GB one. I thought I’ll save myself a lot of trouble and bought a PATA adapter for a notebook hard drive, so that I could just install the hard drive in my desktop. Then I thought I’ll grab an image of the drive, switch the new hard drive in and restore the image to it. So much for the idea. That all worked well except that the drive was no longer bootable after I installed it back in the tablet. Long story short, I got a good ride around Windows trying to resolve the issue. I even saw the warning once that my Windows installation was not genuine…

If you ever want to try upgrading a notebook hard drive yourself, this worked for me: Plug the notebook hdd in the desktop, use ntbackup to backup all the stuff. Plug the new notebook hdd in the desktop, partition it, format it and restore the data from the backup. Install the new drive in your notebook. Boot with a Windows XP CD and go into the Recovery Console. Run fixmbr, fixboot and bootcfg /rebuild. Boot your system with the Ultimate Boot CD for Windows. Note, that I used one that SP2 slipstreamed. Run chkdsk /f. Then run diskpart and set the partition active. Diskpart seems to do quite a bit more than just marking the partition as active, because when a different program did that, it still wouldn’t boot.

You could probably make your life easier if you run diskpart while the drive is still in your desktop…

Having finally upgraded the hard drive on my tablet, I decided I could make good use of my old tablet hard drive and stick it in my girlfriend’s laptop instead of her 2002 30 GB drive. This time I had the steps to making it work down, so it went quite a bit faster.

With the new space on my desktop, I burnt myself a Vista B2 x64 DVD and installed it. I am honestly not that impressed. From reading about Vista, I had expected Aero to be something great, but all I can see it does is making the frames of my windows transparent. I also encountered the expected driver issue. It’s going to take me a lot of time though to be able to find settings again. I tried unsuccesfully to see (changing would be better of course) the details of my wireless LAN connection, but I couldn’t find it anywhere. Besides that, the performance seems to be reasonable for a beta version. I’ll stick with XP until Vista RTMs though.

Next Page »