ExcelDnaDoc
ExcelDnaDoc copied to clipboard
Code to add shortcut key information to model
Hi,
While I do understand this is not the best or proper way to request a code change, but since I'm terrible at git and have never worked with pull requests, here it is.
Can the following code or something along its lines be added to ModelHelper.cs on line 35? It adds the neccessary information for the template to actually display key combinations.
if (excelCommand.ShortCut != null)
{
System.Text.RegularExpressions.Match match = System.Text.RegularExpressions.Regex.Match(excelCommand.ShortCut, "^[\\^\\+\\%\\s]*([^\\^\\+\\%\\s]+)$");
if (match.Success)
{
string shortcutKeys = string.Empty;
if (excelCommand.ShortCut.Contains("^"))
shortcutKeys = "Ctrl ";
if (excelCommand.ShortCut.Contains("+"))
shortcutKeys += "Shift ";
if (excelCommand.ShortCut.Contains("%"))
shortcutKeys += "Alt ";
shortcutKeys = shortcutKeys.TrimStart().Replace(" ", " + ");
shortcutKeys += match.Groups[1].Value;
command.ShortCut = shortcutKeys;
}
}
Regards,
Sascha Sanches
Thank you @Phundamentals - that looks like a nice improvement. I'll add it to the code.
Thank you!