Merge word documents with portrait and landscape orientation does not work using .NET

Please urgent help,

As of today, why can’t I merge word files into one so that the portrait and ladscape page orientation is maintained? Until a few days ago, it worked.

With respect,

Bojan

@bojan.m

To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word documents.
  • Please attach the output Word file that shows the undesired behavior.
  • Please attach the expected output Word file that shows the desired behavior.
  • Please create a standalone console application ( source code without compilation errors ) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.

This is zipped files.

Merger.zip (1.4 MB)

@bojan.m

Please share the code example that you are using to reproduce the same issue at our end.

A post was split to a new topic: Orientation issue while merging documents

@bojan.m I checked your scenario with the following simple code and the result document looks correct.

string[] documents = new string[]
{
    "241. 00 PERFOINVEST DOO Podgorica.docx",
    "241. 01 Izvrsni direktor (1).docx",
    "241. 02 Administrativni radnik (2).docx",
    "241. 03 Radnik na mašinama (3).docx",
    "241. 04 PERFOINVEST DOO Podgorica.docx"
};

string dir = @"C:\Temp\Merger\";

Document doc = null;
foreach (string fileName in documents)
{
    string fullFileName = dir + fileName;

    if (doc == null)
        doc = new Document(fullFileName);
    else
        doc.AppendDocument(new Document(fullFileName), ImportFormatMode.KeepDifferentStyles);
}

doc.Save(@"C:\Temp\out.docx");

Hello Alexey.

In zipped folder there is two Merged documents: OK and BAD.

Ok file is from earler, when the Merger (on site) worked Ok.
BAD file was formed about 40 days ago. From that moment the Merger (on site) won’t work like earlier.

Best regards.

I tried again the Merger on site, and in one section Merged document is ok merged but in other section not ok.

@bojan.m I see no section break between the first and the second document in your BAD output. It seems you are using InsertDocument instead of AppendDocument. Anyways to suggest you a solution it is required to reproduce the problem on our side. So please create a simple app or provide a code to reproduce the problem.
The output document generated on my side using the provided code looks exactly as your OK document.