在Word 2010中,我想在文档中添加文本,为此文本添加书签,然后在文档的页眉和页脚中交叉引用此文本。
这可以录制还是我必须编码?
In Word 2010 I want to add text to a document, bookmark this text and then cross reference this text in the header and footer of the document.
Can this be recorded or will I have to code it?
最满意答案
对的,这是可能的。
是的,您可以在Word中录制 - 尽管有一些限制,因为在录制模式下您无法通过鼠标浏览文本; 生成的代码将是丑陋的,并且充满了“硬编码”,但会给你一个对象,方法和属性可能相关的印象。
如果你想要一个比一次性更可持续的解决方案,那么正确的编码肯定是要走的路。 您应该与以下人员交朋友以解决您的任务:
Selection对象及其方法,尤其是GoTo , Move及其变体 将光标扩展为标记文本的方法 使用各种Insert ...方法插入文本(例如Selection.InsertCrossReference ReferenceType:="Bookmark" ... ) 将书签添加到书签集合 了解如何操纵页眉和页脚尝试一些编码,如果你遇到困难,可以回答更具体的问题。
Yes it is possible.
Yes you can record in Word - allthough with some limitations as you can't navigate thru your text by mouse when in recording mode; the generated code will be ugly and full of "hard coding" but will give you an impression which objects, methods and properties might be relevant..
If you want a solution that is a bit more sustainable than a one-off, proper coding surely is the way to go. You should make friends with the following in order to solve your task:
the Selection object and its methods, especially GoTo, Move and its variants the way to extend a cursor to mark text inserting text using various Insert... methods (e.g. Selection.InsertCrossReference ReferenceType:="Bookmark" ...) adding bookmarks to the Bookmarks collection understanding how to manipulate headers & footersTry some coding and come back with more sopecific questions if you get stuck.
更多推荐
document,text,Word,电脑培训,计算机培训,IT培训"/> <meta name="descriptio
发布评论