Exported html for tables, <p> vs <br>

Exporting a writer document to html, that contains lines of text within tables, produces “It does not look the same”. There is an extra “line break” between each line of text within a table. Looking at the html shows that lines of text within a table are exported with a surrounding “p-tag /p-tag” when “br-tag” is adequate. The lines of text are “different colors”. The document started life as a Microsoft word document. This behavior appears to be specific to text within tables. When I enter “real” html tags in this editor, the tags disappear and ruin the formatting.

Question… How do I get writer to export “br-tag” between lines instead of “p-tag /p-tag”, when exporting a writer document to html?

This might not be the definitive answer.

Writer is basically a document processor, not an HTML developing environment. Its starting “brick” is the paragraph. Paragraphs translate as <p> … <\p> blocks in HTML This is the correct way to do it, even if you find the <p> block redundant inside a <td> cell.

A paragraph, like a <p> block can have padding (called indents – horizontal – and spacings --vertical), borders and margins.

A <br> tag does not create a new block, it just tells the renderer to break the line and start a new one. It is an “inline” or “inblock” formatting instruction.

If you want to do the same with Writer, try to add line breaks in the paragraphs making up you cell content. Key encoding for a line break is Shift+Return instead of simply Return for paragraph break.

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 for taking the time to provide constructive thoughts. It helps a lot. I am in a re-learning process and the subtlety of shift+return vs return is an excellent lesson. The issue/problem I have is with multiple p-tag blocks within a td-tag block. It is hard to appreciate the “right” way, when the result leads to “it looks different”. I was able to discover the “what”, but I suspect there should be a solution in Writer that is an “alternative” option in the “Export as html” feature. When you export a document as html and the result is “the tables are messed up”, there should be an “obvious” or less painful solution. I was hoping I had missed the obvious solution.

There are other subtleties in the translation process. You start from Writer with a page format and styles to format paragraph. You end up in a Web screen with no specific page limits (the document will be set within a “view port” defined by the geometry of the window, i.e. it is dynamic instead of fixed)with text formatted by a CSS stylesheet.

Writer styles are translated as CSS. In principle, you should have identical results with explicitly defined styles. I don’t know what the result is with implicit styles such as Default Style. Also, there is no “traditional” style associated with tables (present so-called “table styles” are in fact templates). Consequently, there is probably no CSS directive for tags table, tr and td. You should experiment with table attributes in Writer to see if this makes a difference.

Question… How do I get writer to export “br-tag” between lines instead of “p-tag /p-tag”, when exporting a writer document to html?

I sometimes have to edit HTML pages including tables. What you can do is to work on source text (rename your HTML file to txt file) and then erase the <p></p> tags using SEARCH&REPLACE. Sometimes you may find <\p> instead of </p>.

On SEARCH&REPLACE I use Regular Expressions like this for searching: <\\p>|</p>|<p> (replace: nothing - I don’t need the <br> tag).
Procedure always after having finished editing. If you edit your HTML file on Writer later it will place the paragraph tags again.

For inserting the <br> tag you may replace this instead of <\\p>|</p> if necessary (depending on document structure). More steps necessary.

You also could use editors like Notepad++ which is highly capable.

A BIG “Thank You” for the suggestions. Being an old vi/vim user, I got stuck in “global replace syntax” for vi/vim, which was not productive. Notepad++ search/replace helped me “clean up” the file with less brain stress. Highlighting the desired text/tags in Notepad++ worked “like I wanted/expected” as compared to a similar process in vim or BlueGriffon. The combination of BlueGriffon and Notepad++ have proven to be good for fixing and re-learning html “features”. I still have the opinion that a writer documents visual appearance, should not change when exported as html. Why? I think I have seen statements that the “goal of exporting to html” is to preserve visual appearance. The subtleties of “shift return” vs “return” may not be obvious to the casual document creator or the older person trying to get back on the horse. Again… Thank you for taking the time to respond with constructive thoughts.