Ask Your Question

[Solved] writer macro for extending selection from table to paragraph before and after table

asked 2020-04-28 16:04:39 +0200

torreone gravatar image

updated 2021-01-28 17:57:04 +0200

Comment that I can not delete

edit retag flag offensive close merge delete


@torreone: adding "Solved" in the title is not the right way to mark the question as "solved" because it will still be counted as unanswered by the site engine.

For a much better referencing in the site, answer your own question by cutting "Having found …" up to the end and pasting it in your answer. I used "cutting" instead of "copying", meaning you should edit your question so that it looks like a question (explaining why you ask a new one) which now receives an acceptable answer.

To be really useful your question should include a link to 223599/writer-macro-for-extending-selection-from-table-to-paragraph-before-and-after-table.

A much better solution would be to reopen question #223599 to add your own answer. Your karma is high enough to allow you to do that and delete this one afterwards.

ajlittoz gravatar imageajlittoz ( 2021-01-28 15:06:13 +0200 )edit

thanks @ajlittoz

torreone gravatar imagetorreone ( 2021-01-28 22:52:51 +0200 )edit

1 Answer

Sort by » oldest newest most voted

answered 2021-01-28 17:52:46 +0200

torreone gravatar image

updated 2021-01-28 20:16:53 +0200

ajlittoz gravatar image

In question 223599/writer-macro-for-extending-selection-from-table-to-paragraph-before-and-after-table I posed the problem described by the title that @Mike Kaganski had given a solution to Subsequently, after having closed the question, I had found an alternative solution that I propose here since I cannot reopen the closed discussion (it takes more than 200 karma to do this)

sub selectTable1(sTable)   

  Dim oD, oTab, oCell, oTC1, oVC
  oD = ThisComponent 
  oTab = oD.getTextTables().getByName(sTable)
  oVC = oD.getCurrentController().getViewCursor()

  oCell = oTab.getCellByPosition(0, 0) 
  oVC.gotoRange(oCell, false)
  oVC.goup(1, false)

  oCell = oTab.getCellByPosition(oTab.columns.count-1, oTab.rows.count-1 )
  oVC.gotoRange(oCell, false) 
  oVC.goDown(1, false)  


End Sub

Thanks to @ajlittoz per the explaining the correct procedure to me.

I hope it is correct now.

(yes, I just edited the link to make it nicer)

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2020-04-28 16:04:39 +0200

Seen: 38 times

Last updated: Jan 28