Question : I need to Merge multiple Word documents into a Single Word document without changing the Format

I have already tried Balareva Word Activities 8.0.0 but the Alignment looks incorrect, Can someone help me with the VB Code to merge multiple documents to single document without changing the format?

Hi @sandeep.panthulu06

This could be of help.

//Opens the main document.
using (WordDocument mainDocument = new WordDocument(@“…/MainDocument.docx”))
{
//Gets the Word document names from a folder.
string subDocumentNames = Directory.GetFiles(@“…/Data/”);
//Merges each Word document to the main document.
foreach (string subDocumentName in subDocumentNames)
{
//Opens the sub document.
using (WordDocument subDocument = new WordDocument(subDocumentName))
{
//Imports the contents of sub document at the end of main document.
mainDocument.ImportContent(subDocument);
}
}
//Saves the main document.
mainDocument.Save(“Result.docx”);
}

Thanks,
Shabbir

Hi @Mohammed_Shabbir,

I have tried to use the above code but getting few syntax errors, would you mind sharing the UiPath workflow (xaml) so that I can test it with my Input Documents.