It is possible via macro, set your own coordinates in the line: oWindow.setPosSize(…) in the Sub openInDefinedWindow
Sub openInDefinedWindow 'choose a file and open it in the defined coordinates X/Y & width/height
dim oDoc as object, sUrl$, oSize as new com.sun.star.awt.Size, oPosSize as new com.sun.star.awt.Rectangle
sUrl=filePicker
if sUrl="" then exit sub
oDoc=StarDesktop.LoadComponentFromURL(sUrl, "_blank", 0, array()) 'open the file
oWindow=oDoc.CurrentController.Frame.ContainerWindow
oWindow.setPosSize(100, 100, 500 ,800, com.sun.star.awt.PosSize.POSSIZE) 'set parameters for opened window: X, Y (coordinates from left-top border in Desktop), width, height
End Sub
Function filePicker() as string 'open dialog for File Open
on local error goto chyba
dim oFileDlg, oFileAccess, oFiles, sFile$, sInitDir$
oFileDlg=CreateUnoService("com.sun.star.ui.dialogs.FilePicker")
' oFileDlg.AppendFilter("Writer (*.odt)", "*.odt") : oFileDlg.SetCurrentFilter("Writer (*.odt)") 'filters only for ODT files
oFileAccess=CreateUnoService("com.sun.star.ucb.SimpleFileAccess")
sInitDir=convertToUrl(CreateUnoService("com.sun.star.util.PathSettings").Work) 'default directory from: Tools/ Options/ LibreOffice/ Paths -> My Documents
if oFileAccess.Exists(sInitDir) then
oFileDlg.SetDisplayDirectory(sInitDir)
end if
if oFileDlg.execute() then
oFiles=oFileDlg.getFiles()
if ubound(oFiles)>=0 then
sFile=oFiles(0)
end if
end if
filePicker=sFile
exit function
chyba:
msgbox("Error " & Err & chr(13) & Erl & chr(13) & Error)
End Function