Opening HTML file with caption tags does not result in caption style in document

When opening an HTML file (or cutting and pasting from a HTML file opened in the browser) with the <caption> tag the caption style is not being applied - the text is styled ‘Default Paragraph Body’. How do I get the paragraph to be styled “Caption” or “Caption - Table”?

For instance this code:

<caption>Were you satisfied with your children’s diet before the pandemic? (out of those who reported having children)</caption>
<tr class="header">
<th style="text-align: left;"></th>
<th style="text-align: right;">Dehradun</th>
<th style="text-align: right;">Delhi</th>
<th style="text-align: right;">Hills of Uttarakhand</th>
<th style="text-align: right;">Tamil Nadu</th>
<th style="text-align: right;">All</th>
<tr class="odd">
<td style="text-align: left;">No</td>
<td style="text-align: right;">2.97</td>
<td style="text-align: right;">26.39</td>
<td style="text-align: right;">15.67</td>
<td style="text-align: right;">27.46</td>
<td style="text-align: right;">16.53</td>
<tr class="even">
<td style="text-align: left;">Yes</td>
<td style="text-align: right;">97.03</td>
<td style="text-align: right;">73.61</td>
<td style="text-align: right;">84.33</td>
<td style="text-align: right;">72.54</td>
<td style="text-align: right;">83.47</td>

Does not produce a caption in the document. Why is this happening, and is there a workaround?

I think it’s quite cumbersome.
What you can do is…

  • Work on source code (insert source code in Writer)

  • Use FIND&REPLACE (regular expressions)

  • SEARCH (see screenshot - code could no show here)

  • REPLACE (see screenshot - code could no show here)
    After you have added the green font color to the source code of caption put the altered source code into an editor like Notepad++ and save as a html file.
    Then open on Writer and check the green colored text (caption) which is in wrong paragraph style.
    If you have some more captions in a longer source code you could again work on FIND&REPLACE…

  • Start again FIND&REPLACE (regular expressions)

  • SEARCH color green (Format…) - use the HTML-palette

  • FIND ALL - every green text should be selected

  • leave FIND&REPLACE - every green text should remain selected

  • apply the suiting paragraph style