How do I get rid of field shadings in mail merged file that's been converted to html?

Hi, I have used a python script to convert a LibreOffice writer (.odt) file to html using the LibreOfiice API components in a stand alone python script.

The mail merged document does not contain field shadings, but once it has converted the file, all the mail merged fields have field shadings. These appear as a css style background <span style="background: #c0c0c0">Tester</span> This is visible when the file is rendered in the browser.
I have unchecked the field shadings setting in View->Field Shadings and Tools->Options->LibreOffice->Application Colors then unchecked field shadings option. There is also no direct formatting or styles applied.

I also can not find any API reference to field shadings.

EDIT Attached is the mail merged file OutputTestFile5.odt and an image of how it displays in the browser

Can anyone please help?

(edited by ajlittoz for better formatting)

Field shadings are only visual clues which are not kept in the ODF XML. Turning them off has no effect.

What is your workflow? You mention a “mail merged text file”: does it mean an ASCII file (without any formatting)? Is your Python script executed from inside LO (Writer or other components?) or stand alone? Is the field shading rendered by the browser displaying the HTML file?

To answer all these questions, edit your description. Don’t use an answer: it is reserved for solutions on Question & Answer sites like this one.

Thanks for editing. Another set of questions:

  • is the original mail merged document formatted either with styles or direct formatting?
  • when you display this document in LO Writer, are there any “field shading” on the merged fields?
  • how is this “field shading” translated in HTML: a specific HTML element or a CSS decoration?

Eventually, attach a 1-page anonymised sample of your .odt to your question for technical analysis.

When I display the attached document, it tells me the content is related to entry # -1 of the database. In other words, though it contains “Mr” “Tester” “McTestFace” in the various fields, this is a fake merged letter. Does the same shading occur on real records of the data base?

Hi, Thank you so much with your engagement on this. That is actually based on the 6th record in the LO base table used to generate the file. The attached letter is the actual output file generated after running a mail merge script.

I understand that. I checked there is no styling set over/around the fields.

I then exported one of my documents with fields to HTML. It seems that the converter intentionally adds background to every field. I wonder where it takes the background definition. The colour should be under user control.

This sounds like a bug. If you know how to do it, fill in a bug report. Otherwise, I can do it.

Thank you again. Not sure how to fill in a bug report. Please assist me in doing this.

Bug reported as tdf#137174