Writer: Why does libre office insist on font in table?

I’ve set the default font to Menlo. Every time I insert a table, libre office insists on liberation serif font. I have to keep selecting the table & changing the font. It drives me crazy. I’ve looked at the preferences & I see no way to change the font for the table to a default font. Why does the table insist on liberation serif & how do I change to default to Menlo or whatever I choose as the default font?

I’ve set the default font to Menlo.

How?

The paragraphs in a table have got the paragraph style “Table Contents” and “Table Heading”, which is derived from “Table Contents”. The style “Table Contents” has got its on font setting. If you want that the style “Table Contents” inherits the font from the style “Default”, then you need to remove its own setting. Right-click “Table Contents” in Style&Formatting, part Paragraph styles, and click on item “Modify”. Open tab “Font” and click on button “Standard”. That should remove the own font setting, so that the inherited font is used. Be aware, that changing styles is a per document setting.

In case you use one of the predefined table style templates, the paragraph font setting is included in the table style template and applied to the table as direct formatting. So you first need to remove the direct setting. To do this, select the item “Clear Formatting” from the paragraph style drop-down-list in the Formatting-toolbar. Then the table will follow the settings in styles “Table Contents” and “Table Heading”.

If you want to get your settings for other documents too, then you can make a document template from a document, where you have changed the style settings. Or you mark such a table (from end of paragraph before table to start of paragraph after table) and make an AutoText from it.

If you want to have a different default font for your tables than you have set as “Default” for the entire document, then you do the same steps, but do not click “Standard” but choose the font you want from the drop-down list.

I have tested it in LO 6.0.4. It might be, that you need to update to that version.

1 Like

OK, I’m keeping my fingers crossed!

Thanks!

In LO 7.6.7.2 the font automatically used for a new table can be set by Tools > Options > Basic Fonts (Western). I assign the same font to all items. This usually is effective for new tables but sometimes, for no obvious reason, Libre insists on using Liberation serif 12 pt. It always does this if a row is inserted. If an existing row is selected before insertion (above or below) only the new row get this treatment. However, if a cell is selected, the font is changed throughout the entire table. This can usually be corrected by selecting the table and changing its font but sometimes the selected range must extend beyond the table itself.

(This is a very old thread, and the current situation may be different.
My comment is based on a version from the 7.6 series and also applies to V 24.8.0…)

I suspect this to be an error.

  1. There are five sub-items in the mentioned setting path, none of them Table or similar.
  2. There is the paragraph style Table Contents where you can change the font and related properties.
  3. The Styles panel allows to choose Table Styles via one of the icons. Having made this choice you can edit table styles and define additional ones.

I already checked that and saw that it automatically adjusted to my Tools > Options > Basic Fonts (Western) settings. Further, that Libre usually inserts a new table with those setting but sometimes reverts to the old ones suggests a programming error.

I read what you wrote.
Did you read my comment?

My comment was in response to yours.

@DavidMcCracken Have you fully and thoroughly read and understood @Regina’s answer above? Are you familiar with style inheritance?

Paragraph in “unstyled” tables are styled by default Table Contents. This built-in style, as shipped from the factory, just modifies orphan/widow properties (because they have little sense in table and, anyway don’t work in tables). Font is not changed.

Unless modified, Table contents inherit from Default Paragraph Style. As shipped from the factory, this latter style has no attribute set (it is there for you to force your preferred choices). If you didn’t configure anything there, Default Paragraph Style inherits its font face and size from Tools>Options, LO Writer>Basic Fonts (Western).

But anytime you set anything along this inheritance chain, you create an override. And there is a trap: if you reset the attributes to what they were before, you still create an override which will prevent any change higher in the hierarchy from cascading down. For instance, you made a try in Table Contents for Tex Gyre Termes and reverted to Liberation Serif. This is forcing font face to Liberation Serif. Now if you change to Liberation Sans in Tools>Options, LO Writer>Basic Font (Western), this will not replace Liberation Serif in Table Contents because you explicitly set it.

The only way to return to inheritance without override is to press Reset to Parent. Note that the UI can’t show the “transparent” state (inheriting state) and shows the effective value resulting from inheritance instead.

So, if you have some inconsistency in your document,

  • either you have a “non-transparent” style in the inheritance chain,
  • or direct formatting is applied on the element
    Direct formatting always takes precedence over style.
1 Like

Style inheritance is not a simple topic but, as a software engineer, I can tell you that whenever a program I have written behaves inconsistently I try to fix my mistakes rather than attribute them to some abstruse topic.

1 Like

Do you hint that being a software engineer, you got a special ability to tell when you are talking to the discussed software’s another software engineer on a user-to-user “how do I” Ask site? :wink:

Writing a bug report (a proper bug report) might be the right decision.

1 Like

Regardless of whether the desired font is restored by “Clear Formatting” or by simply selecting the table and changing its font, the correction is undone whenever a row is added or deleted. For a static table this is not a significant problem but for tables that frequently change it is annoying. To my document that tracks constantly changing accounts I have added macros to insert or delete a row at the cursor (and therefore any table) and automatically restore the Times New Roman 10pt that I want.

' ---------------------------------- #setFont ----------------------------------
sub setFont(dispat as object, frame as object)
    dim args(4) as new com.sun.star.beans.PropertyValue
    args(0).Name = "FontHeight.Height"
    args(0).Value = 10
    args(1).Name = "FontHeight.Prop"
    args(1).Value = 100
    args(2).Name = "FontHeight.Diff"
    args(2).Value = 0
    dispat.executeDispatch(frame, ".uno:FontHeight", "", 0, args())
    
    args(0).Name = "CharFontName.StyleName"
    args(0).Value = ""
    args(1).Name = "CharFontName.Pitch"
    args(1).Value = 2
    args(2).Name = "CharFontName.CharSet"
    args(2).Value = -1
    args(3).Name = "CharFontName.Family"
    args(3).Value = 3
    args(4).Name = "CharFontName.FamilyName"
    args(4).Value = "Times New Roman"
    dispat.executeDispatch(frame, ".uno:CharFontName", "", 0, args())
end sub ' setFont

' -------------------------------- #InsDelRow ----------------------------------
' Argument insDel integer is 0 to insert a row below the cursor row, any other
' to delete the cursor row. 
' This restores the font, which Libre screws up, throughout the table and moves
' the cursor to the inserted row or to the row preceding the deleted row.
' ..............................................................................
sub InsDelRow( insDel as integer)
    dim dispat as object, frame as object, vc as object, table as object
    dim cell as object, row as integer
    
    dispat = createUnoService("com.sun.star.frame.DispatchHelper")
    frame = ThisComponent.CurrentController.Frame
    vc = ThisComponent.CurrentController.ViewCursor
    table = vc.TextTable
    row = Cint( Mid(vc.Cell.CellName, 2))

    if insDel = 0 then ' Insert
        dispat.executeDispatch( frame, ".uno:InsertRowsAfter", "", 0, Array())
    else
        dispat.executeDispatch( frame, ".uno:DeleteRows", "", 0, Array())  
    endif
    dispat.executeDispatch( frame, ".uno:SelectTable", "", 0, Array()) 
    print "OK" ' Otherwise, Libre does not change the table's font
    setFont(dispat, frame)
    cell = table.getCellByName( "A" & IIF(insDel = 0, row + 1, _
      IIF(row = 1, row, row - 1)))
    vc.gotoRange(cell.Start, FALSE)
    vc.goRight(3, TRUE) ' User feedback
end sub ' InsDelRow

sub InsRow()
    InsDelRow(0)
end sub

sub DelRow()
    InsDelRow(1)
end sub

I think the answer is do not use table styles, always select None for table style when adding new tables.

Table styles are not like normal styles, a macro always formats them back to the programmed style after some editing, especially row or column addition or deletion.

To convert a styled table to a None styled table the easiest way is to

  1. Click in the table and then click Table > Convert > Table to text
  2. Select the previous contents of the table and click Table > Convert > Text to table
  3. In the dialogue that opens select Format None and OK

If you insist on the formatting, it is possible you could select the table style you like in step 3. above and **untick** the box *Font*. I assume it might work.

[Edit]

Unticking Font also prevents the pattern and alignment from updating when a new row is inserted so I presume unticking one of those boxes prevents the macro from running again.