Download it now!
Bug 82196 - convert documents to plain text via command terminal
Summary: convert documents to plain text via command terminal
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: Other All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-05 14:50 UTC by inpost
Modified: 2014-08-18 13:04 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description inpost 2014-08-05 14:50:38 UTC
The command 'convert-to' does not seem to work when the required output is plain text ('.txt')
Comment 1 Jean-Baptiste Faure 2014-08-05 16:45:32 UTC
rtf and html conversion works. Not sure if a plain text converter exists.

Possible workaround: convert to pdf then use pdftotext to extract the text.

Please have a look to bug 82188.

Best regards. JBF
Comment 2 Maxim Monastirsky 2014-08-05 18:40:31 UTC
Hi,

Currently you can use: --convert-to txt:Text

*** This bug has been marked as a duplicate of bug 38511 ***
Comment 3 inpost 2014-08-11 14:21:42 UTC
(In reply to comment #2)
> Hi,
> 
> Currently you can use: --convert-to txt:Text
> 
> *** This bug has been marked as a duplicate of bug 38511 ***

This command opened a pdf document in lo draw!

The desired action is to convert to text via the command terminal.
Comment 4 Maxim Monastirsky 2014-08-11 14:30:36 UTC
(In reply to comment #3)
> This command opened a pdf document in lo draw!
What is the format of the source file your'e trying to convert? Can you post the complete command you tried?
Comment 5 inpost 2014-08-15 11:30:37 UTC
(In reply to comment #4)
> (In reply to comment #3)
> > This command opened a pdf document in lo draw!
> What is the format of the source file your'e trying to convert? Can you post
> the complete command you tried?

Lo writer opened, new odt created containing only:

test text

saved as ~/tmp/test.txt

libreoffice --convert-to txt:Text text.odt

Writer opens from the command terminal, no new text file is created at the command terminal.
Comment 6 Maxim Monastirsky 2014-08-16 19:43:50 UTC
(In reply to comment #5)
> saved as ~/tmp/test.txt
I guess it's a typo, and should be test.odt?
 
> libreoffice --convert-to txt:Text text.odt
Another typo I hope - should be test.odt (not text.odt).

> Writer opens from the command terminal
I you don't want the gui to show up, you must add '--headless'.

> no new text file is created at the command terminal.
Do you get any output in the terminal?
Comment 7 inpost 2014-08-18 12:32:40 UTC
(In reply to comment #6)
> (In reply to comment #5)
> > saved as ~/tmp/test.txt
> I guess it's a typo, and should be test.odt?
>

Correct: to clarify

the filename contained 'test text', saved as 'test.odt'
  
> > libreoffice --convert-to txt:Text text.odt
> Another typo I hope - should be test.odt (not text.odt).
> 

Yes.

> > Writer opens from the command terminal
> I you don't want the gui to show up, you must add '--headless'.
>

This is not necessary with

-convert-to ...

(notice only one dash (-) character at start
 
> > no new text file is created at the command terminal.
> Do you get any output in the terminal?

Correction: new observations

with

--convert-to txt:Text test.odt

the gui starts and shows the file

with

-convert-to txt:Text test.odt

conversion at the command terminal is successful, without the need to specify 'headless'.

This should be added to the help manual (especially the local copy, not everyone has constant internet access)
Comment 8 Maxim Monastirsky 2014-08-18 13:04:59 UTC
(In reply to comment #7)
> > I you don't want the gui to show up, you must add '--headless'.
> This is not necessary with
> 
> -convert-to ...
> 
> (notice only one dash (-) character at start
This is not the case for me.
 
> This should be added to the help manual (especially the local copy, not
> everyone has constant internet access)
-convert-to is deprecated. You must be using a very old (and thus unsupported) version.