简体   繁体   English

如何取消选择 LibreOffice Writer 中的表格单元格?

[英]How to deselect Table Cells in LibreOffice Writer?

Working with LibreOffice and OpenOffice Writer.使用 LibreOffice 和 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.使用 gotoCellByName、createCursorByCellName、goDown(1, True) 和 goLeft(1, True) 完成复制一行,选择整行,然后复制它并将该行粘贴到新选择的区域。 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.此时,当我想打印文档时,虽然表格的一部分仍处于选中状态,但 Print() 仅打印该选择。 I tried every line of code I could find on the Inte.net that supposedly would deselect the area, to no avail.我尝试了我在 Inte.net 上可以找到的每一行代码,这些代码据说会取消选择该区域,但无济于事。 So my big question: how can I deselect a selection in OO or LO that was created using a Cell Range?所以我的大问题是:如何在 OO 或 LO 中取消选择使用单元格范围创建的选择?

      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.也许有一个打印所有页面的 UNO 参数。 However that's not the question you asked, so I won't pursue it further.但这不是你问的问题,所以我不会进一步追究。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 LibreOffice API/UNO:如何在 writer 中的表格单元格中水平右对齐文本 - LibreOffice API/UNO: How to horizontal right-align text in table cell in writer 使用UNO将新行插入LibreOffice writer表中 - Insert new row into LibreOffice writer table using UNO 如何在libreoffice writer文档中插入数据url /二进制文件以替换图像? - How to insert a data url/binary to replace an image in a libreoffice writer document? 如何使用Python插入带有日期的Libreoffice作家注释 - How to insert a Libreoffice writer Annotation with a date using Python 如何将模板名称添加到 libreoffice writer 的状态栏? - How do I add template name to status bar of libreoffice writer? 如何在 libreoffice-calc 中合并单元格而不丢失数据? - How to merge cells without losting data in libreoffice-calc? 如何在libreoffice writer中编写python宏以发送接收数据 - How do I write a python macro in libreoffice writer to send a receive data 如何在libreoffice writer中使用python宏插入Italic或Bold等文本 - How do I insert text as Italic or Bold etc with a python macro in libreoffice writer LibreOffice UNO Writer获取单元名称 - LibreOffice UNO Writer get cell name 在UNO LibreOffice中使用writer_pdf_Export过滤器时出现问题 - Problem when using writer_pdf_Export filter in UNO LibreOffice
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM