Office js word.run在服务器环境中不工作

Office js word.run在服务器环境中不工作,office-js,Office Js,绑定对象(Word) 网址: 创建对变量的绑定: 使用Office.context.document.getSelectedDataAsync(),asyncResult.value(响应)与TextBinding一起添加,使用 Office.context.document.bindings.addFromSelectionAsync()添加到当前选择 填充内容 使用Binding.setDataAsync方法,我们将数据写入由指定绑定对象表示的文档的绑定部分。 现在的问题是,我们无法将

绑定对象(Word)

网址:

  • 创建对变量的绑定:

    • 使用Office.context.document.getSelectedDataAsync(),asyncResult.value(响应)与TextBinding一起添加,使用 Office.context.document.bindings.addFromSelectionAsync()添加到当前选择
  • 填充内容

    • 使用Binding.setDataAsync方法,我们将数据写入由指定绑定对象表示的文档的绑定部分。 现在的问题是,我们无法将{impressionType:“html”}设置为在文档的绑定部分插入富文本,因为它可以处理文本
  • 问题:

  • 无法在联机word中使用setDataAsync()插入富格文本
  • 无法使用bindingId对内容进行活动选择,bindingId将帮助我们使用Office.context.document.setSelectedDataAsync()将数据写入文档中的当前选择(富文本与此API配合使用)。在使用此方法之前,我们需要释放绑定
  • 无法通过在Office.initialize之后将函数传递到Word.run()方法来执行 run(函数(上下文){}) 没有控制台错误或警告,但Word.run()块在试图通过服务器执行代码时从不运行。本地开发环境在这种情况下起作用

    显示

        <?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>010861c8-0558-472c-b350-f7795e27cfa5</Id>
    
      <!--Version. Updates from the store only get triggered if there is a version change -->
      <Version>1.0.0.0</Version>
      <ProviderName>Parrot365 : [QA]</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 : [QA]" />
      <Description DefaultValue="Parrot365 : QA Mode"/>
    
      <!--Icon for your add-in. Used on installation screens and the add-ins dialog -->
      <IconUrl DefaultValue="https://qaparrot365.wittyparrot.com/resources/assets/images/wp_logo_32px.png" />
      <HighResolutionIconUrl DefaultValue="https://qaparrot365.wittyparrot.com/resources/assets/images/wp_logo_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://qaparrot365.wittyparrot.com?source=msoffice" />
      </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>
                            <!--Title of the Getting Started callout. resid points to a ShortString resource -->
                            <Title resid="Witty.GetStarted.Title"/>
    
                            <!--Description of the Getting Started callout. resid points to a LongString resource -->
                            <Description resid="Witty.GetStarted.Description"/>
    
                            <!--Not used right now but you need to provide a valid resource. We will add code in the future to consume this URL.
                                resid points to a Url resource -->
                            <LearnMoreUrl resid="Witty.GetStarted.LearnMoreUrl"/>
              </GetStarted>
              <FunctionFile resid="residDesktopFuncUrl" />
              <!--PrimaryCommandSurface==Main Office Ribbon-->
              <ExtensionPoint xsi:type="PrimaryCommandSurface">
                <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="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>
                            <!--Title of the Getting Started callout. resid points to a ShortString resource -->
                            <Title resid="Witty.GetStarted.Title"/>
    
                            <!--Description of the Getting Started callout. resid points to a LongString resource -->
                            <Description resid="Witty.GetStarted.Description"/>
    
                            <!--Not used right now but you need to provide a valid resource. We will add code in the future to consume this URL.
                                resid points to a Url resource -->
                            <LearnMoreUrl resid="Witty.GetStarted.LearnMoreUrl"/>
              </GetStarted>
              <FunctionFile resid="residDesktopFuncUrl" />
              <!--PrimaryCommandSurface==Main Office Ribbon-->
              <ExtensionPoint xsi:type="PrimaryCommandSurface">
                <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>
                            <!--Title of the Getting Started callout. resid points to a ShortString resource -->
                            <Title resid="Witty.GetStarted.Title"/>
    
                            <!--Description of the Getting Started callout. resid points to a LongString resource -->
                            <Description resid="Witty.GetStarted.Description"/>
    
                            <!--Not used right now but you need to provide a valid resource. We will add code in the future to consume this URL.
                                resid points to a Url resource -->
                            <LearnMoreUrl resid="Witty.GetStarted.LearnMoreUrl"/>
              </GetStarted>
              <FunctionFile resid="residDesktopFuncUrl" />
              <!--PrimaryCommandSurface==Main Office Ribbon-->
              <ExtensionPoint xsi:type="PrimaryCommandSurface">
                <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://qaparrot365.wittyparrot.com/resources/assets/images/widget_logo.png">
            </bt:Image>
            <bt:Image id="icon1_32x32" DefaultValue="https://qaparrot365.wittyparrot.com/resources/assets/images/wp_logo_32px.png">
            </bt:Image>
            <bt:Image id="icon1_80x80" DefaultValue="https://qaparrot365.wittyparrot.com/resources/assets/images/wp_logo_80px.png">
            </bt:Image>
            <bt:Image id="icon2_32x32" DefaultValue="https://qaparrot365.wittyparrot.com/resources/assets/images/wp_logo_32px.png">
            </bt:Image>
            <bt:Image id="icon3_32x32" DefaultValue="https://qaparrot365.wittyparrot.com/resources/assets/images/wp_logo_32px.png">
            </bt:Image>
          </bt:Images>
          <bt:Urls>
             <bt:Url id="residDesktopFuncUrl" DefaultValue="https://qaparrot365.wittyparrot.com?source=msoffice">
            </bt:Url>
            <bt:Url id="residUnitConverterUrl" DefaultValue="https://qaparrot365.wittyparrot.com?source=msoffice">
            </bt:Url>
              <!--LearnMore URL currently not used -->
            <bt:Url id="Witty.GetStarted.LearnMoreUrl" DefaultValue="https://qaparrot365.wittyparrot.com">
            </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: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:LongStrings>
        </Resources>
      </VersionOverrides>
    </OfficeApp>
    
    
    010861c8-0558-472c-b350-f7795e27cfa5
    1.0.0.0
    鹦鹉365:[QA]
    恩美
    读写文件
    
    “严格使用”;
    var计数=0;
    (功能(){
    角度模块('wpoffice'))
    .directive('wittyWordVariable',function(){
    返回{
    限制:'E',
    替换:正确,
    templateUrl:'app/components/witty-word-variable/witty-word-variable_template.html',
    作用域:{},
    bindToController:对,
    控制器:“WordVariableController”,
    controllerAs:'WordVariableCtrl'
    };
    })
    .controller('WordVariableController',WordVariableController);
    function WordVariableController($q,ngNotify){
    var vm=这个;
    vm.init=init;
    vm.getSelectedWordFromDocument=getSelectedWordFromDocument;
    vm.populateWordVar=populateWordVar;
    函数init(){
    log('Initialized WordVariableController');
    vm.inputBoxObjects=[];
    vm.varValues=[];
    vm.onloadVariablesFound=[];
    if(Office.context.document){
    getAllSelectedContentControl();
    }否则{
    ngNotify.set('请重新加载Parrot365','错误');
    }
    }
    /*
    *getAllSelectedContentControl----它将加载变量和相应的文本框
    *@参数---无参数
    */
    函数getAllSelectedContentControl(){
    log('getAllSelectedContentControl');
    console.log(Word);
    运行(函数(上下文){
    骗局