Page 1 of 1

Start Macro from Hidden writer document

PostPosted: Thu Aug 22, 2019 4:28 pm
by Touf2638
Hello,
I launch a macro from .net application in a writer document to generate a QRCode. My problem is I need to launch document hidden and when document is hidden, macro seems unreach document.
When I start with hidden=false it works fine.

Is there a way to refer thiscomponent to an hidden document ?
Thanks

Re: Start Macro from Hidden writer document

PostPosted: Thu Aug 22, 2019 7:27 pm
by JeJe
Have you tried hiding it by positioning it off screen (by setting the window x value to minus the width for example) instead of not visible?

Edit: another alternative would be to hide it behind another open window... perhaps by making it minimum size and the other open window a topmost window. You may be able to use Api calls to change the window style so it doesn't appear in the Windows taskbar.

Re: Start Macro from Hidden writer document

PostPosted: Thu Aug 22, 2019 8:56 pm
by Touf2638
It's a good idea. I will look how change position of writer application if it is possible.

Re: Start Macro from Hidden writer document

PostPosted: Mon Aug 26, 2019 10:07 am
by Touf2638
I have try to change position but I need to open document before change. So I see application then I see my change...
So I need to find and other way. Any idea ?

Cod eto change position if somebody need

Code: Select all   Expand viewCollapse view
                Dim vFrame As Object, intXPos As Integer, intYPos As Integer, intHeight As Integer, intWidth As Integer
                vFrame = Document.getCurrentController.getFrame()
                vWindow = vFrame.getContainerWindow()
                intXPos = 6000
                intYPos = 6000
                intHeight = 1
                intWidth = 1
                vWindow.setPosSize(intXPos, intYPos, intWidth, intHeight, unoidl.com.sun.star.awt.PosSize.POSSIZE)

Re: Start Macro from Hidden writer document

PostPosted: Mon Aug 26, 2019 10:13 am
by Touf2638
If it's possible to show and hidden document, it can works but I don't know how show a document open with hidden property

Re: Start Macro from Hidden writer document

PostPosted: Mon Aug 26, 2019 10:37 am
by Touf2638
Ok i find Document.currentController.Frame.ContainerWindow.setVisible(True)
So I open document hidden, I change position out of screen then I set visible to true.
It works.
At the end I do reverse because if you let with parameters out of screen, when you launch manually open office it keep this parameters.
Thanks

Re: Start Macro from Hidden writer document

PostPosted: Mon Aug 26, 2019 10:41 am
by RoryOF
If the visible/hiding of the document is too obtrusive, you might experiment with making it visible but minimised.