FIXED - Page break with a style that does not exist while merging other documents

Hello everyone,
I am using the .NET version and I have a problem.

I am doing the following things:

  • I have a source document with various styles
  • I merge documents with same or different styles and importing them with KeepSourceFormatting and testing with KeepDifferentStyles but there is no difference.
  • The problem appears with builder.InsertDocument , document.AppendDocument is not the right method for me, but AppendDocument does not show this problem
  • I put Page Breaks when I need

with this, page breaks, have a shadow behind that looks like a style present in the document, but, if I check, Word tells me those empty paragraphs with page breaks does not have a style.

What could I check? Can I remove that shadow when I make the page break?

Thanks!


As you can see it says “Interruzione di pagina” which is “page break” in Italian

Important edit: putting a couple of empty writeln("") fix the problem, looks like the shadow on the page break was linked to the style of the next page which comes from another word merged.

docBuilderOrigine.Writeln("");                          
docBuilderOrigine.InsertBreak(BreakType.PageBreak);
docBuilderOrigine.Writeln("");
// code for merging another document

@RiccardoDigital Could you please attach your source, target and output documents here for our reference? We will check the issue and provide you more information.
It is difficult to analyze the issue by screenshot, but I suspect, formatting is applied to the paragraph break. Please try the following code:

docBuilderOrigine.CurrentParagraph.ParagraphBreakFont.ClearFormatting();
docBuilderOrigine.InsertBreak(BreakType.PageBreak);
// code for merging another document

Hello!
Sure, I can attach the documents once I remove the confidential informations on the word files!

I need some time, tho, since I am in the middle of a project.

1 Like

Hey, sorry for the late answer.
I fixed the problem with the suggestions you gave me, when I will have more time I will put the examples.

1 Like