Hi all!
I am putting together my Writer document and at some point (in time) I create a LineShape (a vertical Line). Then I go on with filling the page with content. When finished I want to correct the end position of my LineShape with the millimeter coordinates of the current cursor position.
The end result with code below looks good, but cLine.setSize(uno.createUnoStruct("com.sun.star.awt.Size", 0, YVALUE))
has to be guessed, and content size may vary.
# Creating the vertical Line
cLine = doc.createInstance("com.sun.star.drawing.LineShape")
cLine.LineStyle = SOLIDLINE
cLine.LineWidth = 10 # Width of the line in 1/100 mm
cLine.LineColor = 0x000000 # RGB color (black)
cLine.setPosition(uno.createUnoStruct("com.sun.star.awt.Point", 15350, 4800))
cLine.setSize(uno.createUnoStruct("com.sun.star.awt.Size", 0, 20500))
cLine.setPropertyValue("AnchorType", AT_PARAGRAPH)
text.insertTextContent(cursor, cLine, False)
doc.CurrentController.select(cLine)
dispatcher.executeDispatch(doc.CurrentController.Frame, ".uno:WrapThroughTransparent", "", 0, ())
I want to achieve something like that:
# Pseudo code
endSize = cursor.getAbsoluteDocumentPositionY() - 4800
cLine.setSize(uno.createUnoStruct("com.sun.star.awt.Size", 0, endSize))
Best ragards,
Robert