2017-05-12 6 views
0

リボン上のボタンをクリックしてもコマンドを実行しようとしていますが、関数が出現していません。ファイルパスはokです.iはマニフェスト内に関数名を持つアクション属性を追加しました コンソールにエラーなししなさいは、マニフェストがWRITETEXTがグローバルスコープ内にある.... WRITETEXTはあなたがリボンから呼び出したい関数であると仮定するとワードリボンからコマンドを実行する

<?xml version="1.0" encoding="UTF-8"?> 
 
<OfficeApp xmlns="http://schemas.microsoft.com/office/appforoffice/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bt="http://schemas.microsoft.com/office/officeappbasictypes/1.0" xmlns:ov="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="TaskPaneApp"> 
 
    <!-- BeginBasicSettings: Add-in metadata, used for all versions of Office unless override provided --> 
 

 
    <!--IMPORTANT! Id must be unique for your add-in, if you clone this manifest ensure that you change this id to your own GUID --> 
 
    <Id>171371dd-52ac-4c34-bab4-c9e27eae5fda</Id> 
 

 
    <!--Version. Updates from the store only get triggered if there is a version change --> 
 
    <Version>1.0.0.0</Version> 
 
    <ProviderName>Parrot365 :: Dev</ProviderName> 
 
    <DefaultLocale>en-US</DefaultLocale> 
 
    <!-- The display name of your add-in. Used on the store and various placed of the Office UI such as the add-ins dialog --> 
 
    <DisplayName DefaultValue="Parrot365 :: Dev" /> 
 
    <Description DefaultValue="Parrot365 :: Dev Mode"/> 
 

 
    <!--Icon for your add-in. Used on installation screens and the add-ins dialog --> 
 
    <IconUrl DefaultValue="https://p365.wittyparrot.com:3000/resources/assets/images/parrot365/p365_icons/parrot365_32px.png" /> 
 
    <HighResolutionIconUrl DefaultValue="https://p365.wittyparrot.com:3000/resources/assets/images/parrot365/p365_icons/parrot365_128px.png" /> 
 
    <SupportUrl DefaultValue="http://support.wittyparrot.com/support/home" /> 
 

 
    <!--BeginTaskpaneMode integration. Office 2013 and any client that doesn't understand commands will use this section. 
 
    This section will also be used if there are no VersionOverrides --> 
 
    <Hosts> 
 
    <Host Name="Document" /> 
 
    <Host Name="Workbook" /> 
 
    <Host Name="Presentation" /> 
 
    </Hosts> 
 
    <DefaultSettings> 
 
    <SourceLocation DefaultValue="https://dev2.wittyparrot.com:3000" /> 
 
    </DefaultSettings> 
 
    <!--EndTaskpaneMode integration --> 
 

 
    <Permissions>ReadWriteDocument</Permissions> 
 

 
    <!--BeginAddinCommandsMode integration--> 
 
    <VersionOverrides xmlns="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="VersionOverridesV1_0"> 
 
    <!-- Optional, override the description of the Add-in --> 
 
    <Description resid="residToolTip" /> 
 
    <!--Required, hosts node. Each host can have a different set of commands --> 
 
    <Hosts> 
 
     <!--Specific host. Workbook=Excel, Document=Word, Presentation=PowerPoint --> 
 
     <Host xsi:type="Document"> 
 
     <!-- Form factor. Currenly only DesktopFormFactor is supported. We will add TabletFormFactor and PhoneFormFactor in the future--> 
 
     <DesktopFormFactor> 
 

 
      <!--GetStarted information used on the callout that appears when installing the add-in. 
 
      Ensure you have build 16.0.6769 or above for GetStarted section to work--> 
 
      <GetStarted> 
 
\t \t \t \t \t \t <!--Title of the Getting Started callout. resid points to a ShortString resource --> 
 
\t \t \t \t \t \t <Title resid="Witty.GetStarted.Title"/> 
 

 
\t \t \t \t \t \t <!--Description of the Getting Started callout. resid points to a LongString resource --> 
 
\t \t \t \t \t \t <Description resid="Witty.GetStarted.Description"/> 
 

 
\t \t \t \t \t \t <!--Not used right now but you need to provide a valid resource. We will add code in the future to consume this URL. 
 
\t \t \t \t \t \t \t resid points to a Url resource --> 
 
\t \t \t \t \t \t <LearnMoreUrl resid="Witty.GetStarted.LearnMoreUrl"/> 
 
\t \t </GetStarted> 
 
\t \t <FunctionFile resid="residDesktopFuncUrl" /> 
 
      <!--PrimaryCommandSurface==Main Office Ribbon--> 
 
      <ExtensionPoint xsi:type="PrimaryCommandSurface"> 
 
\t \t \t <OfficeTab id="TabHome"> 
 
       <!--Group. Ensure you provide a unique id. Recommendation for any IDs is to namespace using your companyname--> 
 
       <Group id="Witty.Citations.Group1Id1"> 
 
       <!--Label for your group. resid must point to a ShortString resource --> 
 
       <Label resid="residLabel4" /> 
 
       <!--Icons. Required sizes 16,31,80, optional 20, 24, 40, 48, 64. Strongly recommended to provide all sizes for great UX --> 
 
       <!--Use PNG icons and remember that all URLs on the resources section must use HTTPS --> 
 
       <Icon> 
 
        <bt:Image size="16" resid="icon1_16x16" /> 
 
        <bt:Image size="32" resid="icon1_32x32" /> 
 
        <bt:Image size="80" resid="icon1_80x80" /> 
 
       </Icon> 
 

 

 
       <!--Control. It can be of type "Button" or "Menu" --> 
 
       <Control xsi:type="Button" id="Button3Id1"> 
 
        <!--Label for your button. resid must point to a ShortString resource --> 
 
        <Label resid="residLabel3" /> 
 
        <Supertip> 
 
        <!--ToolTip title. resid must point to a ShortString resource --> 
 
        <Title resid="residLabel" /> 
 
        <!--ToolTip description. resid must point to a LongString resource --> 
 
        <Description resid="residToolTip" /> 
 
        </Supertip> 
 
        <Icon> 
 
        <bt:Image size="16" resid="icon1_16x16" /> 
 
        <bt:Image size="32" resid="icon3_32x32" /> 
 
        <bt:Image size="80" resid="icon1_80x80" /> 
 
        </Icon> 
 
        <!--This is what happens when the command is triggered (E.g. click on the Ribbon). Supported actions are ExecuteFuncion or ShowTaskpane--> 
 
        <Action xsi:type="ShowTaskpane"> 
 
        <!--Provide a url resource id for the location that will be displayed on the taskpane --> 
 
        <SourceLocation resid="residUnitConverterUrl" /> 
 
        </Action> 
 
       </Control> 
 

 
       <!--Control. It can be of type "Button" or "Menu" --> 
 
       <Control xsi:type="Button" id="Contoso.FunctionButton"> 
 
       <!--Label for your button. resid must point to a ShortString resource --> 
 
        <Label resid="Contoso.FunctionButton.Label" /> 
 
        <Supertip> 
 
        <!--ToolTip title. resid must point to a ShortString resource --> 
 
        <Title resid="Contoso.FunctionButton.Label" /> 
 
        <!--ToolTip description. resid must point to a LongString resource --> 
 
        <Description resid="Contoso.FunctionButton.Tooltip" /> 
 
        </Supertip> 
 
        <Icon> 
 
        <bt:Image size="16" resid="Contoso.FunctionButton.Icon" /> 
 
        <bt:Image size="32" resid="Contoso.FunctionButton.Icon" /> 
 
        <bt:Image size="80" resid="Contoso.FunctionButton.Icon" /> 
 
        </Icon> 
 
        <!--This is what happens when the command is triggered (E.g. click on the Ribbon). Supported actions are ExecuteFuncion or ShowTaskpane--> 
 
        <!--Look at the FunctionFile.html page for reference on how to implement the function --> 
 
        <Action xsi:type="ExecuteFunction"> 
 
        <!--Name of the function to call. This function needs to exist in the global DOM namespace of the function file--> 
 
        <FunctionName>writeText</FunctionName> 
 
        </Action> 
 
       </Control> 
 

 

 

 
       </Group> 
 
      </OfficeTab> 
 
      </ExtensionPoint> 
 
     </DesktopFormFactor> 
 
     </Host> 
 

 
     <Host xsi:type="Workbook"> 
 
     <!-- Form factor. Currenly only DesktopFormFactor is supported. We will add TabletFormFactor and PhoneFormFactor in the future--> 
 
     <DesktopFormFactor> 
 

 
      <!--GetStarted information used on the callout that appears when installing the add-in. 
 
      Ensure you have build 16.0.6769 or above for GetStarted section to work--> 
 
      <GetStarted> 
 
\t \t \t \t \t \t <!--Title of the Getting Started callout. resid points to a ShortString resource --> 
 
\t \t \t \t \t \t <Title resid="Witty.GetStarted.Title"/> 
 

 
\t \t \t \t \t \t <!--Description of the Getting Started callout. resid points to a LongString resource --> 
 
\t \t \t \t \t \t <Description resid="Witty.GetStarted.Description"/> 
 

 
\t \t \t \t \t \t <!--Not used right now but you need to provide a valid resource. We will add code in the future to consume this URL. 
 
\t \t \t \t \t \t \t resid points to a Url resource --> 
 
\t \t \t \t \t \t <LearnMoreUrl resid="Witty.GetStarted.LearnMoreUrl"/> 
 
\t \t </GetStarted> 
 
\t \t <FunctionFile resid="residDesktopFuncUrl" /> 
 
      <!--PrimaryCommandSurface==Main Office Ribbon--> 
 
      <ExtensionPoint xsi:type="PrimaryCommandSurface"> 
 
\t \t \t <OfficeTab id="TabHome"> 
 
       <!--Group. Ensure you provide a unique id. Recommendation for any IDs is to namespace using your companyname--> 
 
       <Group id="Witty.Citations.Group1Id1"> 
 
       <!--Label for your group. resid must point to a ShortString resource --> 
 
       <Label resid="residLabel4" /> 
 
       <!--Icons. Required sizes 16,31,80, optional 20, 24, 40, 48, 64. Strongly recommended to provide all sizes for great UX --> 
 
       <!--Use PNG icons and remember that all URLs on the resources section must use HTTPS --> 
 
       <Icon> 
 
        <bt:Image size="16" resid="icon1_16x16" /> 
 
        <bt:Image size="32" resid="icon1_32x32" /> 
 
        <bt:Image size="80" resid="icon1_80x80" /> 
 
       </Icon> 
 
       <!--Control. It can be of type "Button" or "Menu" --> 
 
       <Control xsi:type="Button" id="Button3Id1"> 
 
        <!--Label for your button. resid must point to a ShortString resource --> 
 
        <Label resid="residLabel3" /> 
 
        <Supertip> 
 
        <!--ToolTip title. resid must point to a ShortString resource --> 
 
        <Title resid="residLabel" /> 
 
        <!--ToolTip description. resid must point to a LongString resource --> 
 
        <Description resid="residToolTip" /> 
 
        </Supertip> 
 
        <Icon> 
 
        <bt:Image size="16" resid="icon1_16x16" /> 
 
        <bt:Image size="32" resid="icon3_32x32" /> 
 
        <bt:Image size="80" resid="icon1_80x80" /> 
 
        </Icon> 
 
        <!--This is what happens when the command is triggered (E.g. click on the Ribbon). Supported actions are ExecuteFuncion or ShowTaskpane--> 
 
        <Action xsi:type="ShowTaskpane"> 
 
        <!--Provide a url resource id for the location that will be displayed on the taskpane --> 
 
        <SourceLocation resid="residUnitConverterUrl" /> 
 
        </Action> 
 
       </Control> 
 
       </Group> 
 
      </OfficeTab> 
 
      </ExtensionPoint> 
 
     </DesktopFormFactor> 
 
     </Host> 
 

 
     <Host xsi:type="Presentation"> 
 
     <!-- Form factor. Currenly only DesktopFormFactor is supported. We will add TabletFormFactor and PhoneFormFactor in the future--> 
 
     <DesktopFormFactor> 
 

 
      <!--GetStarted information used on the callout that appears when installing the add-in. 
 
      Ensure you have build 16.0.6769 or above for GetStarted section to work--> 
 
      <GetStarted> 
 
\t \t \t \t \t \t <!--Title of the Getting Started callout. resid points to a ShortString resource --> 
 
\t \t \t \t \t \t <Title resid="Witty.GetStarted.Title"/> 
 

 
\t \t \t \t \t \t <!--Description of the Getting Started callout. resid points to a LongString resource --> 
 
\t \t \t \t \t \t <Description resid="Witty.GetStarted.Description"/> 
 

 
\t \t \t \t \t \t <!--Not used right now but you need to provide a valid resource. We will add code in the future to consume this URL. 
 
\t \t \t \t \t \t \t resid points to a Url resource --> 
 
\t \t \t \t \t \t <LearnMoreUrl resid="Witty.GetStarted.LearnMoreUrl"/> 
 
\t \t </GetStarted> 
 
\t \t <FunctionFile resid="residDesktopFuncUrl" /> 
 
      <!--PrimaryCommandSurface==Main Office Ribbon--> 
 
      <ExtensionPoint xsi:type="PrimaryCommandSurface"> 
 
\t \t \t <OfficeTab id="TabHome"> 
 
       <!--Group. Ensure you provide a unique id. Recommendation for any IDs is to namespace using your companyname--> 
 
       <Group id="Witty.Citations.Group1Id1"> 
 
       <!--Label for your group. resid must point to a ShortString resource --> 
 
       <Label resid="residLabel4" /> 
 
       <!--Icons. Required sizes 16,31,80, optional 20, 24, 40, 48, 64. Strongly recommended to provide all sizes for great UX --> 
 
       <!--Use PNG icons and remember that all URLs on the resources section must use HTTPS --> 
 
       <Icon> 
 
        <bt:Image size="16" resid="icon1_16x16" /> 
 
        <bt:Image size="32" resid="icon1_32x32" /> 
 
        <bt:Image size="80" resid="icon1_80x80" /> 
 
       </Icon> 
 
       <!--Control. It can be of type "Button" or "Menu" --> 
 
       <Control xsi:type="Button" id="Button3Id1"> 
 
        <!--Label for your button. resid must point to a ShortString resource --> 
 
        <Label resid="residLabel3" /> 
 
        <Supertip> 
 
        <!--ToolTip title. resid must point to a ShortString resource --> 
 
        <Title resid="residLabel" /> 
 
        <!--ToolTip description. resid must point to a LongString resource --> 
 
        <Description resid="residToolTip" /> 
 
        </Supertip> 
 
        <Icon> 
 
        <bt:Image size="16" resid="icon1_16x16" /> 
 
        <bt:Image size="32" resid="icon3_32x32" /> 
 
        <bt:Image size="80" resid="icon1_80x80" /> 
 
        </Icon> 
 
        <!--This is what happens when the command is triggered (E.g. click on the Ribbon). Supported actions are ExecuteFuncion or ShowTaskpane--> 
 
        <Action xsi:type="ShowTaskpane"> 
 
        <!--Provide a url resource id for the location that will be displayed on the taskpane --> 
 
        <SourceLocation resid="residUnitConverterUrl" /> 
 
        </Action> 
 
       </Control> 
 
       </Group> 
 
      </OfficeTab> 
 
      </ExtensionPoint> 
 
     </DesktopFormFactor> 
 
     </Host> 
 
    </Hosts> 
 
    <Resources> 
 
     <bt:Images> 
 
     <bt:Image id="icon1_16x16" DefaultValue="https://p365.wittyparrot.com:3000/resources/assets/images/parrot365/p365_icons/parrot365_16px.png"> 
 
     </bt:Image> 
 
     <bt:Image id="icon1_32x32" DefaultValue="https://p365.wittyparrot.com:3000/resources/assets/images/parrot365/p365_icons/parrot365_32px.png"> 
 
     </bt:Image> 
 
     <bt:Image id="icon1_80x80" DefaultValue="https://p365.wittyparrot.com:3000/resources/assets/images/parrot365/p365_icons/parrot365_48px.png"> 
 
     </bt:Image> 
 
\t \t  <bt:Image id="icon2_32x32" DefaultValue="https://p365.wittyparrot.com:3000/resources/assets/images/parrot365/p365_icons/parrot365_32px.png"> 
 
     </bt:Image> 
 
     <bt:Image id="icon3_32x32" DefaultValue="https://p365.wittyparrot.com:3000/resources/assets/images/parrot365/p365_icons/parrot365_32px.png"> 
 
     </bt:Image> 
 
     <bt:Image id="Contoso.FunctionButton.Icon" DefaultValue="https://p365.wittyparrot.com:3000/resources/assets/images/parrot365/p365_icons/parrot365_32px.png" > 
 
     </bt:Image> 
 
     </bt:Images> 
 
     <bt:Urls> 
 
\t \t <bt:Url id="residDesktopFuncUrl" DefaultValue="https://dev2.wittyparrot.com:3000/index.html"> 
 
     </bt:Url> 
 
     <bt:Url id="residUnitConverterUrl" DefaultValue="https://p365.wittyparrot.com:3000?source=msoffice"> 
 
     </bt:Url> 
 
      <!--LearnMore URL currently not used --> 
 
     <bt:Url id="Witty.GetStarted.LearnMoreUrl" DefaultValue="https://p365.wittyparrot.com:3000"> 
 
     </bt:Url> 
 
     </bt:Urls> 
 
     <bt:ShortStrings> 
 
     <bt:String id="residLabel" DefaultValue="Launch Widget"> 
 
     </bt:String> 
 
     <bt:String id="residLabel3" DefaultValue="Parrot365"> 
 
     </bt:String> 
 
     <bt:String id="residLabel4" DefaultValue=" "> 
 
     </bt:String> 
 
     <bt:String id="Witty.GetStarted.Title" DefaultValue="Parrot365 Widget Loaded Successfully"> 
 
     </bt:String> 
 
     <bt:String id="Contoso.FunctionButton.Label" DefaultValue="Save Document into Witty Parrot"> 
 
     </bt:String> 
 
     </bt:ShortStrings> 
 
     <bt:LongStrings> 
 
     <bt:String id="residToolTip" DefaultValue="Parrot365 add-in provides improves productivity, accuracy and consistency in communication."> 
 
     </bt:String> 
 
     <bt:String id="Witty.GetStarted.Description" DefaultValue="Get going by opening the Home tab on the Ribbon then click Parrot365 button"> 
 
     </bt:String> 
 
     <bt:String id="Contoso.FunctionButton.Tooltip" DefaultValue="Click to Execute Function" ></bt:String> 
 
     </bt:LongStrings> 
 
    </Resources> 
 
    </VersionOverrides> 
 
</OfficeApp>

答えて

0

の下であることを示唆していますか?そうでない場合、移動する必要があります:

(function() { 
     Office.initialize = function(reason) { 
      //Initialize....   
     }; 

     //Not in global scope, cannot be invoked from the ribbon 
     function writeText() { 
      //Do something 
     } 
    })(); 

    //In global scope, can be invoked from the ribbon. 
    function writeText() { 
     //Do something 
    } 
+0

私は問題を解決しました。機能ファイルのパスを変更し、マニフェストワードをオンラインで再ロードする必要があります。 – Leo

関連する問題