我使用comptypes调用函数并创建msword文档。作为第一次编写这样的程序,我有一些不明白的地方,我想做的是:
下面是VBA中的一些代码片段,使用VBA是因为使用comptypes的翻译几乎是直接的,而且网上有更多的VBA示例
Set myRange = ActiveDocument.Range(Start:= ...., End:= ...) //start and end can be any thing
ActiveDocument.Sections.Add Range:=myRange //Section A
Set newRange = ActiveDocument.Range(Start:= ...., End:= ...) //start and end can be any thing
newRange.Paragraphs.Add
我被困在选择段落a1和设置它的文本。我缺少的是一个say get collection of paragraphs in section A
函数
下面的VBA基于问题中的代码,演示如何获取
Document
对象、添加Section
、获取该Section
的Paragraphs
、获取文档中任何给定Section
的Paragraphs
、从Paragraphs
集合获取第一个或任何Paragraph
相关问题 更多 >
编程相关推荐