- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
在我的 Word 加载项中,我有一个 Word Document
对象,其中包含一个特定的 Section
。在此 Section
中,我附加了一个 Shape
:
var shape = section.Headers[WdHeaderFooterIndex.wdHeaderFooterFirstPage].Shapes.AddTextEffect(MsoPresetTextEffect.msoTextEffect1, "Example text...", "Calibri", 72, MsoTriState.msoFalse, MsoTriState.msoFalse, 0, 0, section.Headers[WdHeaderFooterIndex.wdHeaderFooterFirstPage].Range) as Shape;
我的问题是某些 Word 文档模板的图像或其他内容出现在我的形状之上。最初,我认为设置 Z 顺序就足以解决这个问题:
shape.ZOrder(MsoZOrderCmd.msoBringToFront);
它没有。所以我的问题是,我怎样才能完全设置我的 Shape
的 Z 顺序,或者换句话说,为了制作我的 Shape
我还需要做些什么来设置> 这样它就成为您在文档中看到的最顶层的东西(意思是,它出现在所有其他东西之上)?
最佳答案
我终于弄清楚为什么这些方法不起作用:
shape.ZOrder(MsoZOrderCmd.msoBringInFrontOfText);
shape.ZOrder(MsoZOrderCmd.msoBringToFront);
问题是我在 HeaderFooter
部分中添加了我的 Shape
对象,但是显示在其上方的形状是在 Document< 中定义的
。 Z 顺序仅相对于您的对象所在的同一部分内的其他形状(无论您的对象是否在实际文档、页眉、页脚等中)。
因此代替此代码将形状添加到特定部分:
var shape = section.Headers[WdHeaderFooterIndex.wdHeaderFooterFirstPage].Shapes.AddTextEffect(MsoPresetTextEffect.msoTextEffect1, "Example text...", "Calibri", 72, MsoTriState.msoFalse, MsoTriState.msoFalse, 0, 0, section.Headers[WdHeaderFooterIndex.wdHeaderFooterFirstPage].Range) as Shape;
shape.ZOrder(MsoZOrderCmd.msoBringInFrontOfText);
shape.ZOrder(MsoZOrderCmd.msoBringToFront);
我使用这段代码将其直接添加到我的文档中,然后对其应用 Z 排序,它确实有效。它出现在所有其他对象之上,这些对象是我模板的一部分:
var shape = document.Shapes.AddTextEffect(MsoPresetTextEffect.msoTextEffect1, "Example text...", "Calibri", 72, MsoTriState.msoFalse, MsoTriState.msoFalse, 0, 0) as Shape;
shape.ZOrder(MsoZOrderCmd.msoBringToFront);
Writing Word Macros, Second Edition非常清楚地说明了这一点:
The ZOrder method sets the z-order of a Shape object relative to other objects. Note that the method does not set the absolute z-order.
因此绝对 Z 顺序取决于其他因素,例如在这种情况下 Shape
实际位于何处。
关于c# - 使形状最顶层,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39756344/
我正在开发一个需要多个窗口的程序,第一个出现的是登录窗口,我使用了 Toplevel 小部件以使其他窗口成为其子窗口,但这段代码一直显示两个窗口而不是一个。 from Tkinter import F
我不知道一般如何实现这一点,但为了清楚起见,我会特别询问一个实例: Sexplib 对我来说看起来很有趣。我想玩弄它。我已经下载了它,安装得很好(反正我很确定)等等。我想在顶层使用“with sexp
我在 makefile 中设置一个变量,如下所示: SOMEVAR = foo 此 makefile 稍后包含一些其他 makefile,在其中进行实际的程序构建: include generic/M
from tkinter import* import tkinter as tk def topLevel(): top=Toplevel() top.title("Listbox
我想查看乘法函数 (*) 的类型,因此我将其输入 OCaml 顶层。 # (*) 然而,顶层回应: (*);; 1: this is the start of a comment. 然后消耗我输入的任
我喜欢Try Ocaml的顶层行为:;; 在我按下 Enter 时隐式添加,并且我能够使用 Shift-Enter 进行多行编辑。 是否有可能在标准顶层或 utop 中获得相同的功能? 最佳答案 目前
我想知道,在 Ocaml 中,是否有部分输入信息。对于无法编译的程序,可以通过顶层/编译器的某些现有功能来绘制吗?让我解释。 在 Ocaml 中,众所周知,可以通过 -annot 文件检索推断类型。但
当我将分层 SVG 文件加载到 Illustrator 中时,所有图层都按其应有的方式工作,但它们始终位于新图层下;我没有指定“第 1 层”。 如何创建一个 SVG,使我的顶层最终也成为 Illust
我遇到了让我的 TreeView 填充已创建的顶层窗口的挑战,已尝试 fill=“x”和 fill=“both”,但没有得到结果。有任何建议这样做。 from tkinter import ttk i
标签在 div 中
我有以下布局: target target not target 我的问题是,如何定位所有顶级 标签(参见 target )使用 .fin
大家好,我有一个 div.mapFullscreenContainer #mapFullscreenContainer { position:fixed; top:0; lef
我有一个以编程方式创建的标签栏 Controller ,名为 TPastJourneyTabbar。当我单击 TableView 并调用 didSelectRowAtIndexPath: 时,我的选项
我是一名优秀的程序员,十分优秀!