Word 2007 架构库存储在哪里?

发布于 2024-09-08 00:07:02 字数 183 浏览 1 评论 0原文

Word 2007 允许将 XML 架构附加到文档(在开发工具栏 | XML 组 | 架构按钮下)。这个模式库信息存储在哪里?

我有一些使用基于架构的自定义 XML 标签创建的文档,但是当我将文档和架构传递给其他人时,架构被标记为不可用,可能是因为架构的文件位置不同。

是否有某种方法可以编辑此信息以更改给定架构的路径?

Word 2007 allows XML schemas to be attached to a document (under the Developer toolbar | XML group | Schema button). Where is this schema library information stored?

I have documents that I have created with custom XML tags based on a schema but when I pass on the document and the schema to someone else the schema is marked as unavailable, presumably because the file location of the schema is different.

Is there some way to edit this information to change the path to a given schema?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

再见回来 2024-09-15 00:07:02

它不与 docx 一起存储,只存储它的路径。因此,传递文档几乎总是会破坏链接。 VSTO 可以通过将 XSD 作为资源嵌入到应用程序中来解决此问题。

但对于 VBA 来说,这就更棘手了 - 您需要有一个可以依赖每个用户计算机的路径,然后在那里部署您的 XSD。一种方法是同步 Document_Open (或仅使用 AutoOpen)事件,以便当用户打开文档时(警告:需要注意宏安全性),您可以简单地“编写”XSD,将其硬编码为代码隐藏中的字符串,然后将其写入文件,然后使用如下例程附加该文件:

Dim objSchema As XMLNamespace
Set objSchema = Application.XMLNamespaces.Add("c:\something\mynewlycreated.xsd")
objSchema.AttachToDocument ActiveDocument

因此,由于您不会留下工件,因此您可以通过 Document_CloseAutoClose 从用户计算机中删除该 XSD。

It's not stored with the docx, just the path to it is stored. So passing a document around will almost always break the link. VSTO can get around this by embedding the XSD as a resource in the app.

But for VBA, it's trickier - you need to have a path you can rely on on each user's computer and then deploy your XSD there. One way is to synch the Document_Open (or just use the AutoOpen) event so that when a user opens the document (warning: macro security needs to be dinked around with), you can simply "write" your XSD that is hard-coded as a string in code-behind and then write it to a file and then attach that file with a routine like:

Dim objSchema As XMLNamespace
Set objSchema = Application.XMLNamespaces.Add("c:\something\mynewlycreated.xsd")
objSchema.AttachToDocument ActiveDocument

So as you're not leaving behind artifacts, you could then delete that XSD from the user's computer on Document_Close or AutoClose.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文