Problems suppressing the "Update Links?" dialog
Posted: 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 com.sun.star.beans.PropertyValue 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:
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.
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
Dim SaveProperties(1) As New com.sun.star.beans.PropertyValue
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())
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.