Villeroy Super User


Joined: 04 Oct 2004 Posts: 10065 Location: Germany
|
Posted: Tue Aug 30, 2005 12:29 pm Post subject: unlocalized calc formula |
|
|
This one shows an inputbox with the unlocalized (english) formula of the active cell. Displays an input box with the unlocalized formula of active cell. You can paste an unlocalized formula into the input box in order to put the localized version into the cell.
Install: Tools>Macros>Organize>Basic ... Paste the code into a new module or any existing one in container "My Macros".
Call: Tools>Macros>Run... or assign some shortcut/button/menu to the installed macro (Tools>Customize...).
2006-08-09: fixed error in getFocussedCell when row > 8191
| Code: |
Sub showENFormula
Dim oCell as object,sFml$
oCell = thisComponent.CurrentController.Selection
if NOT hasUnoInterfaces(oCell,"com.sun.star.table.Cell") then
oCell = GetFocussedCell(thisComponent,false)
end if
sFml = oCell.getFormula()
sFml = inputbox("Unlocalized Formula of Focussed Cell:","showENFormula",sFml)
if sFml <> "" then oCell.setFormula(sFml)
End Sub
'-------usefull helper-function, returning focussed cell or it's address
'by UROS > http://www.oooforum.org/forum/viewtopic.phtml?t=19348
REM 2006-08-09: fixed error when row > 8191
'100/60/0;1;tw:309;2/2/0/0/0/0/2/0/0/0/0;253/8191/0/0/0/0/2/246/0/0/8158;0/0/0/0/0/0/2/0/0/0/0
'100/60/0;1;tw:309;2/2/0/0/0/0/2/0/0/0/0;253+8192+0+0+0+0+2+246+0+0+8158;0/0/0/0/0/0/2/0/0/0/0
Function GetFocussedCell(oDoc as Object,bAddr as Boolean) as Object
Dim as1(), lSheet&,lCol&,lRow$, sDum as String,bErr as Boolean
as1() = Split(oDoc.currentController.ViewData, ";")
lSheet = CLng(as1(1))
sDum = as1(lSheet +3)
as1() = Split(sDum, "/")
on error goto errSlash
lCol = CLng(as1(0))
lRow = CLng(as1(1))
on error goto 0
if bAddr then
GetFocussedCell = oDoc.getSheets.getByIndex(lSheet).getcellByPosition(lCol,lRow).getCellAddress
else
GetFocussedCell = oDoc.getSheets.getByIndex(lSheet).getcellByPosition(lCol,lRow)
end if
exit Function
errSlash:
if NOT(bErr) then
bErr = True
as1() = Split(sDum, "+")
resume
endif
End Function
|
Any addin-functions must be localized manually in the input box or specified by their full service-name like this:
sheet-function[addin] MROUND ---> com.sun.star.sheet.addin.Analysis.getMround
or manually MROUND ---> VRUNDEN [german translation] |
|