Hi
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
Thank you for additional information. It seems the problem occurs because except style formation of the paragraph, also formatting of runs is set. You can try using the following code to resolve the problem:
// Open source docuemnts
Document dst = new Document(@"C:\Temp\1.doc");
Document src = new Document(@"C:\Temp\2.doc");
// Combine documents.
dst.AppendDocument(src, ImportFormatMode.UseDestinationStyles);
// Attach template.
dst.AttachedTemplate = @"C:\Temp\Template.dot";
// Reset formatign of runs inside heading paragraphs.
NodeCollection paragraphs = dst.GetChildNodes(NodeType.Paragraph, true);
foreach (Paragraph paragraph in paragraphs)
{
StyleIdentifier styleIdentifier = paragraph.ParagraphFormat.StyleIdentifier;
if(styleIdentifier == StyleIdentifier.Heading1 ||
styleIdentifier == StyleIdentifier.Heading2 ||
styleIdentifier == StyleIdentifier.Heading3 ||
styleIdentifier == StyleIdentifier.Heading4 ||
styleIdentifier == StyleIdentifier.Heading5)
{
// Clear font formaing of paragraph end.
paragraph.ParagraphBreakFont.ClearFormatting();
// Clear font formatign of runs inside paragraph
foreach (Run run in paragraph.Runs)
run.Font.ClearFormatting();
}
}
// Save output document.
dst.Save(@"C:\Temp\out.doc");
Hope this helps.
Best regards.