Generated docs don't match the template

We are facing a document problem when generating word & pdf documents at the server, using Aspose.Words for .NET.

The customer prepares the word templates, and upload them to the server, where some processes takes them in order to create documents with the proper data.

The issue is the resulting document – either .Docx or .Pdf – doesn’t match the word template used to generated it, and we do not know why are we having such a strange behavior.

Basically, it is like
the word template elements are moved when merging the data in the doc.


The customer’s word version is 2010.
Hi there,

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

  • Your input Word document
  • 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'll start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip them and Click 'Reply' button that will bring you to the 'reply page' and there at the bottom you can include any attachments with that post by clicking the 'Add/Update' button.
Maybe I didn't make myself clear in the first post.
I will try to explain it in a different way.

The customer uses Word 2010 to create templates - see attached image "aspose01" - and uploads them to the Server.
When the server process takes the word template, and merge it with some data, the resulting document doesn't match the temple (see the second attached image: "aspose02").

I think this issue is cause because the doc's version is 2010.

In order to check what was going on, I ferret around with different versions, and this is what I got:
- Word 2010: No problems.
- Word 2013: No problems.
- Word 2016: It depends. I got different results depending on the OS & Office specific version, watching different stuff when opening the same document.

Let me see if I can provide you with more stuff in order to help us with this issue.

NOTE: I don't think the console app, with a sample doc makes sense in here, because I am talking about the way Aspose interacts with a Word 2010 doc, not about merging data into it.
Also it will not reproduce our business scenario.

Thanks,
Exit();
Hi there,

Thanks for sharing the detail. We suggest you please try latest version of Aspose.Words for .NET 16.11.0 and let us know how it goes on your side. Hope this helps you.

Unfortunately, it is difficult to say what the problem is without documents and simplified application. We need your document and simple project to reproduce the problem. As soon as you get these pieces of information to us we'll start our investigation into your issue.

Good afternoon,

First of all, let me tell you that we have not been able to test the latest version - 16.11.0 - because we got a license error when tried it, and we are still waiting to get the updated license file.

About our issue, I have attached 4 documents:
- Template.docx
- output.doc
- output.docx
- output.pdf

The "template.doc" is the one we have used to generate the other 3 documents.
As you can see, opening it, and opening the other ones, is that the output files do not match the template.
The "template.doc" has been created and edited in Word 2010, because that's the software the customer has.
Hi there,

Thanks for sharing the documents. We have converted the shared document to Pdf and have noticed that the contents of document are rendered on previous pages. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-14522. You will be notified via this forum thread once this issue is resolved. We apologize for your inconvenience.

You are performing the mail merge and then convert the final document to Pdf. Please create a standalone console application (source code without compilation errors) and attach it here for further testing. Thanks for your cooperation.

Hi there Tahir.



I have attached a simple sample application, that works fine just to generate the sample output files (doc / docx / pdf) so we can use it for future testing, as requested by you.



I have tried it with the previous docs, and we will use it in order to test other templates too.

Hi there,

Thanks for sharing the detail.

We will inform you via this forum thread once this issue is resolved. Please let us know if you have any more queries.
Hi there,

Thanks for your patience. Please note that Aspose.Words requires TrueType fonts when rendering documents to fixed-page formats (JPEG, PNG, PDF or XPS). You need to install fonts on the machine where you're converting documents to Jpg. Please refer to the following articles:

How Aspose.Words Uses True Type Fonts

Your document contains the font "Gill Sans MT". Please install this font at your end or use FontSettings.SetFontSubstitutes method to override substitute (alternative) font names for given original font name. Hope this helps to fix the shared issue.