Bug 149135 - Writer does not always apply styles correctly
Summary: Writer does not always apply styles correctly
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.2.7.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-17 17:18 UTC by wpeaton4
Modified: 2022-06-09 14:51 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Second line is style resistant paragraph (116.12 KB, application/vnd.oasis.opendocument.text)
2022-05-17 17:18 UTC, wpeaton4
Details

Note You need to log in before you can comment on or make changes to this bug.
Description wpeaton4 2022-05-17 17:18:21 UTC
Created attachment 180169 [details]
Second line is style resistant paragraph

Sometimes Writer will not apply styles correctly. This is mostly prominent in Writer. But other Suite programs are sometimes strange when applying text properties and fonts.

There are some paragraphs that are resistant to the application of styles. In the attached file, Default Paragraph Style is Cambria, 12 pt, normal. But the second line is 14 pt bold.

For paragraphs like this, switching styles to something else and then back to what you want does not work. The only ways I have found to fix these paragraphs is

1. Create a separate paragraph with the same style. Then copy and paste special/unformatted text

2. Manually change font and paragraph settings to what they should be for that style.
Comment 1 Telesto 2022-05-18 10:06:09 UTC
1. Open the file
2. Open the sidebar -> Style inspector deck
3. Click on the paragraph with 14 bold -> Notice Character Direct Formatting being set..
4. I guess the formatting being introduced by pressing Enter after the heading -> Which has also Character Direct Formatting (and not using Paragraph Style)
Comment 2 wpeaton4 2022-05-18 16:35:23 UTC
So yes. Looks like the first line has Direct Formatting and the second line has that direct formatting carried with it.

If you select the whole second line, then right click and do "Clear Direct Formatting" (or type Ctl+M), it will clear the direct formatting and the paragraph will then follow the style.

This implies that by default, Writer will not override direct formatting when a style is applied. Is this deliberate behavior?

I would make the case that the "least astonishing" behavior would be that applying a style **would** override Direct Formatting.
Comment 3 Telesto 2022-05-18 20:21:05 UTC
@Mike
I'm not seeing any problem here, but I struggle to give a proper explanation

(In reply to wpeaton4 from comment #2)
> I would make the case that the "least astonishing" behavior would be that
> applying a style **would** override Direct Formatting.
Comment 4 Mike Kaganski 2022-05-18 21:07:29 UTC
When you apply paragraph style, the action does reset the direct formatting set on the paragraph level. It does not change any format (direct or style) set on character level (with an exception when the character direct formatting spans the whole paragraph).

This allows e.g. to keep some words highlighted, even if you decided to change this paragraph from text body to table contents. This is the correct behavior, and follows the least astonishment principle.

It might seem that the test case matches the "character direct formatting spans the whole paragraph" exception mentioned above. No, in that paragraph, there are actually *two* text runs with different direct formatting, the only difference being an "rsid" invisible attribute, showing different edit sessions. It is visible in the XML, but deliberately not shown in style inspector. This makes this case to work differently compared to tdf#146663. Possibly it would make sense to reset all but rsid in this case, to behave like 146663.
Comment 5 Timur 2022-06-09 14:51:14 UTC
I close as NotABug. 

Maybe something else can be added to https://wiki.documentfoundation.org/Faq/Writer/026.