Issue 23552

Summary: setString followed by setPropertyValue produces redundant formatting tags
Product: App Dev Reporter: akrioukov <basileia>
Component: apiAssignee: AOO issues mailing list <issues>
Status: CONFIRMED --- QA Contact:
Severity: Trivial    
Priority: P3 CC: issues
Version: 3.3.0 or older (OOo)   
Target Milestone: ---   
Hardware: All   
OS: Linux, all   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---
Attachments:
Description Flags
A document containing a Basic macro which demonstrates the problem none

Description akrioukov 2003-12-14 17:55:40 UTC
I'm developing a text converter which searches for strings with specific
formatting and replaces them with other strings having different formatting.
This program is crucial for me. But, since searching for formatted text in OOo
is broken (see issue 10569) and nobody plans to fix this issue, I used the
following algorithm as a workaround: first, we search for a string without
formatting, then test formmating for each of all found text ranges, and, if it
matches, change both the string an the formatting.

Of course, this works too slow, but there is another problem: when I use
XTextRange:setString in combination with setPropertyValue (), the text range
always gets enclosed in its own pair of formatting tags, even if the text around
it has the same formatting. So the xml code may look as follows:

<text:span text:style-name="T1">Thi</text:span><text:span
text:style-name="T1">s</text:span><text:span text:style-name="T1">
i</text:span><text:span text:style-name="T1">s</text:span><text:span
text:style-name="T1"> j</text:span>

Of course, this kind of formatting makes the whole document hardly usable.

Previously I could remove this redundant formatting tags using one more
replacement operation with empty searchString and replaceString and identical
SearchAttributes and ReplaceAttributes. This worked until 1.1 RC4, but doesn't
work now. So, simply there is no workaround any more, no way to implement the
functionality I need! Of course I'd like prefer fixing issue 10569, but, if it
is so difficult, is it possible a least prevent OOo from generating redundant
formatting tags?

The attached documents shows the problem. It contains a macro
("TestSearchReplace") which searches for characters formatted with Times New
Roman, and replaces them with the same characters, but in Arial. To reproduce
the problem:

-- run the macro on this (or any other) document;
-- save the document to another location, unzip it at look at content.xml. It
should look as in the sample above.
Comment 1 akrioukov 2003-12-14 17:57:45 UTC
Created attachment 11944 [details]
A document containing a Basic macro which demonstrates the problem
Comment 2 ooo 2003-12-15 08:18:42 UTC
forwarding to responsible developer
Comment 3 thomas.lange 2003-12-16 11:58:11 UTC
TL->FME: Since the same problem occurs in the UI, can you please take care of this?
Comment 4 frank.meies 2003-12-16 12:07:54 UTC
FME->MRU: Could you please check this issue and choose a target?
Comment 5 michael.ruess 2003-12-17 15:20:56 UTC
MRU->SBA: This deals with Find&Replace. 
Comment 6 jack.warchold 2004-03-03 14:17:06 UTC
set target not determined
Comment 7 stefan.baltzer 2004-07-16 14:55:23 UTC
SBA: Target set to "Office Later".