Microsoft Word 默认的allowincell 属性“destroys”格式化。它从哪里来?
我们有一个 Win32 应用程序,它通过 OLE 将数据库中保存的各种片段拼接到 Word 中的文档。有一个包含一组宏的 Word 模板,旨在确保 Word 文档无法保存到磁盘,但会保存回数据库。到目前为止,一切都很好。让我们假设系统工作正常。
我们也有只读用户。其设计是使用不同的模板,以便这些用户可以查看文档。这个“浏览器”模板已被破坏,因此可能无法保存文件。
当此设计失败时,我已经确定了一个非常具体的情况 - 当图形落入表格内时,只读模板将其转储到表格外,这会导致整个文档的完全重新格式化 - 绝对不是所需要的。
通过以 xml 格式保存示例文档,每种情况一次,我已经表明“allowincell=false”出现在每个受影响图形的错误文档中。假设这是罪魁祸首似乎是合理的。 在好的版本中根本没有提到该属性。 (很奇怪,因为 MSDN 声明“false”是默认值,至少在 .NET 中是这样)
如果我更好地理解设置该值的机制,将会有所帮助。如果我必须猜测,我会假设该属性设置为 True(即未提及),因为原始用户只是通过将图形放置在表格中来请求。
最终我的问题是 - 我可以采取什么最小的干预来解决这个具体问题?任何有关如何解决这一问题的建议将不胜感激。
We have a Win32 application that stitches together documents in Word via OLE from various fragments held in a database. There is a Word Template with a set of macros designed to ensure that the Word Document cannot be saved to disk but will be saved back to the database. So far, so good. Let us assume the system works.
We have readonly users too. The design is that a different template is used so these users may view documents. This 'browser' template has been brain-damaged so that no saving of the file may occur.
I have identified a very specific circumstance when this design fails - when a graphic falls inside a table, the readonly template dumps it outside the table, which results in a total reformat of the whole document - definitely NOT what is required.
By saving a sample document in xml format, once for each case, I have shown that 'allowincell=false' appears in the bad document for each affected graphic. It seems reasonable to suppose this is the culprit. The attribute is not mentioned at all in the good version. (Odd because MSDN states 'false' is the default value, at least in .NET)
It would help if I understood better the mechanism by which this value is being set. If I had to make a guess I would suppose that the attribute is set to True (i.e not mentioned) because the original user has requested so simply by placing the graphic inside a table.
Ultimately my question is - what is the MINIMAL intervention I can make to solve this specific problem ? Any suggestions as to how this might be approached would be most gratefully received.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能没有为图像设置
LayoutInCell = True
(及其WrapFormat
为wdWrapSquare
、wdWrapThrough
、wdWrapTight
或wdWrapTopBottom
)。默认值始终为 False,并且会转换为您所看到的“allowincell=false”的 VML。再次确保WrapFormat
不是wdWrapNone< /code> 或
wdWrapInline
- 只需使用上面的其他之一)。如果这不起作用,请向我们提供更多信息,例如“保存”是什么版本。代码为您使用什么“保存到网页”选项?将同一文档的完整版本(根据需要进行编辑)放入 DropBox 中供我们检查。
It's likely you may not have set
LayoutInCell = True
for the image (along with itsWrapFormat
towdWrapSquare
,wdWrapThrough
,wdWrapTight
orwdWrapTopBottom
). The default is always False and that translates to the VML of 'allowincell=false" that you're seeing. Again, make sure thatWrapFormat
is notwdWrapNone
orwdWrapInline
- just use one of the other ones above).If this doesn't work, please supply us with more information. For example what version of Word? What is the "save" code for the brain-dead version. What "Save to Web Page" options are you using? Put a full and brain-dead version of the same document (redact as needed) in something like DropBox for us to examine.