Вход на сайт
Macro для Openoffice
530
NEW 23.11.10 21:40
Последний раз изменено 23.11.10 21:45 (Talik)
Всем привет!
такой вопрос: написал тут небольшой макро - вернее записал и подправил - для опенофиса для замены букв, но меня достаёт что надо постоянно "ок" жать, если буква не найдена. можно как нибуть это дело отключить или подругому сделать?
Private sub suche()rem erog as String, klar as string
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")
dim kyr_erog() as String
dim kyr_clar() as String
kyr_erog = Array("а","б")
kyr_cla = Array( "Ъ", "Э")
dim iCount2 as integer
rem Print Ubound(kyr_erog)
for iCount2 = Lbound(kyr_erog) to Ubound(kyr_erog)
rem ----------------------------------------------------------------------
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "ToPoint"
args1(0).Value = "$A$1"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())
rem ----------------------------------------------------------------------
dim args2(17) as new com.sun.star.beans.PropertyValue
args2(0).Name = "SearchItem.StyleFamily"
args2(0).Value = 2
args2(1).Name = "SearchItem.CellType"
args2(1).Value = 0
args2(2).Name = "SearchItem.RowDirection"
args2(2).Value = true
args2(3).Name = "SearchItem.AllTables"
args2(3).Value = false
args2(4).Name = "SearchItem.Backward"
args2(4).Value = false
args2(5).Name = "SearchItem.Pattern"
args2(5).Value = false
args2(6).Name = "SearchItem.Content"
args2(6).Value = false
args2(7).Name = "SearchItem.AsianOptions"
args2(7).Value = false
args2(8).Name = "SearchItem.AlgorithmType"
args2(8).Value = 0
args2(9).Name = "SearchItem.SearchFlags"
args2(9).Value = 65536
args2(10).Name = "SearchItem.SearchString"
args2(10).Value = kyr_erog(iCount2)
args2(11).Name = "SearchItem.ReplaceString"
args2(11).Value = kyr_cla(iCount2)
args2(12).Name = "SearchItem.Locale"
args2(12).Value = 255
args2(13).Name = "SearchItem.ChangedChars"
args2(13).Value = 2
args2(14).Name = "SearchItem.DeletedChars"
args2(14).Value = 2
args2(15).Name = "SearchItem.InsertedChars"
args2(15).Value = 2
args2(16).Name = "SearchItem.TransliterateFlags"
args2(16).Value = 1024
args2(17).Name = "SearchItem.Command"
args2(17).Value = 3
dispatcher.executeDispatch(document, ".uno:ExecuteSearch", "", 0, args2())
endif
next iCount2
end sub
заранее благодарен за помощь!!!
такой вопрос: написал тут небольшой макро - вернее записал и подправил - для опенофиса для замены букв, но меня достаёт что надо постоянно "ок" жать, если буква не найдена. можно как нибуть это дело отключить или подругому сделать?
Private sub suche()rem erog as String, klar as string
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")
dim kyr_erog() as String
dim kyr_clar() as String
kyr_erog = Array("а","б")
kyr_cla = Array( "Ъ", "Э")
dim iCount2 as integer
rem Print Ubound(kyr_erog)
for iCount2 = Lbound(kyr_erog) to Ubound(kyr_erog)
rem ----------------------------------------------------------------------
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "ToPoint"
args1(0).Value = "$A$1"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())
rem ----------------------------------------------------------------------
dim args2(17) as new com.sun.star.beans.PropertyValue
args2(0).Name = "SearchItem.StyleFamily"
args2(0).Value = 2
args2(1).Name = "SearchItem.CellType"
args2(1).Value = 0
args2(2).Name = "SearchItem.RowDirection"
args2(2).Value = true
args2(3).Name = "SearchItem.AllTables"
args2(3).Value = false
args2(4).Name = "SearchItem.Backward"
args2(4).Value = false
args2(5).Name = "SearchItem.Pattern"
args2(5).Value = false
args2(6).Name = "SearchItem.Content"
args2(6).Value = false
args2(7).Name = "SearchItem.AsianOptions"
args2(7).Value = false
args2(8).Name = "SearchItem.AlgorithmType"
args2(8).Value = 0
args2(9).Name = "SearchItem.SearchFlags"
args2(9).Value = 65536
args2(10).Name = "SearchItem.SearchString"
args2(10).Value = kyr_erog(iCount2)
args2(11).Name = "SearchItem.ReplaceString"
args2(11).Value = kyr_cla(iCount2)
args2(12).Name = "SearchItem.Locale"
args2(12).Value = 255
args2(13).Name = "SearchItem.ChangedChars"
args2(13).Value = 2
args2(14).Name = "SearchItem.DeletedChars"
args2(14).Value = 2
args2(15).Name = "SearchItem.InsertedChars"
args2(15).Value = 2
args2(16).Name = "SearchItem.TransliterateFlags"
args2(16).Value = 1024
args2(17).Name = "SearchItem.Command"
args2(17).Value = 3
dispatcher.executeDispatch(document, ".uno:ExecuteSearch", "", 0, args2())
endif
next iCount2
end sub
заранее благодарен за помощь!!!