重新加载时 Word 2010 内容控制损坏

发布于 2024-12-17 15:41:51 字数 769 浏览 0 评论 0原文

我们在使用内容控件的 Word 2010 中构建模板时遇到问题。这些模板与我们继承的自定义系统结合使用,该系统使用它们来构建报告。

这些模板具有嵌套的内容控件,因此:

<CONDITION>
    <IF>{xpath}</IF>
    <THEN>
        {rich text}
    </THEN>
</CONDITION>

IF 用于确定通过 {xpath} 指定的条件是 true 还是 false。如果为 true,则使用 THEN 控件中包含的内容。

奇怪的是,构建模板似乎没有问题。保存后,它们可以在自定义系统中正常工作。但是,当稍后在 Word 2010 中重新打开它们时,原本应该出现在 THEN 内容控件中的 {rich text} 被替换为 IF 内容控件中的 {xpath},因此

<CONDITION>
    <IF>{xpath}</IF>
    <THEN>
        {xpath}
    </THEN>
</CONDITION>

:似乎这种损坏发生在它们重新加载到 Word 2010 时。因此,我们第一次了解这种损坏似乎是当有人重新加载模板以进行进一步更改时,几天,几周或者许多个月后。到那时我们可能已经忘记了应该放在那里的东西并丢失了大量的工作。

谁能解释为什么会发生这种腐败?

我在互联网上寻找答案但一无所获。

We're experiencing a problem building templates in Word 2010 that feature Content Controls. These templates are used in conjunction with a custom system we have inherited that uses them to build reports.

These templates feature nested Content Controls thus:

<CONDITION>
    <IF>{xpath}</IF>
    <THEN>
        {rich text}
    </THEN>
</CONDITION>

The IF is used to determine whether a condition specified via an {xpath} is true or false. If it is true the content contained within the THEN control is then used.

The odd thing is there doesn't seem to be a problem building the templates. When they are saved they work fine in the custom system. However, when they are later re-opened in Word 2010, the {rich text} that was suppose to appear in the THEN Content Control is replaced with the {xpath} from the IF Content Control thus:

<CONDITION>
    <IF>{xpath}</IF>
    <THEN>
        {xpath}
    </THEN>
</CONDITION>

As the templates work with the system it seems like this corruption occurs at the point where they are re-loaded into Word 2010. As such, it seems like the first time we'll get to know about this corruption is when someone reloads the template to make further alterations, days, weeks or many months later. By which time we may have forgotten what should be there and lost an awful lot of work.

Can anyone explain why this corruption might be happening?

I've looked on the internet for an answer but found nothing.

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

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

发布评论

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

评论(1

迷你仙 2024-12-24 15:41:51

听起来您的代码中存在错误,导致 XML 格式错误。打开时,Word 会尝试解释格式错误的 XML,结果会得到不希望的结果。

It sounds like there is a mistake in your code causing malformed XML. When opened, Word tries to interpret the malformed XML and as a result you are ending up with undesired results.

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