2 rem This file is part of the LibreOffice project.
4 rem This Source Code Form is subject to the terms of the Mozilla Public
5 rem License, v. 2.0. If a copy of the MPL was not distributed with this
6 rem file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 rem This file incorporates work covered by the following license notice:
10 rem Licensed to the Apache Software Foundation (ASF) under one or more
11 rem contributor license agreements. See the NOTICE file distributed
12 rem with this work for additional information regarding copyright
13 rem ownership. The ASF licenses this file to you under the Apache
14 rem License, Version 2.0 (the "License"); you may not use this file
15 rem except in compliance with the License. You may obtain a copy of
16 rem the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 Attribute VB_Name
= "Module1"
25 'The service manager is always the starting point
26 'If there is no office running then an office is started up
27 Dim objServiceManager
As Object
28 Set objServiceManager
= CreateObject("com.sun.star.ServiceManager")
30 'Create the CoreReflection service that is later used to create structs
31 Set objCoreReflection
= objServiceManager
.createInstance("com.sun.star.reflection.CoreReflection")
34 Set objDesktop
= objServiceManager
.createInstance("com.sun.star.frame.Desktop")
36 'Open a new empty writer document
38 Set objCoreReflection
= objServiceManager
.createInstance("com.sun.star.reflection.CoreReflection")
39 'get a type description class for Size
40 Set propClass
= objCoreReflection
.forName("com.sun.star.beans.PropertyValue")
43 propClass
.CreateObject prop
47 'create the actual object
52 'Set objDocument= objDesktop.loadComponentFromURL("private:factory/swriter", "_blank", 0, args)
53 Set objDocument
= objDesktop
.loadComponentFromURL("private:factory/swriter", "_blank", 0, args2
)