Skip to content

Commit ef01b1f

Browse files
Modified the source and destination documents
1 parent 063e4dd commit ef01b1f

File tree

3 files changed

+2
-2
lines changed

3 files changed

+2
-2
lines changed
Binary file not shown.

Paragraphs/Copy-style-between-documents/Copy-style-between-documents/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
using (WordDocument destinationDocument = new WordDocument(destinationStream, FormatType.Docx))
1313
{
1414
//Get the style from source document.
15-
WParagraphStyle paraStyle = sourceDocument.Styles.FindByName("User_defined_style") as WParagraphStyle;
15+
WParagraphStyle paraStyle = sourceDocument.Styles.FindByName("MyStyle") as WParagraphStyle;
1616
//Add it into destination document.
1717
destinationDocument.Styles.Add(paraStyle.Clone());
1818
//Get the first paragraph in destination document.
1919
WParagraph paragraph = destinationDocument.Sections[0].Body.ChildEntities[0] as WParagraph;
2020
//Applies the new style to paragraph.
21-
paragraph.ApplyStyle("User_defined_style");
21+
paragraph.ApplyStyle("MyStyle");
2222
//Saves the destination document.
2323
using (FileStream outputStream = new FileStream(Path.GetFullPath(@"Output/Result.docx"), FileMode.Create, FileAccess.ReadWrite))
2424
{

0 commit comments

Comments
 (0)