We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Fomatting issue in merged word document

We are using Aspose.Words for .NET library for merging word documents into single word document. It works good and we are very impressed the way Aspose made it so simple to accomplish that task.


But in the merged document we see some alignment issues as shown in attached document.

The text that is center aligned in original document is some how not center aligned in the merged document, i.e. the tab indentation is not retained properly in the merged document. The text in the final merged document is moved towards left.


Please check the attached input and output documents and let us know ASAP if there is any help on this or if you need more information for this question to be answered
Appreciate your quick response.

Below is the code used:

Document Finaldoc = new Document();
doc.RemoveAllChildren();

Loop
{
Document srcDoc = new Document(SourceDocumentPath);
srcDoc.FirstSection.PageSetup.SectionStart = SectionStart.NewPage;
srcDoc.FirstSection.PageSetup.RestartPageNumbering = true;

Finaldoc.AppendDocument(srcDoc, ImportFormatMode.KeepSourceFormatting);

if (i > 0) { Finaldoc.Sections[i].HeadersFooters.LinkToPrevious(false); }
i++;
}
if (i > 0) Finaldoc.Save(destinationFile);


Regards,
Vikas

Hi Vikas,

Thanks for your inquiry.

I have tested the scenario and have managed to reproduce the same issue at my side. For the sake of correction, I have logged this problem in our issue tracking system as WORDSNET-10707. I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Hi Vikas,

Thanks for your patience.


It is to inform you that our development team has completed the work on the issue (WORDSNET-10707) and has come to a conclusion that this issue and the
undesired behavior you’re observing is actually not a bug in
Aspose.Words.

MS Word renders problematic paragraphs differently because source document (Input.docx) has DoNotUseIndentAsNumberingTabStop compatibility option set to FALSE and empty document created from scratch has this option TRUE.

Please set this option as false to match source document as shown in following code example. This will fix the issue which you are facing. Please let us know if you have any more queries.


Document Finaldoc = new Document();

Finaldoc.RemoveAllChildren();

Document srcDoc = new Document(MyDir + "Input.docx");

srcDoc.FirstSection.PageSetup.SectionStart = SectionStart.NewPage;

srcDoc.FirstSection.PageSetup.RestartPageNumbering = true;

Finaldoc.AppendDocument(srcDoc, ImportFormatMode.KeepSourceFormatting);

Finaldoc.CompatibilityOptions.DoNotUseIndentAsNumberingTabStop = false;

Finaldoc.Save(MyDir + "Out.docx");

Hi Tahir and Team,

Appreciate your reply.



I tried to apply the same options in my code but still I see same issues.The output final document still has formatting / page break issues…



Just wanted to check with you, did you tried using the Input.docx document that I have attached to this thread previously? Please let us know.



I also tried several other options like below but it did not help.

doc.CompatibilityOptions.DoNotUseIndentAsNumberingTabStop = true / false;

doc.CompatibilityOptions.DoNotSuppressIndentation = true / false;

doc.CompatibilityOptions.DoNotUseHTMLParagraphAutoSpacing = true / false;

doc.CompatibilityOptions.NoExtraLineSpacing = true / false;

doc.CompatibilityOptions.UseWord97LineBreakRules = true / false;

doc.CompatibilityOptions.SuppressSpBfAfterPgBrk = true / false;



doc.AutomaticallyUpdateSyles = true / false;

doc.CompatibilityOptions.ApplyBreakingRules = true / false;





Regards

Vikas

Hi Vikas,

Thanks for your inquiry. In case you are using an older version of Aspose.Words, I would suggest you please upgrade to the latest version (v14.7.0) from here and let us know how it goes on your side. I have attached the output document with this post for your kind reference.