fernandreu / office-ribbonx-editor

An overhauled fork of the original Custom UI Editor for Microsoft Office, built with WPF
MIT License
517 stars 100 forks source link

Custom Sample XML Code Snippets and Variables in XML #110

Open FreeSoftwareServers opened 4 years ago

FreeSoftwareServers commented 4 years ago

I'm looking to re-deploy all my xlam add-ins using this tool, it's great by the way! I no longer have to manage a single Excel.OfficeUI and/or worry about overwritting others when they deploy my add-ins package, but I'm going to be doing a lot of the same coding over and over as I have to add this to each of my add-ins.

It would be great if I could store a few code snippets inside the editor to easily paste into my add-ins! (also, on an unrelated note, I'm looking to setup variables before I get started and running into a snag if you have any suggestions the post on SO is here --> https://stackoverflow.com/questions/63803840/using-variables-in-customui-for-microsoft-office-and-xml

FreeSoftwareServers commented 4 years ago

I deleted my question on SO... Turns out that the UI editor was validating my XML, but it didn't work at all w/ variables when I actually tried opening Excel. So... Two fold, I'd love to use variables and/or code snippets to save on repeated tasks.

FreeSoftwareServers commented 4 years ago

Well I changed my attack plan, I'm refactoring all my add-ins under one master xlam so code snippets/"custom sample xml's" are less of a benefit than variables.

I was going to use IdQ to manage all my add-ins under the same tabs but each add-in would have it's own customUI element, but that is no longer an issue.

Regarding variables, my guess is something like this injects code into a portion of an already existing xml and the issue is variables need to be defined at the top. If so, something in the UI would need to detect a variable definition inside the UI editor and then inject that at the top separately.

I realize this is a free tool, and I'm so elated to not have to manage/deploy an custom "Excel.OfficeUI" along with the fact I no longer have to worry that if an end-user has customized there ribbon, I would be destroying their customization, so I want to say thanks for the awesome tool and it's 100% usable as it stands!

In fact, I have tested that while I re-factor my add-ins into a single add-in, I can continue to use the custom "Excel.OfficeUI" that I deploy while still having custom ribbon elements inside the xlam add-ins.

Therefor my add-ins shouldn't effect end users customization's once I stop deploying the "Excel.OfficeUI" altogether!

Not that I'm rambling, but messing with the "Excel.OfficeUI" was a pain due to Excel using files paths like "CUSERS"... I mean you'd think a product made my microsoft would use "C:\users" format at least! So i used to use "batchsubstitute" and transform my "generalized" "Excel.OfficeUI" at each deployment.

References:

Old Way --> https://www.freesoftwareservers.com/display/FREES/Distributing+Macro+via+Add-In+-+Customized+Ribbon+-+Via+Batch

New Awesome Way ! --> https://www.freesoftwareservers.com/display/FREES/Distributing+Excel+Macros+via+Add-Ins+and+Customized+Ribbon

fernandreu commented 4 years ago

Hi,

If I have followed you correctly, you no longer have as much of a need for custom samples / variables because you merged all / most of your add-ins into one, is that correct?

What I would mention is: you can already have code snippets but without variables, via custom XML samples which can be added in settings:

image

You will probably need to restart the tool after changing that, and then:

image

If you do this with a file that does not have a customUI file yet, it will create one for you. Otherwise, it will append the sample at the end or, if you have it currently open, at your cursor's position. This last part is relatively new (see #59) and might need a some tweaks; for example, the warning message you receive is a bit misleading, saying your entire file will be replaced when it is no longer the case.

What I could do is expand this functionality so that you can use these two things