用ASP实现超长内容的word模板替换objDoc.Content.Find.Execute

内部系统生成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

posted @ 2009-04-30 14:44  林建彧  阅读(98)  评论(0编辑  收藏  举报

欢迎光临个人主站:70apps.com,方便分享代码、截图的小工具 DevShots