Run calc invisible (headless)

Discuss the spreadsheet application
Post Reply
bpwillie
Posts: 4
Joined: Mon Sep 14, 2009 5:20 pm

Run calc invisible (headless)

Post by bpwillie »

I have looked extensively in the forums, the issue tracker and via web searches. Found folks with related issues but no solution.

I've written macros for calc that generate a PDF report with charts, etc. The calc file gets invoked from within an MFC program via _spawnv(). (I'm running the program on Windows XP.) Everything works great except that I don't want the spreadsheet to be displayed to the user - I want it to run invisibly behind the scene. I believe the -headless command line argument should hide the spreadsheet, but it doesn't. Neither does -invisible. I would settle for -minimize, but that doesn't work either. Same problem when I run the command directly from the command prompt.

I can reduce the amount of time the spreadsheet is visible to a number of seconds by setting the document itself invisible within the macro code. But this still isn't good.

From what I've read it looks like -headless works on other platforms. Is this a bug on MS Windows? Is there a work around? Thanks for any help.
bpwillie
OpenOffice 3.1.1
Windows XP
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Run calc invisible (headless)

Post by Villeroy »

There are working programs to do this job.
http://www.oooninja.com/2008/02/batch-c ... -with.html provides everything to convert anything
and there you find an important hint about PDF:
PDF printer method

If you just want to generate PDF files, you don't need a Python script, a Basic macro, Java code, or any other kind of programming. Just install a PDF printer such as PDFCreator (Windows) or CUPS-PDF. Then, use the -pt command with the the first argument as the printer name and the second argument as the source document.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
bpwillie
Posts: 4
Joined: Mon Sep 14, 2009 5:20 pm

Re: Run calc invisible (headless)

Post by bpwillie »

Thanks for your reply. Unfortunately, it doesn't address my issue. It's not that I can't create a PDF file or print it. The problem I'm having is that I can't prevent the display of the spreadsheet to the user while it's actually creating the report. I'd like the spreadsheet to be hidden while it's doing its work.
bpwillie
OpenOffice 3.1.1
Windows XP
User avatar
RoryOF
Moderator
Posts: 34613
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Run calc invisible (headless)

Post by RoryOF »

Can you let the spreadsheet open but run Minimised?
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
bpwillie
Posts: 4
Joined: Mon Sep 14, 2009 5:20 pm

Re: Run calc invisible (headless)

Post by bpwillie »

That would be acceptable but unfortunately, -minimize doesn't minimize the spreadsheet.
bpwillie
OpenOffice 3.1.1
Windows XP
bakshiabhishek
Posts: 5
Joined: Wed Feb 25, 2009 3:25 pm

Re: Run calc invisible (headless)

Post by bakshiabhishek »

Even im facing a similar issue. I can connect to the openoffice instance (started in a headless mode) , but as soon as a document is loaded using 'loadComponentFromURL' the OO window becomes visible.

Im using java to do this.! Looking for a solution around this problem.

Thanks,
Abhishek.
OOo 3.0.X on MS Windows Vista + Linux
bakshiabhishek
Posts: 5
Joined: Wed Feb 25, 2009 3:25 pm

Re: Run calc invisible (headless)

Post by bakshiabhishek »

I found this thread:
http://markmail.org/message/nviuqo6n75j ... te:results

Might be useful. I m still trying to work around this problem. Pls. share if you already have a solution :-)

Thanks in advance.
OOo 3.0.X on MS Windows Vista + Linux
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Run calc invisible (headless)

Post by Villeroy »

What's so important about a window being visible or not? You can run some type of headless document converter on a server machine. If there is a living person (a person and not an ape) he/she should be able to decide about the appropriate file format.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
bpwillie
Posts: 4
Joined: Mon Sep 14, 2009 5:20 pm

Re: Run calc invisible (headless)

Post by bpwillie »

Since my original posts I've observed that when Calc starts up it doesn't automatically get focus. If there are windows already displayed, Calc remains hidden behind them. This seems like a bug, but I'm using it to my advantage. Since my application is run full screen, and since Calc doesn't get focus on startup, the user will not be aware that Calc is running. Obviously, this is not a good solution, and is only acceptable for me due to my environment circumstances, but I'll run with it. Thanks for your interest and help.
bpwillie
OpenOffice 3.1.1
Windows XP
bakshiabhishek
Posts: 5
Joined: Wed Feb 25, 2009 3:25 pm

Re: Run calc invisible (headless)

Post by bakshiabhishek »

I was able to run OO in a headless mode and then open a document keeping the window hidden.
The only thing i did was to set the Hidden property while opening the document :

Code: Select all

//Only the hidden property is required:
PropertyValue[] pPropValues = new PropertyValue[2];
            pPropValues[0] = new PropertyValue();
            pPropValues[0].Name = "ReadOnly";
            pPropValues[0].Value = new Boolean(true);
            pPropValues[1] = new PropertyValue();
            pPropValues[1].Name = "Hidden";
            pPropValues[1].Value = new Boolean(true);

            component = desktopObj.loadComponentFromURL(fileName, "_blank", 0, pPropValues);
However, i still have confusion on weather running OO in a headless mode should / should not display windows.
Any help on this front is highly appreciated.

Thanks,
OOo 3.0.X on MS Windows Vista + Linux
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Run calc invisible (headless)

Post by Villeroy »

I can run OOo headless from a terminal session without any graphical user interface. There is no way to show any window, even if OOo "wanted" to be visible.
Quite obviously, the problem occurs only under Windows Vista which has it's own idea of what should be shown in a Window.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Post Reply