Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 619902 - headless option does not work right
headless option does not work right
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: openoffice.org (Show other bugs)
13
All Linux
low Severity medium
: ---
: ---
Assigned To: Caolan McNamara
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-07-30 16:16 EDT by Need Real Name
Modified: 2010-08-03 04:39 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-07-31 08:49:04 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
code for batch export (1.53 KB, text/plain)
2010-07-30 16:18 EDT, Need Real Name
no flags Details
replacement code (1.51 KB, text/plain)
2010-07-31 08:47 EDT, Caolan McNamara
no flags Details

  None (edit)
Description Need Real Name 2010-07-30 16:16:28 EDT
I am using a .vba script to convert .xls to .html
assume the  /tmp/m.xls is input xls 
then the command

soffice -calc -nologo -nofirststartwizard -view -norestore -headless -nolockcheck -unaccept=all 'macro:///Standard.Module1.SaveAsHTML("/tmp/m.xls","/tmp/m.xls.html","HTML (StarCalc)")'

convert m.xls to m.xls.html just fine.

The problem is: in case the file m.xls has, for example HTML content inside then:

1. if there exist an "openoffice open window" then the command above 
give a dialogue "Filter not found" (because it cannot import .html as .xls) DESPITE THE OPTION -headless
if I click OK - it exits & fails to convert, as it should be.
But -headless should not give no dialogue at all.

2. This became much more problematic if there is no open openoffice window.
Then the command above NEVER EXITS,just hangs forever. Probably because it expects a click on "Filter not found", and there is no chance to click.
This create a very serious problem in using openoffice as batch format converter,
because if input format is wrong - soffice never exit.
Comment 1 Need Real Name 2010-07-30 16:18:15 EDT
Created attachment 435637 [details]
code for batch export

copy the content to Module1 (inside Tools->Macro)
Comment 2 Caolan McNamara 2010-07-31 08:46:45 EDT
1. Yes, OOo is always a single process, so if there is a non-headless instance already running, then a second headless is not created, so the -headless option doesn't affect the already running OOo that executes the macro.

2. No, it isn't stuck on a "Filter not found" dialog. Its the document is opened in writer successfully, the store to url fails, so it jumps to the ConversionError and the document isn't closed, so its still there idling.

Try this replacement code.
Comment 3 Caolan McNamara 2010-07-31 08:47:55 EDT
Created attachment 435749 [details]
replacement code

This might work better
Comment 4 Need Real Name 2010-07-31 15:15:05 EDT
Caolan,
Thanks a lot. The code you suggested works fine with invalid content inside input file.
The only problem left - if input file does not exist at all.
Then I get an error (and window opened) and stuck at
 oDoc.close( True )

I tries the handling below
----------------------
Sub SaveAsHTML(iFile, oFile, convertername)
   ON ERROR GOTO ConversionError
......conversion code....
   ConversionError:
   ON ERROR Resume Next
   oDoc.close( True )
   'exit sub
End Sub
------------------------------

but the result is the same - if input file does not exist -
the new window is opened and oDoc.close( True ) is highlited.
I can do a workaround to test file existence outside of OO,
but would much prefer to handle oDoc.close( True ) errors in basic.
Comment 5 Need Real Name 2010-08-01 16:10:20 EDT
I fixed mentioned problem this way, is it correct?

Sub SaveAsHTML(iFile as String, oFile as String, convertername as String)
   ON ERROR Resume Next
   Dim oDoc As Object
   oDoc = StarDesktop.loadComponentFromURL(ConvertToURL(iFile), "_blank", 0, Array(MakePropertyValue("Hidden",True),MakePropertyValue("ReadOnly",true),))

   if IsObject( oDoc ) Then
     oDoc.storeToURL(ConvertToURL(oFile), Array(MakePropertyValue("FilterName",convertername),))
     oDoc.close( True )
   EndIf
   'exit sub
End Sub
Comment 6 Caolan McNamara 2010-08-03 04:39:54 EDT
looks fairly reasonable

Note You need to log in before you can comment on or make changes to this bug.