http://openoffice.org/bugzilla/show_bug.cgi?id=90681
--- Comment #6 from sungkhum <[email protected]> 2011-04-07 09:01:08 --- Here is another macro that only replaces numbers within the current selection: Sub KhmerNumbersSelection() Dim oDoc,oText,oVC,oStart,oEnd,oFind,FandR oDoc = ThisComponent : oText = oDoc.Text oVC = oDoc.CurrentController.getViewCursor aFind = Array("1", "2","3" ,"4", "5" ,"6" ,"7", "8", "9", "0") aReplace = Array("១", "២", "៣", "៤", "៥", "៦", "៧", "៨", "៩", "០") aRayCount = 0 While aRayCount <= uBound(aFind) oStart = oText.createTextCursorByRange(oVC.Start) If Not oVC.isCollapsed then oEnd = oText.createTextCursorByRange(oVC.End) FandR = oDoc.createReplaceDescriptor With FandR .SearchString = aFind(aRayCount) .ReplaceString = aReplace(aRayCount) .SearchWords = false End With If isEmpty(oEnd) then 'Do whole document. oDoc.replaceAll(FandR) Else 'Do selection. Do oFind = oDoc.FindNext(oStart.End,FandR) If isNull(oFind) then Exit Do If oText.compareRegionEnds(oFind,oEnd) < 0 then Exit Do oFind.setString(FandR.ReplaceString) oFind = oDoc.FindNext(oFind.End,FandR) Loop EndIf aRayCount = aRayCount + 1 Wend End Sub -- Configure bugmail: http://openoffice.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. --------------------------------------------------------------------- Please do not reply to this automatically generated notification from Bugzilla. Please log into the website and enter your comments. ----------------------------------------------------------------------- ----------------------------------------------------------------- To unsubscribe send email to [email protected] For additional commands send email to [email protected] with Subject: help -- ----------------------------------------------------------------- To unsubscribe send email to [email protected] For additional commands send email to [email protected] with Subject: help
