Ask Your Question
0

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

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

torreone gravatar image

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

Comment that I can not delete

edit retag flag offensive close merge delete

Comments

@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 +0100 )edit

thanks @ajlittoz

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

1 Answer

Sort by » oldest newest most voted
0

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

torreone gravatar image

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

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)
  oTC1=oVC.text.createTextCursorByRange(oVC)
  oTC1.gotoEndOfParagraph(false)

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

  oD.getCurrentController().select(oTC1)

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

Stats

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

Seen: 32 times

Last updated: Jan 28