Setting text color of Table Controls in Base

I have a .odb file that I set up years ago. (Just in case of very unlikely significance, the backend is MySQL.) One of the forms was originally set up with two tabular subforms that used queries as their data sources. To indicate that the table controls of those subforms are for informational display only, their backgrounds were set to a pale yellow color. Somewhere along the lines, perhaps because of an update (either to LO or to Windows) or perhaps because I started using a dark system theme, one and only one of those subforms became unuseable because the text started displaying in white instead of black (providing insufficient contrast against the pale yellow). I’m trying to come up with a way to make it display in black again. To get a closer look at what’s going on, I unzipped the .odb file, and using a file content search of the contents, determined that the form in question corresponded to one of the ObjXX directories’ content.xml files. Examining that file shed a little light on why the two subforms are not presenting identiacally.

Here is the portion directly defining the Table Control that is displaying black text:

<form:grid form:name="Chirp" form:control-implementation="ooo:com.sun.star.form.component.GridControl" xml:id="control12" form:id="control12">
                        <form:properties>
                            <form:property form:property-name="DefaultControl" office:value-type="string" office:string-value="com.sun.star.form.control.GridControl"/>
                        </form:properties>
                        <form:column form:name="NAME" form:control-implementation="ooo:TextField" form:label="NAME">
                            <form:text xml:id="control13" form:id="control13" form:max-length="20" form:data-field="NAME" form:input-required="false" form:convert-empty-to-null="true">
                                <form:properties>
                                    <form:property form:property-name="ControlTypeinMSO" office:value-type="float" office:value="0"/>
                                    <form:property form:property-name="DefaultControl" office:value-type="string" office:string-value="com.sun.star.form.control.TextField"/>
                                    <form:property form:property-name="ObjIDinMSO" office:value-type="float" office:value="65535"/>
                                    <form:property form:property-name="Width" office:value-type="float" office:value="0"/>
                                </form:properties>
                            </form:text>
                        </form:column>
                        <form:column form:name="NOMINAL" form:control-implementation="ooo:FormattedField" form:label="NOMINAL" form:text-style-name="ctrl1">
                            <form:formatted-text xml:id="control14" form:id="control14" form:data-field="NOMINAL" form:input-required="false" form:convert-empty-to-null="true">
                                <form:properties>
                                    <form:property form:property-name="ControlTypeinMSO" office:value-type="float" office:value="0"/>
                                    <form:property form:property-name="DefaultControl" office:value-type="string" office:string-value="com.sun.star.form.control.FormattedField"/>
                                    <form:property form:property-name="MouseWheelBehavior" office:value-type="float" office:value="0"/>
                                    <form:property form:property-name="ObjIDinMSO" office:value-type="float" office:value="65535"/>
                                    <form:property form:property-name="Width" office:value-type="float" office:value="0"/>
                                </form:properties>
                            </form:formatted-text>
                        </form:column>
                        <form:column form:name="TOLERANCE" form:control-implementation="ooo:TextField" form:label="TOLERANCE">
                            <form:text xml:id="control15" form:id="control15" form:max-length="29" form:data-field="TOLERANCE" form:input-required="false" form:convert-empty-to-null="true">
                                <form:properties>
                                    <form:property form:property-name="ControlTypeinMSO" office:value-type="float" office:value="0"/>
                                    <form:property form:property-name="DefaultControl" office:value-type="string" office:string-value="com.sun.star.form.control.TextField"/>
                                    <form:property form:property-name="ObjIDinMSO" office:value-type="float" office:value="65535"/>
                                    <form:property form:property-name="Width" office:value-type="float" office:value="0"/>
                                </form:properties>
                            </form:text>
                        </form:column>
                        <form:column form:name="TAGNO" form:control-implementation="ooo:TextField" form:label="TAGNO">
                            <form:text xml:id="control16" form:id="control16" form:max-length="20" form:data-field="TAGNO" form:input-required="false" form:convert-empty-to-null="true">
                                <form:properties>
                                    <form:property form:property-name="ControlTypeinMSO" office:value-type="float" office:value="0"/>
                                    <form:property form:property-name="DefaultControl" office:value-type="string" office:string-value="com.sun.star.form.control.TextField"/>
                                    <form:property form:property-name="ObjIDinMSO" office:value-type="float" office:value="65535"/>
                                    <form:property form:property-name="Width" office:value-type="float" office:value="0"/>
                                </form:properties>
                            </form:text>
                        </form:column>
                        <form:column form:name="RESULT" form:control-implementation="ooo:FormattedField" form:label="RESULT" form:text-style-name="ctrl2">
                            <form:formatted-text xml:id="control17" form:id="control17" form:data-field="RESULT" form:input-required="false" form:convert-empty-to-null="true">
                                <form:properties>
                                    <form:property form:property-name="ControlTypeinMSO" office:value-type="float" office:value="0"/>
                                    <form:property form:property-name="DefaultControl" office:value-type="string" office:string-value="com.sun.star.form.control.FormattedField"/>
                                    <form:property form:property-name="MouseWheelBehavior" office:value-type="float" office:value="0"/>
                                    <form:property form:property-name="ObjIDinMSO" office:value-type="float" office:value="65535"/>
                                    <form:property form:property-name="Width" office:value-type="float" office:value="0"/>
                                </form:properties>
                            </form:formatted-text>
                        </form:column>
                        <form:column form:name="UNCERTAINTY" form:control-implementation="ooo:FormattedField" form:label="UNCERTAINTY" form:text-style-name="ctrl2">
                            <form:formatted-text xml:id="control18" form:id="control18" form:data-field="UNCERTAINTY" form:input-required="false" form:convert-empty-to-null="true">
                                <form:properties>
                                    <form:property form:property-name="ControlTypeinMSO" office:value-type="float" office:value="0"/>
                                    <form:property form:property-name="DefaultControl" office:value-type="string" office:string-value="com.sun.star.form.control.FormattedField"/>
                                    <form:property form:property-name="MouseWheelBehavior" office:value-type="float" office:value="0"/>
                                    <form:property form:property-name="ObjIDinMSO" office:value-type="float" office:value="65535"/>
                                    <form:property form:property-name="Width" office:value-type="float" office:value="0"/>
                                </form:properties>
                            </form:formatted-text>
                        </form:column>
                        <form:column form:name="COMPLIANCE" form:control-implementation="ooo:TextField" form:label="COMPLIANCE">
                            <form:text xml:id="control19" form:id="control19" form:max-length="16" form:data-field="COMPLIANCE" form:input-required="false" form:convert-empty-to-null="true">
                                <form:properties>
                                    <form:property form:property-name="ControlTypeinMSO" office:value-type="float" office:value="0"/>
                                    <form:property form:property-name="DefaultControl" office:value-type="string" office:string-value="com.sun.star.form.control.TextField"/>
                                    <form:property form:property-name="ObjIDinMSO" office:value-type="float" office:value="65535"/>
                                    <form:property form:property-name="Width" office:value-type="float" office:value="0"/>
                                </form:properties>
                            </form:text>
                        </form:column>
                    </form:grid>

As you can see, the definitions of some of the columns set the text-style-name to either “ctrl1” or “ctrl2”, which are both defined in the same content.xml file:

<style:style style:name="ctrl1" style:family="paragraph" style:data-style-name="C129"/>
        <style:style style:name="ctrl2" style:family="paragraph" style:data-style-name="C130"/>

I don’t see anything in those definitions that specifies text color, but the application of that style to the columns must be making the difference, because here’s the portion of the xml corresponding to the Table Control that’s displaying white text:

<form:grid form:name="Hoot" form:control-implementation="ooo:com.sun.star.form.component.GridControl" xml:id="control4" form:id="control4">
                            <form:properties>
                                <form:property form:property-name="DefaultControl" office:value-type="string" office:string-value="com.sun.star.form.control.GridControl"/>
                            </form:properties>
                            <form:column form:name="TextField1" form:control-implementation="ooo:TextField" form:label="TAGNO" form:text-style-name="ctrl1">
                                <form:text xml:id="control5" form:id="control5" form:data-field="TAGNO" form:input-required="false" form:convert-empty-to-null="true">
                                    <form:properties>
                                        <form:property form:property-name="ControlTypeinMSO" office:value-type="float" office:value="0"/>
                                        <form:property form:property-name="DefaultControl" office:value-type="string" office:string-value="com.sun.star.form.control.TextField"/>
                                        <form:property form:property-name="ObjIDinMSO" office:value-type="float" office:value="65535"/>
                                    </form:properties>
                                </form:text>
                            </form:column>
                            <form:column form:name="TextField2" form:control-implementation="ooo:TextField" form:label="MANUFACTURER">
                                <form:text xml:id="control6" form:id="control6" form:data-field="MANUFACTURER" form:input-required="false" form:convert-empty-to-null="true">
                                    <form:properties>
                                        <form:property form:property-name="ControlTypeinMSO" office:value-type="float" office:value="0"/>
                                        <form:property form:property-name="DefaultControl" office:value-type="string" office:string-value="com.sun.star.form.control.TextField"/>
                                        <form:property form:property-name="ObjIDinMSO" office:value-type="float" office:value="65535"/>
                                    </form:properties>
                                </form:text>
                            </form:column>
                            <form:column form:name="TextField3" form:control-implementation="ooo:TextField" form:label="MODEL">
                                <form:text xml:id="control7" form:id="control7" form:data-field="MODEL" form:input-required="false" form:convert-empty-to-null="true">
                                    <form:properties>
                                        <form:property form:property-name="ControlTypeinMSO" office:value-type="float" office:value="0"/>
                                        <form:property form:property-name="DefaultControl" office:value-type="string" office:string-value="com.sun.star.form.control.TextField"/>
                                        <form:property form:property-name="ObjIDinMSO" office:value-type="float" office:value="65535"/>
                                    </form:properties>
                                </form:text>
                            </form:column>
                            <form:column form:name="TextField4" form:control-implementation="ooo:TextField" form:label="DESCRIPTION">
                                <form:text xml:id="control8" form:id="control8" form:data-field="DESCRIPTION" form:input-required="false" form:convert-empty-to-null="true">
                                    <form:properties>
                                        <form:property form:property-name="ControlTypeinMSO" office:value-type="float" office:value="0"/>
                                        <form:property form:property-name="DefaultControl" office:value-type="string" office:string-value="com.sun.star.form.control.TextField"/>
                                        <form:property form:property-name="ObjIDinMSO" office:value-type="float" office:value="65535"/>
                                    </form:properties>
                                </form:text>
                            </form:column>
                            <form:column form:name="TextField5" form:control-implementation="ooo:TextField" form:label="SERIALNO">
                                <form:text xml:id="control9" form:id="control9" form:data-field="SERIALNO" form:input-required="false" form:convert-empty-to-null="true">
                                    <form:properties>
                                        <form:property form:property-name="ControlTypeinMSO" office:value-type="float" office:value="0"/>
                                        <form:property form:property-name="DefaultControl" office:value-type="string" office:string-value="com.sun.star.form.control.TextField"/>
                                        <form:property form:property-name="ObjIDinMSO" office:value-type="float" office:value="65535"/>
                                    </form:properties>
                                </form:text>
                            </form:column>
                            <form:column form:name="TextField6" form:control-implementation="ooo:TextField" form:label="CALIBDATE">
                                <form:text xml:id="control10" form:id="control10" form:data-field="CALIBDATE" form:input-required="false" form:convert-empty-to-null="true">
                                    <form:properties>
                                        <form:property form:property-name="ControlTypeinMSO" office:value-type="float" office:value="0"/>
                                        <form:property form:property-name="DefaultControl" office:value-type="string" office:string-value="com.sun.star.form.control.TextField"/>
                                        <form:property form:property-name="ObjIDinMSO" office:value-type="float" office:value="65535"/>
                                    </form:properties>
                                </form:text>
                            </form:column>
                            <form:column form:name="TextField7" form:control-implementation="ooo:TextField" form:label="CALIBDUE">
                                <form:text xml:id="control11" form:id="control11" form:data-field="CALIBDUE" form:input-required="false" form:convert-empty-to-null="true">
                                    <form:properties>
                                        <form:property form:property-name="ControlTypeinMSO" office:value-type="float" office:value="0"/>
                                        <form:property form:property-name="DefaultControl" office:value-type="string" office:string-value="com.sun.star.form.control.TextField"/>
                                        <form:property form:property-name="ObjIDinMSO" office:value-type="float" office:value="65535"/>
                                    </form:properties>
                                </form:text>
                            </form:column>
                        </form:grid>

It’s apparent to me, based on how one subform has all the columns named the query result column names and the other does not, that the two were not created in exactly the same way, but that was years ago, so there’s no way I can remember how each was specifically created. What I’m looking for is a way to make both Table Controls display their text in black. I’ve tried adding “text-style-name=“ctrl2”” or “text-style-name=“ctrl1””to the definition of the first column in the Table control that’s currently displaying white text, but that just made the .odb file unusable and irreparable. Any other ideas?

P.S.–The version I posted contains my attempt to add the style to the one that was not displaying black text, so if you see that, know it wasn’t originally that way.

Why don’t you open the form for editing? Mark the wrong table control, switch to change the font properties for the control. Set color to “black”, not to “default” for the color of the used font.

If only it were that simple. When I right-click the table control and select “Control Properties”, the available properties include “Background color” and “Border Color”, but no other color properties.

But perhaps I misunderstood what you meant by “switch to change the font properties for the control.”

I’m currently trying to set up a macro that will loop through all columns of all rows in the Table Control and use .setPropertyValue. Unfortunately, I can grab the main form using oForm = ThisComponent.DrawPage.Forms.getByName("MainForm") and then the subform control using oSubFormControl = oForm.gteByName("EquipmentSubForm"), but I have no idea how to access the controls of the subform from that point.

Open form for editing, not for input data.
Right mouse click on table control → Control properties → General.
Look for “Font” and press the button with […].
Dialog for “Character” opens.
Go to “Font Effects” → “Font Color” and set the color to the color you wish.

I see…I had no idea that if I clicked the three dots button for the font property, it would open a dialog that would include the color. Now that I know, I tried it, and the color didn’t “stick”, meaning that I set the font color to black, closed out of the properties dialog, saved the form, then opened the form for data viewing, and the text in the table control was white.

I think I’m seeing the problem. Whenever I click the three dots button for the font property and change the color, the Font property box still says "(Default). It’s like it’s totally disregarding my color selection when I click “OK”. I just tried changing the font, and that change is displayed in the font property box, but changing the color doesn’t.

Sometimes the behavior for table controls, special for the fonts, is buggy.
Try this: Set the color to a color, which isn’t black (dark blue or something like this).
Close the dialog.
Save the form and restart the form.
If font color has been changed then try to set black. Don’t set “default”.
Save again.

Hope this helps.
I have corrected font height very often this way. Got 8pt, but dialog shows 10 pt as value for default. Then changed to 11 pt. Font has been 11 pt. Then back to 10 pt and font now really shows 10 pt. Might be the same problematic behavior.
Just tested with color of the font. Works well here: Changing to blue, saving, opening form → font is blue. Changing to black, saving, opening the form → font is black now.

I tried that, setting custom color 010101 (minimally lighter than black), but even that change didn’t save, and the Control Properties still listed the font as “(Default)”.

I’m creating a bug report right now…

Before writing a bug:
Try to rename the user folder of LO. Under Linux its /.config/libreoffice/4/. I would reset ‘4’ to ‘4_old’, so I could set it back after testing.
Now restart and try again setting the font color.

If you write the bug please add the version information also. Mine here is
Version: 25.2.0.3 (X86_64) / LibreOffice Community
Build ID: e1cf4a87eb02d755bce1a01209907ea5ddc8f069
CPU threads: 6; OS: Linux 6.4; UI render: default; VCL: kf5 (cairo+xcb)
Locale: de-DE (de_DE.UTF-8); UI: de-DE
Calc: threaded

Your comment made me pause before submitting the bug report and try something else. This time, instead of only going minimally off black, I selected a red color. Font still said (Default), but when I tested the form, it was indeed the red color, so I set it to 000000 black, which worked. Thanks for getting me there, @RobertG!

Write a bug for the behavior of the GUI. Which system do you use?