打开不受信任的 visio 文档时如何强制 visio 重新计算公式

发布于 2024-08-04 22:06:11 字数 919 浏览 10 评论 0原文

我有一个在 Visio 之外创建 Visio 文件 (VDX) 的模块。根据 SDK,这指的是“不受信任”的 XML。 我通过从模板复制母版来创建 xml 文件,然后使用 XML 稀疏文件引用它们。

在我的稀疏 xml 中,我以这种方式覆盖形状的位置和大小:

<Shape ID="154" Master="0">
       <Text>Text of the shape</Text>
       <XForm>
         <PinX>2.90625</PinX>
         <PinY>3.895833333333333</PinY>
         <Width F="No Formula">0.75</Width>
         <Height F="No Formula">0.5</Height>
       </XForm>
</Shape>

我的形状是一个具有子形状的组。

它有效,Visio 能够打开它,但子形状具有主形状的默认宽度和高度。 此外,形状之间的链接无法正确路由。

如果我复制/粘贴相同的新文件,那么我会得到预期的结果。

我尝试强制子形状的宽度和高度。我遇到同样的问题。

我尝试通过显式调用 Cell 类的 trigger() 方法来使用 VBA 代码打开文档,并且得到了预期的结果。 它也有效,我打开形状表。该值以黑色显示,我只需在单元格上按 Enter 键,我也得到了预期的结果。

我对这个问题的理解是,当我打开文档时,visio 不会评估我的子形状的公式。

不幸的是,我不能依靠宏来强制和更新单元格。我想知道是否有办法在打开文档时强制重新评估子形状的公式。

提前致谢。

埃里克

I have a module that creates a Visio file (VDX) outside Visio. According to the SDK this refers to 'untrusted' XML.
I've created my xml file by copied the Masters from my stencil and then refer to them using an XML sparse file.

In my sparse xml I override the shape's location and size this way:

<Shape ID="154" Master="0">
       <Text>Text of the shape</Text>
       <XForm>
         <PinX>2.90625</PinX>
         <PinY>3.895833333333333</PinY>
         <Width F="No Formula">0.75</Width>
         <Height F="No Formula">0.5</Height>
       </XForm>
</Shape>

My shape is a group that has sub-shapes.

It works, Visio is able to open it, but the sub-shapes has the default width and height of the master.
Also the links between by shapes don't route properly.

If I copy/paste in the same of new file, then I get the expected result.

I have tried to force the width and height of sub-shapes. I get the same problem.

I have tried using VBA code on opening of the document by explicitly calling the trigger() method of the Cell class and I get the expected results.
It also work, I open the shape sheet. The value is there in black, I just hit enter on the cell, and I get the expected result as well.

My understanding of the problem, is that visio does not evaluate the formulas of my sub-shapes when I open the document.

Unfortunately, I cannot rely on macros to force and update the cells. I would like to know if there's a way to force the formulas of my sub-shapes to be re-evaluated when I open my document.

Thanks in advance.

Eric

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

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

发布评论

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

评论(2

伪装你 2024-08-11 22:06:11

基于
http://blogs.office.com/2013/01/29/10-tips-for-developers-working-with-the-visio-vsdx-file-format/

使用 docPropscustom 中的 RecalcDocument 标志.xml 部分。这将导致完全重新计算,类似于 VDX 的加载行为,但也会显着减慢加载速度。重新计算并加载文件后,下一次保存将从文档中删除 RecalcDocument 标志。这将限制单个文件加载的性能影响。
下面显示了带有 RecalcDocument 标志的 custom.xml 部分的示例。

Based on
http://blogs.office.com/2013/01/29/10-tips-for-developers-working-with-the-visio-vsdx-file-format/

use the RecalcDocument flag in the docPropscustom.xml part. This will cause a complete recalculation, similar to the load behavior from VDX, but will also significantly slow down load. Once the file has been recalculated and loaded, the next save will remove the RecalcDocument flag from the document. This will limit the performance hit to a single file load.
An example of the custom.xml part with RecalcDocument flag is shown below.

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