Working with LibreOffice and OpenOffice Writer. I have a document template with some bookmarks in a table. I created some functions that are able to extend the table so that one line is copied several times. Copying one line is done using gotoCellByName, createCursorByCellName, goDown(1, True) and goLeft(1, True), selecting the entire line, then copying it and pasting the line over a newly selected area. That all works, I'm happy to say.
When I want to print the document at this point, while part of the table is still selected as it is the case, the Print() only prints that selection. I tried every line of code I could find on the Internet that supposedly would deselect the area, to no avail. So my big question: how can I deselect a selection in OO or LO that was created using a Cell Range?
Set cr1= tbl.createCursorByCellName(rf1)
Call cr1.gotoCellByName(rf1, True)
Call cr1.goDown(1, True)
Call cr1.goLeft(1, True)
Set cr2= tbl.getCellRangeByName(cr1.getRangeName())
Call ooDoc.getCurrentController().select(cr2)
Set Frame = ooDoc.getCurrentController().getFrame()
Call ooDH.executeDispatch(Frame, ".uno:Copy", "", 0, ee)
rt1= "A" & (row+2)
Call cr1.gotoCellByName(rt1, False)
Call cr1.goDown(n2, True)
Call cr1.goLeft(1, True)
Set cr2= tbl.getCellRangeByName(cr1.getRangeName())
Call ooDoc.getCurrentController().select(cr2)
Set Frame = ooDoc.getCurrentController().getFrame()
Call ooDH.executeDispatch(Frame, ".uno:Paste", "", 0, ee)
At this point, multiple lines in the table are still selected; how to deselect them??
This worked when I added it to your code.
dispatcher.executeDispatch(frame, ".uno:Escape", "", 0, Array())
Also I wonder about your call to print the document. In the print dialog, there is an option to print all pages or only the selection. Perhaps there is an UNO argument to print all pages. However that's not the question you asked, so I won't pursue it further.