Created attachment 203595 [details] description is also in menu BUG > Help If some part of text has different formatting and then the formatting is returned to the same format like the neighbours have, enumeration will return all parts like for different formatting. Steps to reproduce: Open ODT and run macro from menu: "BUG > DifferentContent" too see fast version instead of Development Tools Description is also in: BUG > Help Or manually: 1) open new document 2) write letters ABC 3) select B and press Ctrl+B to set Bold for B 4) run Tools > Development Tools 5) use Refresh Icon in Development Tools 6) you will see 3 Text Portions in "Object: Paragraphs > Paragraph1" 7) select B and Ctrl+B to unbold B 8) all letters have the same formatting now 9) use Refresh Icon in Development Tools 10) there are 3 Text Portions in "Object: Paragraphs > Paragraph1" instead of 1 same-formatting part ABC Version: 26.2.0.0.alpha0+ (X86_64) / LibreOffice Community Build ID: 6d020f728b573c8c33929f8c494f9b748f576fe5 CPU threads: 8; OS: Windows 10 X86_64 (build 17763); UI render: Skia/Raster; VCL: win Locale: cs-CZ (cs_CZ); UI: en-US Calc: CL threaded
That's because "the formatting with FontWeight set to Normal is applied". I also looked at the macro code, and "com.sun.star.awt.FontWeight.NORMAL" is set. To reset the formatting, use Ctrl+M. In the macro code, change line 29 as follows. Before: .CharWeight=com.sun.star.awt.FontWeight.NORMAL After: .setPropertyToDefault("CharWeight")
The idea was to do F&R in selections but keep the formatting of parts. https://ask.libreoffice.org/t/libreoffice-macro-that-works-only-on-selected-cells-in-libreoffice-writer-table-or-selected-cells-in-calc-spreadsheet/127582/7 It means to do F&R always only in part that has same format, and then in next part(s). But it isn't possible when the same-formatted part is divided to more parts because there stays different CharAutoStyleName (also after some manual changes and not only after macro). For example I would like to replace ABC with 12345, but it isn't possible when the enumeration returns A and then B and then C, although whole ABC has same format.
I can confirm that if you use the toolbar to restore the leter B to normal, there are 3 portions of text. And also, If you use the toolbar to clean format of the leter B it must restore the original status of only one portion of text but the fact is that the 3 portion of text continues. Version: 25.8.2.2 (X86_64) Build ID: d401f2107ccab8f924a8e2df40f573aab7605b6f CPU threads: 8; OS: Windows 10 X86_64 (build 19045); UI render: Skia/Raster; VCL: win Locale: es-ES (es_ES); UI: es-ES Calc: CL threaded
one can argue, Writer is about rendering, and Find is secondary. could also have a sort "garbage collector"behind the scene to re-unify portions. asking UX team to bring an additional review here.
I tested the behavior and found that the results differ between manual and macro operations. Manual: When removing direct formatting manually (using Ctrl+M or the Clear Direct Formatting toolbar button) from a portion that was previously bold, the text remains divided into multiple portions. However, if I select the entire paragraph and then clear the formatting, the portions are merged into one. Macro: In contrast, when using a macro with .setPropertyToDefault("CharWeight"), the formatting is reset and the portions are immediately merged, even if only one character is selected. Tested with: Version: 25.8.3.1 (X86_64) Build ID: 52ad9dd1c984050a9fb6932dbfb16e86a49e9758 CPU threads: 8; OS: Windows 11 X86_64 (build 26100); UI render: Skia/Raster; VCL: win Locale: ja-JP (ja_JP); UI: ja-JP Calc: CL threaded Jumbo