简体   繁体   English

如何制作docx文件,打开时需要一些自定义插件

[英]How to make a docx file, requires some custom plugin when opened

I have an use case in my web application where user can download a DOCX file that has some custom properties added to it required for our word add-in, open it and do some editing or some other stuff using the word add-in. 我的Web应用程序中有一个用例,用户可以下载DOCX文件,该文件已添加了一些自定义属性,这是我们的单词加载项所需的,可以打开它并使用单词加载项进行一些编辑或其他工作。 It worked totally fine when the add-in is already installed in user machine. 当外接程序已经安装在用户计算机中时,它的工作效果很好。 Otherwise I want to notify(some validation popup) user to install the particular add-in when user tries to open the particular document. 否则,当用户尝试打开特定文档时,我想通知(某些验证弹出窗口)用户安装特定加载项。 Is there any way to add some properties to the document about requirement of the specified add-in? 有什么方法可以向文档中添加有关指定外接程序要求的某些属性? If yes then how? 如果是,那怎么办? I would appreciate any help?? 我将不胜感激任何帮助??

There is no built-in mechanism in Word to display a message based on a document's metadata. Word中没有内置的机制来显示基于文档的元数据的消息。 I see two ways you could achieve that: 我看到两种方法可以实现:

  1. Theoretically, you could embed a macro in your document that checks the presence of your add-in when the document is opened and then displays a message. 从理论上讲,您可以在文档中嵌入一个宏,该宏在打开文档时检查加载项的存在,然后显示一条消息。 However, by default (and for very good reasons) Word prevents macros from running in files downloaded from the Web. 但是,默认情况下(出于很好的原因),Word会阻止宏在从Web下载的文件中运行。 Thus, such a solution only would work with a very insecure Office configuration. 因此,这种解决方案仅适用于非常不安全的Office配置。
  2. Display a message in your web application instructing users to download the add-in. 在您的Web应用程序中显示一条消息,指示用户下载加载项。 This can be achieved easily; 这很容易实现; the only disadvantage is that users who already downloaded the document previously won't see the message again when they actually open the document. 唯一的缺点是,以前已经下载过文档的用户在实际打开文档时不会再看到该消息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用带有Java的docx4j在.docx文件中添加带有一些信息的页眉和带有页码的页脚? - How to add page header with some information and footer with page number in .docx file using docx4j with Java? 单击打开的图片中的特定位置后,如何使ComboBox从csv文件加载内容? - How can I make a ComboBox load content from a csv file, when a specific position in an opened picure is clicked on? Intellij IDEA 插件如何获取当前打开文件的路径? - Intellij IDEA plugin how to get path of currently opened file? 打开编辑器时如何在 Eclipse 插件中正确设置 IFile 的内容 - How to properly set the content of an IFile in Eclipse plugin when the editor is opened 如何检查文件是否被锁定(由其他应用打开) - How to check if file is locked (opened by some other app) 如何读取 docx 文件并知道页面何时更改? APACHE POI - How to read a docx file and know when the page changes? APACHE POI 如何制作多页docx? - How to make a multiple pages docx? Eclipse插件-通知何时在Eclipse中打开编辑器 - Eclipse Plugin - Notification of when an editor is opened in Eclipse 如何使休眠增强插件忽略某些类? - How to make hibernate enhancement plugin ignore some classes? 如何在Java中将docx文件标题图像复制到另一个docx文件中 - How to copy docx file header image into anoter docx file in java
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM