Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ParagraphFormat.Duplicate Issue with Formatting

3 views
Skip to first unread message

oliver_zx

unread,
Nov 10, 2009, 3:27:01 AM11/10/09
to
Hi,

i have a weird issue using OLE witn Office 2003 (this issue also occur in
2007 though). I have a VSTO-Addin that copies data from a temporary document
into the customized document. Im doing this like that (shortened):

//saving current para-formatting at position

Word.ParagraphFormat paraFormat = targetRange.ParagraphFormat.Duplicate;

Document moduleDoc = targetRange.Document.Application.Documents.Open(...);

targetRange.FormattedText = moduleDoc.Content.FormattedText;

targetRange.ParagraphFormat = paraFormat;


Typicall the targetRange is intially only 1 char long which represend the
cursor position. Then i start inserting the data at that place. After that i
apply the previously stored paragraph formatting. That copy was made using
the Duplicate Member of the ParagraphFormat class.

Yet i face some issues when i copy the data of moduleDoc into the
header/footer of the document. Im loosing the font-settings like bold,
italic, colors etc at some circumstances.

Now i replaced the Duplicate with copying each of the Paragraph-Properties
seperately. That works now.

But i'd like to know why that happens. This issue only occurs when the data
is copied into the header/footer. In the main body there is no issue using
Duplicate. Is there anything else the Range.Duplicate Setter does ? May i
miss something important when i copy the properties seperately instead of
using Duplicate ?


Thanks for the information and kind regards,
Oliver

0 new messages