| View previous topic :: View next topic |
| Author |
Message |
dave_dsa Guest
|
Posted: Thu Mar 27, 2003 12:31 am Post subject: Opening a Document in Readonly Mode |
|
|
Hi,
Im trying to open a document in readonly mode using the following codein VB, but I get an error. I would appreciate any help.
'create the service Manager
dim objServiceManager as object
Set objServiceManager = CreateObject("com.sun.star.ServiceManager")
'Create the Desktop
dim objDesktop as object
Set objDesktop = objServiceManager.createInstance("com.sun.star.frame.Desktop")
'Create the CoreReflection service that is later used to create structs
Dim objCoreReflection
Set objCoreReflection = objServiceManager.createInstance ("com.sun.star.reflection.CoreReflection")
Dim classsize
Dim objParameters
set classSize=objCoreReflection.forName( "com.sun.star.beans.PropertyValue" )
classsize.CreateObject objParameters
objParameters.Name = "ReadOnly"
objParameters.Value = True
'Open the Document
Set objDocument = objDesktop.loadComponentFromURL(strFilePath, _
"_blank", 0, objParameters) |
|
| Back to top |
|
 |
dfrench Moderator

Joined: 03 Mar 2003 Posts: 1609 Location: Wellington, New Zealand
|
Posted: Sat Apr 05, 2003 2:43 pm Post subject: |
|
|
The following works on my config ... with apologies for my hacker style
| Code: | sub main
Dim args(0) as new com.sun.star.beans.PropertyValue
'Create the Desktop
dim objDesktop as object
Set objDesktop = createUnoService("com.sun.star.frame.Desktop")
'Create the CoreReflection service that is later used to create structs
Dim objCoreReflection as object
Set objCoreReflection = createUnoService("com.sun.star.reflection.CoreReflection")
strFilePath = "file:///D|/bio.sxw" ' valid url here
args(0).Name = "ReadOnly"
args(0).Value = True
dim objdocument as object
'Open the Document
Set objDocument = objDesktop.loadComponentFromURL(strFilePath, "_blank", 0, args())
end sub |
|
|
| Back to top |
|
 |
Sameer Guest
|
Posted: Mon Apr 07, 2003 9:45 pm Post subject: Open Document In Read Mode ... |
|
|
Dev,
i have made bit change in ur code .. just have a look ..
Define Parameter Variable as
Dim objParameters(0)
add pass that variable as below ..
Set objdocument = objDesktop.loadComponentFromURL(strFilePath, "_blank", 0, objParameters()) |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|