Problems suppressing the "Update Links?" dialog

Creating a macro - Writing a Script - Using the API

Problems suppressing the "Update Links?" dialog

Postby pstraton » Wed Feb 12, 2014 12:10 am

I'm brand-new to OpenOffice, StarBasic, and the OpenOffice object model. Lots of experience with MS/VBA, and my task at hand is to port a small amount of moderately sophisticated VBA functionality to OpenOffice Calc in StarBasic. That functionality includes the need to open multiple files in a particular state/mode, and I've found enough information about to be dangerous.

In particular, the files I'm opening are Excel ".xlsm" workbooks that sometimes result in the "This file contains links to other files. Should they be updated? [Yes] [No]" dialog being displayed. I don't need any links to be updated for my purposes and don't want the user to have to get involved, so I set "UpdateDocMode" property to "NO_UPDATE" in the file-open operation as follows:

Code: Select all   Expand viewCollapse view
Dim SaveProperties(1) As New
FileProperties(0).Name = "MacroExecutionMode"
FileProperties(0).Value ="NEVER_EXECUTE"
FileProperties(1).Name = "UpdateDocMode"
FileProperties(1).Value = "NO_UPDATE"
SrcFile = StarDesktop.loadComponentFromURL(FilePath, "_blank",0 ,FileProperties())

Yesterday, I was unable to get this to work as expected, with it continuing to pop the dialog inquiry. Today, I began experimenting to identify other variables that might be involved, such as setting Tools=>Options=>OpenOffice Calc=>General=>Updating to "Never" (or back to "On Request"), and setting ThisComponent.IsExecuteLinkEnabled to False (or back to True), to see if/how they affected the behavior of my file-open code, above. At some point today my code started working correctly and, unfortunately, I didn't do a controlled enough experiment to understand what I did to get it working--too many variables at play. Further, I can now set Tools=>Options=>OpenOffice Calc=>General=>Updating to "On Request" and ThisComponent.IsExecuteLinkEnabled to True (presumably the state they were in yesterday before I started messing with them, when my code didn't work) and now it works even with these settings.

I also did some additional investigation and discovered the "LinkUpdateMode" property, but none of the documentation I can find clearly describes its functionality, especially with regard to how it is different from "UpdateDocMode". (Actually, the documentation for "UpdateDocMode" is pretty vague too.)

So I have four basic questions:

1. What is the difference between the "UpdateDocMode" and "LinkUpdateMode" properties?
2. How do properties like "UpdateDocMode" and/or "LinkUpdateMode" interact with the Tools=>Options=>OpenOffice Calc=>General=>Updating setting?
3. How do properties like "UpdateDocMode" and/or "LinkUpdateMode" interact with the current state of the ThisComponent.IsExecuteLinkEnabled property?
4. Is there something more subtle or obscure going on (such as exiting OpenOffice and restarting it, or some such) that would explain why code that didn't work yesterday now works, under apparently the same conditions?

Thanks in advance for any help.
OpenOffice 4.0.1, installed on Windows XP
Posts: 1
Joined: Tue Feb 11, 2014 11:24 pm

Re: Problems suppressing the "Update Links?" dialog

Postby Villeroy » Wed Feb 12, 2014 12:51 am

The property values are UNO constants. You specified strings. ... iptor.html ... cMode.html ... cMode.html

Code: Select all   Expand viewCollapse view
FileProperties(1).Value =
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 16.04, OpenOffice 4.x & LibreOffice 5.x
User avatar
Posts: 24077
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Problems suppressing the "Update Links?" dialog

Postby NicolasLD » Wed Jul 12, 2017 2:34 pm

I got the same problem, I can't cancel the dialog box after loading component.

Code: Select all   Expand viewCollapse view
var openProps = new PropertyValue[4];
openProps[0] = new PropertyValue { Name = "UpdateDocMode", Value = new uno.Any(typeof(int), 0) };
openProps[1] = new PropertyValue { Name = "MacroExecutionMode", Value = new uno.Any(typeof(int), 0) };
openProps[2] = new PropertyValue { Name = "ReadOnly", Value = new uno.Any(typeof(bool), true) };
openProps[3] = new PropertyValue { Name = "Hidden", Value = new uno.Any(true) };
var xComponent = Loader.loadComponentFromURL(filePath, "_blank", 0, openProps);

Did you solve your problem ?
OpenOffice version :
Posts: 1
Joined: Wed Jul 12, 2017 12:34 pm

Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 12 guests