Ask Your Question
0

Conversion to odt from html: no desidered output

asked 2016-02-02 11:18:58 +0200

Milioli Luca gravatar image

Hi there.

I try to convert an html file obtained from a Java transformation program.

LibreOffice displays correctly this file if I open it from File/Open menu and I choose html from type of file.

In this case I display the web page rendered from LibreOffice in the editor. So, now I want to convert this file to an odt file.

I tried this command, to obtain an odt file named as the input:

soffice --headless --convert-to odt cleanedHtml.xml.html

The .odt file created, If I open directly it with LibreOffice Writer display the raw html whereas I want to display the rendered html page. If I try to open the cleanedHtml.xml.html with LibreOffice as HTML file, as said before, the file is rendered correctly, and after, I try to Save As odt file, LibreOffice create and .odt file which contained the rendered content when I open it with the writer.

I need a command that, having the input html file, give me the same result obtained from opening the file as an HTML file and save it as odt. The goal is to obtain an odt file with the rendered page, and not with the raw html code when I open it with the Writer.

Thank you for your attention.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2016-02-05 13:44:02 +0200

The html file needs to start with <!DOCTYPE html or <html. Your filename contains xml so perhaps it starts with an XML declaration.

You can save to ODT in two ways:

  soffice --headless --convert-to odt:writerweb8_writer cleanedHtml.xml.html
  soffice --headless --convert-to odt:writer8 cleanedHtml.xml.html
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2016-02-02 10:53:34 +0200

Seen: 985 times

Last updated: Feb 02 '16