openoffice-api mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bernard Marcelly <marce...@club-internet.fr>
Subject Re: Set property of selected cell range in a textable in Writer
Date Wed, 08 Jul 2015 17:12:48 GMT
Hi Mark,
You should use Xray to help you explore the API.
All my indications here can be found by a study of what Xray displays (and then 
reading of API docs).


- You can find if your selection is inside a paragraph of a cell, and then find 
the cell and its table:

Dim firstSelection As Object
Dim currentCell As Variant, currentTable As Variant

firstSelection = oCurrentSelection.getByIndex(0)
currentCell = firstSelection.Cell
if not IsEmpty(currentCell) then
   currentCell.WritingMode = com.sun.star.text.WritingMode2.TB_RL
   currentTable = oCurrentSelection.TextTable
else
   MsgBox("First selection is not in a table")
end if


- A table has a property WritingMode. Perhaps it can set WritingMode to all 
cells at once (not tested).

- Enumerate all cells of a table : the table has method getCellNames() that 
returns an array of all the cell names.


Regards
   Bernard


Hung Mark a écrit le 2015-07-08 13:52 :
> Hi Mathias,
>
> While invoking setPropertyValue for ParaAdjust works, it is a Paragraph
> property instead of a cell property.
>
> Sub ModifyCells
>     Dim oCurrentSelection As Variant
>
>     oCurrentSelection = ThisComponent.getCurrentSelection()
>     oCurrentSelection.setPropertyValue( "WritingMode",
> com.sun.star.text.WritingMode2.TB_RL ) ' doesn't work
>     oCurrentSelection.setPropertyValue( "VertOrient",
>   com.sun.star.text.VertOrientation.BOTTOM ) ' doesn't work
>     oCurrentSelection.setPropertyValue( "ParaAdjust",
> com.sun.star.style.ParagraphAdjust.RIGHT ) ' works
>     oCurrentSelection.setPropertyValue( "ParaBackColor",RGB(100,0,0) ) '
> works
>
> End Sub
>

---------------------------------------------------------------------
To unsubscribe, e-mail: api-unsubscribe@openoffice.apache.org
For additional commands, e-mail: api-help@openoffice.apache.org


Mime
View raw message