内部系统生成DOC报表时,会因为数据内容过长而出错,做了一下修正,实现超长内容的WORD模板下的替换。

 

Sub WordReplace(objDoc,strFind,strReplace)
 Dim i,strContent
if isnull(strReplace) then
 objDoc.Content.Find.Execute strFind, , True, , , , , , , "", 2
else
 if len(strReplace)<=200 then
  objDoc.Content.Find.Execute strFind, , True, , , , , , , strReplace, 2
 else
  i=0
  do while i*200<len(strReplace)
   strContent=mid(strReplace,i*200+1,200)+strFind
   objDoc.Content.Find.Execute strFind, , True, , , , , , , strContent, 2
   i=i+1
  loop
  objDoc.Content.Find.Execute strFind, , True, , , , , , , "", 2
 end if
end if
end sub

相关文章:

  • 2021-10-30
  • 2021-07-03
  • 2021-05-22
  • 2022-12-23
  • 2021-09-03
  • 2021-12-31
  • 2022-02-01
  • 2021-12-15
猜你喜欢
  • 2021-12-07
  • 2021-11-21
  • 2021-11-08
  • 2021-12-04
  • 2022-12-23
相关资源
相似解决方案