Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
string sourceFile1 = CommonUtilities.fileOne + fileOne;
string sourceFile2 = CommonUtilities.fileTwo + fileTwo;
// Preparing.
string password = "SomePasswordString";
Stream openFile1 = new FileStream(sourceFile1, FileMode.Open);
Stream openFile2 = new FileStream(sourceFile2, FileMode.Open);
List<JoinItem> documentStreams = new List<JoinItem>();
JoinItem item1 = new JoinItem(openFile1, FileFormat.Docx, password);
documentStreams.Add(item1);
JoinItem item2 = new JoinItem(openFile2, FileFormat.Docx, password);
documentStreams.Add(item2);
// Main method.
DocumentResult result = new DocumentHandler().Join(documentStreams);
Stream documentStream = result.Stream;
var fileStream = File.Create(CommonUtilities.outputPath + "OutPut." + FileFormat.Docx);
documentStream.CopyTo(fileStream);
documentStream.Close();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.