Saving Writer file as html adds line spaces

Hello,
I’m trying to migrate from MSOffice and am new to LibreOffice. I can save an MSWord file as html and it will display in my browser properly. But saving from Writer in html, the browser shows a line space between each line. Opening the html back into Writer shows single spaced.

These are simple text files. Writer line spacing is set to 1.

How can I eliminate these ‘double-spaced’ lines when saving as html?
I did some searching here beforehand, so apologies if I missed something.
Thanks for any help.
Virginia

the browser shows a line space between each line

Do you mean the text is double-spaced in the browser? Have you formatted your text in Writer some way or other?

If it is rather short, edit your question to attach it with the paperclip tool. In case there is private data, overwrite it with non-sense text.

Have a look into the HTML source code. Simple line space is created by <br> tag; paragraphs are followed by space and include content inbetween <p> ... </p> tags.

Have you ever had a look into Microsoft Word HTML source code? :wink:

.

To have relatively simple HTML source code start a new HTML Document, not a Writer Document.

.

@nuevalibre wrote: Opening the html back into Writer shows single spaced.

.

You better upload a sample file. Your description is not exact enough, see annotation of @ajlittoz as well.

Wow, I really don’t know how this wiki thingy works. I kept looking for answers as replies, but just stumbled across the notification button. Sorry for the delay.
I just tested in Writer to create a new html document(I was just creating a Writer document before).
Now when I write a line of text, followed by a carriage return, it is adding a space between the lines. For example, I write the following two lines;
This is line 1

This is line 2

It puts a space in-between the lines as shown. Selecting Format>Spacing>Line Spacing to 1 makes no difference. I’m expecting it to look like;

This is line 1
This is line 2

Does this make any sense?
Thanks for the help.
EDIT: Ok that didn’t display right. I’ll upload an example when I figure how to do that. :slight_smile:

Ok evidently I can only upload 1 attachment? I have three so they can be compared. My single attachment above will show the double-spacing.

Are you talking about HTML writing? If so, when rendering HTML, browsers collect what makes a paragraph, i.e. everything between <p> and </p> (or other equivalent tags) considering line breaks only as a convenience for writing or “pretty printing” the source HTML code: line breaks are replaced by spaces and sequences of spaces are merged into a single space. When this is done, paragraph text is formatted inside its “bounding box”.

You can upload as many (small) attachments as you need. Edit your question, then use the paperclip tool. Don’t forget to use double Enter to space the additions.

Now it won’t upload even a single file. F*ck this.

Behave yourself! The paperclip opens a dialog to browse to the file. Click OK, then add some description in the highlighted text. Move the cursor after the end of the “code” before adding something else or you’ll mess up the link.

I’m not trying to write html. Originally, I used saved my Word document as a web page, and it formatted in the browser just as in Word.
Writer, whether as a Writer document, or html document, double-spaces my lines. I appreciate the offer to help, but right now I’m more frustrated trying to use this wiki forum. I may just stick w/the devil I have (MS Word), rather than the devil I want. :\

Thanks. I may try again tomorrow. Sorry for losing my temper. Cheers

I did some reading about basic html and the /p tag. I now understand what you mean about what makes a paragraph. When I hit ‘enter’ on the keyboard after writing some text, Writer considers it a paragraph, adding a /p at the end of the line instead of a br and hence a double space between my lines of text. MSOffice also uses the /p at end of line, but there’s a bunch more stuff in there which seems to be MS specific.

I guess my question can be summed up by asking; Is there a way to have Writer use something like a br when I hit ‘enter’ at the end of a line instead of treating it like a paragraph?
Thanks.

There are two ways to answer your question in a comment about paragraphs in HTML.

###Styles

Both Writer and HTML use styles and separate content from rendering. You are probably familiar with Writer paragraph styles and browsers use a similar approach for formatting on screen. The most known device is CSS styles (but others are available).

When Writer converts a document to save it as HTML, it tries to preserve its formatting by translating its Writer styles into CSS styles. Not all attributes have a CSS counterpart but the conversion is generally correct

CAUTION! For an unknown reason, the conversion is broken if your paragraph style has both spacing above and below set to zero. The converter uses then above=0 and below=0.25cm. To get the illusion of no-space, use something like above=0.01cm and below=0.

###Line break

You can cause a line break to be inserted in your paragraph with Shift+Enter. You don’t leave the paragraph, you only instruct the formatter to stop filling the line with what it has already collected and to not justify it. The paragraph continues normally on next line. This translates as <br> in the HTML.

*Don’t abuse the Shift+Enter device. If logically the parts before and after are paragraphs, they should be separated with Enter and the relative spacing set with styles.

##Importance of file format

If you start from a standard text document .odt, everything I wrote will give you faithfully the expected result… Just “export” as .html when you need to change the page in your site.

If you create the page with File>New>HTML Document, CSS formatting instructions are not as exhaustive as they could be. Taking the example of paragraphs in Text Body where I changed the spacing below, only the modified parameters were translated into CSS. Considering the CSS inheritance rules, this means the non described attributes like margin or padding are taken from the default CSS style collection.

In the case of my Text Body, only margin-bottom was set. All paddings and margin-top come from the default CSS stylesheet which is internal to the browser. Consequently, the rendering by the browser may look very different from the one by Writer.

To show the community your question has been answered, click the ✓ next to the correct answer, and “upvote” by clicking on the ^ arrow of any helpful answers. These are the mechanisms for communicating the quality of the Q&A on this site. Thanks!

In case you need clarification, edit your question (not an answer) or comment the relevant answer.

Thank you. That was excellent. Shift-Enter seems to work.
Can’t seem to upvote. Not enough points or something.