标签: office-addins

打包和分发Excel应用程序的最佳方法是什么

我写了一个基于Excel的数据库报告工具.Currentely,所有VBA代码都与一个XLS文件相关联.用户通过单击工具栏上的按钮生成报告.不幸的是,除非用户将文件保存在另一个文件名下,否则所有报告的数据都将被清除.

当我在Word中创建类似的工具时,我可以将所有代码放在模板(.dot)文件中并从那里调用它.如果我将模板文件放在Office启动文件夹中,它将在每次启动Word时启动.是否有类似的方法,在Excel中打包和分发我的代码?我尝试过使用加载项,但是我找不到从应用程序窗口调用代码的方法.

excel vba excel-vba office-addins

3
推荐指数
1
解决办法
1万
查看次数

插入页眉和页脚office.js api

我正在尝试使用任务窗格应用程序中的office js API将页眉和页脚插入到文档中.我似乎无法找到一种方法来向文档添加页眉和页脚.

ms-word office-addins office-js

3
推荐指数
1
解决办法
1177
查看次数

如何从Excel中获取范围(打印区域)?

我制作了一个 Excel 插件,必须将打印区域导出为图像。如果我从程序中手动设置打印区域(“Excel.Range range =sheet.Range[“A1”,“E5”]”),它工作正常,但我需要在 Excel 中设置打印区域并导出该区域作为图像。有人知道如何获取我在 Excel 中设置的打印区域吗?

public static void Save(RibbonControlEventArgs e)
{
    Excel.Window window = e.Control.Context;

    Excel.Worksheet sheet = ((Excel.Worksheet)window.Application.ActiveSheet);

    Excel.Range range = sheet.Range["A1", "E5"];

    range.CopyPicture(Excel.XlPictureAppearance.xlPrinter, Excel.XlCopyPictureFormat.xlPicture);

    range.Copy(Type.Missing);

    string fileName = @"U:\test.jpg";

    if (Clipboard.GetDataObject() != null)
    {
        IDataObject data = Clipboard.GetDataObject();

        Image image = (Image)data.GetData(DataFormats.Bitmap, true);

        image.Save(fileName, ImageFormat.Jpeg);
    }

    MessageBox.Show("Save successful!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
Run Code Online (Sandbox Code Playgroud)

c# excel office-addins excel-2013 excel-2016

3
推荐指数
1
解决办法
3552
查看次数

Office-js Excel 插件:何时返回 context.sync()

我很难理解何时使用context.sync().

这是一个基本的例子,但它又让我缺乏理解:

Excel.run(function (context){
    const wb = context.workbook;
    const ws = wb.worksheets.getActiveWorksheet();

    // should never happened, but is it correct to check like this ?
    if (wb === null) {
        // IS IT CORRECT TO DO THIS ?
        // I just want to exit the function
        // return; would be enough ? What's going on in the callstack?
        return context.sync();
    }
    ws.load("name");
    return context.sync().then(function() {
        var name = wb.name;
        // do stuff
        var range = ws.getRangeByIndexes(1,1,10,10);
        return context.sync().then(function() …
Run Code Online (Sandbox Code Playgroud)

javascript excel office-addins office365-apps office-js

3
推荐指数
1
解决办法
2632
查看次数

Office-ui-fabric-core 某些图标未显示

我正在为 Project 构建办公室插件。即使我使用了正确的图标名称,一些图标也没有显示,这真的很奇怪

遵循官方文档中的所有内容

https://developer.microsoft.com/en-us/fabric#/get-started#fabric-core

和 CSS CDN

<link rel="stylesheet" href="https://static2.sharepointonline.com/files/fabric/office-ui-fabric-core/10.0.0/css/fabric.min.css" />
Run Code Online (Sandbox Code Playgroud)

在项目任务窗格中:侧面加载状态

在此处输入图片说明

在 HTML 中使用正确的格式

   <li class="ms-ListItem">
    <i class="ms-Icon ms-Icon--MapLayers"></i>
    <span class="ms-font-m ms-fontColor-neutralPrimary">Export *****" 
Run Code Online (Sandbox Code Playgroud)

注意:这里 MapLayers 是加载失败的图标。

任何帮助表示赞赏。

ms-project office-addins office365 office-js office-ui-fabric

3
推荐指数
1
解决办法
6542
查看次数

在 Office 插件生成器 Yeoman 中运行“yo office”时出现执行策略错误

我想使用 yeoman 为带有 Angular 的办公室创建一个插件。在power shell中安装了nodeJs、Angular、yeoman、generator-office等需求工具后,我尝试运行此代码

yo office 
Run Code Online (Sandbox Code Playgroud)

但我收到了这个错误:

 yo : File C:\Users\ME\AppData\Roaming\npm\yo.ps1 cannot be loaded. 
The file C:\Users\ME\AppData\Roaming\npm\yo.ps1 is not digitally signed. 
You cannot run this script on the current system. 
For more information about running scripts and setting execution policy, 
see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ yo office
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess  
Run Code Online (Sandbox Code Playgroud)

powershell office-addins yeoman angular project-web-addins

3
推荐指数
1
解决办法
863
查看次数

使用 JavaScript API 添加合并字段

我想将 JavaScript API 中的合并字段 ( <<xyz>>) 插入到单词表中。但是,我无法找到 Office Word 加载项的 JavaScript API。

ms-word office-addins word-field word-addins office-js

2
推荐指数
1
解决办法
1732
查看次数

发布使用 Outlook 预览元素的 Outlook 加载项 - SupportsSharedFolders

我正在开发 Outlook 插件,它将与共享邮箱一起使用。目前,Office 加载项不适用于代表场景,但 MS 已发布支持这些场景的预览版。 https://learn.microsoft.com/en-us/office/dev/add-ins/reference/manifest/supportssharedfolders

我的问题是因为manifest.xml有预览元素;我无法在outlook.office365.com下面上传它my add-ins。我收到以下错误。

This app can't be installed. The manifest file doesn't conform to the schema definition. The element 'DesktopFormFactor' in namespace 'http://schemas.microsoft.com/office/mailappversionoverrides/1.1' has invalid child element 'SupportsSharedFolders' in namespace 'http://schemas.microsoft.com/office/mailappversionoverrides/1.1'. List of possible elements expected: 'ExtensionPoint' in namespace 'http://schemas.microsoft.com/office/mailappversionoverrides/1.1'... The element 'DesktopFormFactor' in namespace 'http://schemas.microsoft.com/office/mailappversionoverrides/1.1' has invalid child element 'SupportsSharedFolders' in namespace 'http://schemas.microsoft.com/office/mailappversionoverrides/1.1'. List of possible elements expected: 'ExtensionPoint' in namespace 'http://schemas.microsoft.com/office/mailappversionoverrides/1.1'.

任何人都知道任何其他方法来为用户部署加载项,甚至测试它而无需上传 xml 文件吗?

提前致谢。

我的manifest.xml 文件的副本位于此处。

<?xml …
Run Code Online (Sandbox Code Playgroud)

office-addins outlook-addin yeoman-generator outlook-web-addins

2
推荐指数
1
解决办法
1908
查看次数

Visual Studio 连接 Exchange 电子邮件帐户时出错

大约两个月前,我接到了制作 Outlook.com 插件的任务。基础功能完美运行,但更高优先级的东西出现了。所以这个项目在过去的两个月里还算顺利。

昨天我想继续这个项目,但它不再起作用了。当我在 Visual Studio 中启动项目并且需要登录我的办公室帐户时,问题就出现了。如果我登录,它将加载一段时间,然后弹出错误。它说:

An error occurred while connecting to the server: 

   The request failed. Unable to connect to the remote server
Run Code Online (Sandbox Code Playgroud)

既然我在过去两个月里没有改变任何东西,这怎么可能?我该如何解决这个问题?

我按照微软自己的教程进行操作。

编辑:

以下是一些屏幕截图:

开始

这是在我的 Visual Studio 内,我在这里启动我的加载项。将出现以下弹出窗口。我已经仔细检查了我的凭据。 弹出窗口

如果我单击连接,它将加载一段时间并显示以下错误: 错误

希望这能提供有关正在发生的事情的更多信息。

c# office-addins visual-studio office365 office-js

2
推荐指数
1
解决办法
1472
查看次数

VSTO 自定义功能区未显示

我正在关注本教程:https://learn.microsoft.com/en-us/visualstudio/vsto/ribbon-designer ?view=vs-2019#DesigningRibbonLayout

但无论我做什么,我的自定义选项卡都不会显示。这是我尝试过的事情的列表:

  • 检查插件是否已启用
  • 结束孤儿进程
  • 重新启动 Outlook
  • 重新启动我的电脑
  • 将按钮添加到默认的 Addin 选项卡(这也没有显示)

有人有什么想法吗?

我正在使用 Visual Studio 2019 和目标 .NET Framework 4.7.2,并尝试为 Outlook 365 创建一个插件(如果有帮助的话)

.net outlook vsto office-addins outlook-addin

2
推荐指数
1
解决办法
973
查看次数