Ask Your Question

macroman's profile - activity

2018-01-25 02:04:43 +0200 received badge  Famous Question (source)
2017-04-05 19:25:55 +0200 received badge  Famous Question (source)
2017-04-05 19:25:55 +0200 received badge  Notable Question (source)
2017-04-05 19:25:55 +0200 received badge  Popular Question (source)
2016-09-01 01:12:28 +0200 received badge  Notable Question (source)
2016-09-01 01:12:28 +0200 received badge  Famous Question (source)
2016-06-08 05:20:54 +0200 asked a question Select Text Table Columns

Hopefully a simple question, but I cannot seem to find an answer in the documentation or online:

I want to be able to select particular rows/columns within Writer document text tables.

In theory the macro should look something like this:

sub test

Doc = ThisComponent
Col = Doc.getTextTables(0).getColumns.getbyindex(3)
Doc.CurrentController.Select(Col)   

end sub

However, I am currently getting a BASIC runtime error:

Property or method not found: getColumns.

(Same goes for 'getRows')

The command seems to work if I create a table from scratch, but will not work on existing tables??

Thanks in advance!

2016-06-02 01:28:29 +0200 received badge  Famous Question (source)
2016-03-12 02:51:56 +0200 received badge  Popular Question (source)
2016-03-12 02:51:56 +0200 received badge  Famous Question (source)
2016-03-12 02:51:56 +0200 received badge  Notable Question (source)
2016-03-12 02:51:26 +0200 received badge  Notable Question (source)
2016-03-12 02:51:26 +0200 received badge  Popular Question (source)
2016-03-10 22:27:56 +0200 received badge  Popular Question (source)
2016-02-06 06:55:09 +0200 received badge  Notable Question (source)
2016-02-06 06:55:09 +0200 received badge  Popular Question (source)
2016-01-22 00:51:26 +0200 received badge  Enthusiast
2016-01-13 13:51:34 +0200 asked a question Define Search Range

I am having trouble defining a search range. For example, I want to search the fourth column of the third table in an .odt file.

Any advice?

Thanks!

2016-01-13 13:51:31 +0200 asked a question Update a Text Field

I have a field: Type: Variable Name: ClientName Format: Text

The field is already within the .odt document, with the default value set to "Name" I would like to update this value to a given client name (string value) "John Smith"

I have already checked out a lot of documentation and having no luck... I imagined it would be something along these lines: NameField = Doc.getTextFieldMasters().getByName("ClientName") NameField.Content = "JohnSmith"

2015-12-21 13:56:04 +0200 answered a question dispatcher doesn't work in a Loop [Solved]

dim args2(0) outside of For loop and the problem is resolved.

2015-12-21 13:56:02 +0200 asked a question dispatcher doesn't work in a Loop [Solved]

I am trying to paste the same text into multiple cells via a loop function:

    For n = 1 to TextTables(2).getRows().getCount() - 1
        Range = TemplateDoc.TextTables(2).getCellByPosition(4, n)
        TemplateDoc.getCurrentController.select(Range)
            dim args2(0) as new com.sun.star.beans.PropertyValue
            args2(0).Name = "SelectedFormat"
            args2(0).Value = 10
            dispatcher.executeDispatch(Frame, ".uno:ClipboardFormatItems", "", 0, args2())  
    Next

Currently I am getting the following error after the first pass: BASIC runtime error. An exception occurred Type: com.sun.star.lang.IllegalArgumentException Message: sequence element is not assignable by given value!.

Any ideas???

2015-12-21 13:55:59 +0200 answered a question Paste copied text into a Text Table Cell [Solved]

Solved. Needed to select the desired location:

Range = TemplateDoc.TextTables(2).getCellByPosition(4, 2)
    TemplateDoc.getCurrentController.select(Range)
dispatcher.executeDispatch(Frame, ".uno:Paste", "", 0, Array())
2015-12-21 13:55:57 +0200 asked a question Paste copied text into a Text Table Cell [Solved]

Hi there,

I seem to be having trouble driving the table cell cursor. For example if I want to paste some copied text into cell 4,2 of my text table should this code work?

    Cursor = Texttables(2).getcellbyPosition(4, 2).createTextCursor()
        dispatcher.executeDispatch(Frame, ".uno:Paste", "", 0, Array())

Thanks!

2015-12-21 13:55:54 +0200 answered a question Copy String from Calc Cell [Solved]
Frame = WriterDoc.CurrentController.Frame
Frame2 = CalcDoc.CurrentController.Frame

  dim args1(0) as new com.sun.star.beans.PropertyValue
  args1(0).Name = "ToPoint"
  args1(0).Value = "$C$4"
  dispatcher.executeDispatch(Frame2, ".uno:GoToCell", "", 0, args1())
  dispatcher.executeDispatch(Frame2, ".uno:Copy", "", 0, Array())

  dim args2(0) as new com.sun.star.beans.PropertyValue
  args2(0).Name = "SelectedFormat"
  args2(0).Value = 10
  dispatcher.executeDispatch(Frame, ".uno:ClipboardFormatItems", "", 0, args2())
2015-12-21 13:55:19 +0200 asked a question Copy String from Calc Cell [Solved]

Hi there,

I seem to be having trouble copying a string from a calc cell. Every time I try to paste the copied information into a writer doc, it pastes the entire cell rather than just the text. Here is a code snippet, all terms have been defined and Frame and Frame2 are the Writer doc and Calc doc respectively.

InfoCell = CalcDoc.Sheets(2).getCellbyPosition(2, 3)
Info = InfoCell.String
CalcDoc.CurrentController.Select(Info)
dispatcher.executeDispatch(Frame2, ".uno:Copy", "", 0, Array())
dispatcher.executeDispatch(Frame, ".uno:Paste", "", 0, Array())
2015-12-07 14:04:10 +0200 commented question How does gotoOffset work in LO Basic/Calc?

Did anyone ever find a solution to this?? I'm having the same issue

Using LO Basic 5.0.3.2 on Windows 8