Apache OpenOffice (AOO) Bugzilla – Issue 124049
SystemShellExecute doesn't open browser with local HTML file + target
Last modified: 2014-02-02 13:39:01 UTC
SystemShellExecute doesn't open browser with local HTML file + target. Macro example (with HTML help file in SDK): Sub OpenHtml() Dim oShell As Object Dim Fichier As String, uFile As String Fichier = "file:///C:/Program%20Files%20%28x86%29/OpenOffice%204/sdk/docs/common/ref/com/sun/star/lang/XServiceInfo.html" uFile = ConvertToUrl(Fichier) oShell = createUnoService("com.sun.star.system.SystemShellExecute") oShell.execute(uFile, "", 0) ' works uFile = uFile & "#getImplementationName" oShell.execute(uFile, "", 0) ' doesn't work, see error message below uFile = ConvertToUrl(Fichier & "#getImplementationName") oShell.execute(uFile, "", 0) ' doesn't work, see error message below End Sub The error message is: "Windows ne trouve pas 'C\Program Files (x86)\OpenOffice 4\sdk\docs\(...) ". "Windows ne trouve pas" = "Windows doesn't find"
Please specify steps to reproduce bug.
(In reply to Edwin Sharp from comment #1) > Please specify steps to reproduce bug. 1. First step is to copy or install any HMTL file (with targets inside) in the local system files. In my case it's Windows7 system file. In the example I've taken the help system of the AOO SDK. 2. Execute the macro "OpenHtml()" (with the appropriate way to the HTML file), from Calc or Writer.
Thank you rvboni.
Remark: In MS-Windows, setting a shortcut to an address#target displays the page but ignores the target. So it seems a limitation of the OS. Workaround : SystemShellExecute can open a target in an HTML file if the browser is directly called, with the file#target as argument. Dim BrowserAddr As String ' BrowserAddr is the address of the browser in system specific syntax ' uFile is the URL address as in Description oShell.execute(BrowserAddr, uFile, 0)
(In reply to bmarcelly from comment #4) > Remark: > In MS-Windows, setting a shortcut to an address#target displays the page but > ignores the target. So it seems a limitation of the OS. I believe it depends from which component the address#target is called. From Basic or Writer (see also bug 18325) it produces an error. From Calc it displays the page but ignores the target (if my memory doesn't fail). So, I'm not sure that it depends only of the OS ? > > > Workaround : > > SystemShellExecute can open a target in an HTML file if the browser is > directly called, with the file#target as argument. > > Dim BrowserAddr As String > ' BrowserAddr is the address of the browser in system specific syntax > ' uFile is the URL address as in Description > > oShell.execute(BrowserAddr, uFile, 0) It's the way used in XRAY (and how I workaround), but it needs to choose a priori a browser.
(Add-on to rvboni from comment #5) The best workaround I've found is: 1. search the path of the default browser in Windows'registry, see for example: https://forum.openoffice.org/fr/forum/viewtopic.php?f=8&t=42005#p229844 2. use Shell (instead of SystemShellExecute): URL = "file:///C:/SomeHTMLFilePath.html" & "#someTarget" Shell(DefaultBrowserPath,2,URL)