Date: prev next · Thread: first prev next last
2017 Archives by date, by thread · List index




On 08/29/2017 01:23 AM, Cley Faye wrote:
Some things seems wrong on that command line:

- On most system you can directly call "libreoffice" instead of providing
the full path

Yes, but then I get /usr/bin/libreoffice since /usr/bin is in my path.
/usr/bin/libreoffice is a symlink to ../lib/libreoffice/program/soffice*

Note the file sizes and timestamps.  I don't know what the difference is
between the two or which is correct to use.

ll /usr/lib/libreoffice/program/soffice*
-rwxr-xr-x 1 root root 6012 Apr 28 07:59 /usr/lib/libreoffice/program/s
office*
-rwxr-xr-x 1 root root 6304 Apr 28 12:36 /usr/lib/libreoffice/program/s
office.bin*
-rw-r--r-- 1 root root  789 Apr 28 13:32 /usr/lib/libreoffice/program/s
officerc


​The "libreoffice" command/link is there to avoid issues when/if the way
LibreOffice is installed change. Suppose in a future release the binary is
renamed to loffice, you could still use the ​libreoffice command without
issue.
The "soffice" script manage some extra command line parameters and launch
the actual LibreOffice program; but for your purpose it should make no
difference using one or the other, except that directly calling stuff in
/usr/lib/libreoffice is not as futureproof.




I use the full path because it's the only one that gives output as you can see:

apb@yellow:/usr/local/src/greetonix/src$ /usr/lib/libreoffice/program/soffice -h
apb@yellow:/usr/local/src/greetonix/src$ /usr/bin/libreoffice -h
apb@yellow:/usr/local/src/greetonix/src$ /usr/lib/libreoffice/program/soffice.bin -h
LibreOffice 5.1.6.2 10m0(Build:2)

Usage: soffice [options] [documents...]
[snip]





- I'm not sure the -env:UserInstallation part is needed, unless you have
some specific requirements

Yes.  I typically have LO open 24/7 with other documents.

I don't recall for sure, but if I'm not mistaken, the conversion silently fails without it. I resolved that one awhile ago, I no longer remember the details. I suppose I should mention I had this working at one point. I moved the file to a subdir, made minor changes in a script to accommodate the subdir and it broke. I put it all back the way it was and it still refused to work and that's where I am now. Baffled.


​It should not​ matter when doing a convert-to. This command is useful if
you want to launch an instance of LibreOffice using a different place to
store your configuration/etc. You can have many document open in
LibreOffice and use the command line at the same time.

​- ​the \(encoded\):UTF8 part is not linked to anything, and thus is used
as an input filename. This is most likely not what you want.

Could you elaborate what you mean by not linked to anything?  This is
probably the key to what I'm doing wrong.  To what would I link it, and how?

​The command line is parsed argument by argument. An argument is a single
string, and arguments are separated by a space.​ Sometime an argument
expect a parameter in place of the next argument. This is common practice
for command lines.

In your case, you had: --convert-to csv:Text \(encoded\):UTF8
Which mean that you have three strings: "--convert-to", "csv:Text" and
"(encoded):UTF8". "--convert-to" is the argument, "csv:Text" is a parameter
to the argument, and "(encoded):UTF8" is "nothing", meaning it is
interpreted as an input filename, so your initial command was trying to
open a file named "(encoded):UTF8".

I copied it from a web page, unfortunately I can't find the page again now. Since you're saying it's not needed (as demonstrated by you below), then I guess there's no need to explore this particular argument at this time.


I was able to convert an xlsx to a csv in UTF-8 using the following simple
command:

$ libreoffice --headless --nolockcheck --convert-to csv
--infilter=CSV:44,34,76,1 a.xlsx

I tried exactly as you stated  (I of course replaced with the proper file
to convert) but for me, that had no result.  There were no messages of any
kind, and the file was not created.

infilter does refer to the source file, yes?  As my input/source file is
.xlsx, I tried changing CSV in your --infilter, to MS Excel 97, but that
made no difference in the result.


--infilter does not necessarily related to the input; order is important.​\

If order is important, then I presume the docs are clear on what the ordering should be. Can you link to the docs where it elaborates on the ordering priorities please?


$ libreoffice --version

LibreOffice 5.3.1.2 30m0(Build:2)


​There's no need for other parameters to do an xlsx->csv(utf8) conversion.​
If that simple command doesn't work, maybe there's another issue.

I guess there must be another issue. I'm all ears for ideas on determining what that issue is.

You could even remove the --nolockcheck if you're sure that the file isn't
open anywhere else and remove the --headless if you're not running this
command on a server, it should still work.


The "76" is responsible for generating an UTF-8 CSV output. If that is not
one of your requirements, you can slim this down even more:

I do in fact prefer UTF-8 CSV output.

​
For information, the "44,34,76,1" thing come from this page (the CSV part
is still applicable to LibreOffice):
https://wiki.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Filter_Options

Yes, thank you. I studied it in detail before posting. Very dense page. Took a very long time to figure out how to construct a filter string, especially token 5. There was zero information regarding what was required and what was optional. Your strings imply everything after token 4 is optional, but the docs fail to state that. So it's a great big frustrating mystery as to what's required and what's not.



--
To unsubscribe e-mail to: users+unsubscribe@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.