

So call the executeDispatch event of the dispatcher using two commands. Once we set the properties, it’s time to call the dispatch to send these to the document. To point to the first cell A1 and put a text, we would use two properties – ToPoint and StringName. Our objective is to put ‘Hello World’ in the first Cell. Thus the name contains the property name, and the value contains the value of that property.ĭim args1(0) as new .PropertyValue

Properties are always in a name/value pair. Now we will declare an array of properties.Almost all LibreOffice macro tasks can be executed using the dispatcher. This service will help us to dispatch the tasks from the macro to the frame. The createUnoService creates an instance of the DispatchHelper service. So the document variable refers to the main area of Calc. The controller then dispatches the changes to the document frame, i.e. type, colour, insert, is “watched” by a controller. ThisComponent refers to the current document. Let’s assign two values to the above variables.ĭocument = dispatcher = createUnoService(".DispatchHelper") Let’s declare two variables of type objects.ĭim document as object dim dispatcher as object Now, it’s time to code the first macro.
