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.
Also have you tried copy and pasting with code? If copy and paste will work manually then it should work with code.
~John
Harry,
The CopyAttributes should work, but you will need to do this for each character. This can be really slow, but here is an example:
Dim trSource As TextRange Dim trDestination As TextRange Set trSource = ActiveSelectionRange.Shapes(1).Text.Story.Paragraphs(1) Set trDestination = ActiveSelectionRange.Shapes(2).Text.Story.Paragraphs(1) For i = 1 To trSource.End trDestination.Range(i, i).CopyAttributes trSource.Range(i, i) Next i
I don't recommend copy and paste often, but in this case it is much faster. Here is an example of how you can use copy and paste:
Dim tSource As CorelDRAW.Text Dim tDestination As CorelDRAW.Text Set tSource = ActiveSelectionRange.Shapes(1).Text Set tDestination = ActiveSelectionRange.Shapes(2).Text tSource.Story.Paragraphs(1).Copy tDestination.BeginEdit ActiveLayer.Paste
-Shelby