none
Line breaks in SuperTips RRS feed

  • Question

  • Using the Office 2010 Ribbon Designer, I have drag-dropped various Office Ribbon Controls from the Toolbox, including Buttons.  The SuperTip property on these controls, in some cases, are lengthy enough that I need to include line breaks.  My experience from earlier Office 2007 VSTO add-ins was that I use "
" for a newline, and I entered this string as needed in the SuperTip property textbox.  However, this is not working for me; it merely echoes "
" on showing the SuperTip.

    Oddly enough, when I tried a test from the earlier Office 2007 project using its Ribbon.xml (which of course uses "
") in an Office 2010 add-in, it displays just fine with line breaks. 

    What could be causing this inconsistent behavior?  Is there something different about using the Ribbon Designer with Office 2010 add-ins that affects how line breaks should be entered in SuperTips?

    Thursday, October 14, 2010 2:14 PM

Answers

  • Hi Anonymous

    <<the line breaks in the SuperTips now work just fine, but now I have no icons, because Export XML doesn't include image information !

    In my view, either there is a shortcoming/bug in Export XML, or in the Designer.  What do you think?>>

    A shortcoming of the Export to XML functionality is how I'd term it. Some of the "wrapping" the Designer does is extremely complex, to make the development "experience" with the Designer similar to working with WinForms. And every little bit that's added costs resources (time and money). Probably, the VSTO team had to choose between supporting this, or something else, and the decision fell to the "something else" - whatever that may have been.

    FWIW I was at a meeting, back when the Designer was still "on the drawing board". The VSTO team asked those in the meeting to assign "values" to various aspects of the Ribbon, saying that they couldn't do everything and were interested in opinions of what we considered most important. Turned out almost everything was important :-) But still, the team didn't have infinite resources.

    In any case, here's the information in the VSTO documentation on MSDN (http://msdn.microsoft.com/en-us/library/bb386097.aspx):

    "Not all of the properties that are in the Properties window of the Ribbon designer are transferred to the Ribbon XML file. For example, Visual Studio does not export the value of the Image or Text property. That is because you must create a callback method in the Ribbon code file of the exported project to assign an image or set the text of a control. Visual Studio does not automatically generate callback methods as part of the export process.

    In addition, any unchanged default property values do not appear in the resulting Ribbon XML file."


    Cindy Meister, VSTO/Word MVP
    • Marked as answer by Anonymous9748 Tuesday, October 19, 2010 12:14 PM
    Tuesday, October 19, 2010 7:17 AM
    Moderator
  • Hello,

    I did not realize you are exporting the Ribbon Designer to Ribbon XML. Yes, I think you are right. When we set Image property on a control in Ribbon Designer, and then export it, the Ribbon.xml does not include any information about this Image property. So here, I am afraid that you need to set this property in Ribbon.XML again. Also here is a MSDN page about how to use image in Ribbon xml: http://msdn.microsoft.com/en-us/library/aa338202(office.12).aspx.

    If you have any concerns on this post, just feel free to follow up. Have a nice day.

    Best regards,
    Bessie Zhao - MSFT
    MSDN Subscriber Support in Forum
    If you have any feedback of our support, please contact msdnmg@microsoft.com.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    • Marked as answer by Anonymous9748 Tuesday, October 19, 2010 12:14 PM
    Tuesday, October 19, 2010 7:47 AM

All replies

  • Hello Anonymous,

    Thanks for posting. For this issue, I have made a test in my side. I create a Word 2010 add-in in a system with Office 2010 and VS 2010 installed. When using "&#13;" on SuperTip property, and running this add-in, I could see the new line. The Ribbon XML I used as below.

    <?xml version="1.0" encoding="UTF-8"?>

    <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">

      <ribbon>

        <tabs>

          <tab idMso="TabAddIns">

            <group id="MyGroup"

                   label="My Group">

              <button id="button1" label="button1" supertip="This is line 1 of the supertip&#13;and this is line 2."/>

            </group>

          </tab>

        </tabs>

      </ribbon> 

    </customUI>

    I am not sure if it is related it to be the code itself. To troubleshoot this issue, would you please create a very simple add-in to test and see if this issue happens? If you still could see this issue on your side. Would you mind sharing a sample with us? So that I could use it in my side to reproduce this issue.

    I am looking forward to your reply. Have a nice day.

    Best regards,
    Bessie Zhao - MSFT
    MSDN Subscriber Support in Forum
    If you have any feedback of our support, please contact msdnmg@microsoft.com.

     


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Friday, October 15, 2010 2:53 AM
  • Hi Bessie,

    I created a simple Word Add-In example almost identical to yours:

     

    <?xml version="1.0" encoding="UTF-8"?>
    <customUI onLoad="Ribbon_Load" xmlns="http://schemas.microsoft.com/office/2006/01/customui">
      <ribbon>
        <tabs>
          <tab idMso="TabAddIns">
            <group id="group1" label="group1">
              <button id="button1" supertip="This is line 1 of the supertip.&amp;#13;and this is line 2." label="button1" showImage="false" />
            </group>
          </tab>
        </tabs>
      </ribbon>
    </customUI>
    

    But it has the same problem as before.  You asked me to share a sample.  I'd be happy to provide a ZIP file containing the project, but I do not see a way to provide attachments in this forum.  How should I do that?

    Thanks!

     

    Friday, October 15, 2010 12:42 PM
  • Hi Anonymous

    "almost identical" is not the same as Bessie posted. Look carefully at how she defined the new line separator. You need to use that, with no modification, if you expect it to work.

    Bessie uses: &#13;

    Your code contains: &amp;#13;

    Why do you stick the extra characters in there? Delete amp; and it should work for you, too.


    Cindy Meister, VSTO/Word MVP
    Saturday, October 16, 2010 10:32 AM
    Moderator
  • I did not enter the "&amp": this was converted automatically when I exported the example to XML.  Specificially:

    1. In the designer, in the SuperTip property field, I entered the following:

    This is line 1 of the supertip.;&#13;and this is line 2.

    2. I build/run the project, pause over button1, and the SuperTip appears as follows:

    This is line 1 of the
    supertip.;&#13;and this is line 2.

    The line breaks where it does (following "the") only because of the default width of the SuperTip control.

    3. In the designer, I right-clicked over the group and, from the pop-up menu, selected Export Ribbon to XML.  The resulting Ribbon.xml file has converted the ampersand to "&amp;".

    4. I then looked at Debug > Options and Settings > Text Editor > XML > Miscellaneous and tried changing various settings, but this had no effect on the auto-generation of the ampersand when re-exporting the XML.

    What is causing the difference in behavior between my project(s) and yours is, at this point, unknown. I had asked earlier, in response to Bessie's request, how I can attach/submit the project, but haven't received a response regarding that. 

    Thanks.

     

     

    Monday, October 18, 2010 3:06 PM
  • Hi Anonymous

    Try removing the "&amp;" from the Ribbon XML, so that your code looks exactly like Bessie's. What she posted definitely works in Ribbon XML (but not in the Designer). I tested it myself, just to double-check...


    Cindy Meister, VSTO/Word MVP
    Monday, October 18, 2010 3:45 PM
    Moderator
  • Thanks for clarifying that your suggested approach only works with Ribbon XML.  I tested using "&#13;" in the SuperTip in a Ribbon XML project, and you're right, it's fine.

    But now I have a problem.  My real project includes 3 add-in tabs, a dozen groups, and over 130 controls, which I created using the add-in Designer.  From my Designer-based add-in project, I can export the XML and activate the Ribbon.xml by including

     

        protected override Microsoft.Office.Core.IRibbonExtensibility CreateRibbonExtensibilityObject()
        {
          return new Ribbon();
        }

     

    in my ThisAddIn class.  And the line breaks in the SuperTips now work just fine, but now I have no icons, because Export XML doesn't include image information !

    In my view, either there is a shortcoming/bug in Export XML, or in the Designer.  What do you think?

    Thanks.

    Monday, October 18, 2010 7:08 PM
  • Hi Anonymous

    <<the line breaks in the SuperTips now work just fine, but now I have no icons, because Export XML doesn't include image information !

    In my view, either there is a shortcoming/bug in Export XML, or in the Designer.  What do you think?>>

    A shortcoming of the Export to XML functionality is how I'd term it. Some of the "wrapping" the Designer does is extremely complex, to make the development "experience" with the Designer similar to working with WinForms. And every little bit that's added costs resources (time and money). Probably, the VSTO team had to choose between supporting this, or something else, and the decision fell to the "something else" - whatever that may have been.

    FWIW I was at a meeting, back when the Designer was still "on the drawing board". The VSTO team asked those in the meeting to assign "values" to various aspects of the Ribbon, saying that they couldn't do everything and were interested in opinions of what we considered most important. Turned out almost everything was important :-) But still, the team didn't have infinite resources.

    In any case, here's the information in the VSTO documentation on MSDN (http://msdn.microsoft.com/en-us/library/bb386097.aspx):

    "Not all of the properties that are in the Properties window of the Ribbon designer are transferred to the Ribbon XML file. For example, Visual Studio does not export the value of the Image or Text property. That is because you must create a callback method in the Ribbon code file of the exported project to assign an image or set the text of a control. Visual Studio does not automatically generate callback methods as part of the export process.

    In addition, any unchanged default property values do not appear in the resulting Ribbon XML file."


    Cindy Meister, VSTO/Word MVP
    • Marked as answer by Anonymous9748 Tuesday, October 19, 2010 12:14 PM
    Tuesday, October 19, 2010 7:17 AM
    Moderator
  • Hello,

    I did not realize you are exporting the Ribbon Designer to Ribbon XML. Yes, I think you are right. When we set Image property on a control in Ribbon Designer, and then export it, the Ribbon.xml does not include any information about this Image property. So here, I am afraid that you need to set this property in Ribbon.XML again. Also here is a MSDN page about how to use image in Ribbon xml: http://msdn.microsoft.com/en-us/library/aa338202(office.12).aspx.

    If you have any concerns on this post, just feel free to follow up. Have a nice day.

    Best regards,
    Bessie Zhao - MSFT
    MSDN Subscriber Support in Forum
    If you have any feedback of our support, please contact msdnmg@microsoft.com.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    • Marked as answer by Anonymous9748 Tuesday, October 19, 2010 12:14 PM
    Tuesday, October 19, 2010 7:47 AM
  • It may be easier to use the Ribbon Designer, then set the SuperTip on load:

        Private Sub Ribbon1_Load(ByVal sender As System.Object, ByVal e As RibbonUIEventArgs) Handles MyBase.Load
            MyBtn.SuperTip = "Hello" + vbCrLf + vbCrLf + "World"
        End Sub

    Saturday, March 10, 2012 3:20 PM
  • Thanks for the tip.  I long ago gave up any consideration of using the Ribbon Designer (because we have an extensive ribbon customization project) in favor of Ribbon XML, but programmatically loading the Ribbon XML, instead of keeping it directly in the VS project, is something we're weighing because of the advantages that gives us.
    Saturday, March 10, 2012 5:52 PM
  • You can use double &amp;&amp;

    And this is a result:



    Oskar Shon, Office System MVP - www.VBATools.pl
    if Helpful; Answer when a problem solved

    Wednesday, May 8, 2019 1:01 PM