File tree Expand file tree Collapse file tree
Performance-metrices/Clone-and-merge/.NET/Clone-and-merge-word-document/Clone-and-merge-word-document Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,18 +10,20 @@ static void Main()
1010 {
1111 using ( FileStream destinationFileStream = new FileStream ( Path . GetFullPath ( @"Data/DestinationDocument/Document-100.docx" ) , FileMode . Open , FileAccess . Read ) )
1212 {
13- WordDocument mainDoc = new WordDocument ( sourceFileStream , FormatType . Docx ) ;
14- WordDocument mergeDoc = new WordDocument ( destinationFileStream , FormatType . Docx ) ;
15- Stopwatch sw = Stopwatch . StartNew ( ) ;
16- mainDoc . ImportContent ( mergeDoc , ImportOptions . UseDestinationStyles ) ;
17- sw . Stop ( ) ;
18- Console . WriteLine ( "Time taken for Merge Documents:" + sw . Elapsed . TotalSeconds ) ;
19- using ( FileStream outputFileStream = new FileStream ( Path . GetFullPath ( @"Output/MergedDocument.docx" ) , FileMode . Create ) )
13+ using ( WordDocument mainDoc = new WordDocument ( sourceFileStream , FormatType . Docx ) )
2014 {
21- mainDoc . Save ( outputFileStream , FormatType . Docx ) ;
22- }
23- mainDoc . Close ( ) ;
24- mergeDoc . Close ( ) ;
15+ using ( WordDocument mergeDoc = new WordDocument ( destinationFileStream , FormatType . Docx ) )
16+ {
17+ Stopwatch sw = Stopwatch . StartNew ( ) ;
18+ mainDoc . ImportContent ( mergeDoc , ImportOptions . UseDestinationStyles ) ;
19+ sw . Stop ( ) ;
20+ Console . WriteLine ( "Time taken for Merge Documents:" + sw . Elapsed . TotalSeconds ) ;
21+ using ( FileStream outputFileStream = new FileStream ( Path . GetFullPath ( @"Output/MergedDocument.docx" ) , FileMode . Create ) )
22+ {
23+ mainDoc . Save ( outputFileStream , FormatType . Docx ) ;
24+ }
25+ }
26+ }
2527 }
2628 }
2729 }
You can’t perform that action at this time.
0 commit comments