Bug 152847 - Writer: Find and Replace does not impose Title Case formatting
Summary: Writer: Find and Replace does not impose Title Case formatting
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
3.5.0 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Find&Replace-Regex
  Show dependency treegraph
 
Reported: 2023-01-02 17:18 UTC by Paul
Modified: 2025-03-22 22:08 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paul 2023-01-02 17:18:02 UTC
Description:
When specifying Title Case formatting in the Find and Replace dialog, all caps is not changed. 

Steps to Reproduce:
1.Construct F&R search to hit all-caps text and replace with Title case
2. perform search
3.

Actual Results:
no change in text

Expected Results:
I want the text to be in title case


Reproducible: Always


User Profile Reset: No

Additional Info:
Font Effects of paragraph style make no difference (NOTE: They do not impose Title Case either, for that matter)

My Search is for `([A-Z]{2,25})`

Replace: $1, formatting: Title

[x] Regex
Comment 1 Paul 2023-01-03 18:46:34 UTC
Note: Menu / Format / Text / Change Case / Capitalize Every Word DOES impose Title Case on all-caps text, which is the way I believe this function should work.

All these observations hold in LO 7.4.3.2 and 7.5 beta.
Comment 2 Paul 2023-01-03 19:39:47 UTC
What does work is to use Find/Replace to "Find All", then use the Menu's "Capitalize Every Word" to impose Title Case.
Comment 3 Dieter 2023-01-29 18:38:02 UTC
Just for clarification: As far as I can see, finding of all-caps text works, so your bug is about replacing them with title case. Correct?
Comment 4 Paul 2023-01-29 19:37:21 UTC
Yes, the Find part works, the Replace does not.
Comment 5 Dieter 2023-01-30 07:46:08 UTC
I can't assess, if replace settings are correct. If you just enter a word into replace dialog, it works. Perhaps you should use ask.libreoffice.org to get a confirmation or correction of replace setting.
Comment 6 Buovjaga 2023-03-22 13:50:05 UTC
Repro already in 3.5.0.

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: b5c3a7502f7ff6ccf0f829c1f3a2ba50b8584c41
CPU threads: 2; OS: Windows 10.0 Build 22621; UI render: Skia/Raster; VCL: win
Locale: en-US (en_FI); UI: en-US
Calc: threaded

Arch Linux 64-bit, X11
Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 74f398bb58510087cc4a11bb2253715771a2c6b2
CPU threads: 8; OS: Linux 6.2; UI render: default; VCL: kf5 (cairo+xcb)
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: threaded
Built on 22 March 2023
Comment 7 QA Administrators 2025-03-22 03:12:06 UTC Comment hidden (obsolete)
Comment 8 Paul 2025-03-22 10:03:25 UTC
This seems to be resolved in 25.8 dev.

Also, I discovered that to do a f/r case change I do not have to go to regex ".*", etc. Simply leaving the field blank and specifying case is enough.

Version: 25.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: f382c1a267a93539f3c169530780889336d20b25
CPU threads: 12; OS: Linux 6.1; UI render: default; VCL: qt5 (cairo+xcb)
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded
Comment 9 Buovjaga 2025-03-22 12:30:49 UTC
(In reply to Paul from comment #8)
> This seems to be resolved in 25.8 dev.
> 
> Also, I discovered that to do a f/r case change I do not have to go to regex
> ".*", etc. Simply leaving the field blank and specifying case is enough.

I'm sorry, but what are the steps? Your latest comment completely confuses me.

Find: ([A-Z]{2,25})
Replace: $1 (Capitalize Every Word aka Title formatting)

...does not work.
Comment 10 Paul 2025-03-22 12:39:29 UTC
The steps were simply to put Capitals in the find format, and Capitalize Every Word in the Replace format, leaving the two fields blank, then hit Replace All.
Comment 11 Buovjaga 2025-03-22 20:03:22 UTC
(In reply to Paul from comment #10)
> The steps were simply to put Capitals in the find format, and Capitalize
> Every Word in the Replace format, leaving the two fields blank, then hit
> Replace All.

Ah, so this only works, if we have done Format - Character - Font Effects - Case - UPPERCASE. I didn't get it at first and tried it on text I had changed via Format - Text - UPPERCASE, which in hindsight was just silly.
Comment 12 Paul 2025-03-22 20:21:58 UTC
Actually, I was unaware of the difference.

I just ran a test. Three sets of text converted to caps. one through the menu. the next through the Character properties. The third via a macro that is my standard way to change case. Only the second, done through character was hit. 

The F/R dialog deals with the Font Effects tab of a search dialog, but I don't know what element that dialog actually applies to. Apparently it's Character, but the dialog doesn't match the standard Character dialog very well. Maybe not all Character parameters are searchable. 

The macro creates a text cursor then works on its String with  ".uno:ChangeCaseToTitleCase", and at this point I don't know what that effects.

So now I'm more confused than before.
Comment 13 Buovjaga 2025-03-22 22:08:23 UTC
(In reply to Paul from comment #12)
> Actually, I was unaware of the difference.
> 
> I just ran a test. Three sets of text converted to caps. one through the
> menu. the next through the Character properties. The third via a macro that
> is my standard way to change case. Only the second, done through character
> was hit. 
> 
> The F/R dialog deals with the Font Effects tab of a search dialog, but I
> don't know what element that dialog actually applies to. Apparently it's
> Character, but the dialog doesn't match the standard Character dialog very
> well. Maybe not all Character parameters are searchable. 
> 
> The macro creates a text cursor then works on its String with 
> ".uno:ChangeCaseToTitleCase", and at this point I don't know what that
> effects.
> 
> So now I'm more confused than before.

Well, I think your reasoning in comment 10 is solid compared to comment 0, because back in 2023 you were trying to apply Title Case as formatting to text that was literally uppercase.

For text that is literally uppercase, the solution would be to use regex find `([A-Z]{2,25})`, click Find All so all the hits become selected and then apply Format - Text - Capitalize Every Word.