Re: Set property of selected cell range in a textable in Writer

2015-07-10 Thread Andrew Douglas Pitonyak
Sadly, I am not aware of a simple obvious way to do this. I suppose that if you know that the table is simple, you can take some short-cuts. Here are some things that you do know... You know the range name by calling oSel.RangeName You can get the containing text table (because you cannot sel

Re: Set property of selected cell range in a textable in Writer

2015-07-09 Thread Hung Mark
Hi Mathias, I use mouse to select cells, as below. http://i.imgur.com/2H6JFAb.png After running macro. Paragraph property works but the others doesn't. http://i.imgur.com/Tc7utrz.png If I add messages to show the values, I can see that the values changed, but it has no effect on formatting. I wo

Re: Set property of selected cell range in a textable in Writer

2015-07-09 Thread Mathias Röllig
Hi! When selecting multiple cells, WritingMode of the first cell changed. The remaining cells didn't In contrast, ParaAdjust of all paragraphs in all the selected cells are changed. How do you "select"? With mouse or with API? I use simply a text document with one table and select the cells

Re: Set property of selected cell range in a textable in Writer

2015-07-08 Thread Andrew Douglas Pitonyak
First, you need to understand what is returned when you get the current selection and then you need to check for it. For example: Nothing selected or multiple text ranges: com.sun.star.text.TextRanges ne or more cells selected in one block: com.sun.star.text.TextTableCursor So, you must inspe

Re: Set property of selected cell range in a textable in Writer

2015-07-08 Thread Hung Mark
Hi, I didn't express very clearly. What I want to do is to set WritingMode property for all the selected cells. I did use MRI to explore APIs, but I was stuck in the middle. To Mathias, When selecting multiple cells, WritingMode of the first cell changed. The remaining cells didn't In contrast,

Re: Set property of selected cell range in a textable in Writer

2015-07-08 Thread Bernard Marcelly
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 Objec

Re: Set property of selected cell range in a textable in Writer

2015-07-08 Thread Mathias Röllig
Hello Mark! What is your Selection? If you select a complete cell or cellrange it should work. What means "it works not"? Is there a errror message? If not: Sub CellModifyTest Dim oCurrentSelection As Object Dim i As Integer i = oCurrentSelection.getPropertyValue( "WritingMode" ) oCu

Re: Set property of selected cell range in a textable in Writer

2015-07-08 Thread Hung Mark
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.st

Re: Set property of selected cell range in a textable in Writer

2015-07-08 Thread Mathias Röllig
Hello Mark! It works. Maybe you are missing something like oCurrentSelection.setPropertyValue( "ParaAdjust", com.sun.star.style.ParagraphAdjust.RIGHT ) Regards, Mathias - To unsubscribe, e-mail: api-unsubscr...@openoffice.apa

Re: Set property of selected cell range in a textable in Writer

2015-07-08 Thread Hung Mark
Hi Mathias, It doesn't work. 2015-07-08 16:04 GMT+08:00 Mathias Röllig : > Hello Hung! > > It should be enough: > > Sub Snippet >Dim oCurrentSelection As Variant > >oCurrentSelection = ThisComponent.getCurrentSelection() >oCurrentSelection.setPropertyValue( "WritingMode", > com.sun.s

Re: Set property of selected cell range in a textable in Writer

2015-07-08 Thread Mathias Röllig
Hello Hung! It should be enough: Sub Snippet Dim oCurrentSelection As Variant oCurrentSelection = ThisComponent.getCurrentSelection() oCurrentSelection.setPropertyValue( "WritingMode", com.sun.star.text.WritingMode2.TB_RL ) End Sub Regards, Mathias

Set property of selected cell range in a textable in Writer

2015-07-07 Thread Hung Mark
I'm not sure if I it is possible to make cell enumeration based on the CellRange so that i can set property for each cell. Setting the property of a CellRange seems not work. Please advice, thank you. Sub Snippet Dim oCurrentSelection As Variant Dim sRangeName As String Dim oCurrentControlle