If I have a paragraph text object tPara I can see the contents of the second paragraph as a textrange object at tPara.Text.Story.Paragraphs(2)
Consequently, I can take the contents of that paragraph :
dim t as textrangeset t = tPara.Text.Story.Paragraphs(2)
If I look in the debugger, I can then see that the t.Characters collection includes not only the characters themselves, but also the information associated with each character -- including fonts, attributes and font colours.
So, if I have an empty paragraph tPara2 -- why is it that a further assignment
tPara2.Text.Story.Paragraphs(1) = t
causes the paragraph text to receive only the plain text and not the associated attributes ? If the assignment is a textrange, surely the entire set of textrange objects should now be visible in tPara2, rather than just the plain text ?
[textAttributes.cdr attached for anybody who wants to check it out, the objects are referred to as sSource and sDest in the Button 1 code]
Hi.
I think it's a Draw limitation. You cannot have multiple attributes in the text string and copy them over. You would have to get the property for each character that has different properties aside from the standard single property that can be copied. Hopefully I'm wrong though.
~John
It seems a bit lopsided ... if you can create a textrange object from a paragraph (and include the various attributes within it) then you also ought to have a way to create a paragraph from a textrange.
The aim in this case is actually to exchange two paragraphs (complete with their various attributes) -- which probably ought to be as simple as swapping the pointers of the corresponding two elements. But I'm not sure if that's possible in VBA.