Please bear with me - I am new to the OOo UDK and API.
I am also not completely sure this is the right mailing list,
perhaps because I am not sure what the problem is.
I am trying to generate a hyperlink in Calc, using Python as
scripting language. Setting the formula to "=HYPERLINK(<target>, <rep>)"
only yields an absolute hyperlink, and is thereby useless for me.
so I've tried (replace '....' with a tab or spaces):
import uno
import os.path
def sFoo(x):
....Doc = XSCRIPTCONTEXT.getDocument()
....Sheets = Doc.Sheets
....Sheet = Sheets.getByIndex(0)
....Selection = Doc.CurrentSelection
....if Selection.supportsService("com.sun.star.sheet.SheetCell"):
........Link = Doc.createInstance('com.sun.star.text.TextField.URL')
........Link.URL = uno.systemPathToFileUrl(os.path.abspath('readme.txt'))
........Link.Representation = 'readme'
........Link.TargetFrame = ''
........Selection.Text.insertString(Selection.Text.Start, 'ABC', False)
........Selection.Text.insertTextContent(Selection.Text.End, Link, False)
this works fine up to the last line, where OOo crashes. According to the
Developers Guide, insertTextContent() is the method to attach a TextField.
I am lost about what I am doing wrong here, and would appreciate any hint.
Note: the documentation distinguishes between com.sun.star.textfield and
com.sun.star.TextField. I tried the former, and it crashed when trying to
create the link, since com.sun.star.textfield does not seem to have any
URL structure. If they are really both used, then this will create
problems with case-insensitive languages like Basic, but that should be
besides the point when using Python.
Best regards, Josef Dalcolmo
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]