OpenOffice Draw 宏查找替换文本
Posted
技术标签:
【中文标题】OpenOffice Draw 宏查找替换文本【英文标题】:OpenOffice Draw macro to find replace text 【发布时间】:2013-03-29 21:13:58 【问题描述】:我希望使用 Draw 在多个 PDF 文档中查找替换文本。到目前为止,我已经设法打开了 PDF
mydoc.createReplaceDescription
似乎不是 Draw 文档上的有效属性/方法。尽管奇怪的是,这在许多 writer 和 calc 示例中都使用了。
还有其他选择吗?
【问题讨论】:
【参考方案1】:好吧,在 Writer 中使用了一些记录器后,我设法录制了一个宏,该宏似乎比我之前尝试的 createReplaceDiscription 更通用。 它有很多缺陷,我想可以清理它,但它可以工作......
REM ***** BASIC *****
Sub Main
End Sub
sub WriterFindReplace
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(18) as new com.sun.star.beans.PropertyValue
args1(0).Name = "SearchItem.StyleFamily"
args1(0).Value = 2
args1(1).Name = "SearchItem.CellType"
args1(1).Value = 0
args1(2).Name = "SearchItem.RowDirection"
args1(2).Value = true
args1(3).Name = "SearchItem.AllTables"
args1(3).Value = false
args1(4).Name = "SearchItem.Backward"
args1(4).Value = false
args1(5).Name = "SearchItem.Pattern"
args1(5).Value = false
args1(6).Name = "SearchItem.Content"
args1(6).Value = false
args1(7).Name = "SearchItem.AsianOptions"
args1(7).Value = false
args1(8).Name = "SearchItem.AlgorithmType"
args1(8).Value = 0
args1(9).Name = "SearchItem.SearchFlags"
args1(9).Value = 65536
args1(10).Name = "SearchItem.SearchString"
args1(10).Value = "<<THE WORD YOUR FINDING>>"
args1(11).Name = "SearchItem.ReplaceString"
args1(11).Value = "<< THE WORD YOUR USING TO REPLACE>>"
args1(12).Name = "SearchItem.Locale"
args1(12).Value = 255
args1(13).Name = "SearchItem.ChangedChars"
args1(13).Value = 2
args1(14).Name = "SearchItem.DeletedChars"
args1(14).Value = 2
args1(15).Name = "SearchItem.InsertedChars"
args1(15).Value = 2
args1(16).Name = "SearchItem.TransliterateFlags"
args1(16).Value = 1280
args1(17).Name = "SearchItem.Command"
args1(17).Value = 3
args1(18).Name = "Quiet"
args1(18).Value = true
dispatcher.executeDispatch(document, ".uno:ExecuteSearch", "", 0, args1())
end sub
【讨论】:
以上是关于OpenOffice Draw 宏查找替换文本的主要内容,如果未能解决你的问题,请参考以下文章
使用 Excel VBA 宏在 Word 中查找和替换页脚文本
Excel宏查找文本,查找参考单元格,从参考单元格复制数据到固定位置