Skip to content

Commit ea7821e

Browse files
Modified the Input document and XML comments
1 parent ef01b1f commit ea7821e

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed
Binary file not shown.

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
using Syncfusion.DocIO.DLS;
22
using Syncfusion.DocIO;
33

4-
using (FileStream sourceStream = new FileStream(Path.GetFullPath(@"Data/SourceDocument.docx"), FileMode.Open, FileAccess.ReadWrite))
4+
using (FileStream destinationStream = new FileStream(Path.GetFullPath(@"Data/DestinationDocument.docx"), FileMode.Open, FileAccess.ReadWrite))
55
{
66
//Open the source document.
7-
using (WordDocument sourceDocument = new WordDocument(sourceStream, FormatType.Docx))
7+
using (WordDocument destinationDocument = new WordDocument(destinationStream, FormatType.Docx))
88
{
9-
using (FileStream destinationStream = new FileStream(Path.GetFullPath(@"Data/DestinationDocument.docx"), FileMode.Open, FileAccess.ReadWrite))
9+
using (FileStream sourceStream = new FileStream(Path.GetFullPath(@"Data/SourceDocument.docx"), FileMode.Open, FileAccess.ReadWrite))
1010
{
1111
//Open the destination document.
12-
using (WordDocument destinationDocument = new WordDocument(destinationStream, FormatType.Docx))
12+
using (WordDocument sourceDocument = new WordDocument(sourceStream, FormatType.Docx))
1313
{
14-
//Get the style from source document.
14+
// Retrieve the specific style from the source document.
1515
WParagraphStyle paraStyle = sourceDocument.Styles.FindByName("MyStyle") as WParagraphStyle;
16-
//Add it into destination document.
16+
// Add the retrieved style to the destination document.
1717
destinationDocument.Styles.Add(paraStyle.Clone());
18-
//Get the first paragraph in destination document.
18+
// Get the first paragraph in the destination document.
1919
WParagraph paragraph = destinationDocument.Sections[0].Body.ChildEntities[0] as WParagraph;
20-
//Applies the new style to paragraph.
20+
// Apply the retrieved style to the paragraph in the destination document.
2121
paragraph.ApplyStyle("MyStyle");
22-
//Saves the destination document.
22+
// Save the destination document.
2323
using (FileStream outputStream = new FileStream(Path.GetFullPath(@"Output/Result.docx"), FileMode.Create, FileAccess.ReadWrite))
2424
{
2525
destinationDocument.Save(outputStream, FormatType.Docx);

0 commit comments

Comments
 (0)