Skip to main content
May 15, 2009
Answered

Preventing Spans from Merging

  • May 15, 2009
  • 1 reply
  • 977 views

Hi,

I have a question about how to prevent a particular span from getting merged with adjacent ones.  I saw something posted somewhere a while back that mentioned something about the fact that setting the 'id' property on a FlowElement will prevent that element from being merged with others.  If I assign an id to a span, will that prevent it from being merged with any adjacent spans that have identical text layout formats?  Does assigning a unique user style achieve this also?

TIA,

Brent

This topic has been closed for replies.
Correct answer robin_briggs

In order for two spans to merge, their attributes have to match, and this includes both the ids and the user-defined attributes that have been applied. So if the two spans have the same user-defined attribute but with different values, they will not merge. Of if one span has the user-defined attribute and the other does not, they will not merge. The match has to be complete for the merge to happen. Or if the two spans have different values for "id", they will not merge.

Thanks,

- robin

1 reply

robin_briggsCorrect answer
Adobe Employee
May 15, 2009

In order for two spans to merge, their attributes have to match, and this includes both the ids and the user-defined attributes that have been applied. So if the two spans have the same user-defined attribute but with different values, they will not merge. Of if one span has the user-defined attribute and the other does not, they will not merge. The match has to be complete for the merge to happen. Or if the two spans have different values for "id", they will not merge.

Thanks,

- robin

May 15, 2009

Robin,

Thanks for the quick answer.  I have one related follow-up question.  I understand now how id's and user styles affect spans.  If we are assigning id's to paragraphs, what are the side effects of doing so?

Adobe Employee
May 15, 2009

Good question. Whatever user formats you apply to the paragraph will inherit down, as would any other formats. So if you apply a user style at the paragraph level and then call getStyle() on one of its children you will see it applied there. Paragraphs don't merge the way spans do, because paragraphs have structural meaning in the text. When you copy/paste, you will see text in paragraphs that you copy from merging into paragraphs you paste to. This process should be the same for user-defined formats as for TLF-defined formats. I don't know of any other way user defined properties affect behavior.

Hope this helps,

- robin