我正在构建一个用于编辑现有Word文档的应用程序。
代码应删除第二页上的一段,并用由字符串变量“ Direct_introduction”标识的另一段代替。
问题是文本被插入到文档的末尾,即使指定了段落编号,我也无法将其插入其他任何地方。
<?php
$aNumberArray = array();
$aArray = array(4,4,5,7,4,8,7,9,4,3);
foreach ($aArray as $value) {
if (!isset($aNumberArray[$value])) {
$aNumberArray[$value] = 0;
}
$aNumberArray[$value] += 1;
}
print_r($aNumberArray);
答案 0 :(得分:0)
执行“ Direct_introduction”的查找,如果找到,则在当前位置插入。例如(在VBA中):
Sub Demo()
Application.ScreenUpdating = False
With ActiveDocument.Range
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "Direct_introduction"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWildcards = False
.Execute
End With
If .Find.Found = True Then
.Text = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas porttitor congue massa." & vbCr & _
"Fusce posuere, magna sed pulvinar ultricies, purus lectus malesuada libero, sit amet commodo magna eros quis urna." & vbCr & _
" Nunc viverra imperdiet enim." & vbCr & _
"Fusce est. Vivamus a tellus."
End If
End With
Application.ScreenUpdating = True
End Sub