doc.Paragraphs.add.Range.InsertBefore("声明")doc.Paragraphs.add.Range.InsertBefore("")
<%for i=0 to ubound(fcsm)%>
doc.Paragraphs.add.Range.InsertBefore("<%=fcsm(i)%>")
<%next%>
doc.Paragraphs.add.Range.InsertBefore("")
doc.Paragraphs.add.Range.InsertBefore("假设和限制条件")
doc.Paragraphs.add.Range.InsertBefore("")
<%for i = 0 to ubound(gjtj)%>
doc.Paragraphs.add.Range.InsertBefore("<%=gjtj(i)%>")
<%next%>
doc.Paragraphs.add.Range.InsertBefore("报告")
我想知道,我怎么写才能选中"假设和限制条件"与"报告"之间的文字.然将选中的文字的段落格式设置为(LineSpacingRule) "固定值"25磅.
我在线等...还往高手指点!! 我在其中渗加了asp语言
<%for i=0 to ubound(fcsm)%>
doc.Paragraphs.add.Range.InsertBefore("<%=fcsm(i)%>")
<%next%>
doc.Paragraphs.add.Range.InsertBefore("")
doc.Paragraphs.add.Range.InsertBefore("假设和限制条件")
doc.Paragraphs.add.Range.InsertBefore("")
<%for i = 0 to ubound(gjtj)%>
doc.Paragraphs.add.Range.InsertBefore("<%=gjtj(i)%>")
<%next%>
doc.Paragraphs.add.Range.InsertBefore("报告")
我想知道,我怎么写才能选中"假设和限制条件"与"报告"之间的文字.然将选中的文字的段落格式设置为(LineSpacingRule) "固定值"25磅.
我在线等...还往高手指点!! 我在其中渗加了asp语言
解决方案 »
- 记录集中的感叹号。是什意思。
- 怎么样用VB做一个在VB环境下调用一个文档浏览器(比如WORDVIEW),来打开一个DOC文件,然后得到这个DOC文件的页数并且打印出来。
- 请问有谁做过filenet的vb开发?
- 二维数组可以这样定义吗?急!
- [求助]请问如何使用 ACTIVEBAR。ACTIVESKIN 控件!
- VB怎样调用COM中的事件啊?
- 大家帮我看看语句有什么地方不对
- 高分聘请高手出招啊??(2个高难度的VB问题,请大家帮忙,不要让我希望啊)
- vb中怎么实现记时最方便?
- 注册表的问题2
- 两个excel问题,谢谢。
- adodc控件和datagrid控件结合,如何实现data控件的 .edit功能?这个问题问了三天了,高手们请帮忙
你可以用录制宏来看它生成的代码。
应该有所启发。
我帮你搞定了代码如下:Dim startflag As Long
Dim endflag As Longapp.Selection.Find.ClearFormatting
With app.Selection.Find
.Text = "假设和限制条件"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
End With
app.Selection.Find.Execute
startflag = app.Selection.Endapp.Selection.Find.ClearFormatting
With app.Selection.Find
.Text = "报告"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
End With
app.Selection.Find.Execute
endflag = app.Selection.startapp.Selection.start = startflag
app.Selection.End = endflag
For Each para In app.Selection.Paragraphs
para.LineSpacingRule = wdLineSpaceAtLeast
para.LineSpacing = 25
Next
<script language="vbscript" >
Sub buildDoc()
Dim startflag
Dim endflag
set objWordDoc = CreateObject("Word.Application")
ObjWordDoc.Application.Visible=True
readonly=false
ObjWordDoc.Application.Documents.open("d:/test1.doc")
set myRange =objWordDoc.Application.ActiveDocument.Range()
set doc=objWordDoc.Application.ActiveDocument
set doc1=objWordDoc.Application
doc.Paragraphs.add.Range.InsertBefore("声明")doc.Paragraphs.add.Range.InsertBefore("")
<%for i=0 to ubound(fcsm)%>
doc.Paragraphs.add.Range.InsertBefore("<%=fcsm(i)%>")
<%next%>
doc.Paragraphs.add.Range.InsertBefore("")
doc.Paragraphs.add.Range.InsertBefore("假设和限制条件")
doc.Paragraphs.add.Range.InsertBefore("")
<%for i = 0 to ubound(gjtj)%>
doc.Paragraphs.add.Range.InsertBefore("<%=gjtj(i)%>")
<%next%>
doc.Paragraphs.add.Range.InsertBefore("报告")
----------------------------------------------
doc1.Selection.Find.ClearFormatting
With doc1.Selection.Find
.Text = "估价的假设和限制条件"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
End With
doc1.Selection.Find.Execute
startflag = doc1.Selection.Enddoc1.Selection.Find.ClearFormatting
With doc1.Selection.Find
.Text = "估价结果报告"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
End With
doc1.Selection.Find.Execute
endflag = doc1.Selection.startdoc1.Selection.start = startflag
doc1.Selection.End = endflagDim para
For Each para In doc1.Selection.Paragraphs
para.LineSpacingRule = wdLineSpaceAtLeast
para.LineSpacing = 25
Next
----------------------------------
End Sub
</script>
加在虚线上的程序好像不灵呀.. DarkChampion(暗黑骑士) 这位老师你能不能再帮我看看呀.
.Text = "假设和限制条件"
.Text = "报告"
改为了
.Text = "估价的假设和限制条件"
.Text = "估价结果报告"
而导致找不到文本。
从而Selection对象为空。
所以失败。