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

Free Support Forum - aspose.com

IMailMergeDataSource - getValue truncates leading spaces

Good Morning

I implemented my own IMailMergeDataSource and I struggle to get leading spaces into the word document. As it looks the value in fieldValue[0] is trimed automatically. I need some spaces for formating reasons. Is it possible to avoid triming the provided value?
I couldn’t find any information in the internet, so I ask here.
We are looking forward to get some advice.

Hi Aspectra,

Thanks for your inquiry. It would be great if you please share following detail for investigation purposes.

  • Please attach your input Word document.
  • Please
    share a standalone/runnable simple application Java that demonstrates the code (Aspose.Words code) you used to generate
    your output document
  • Please attach the output Word file that shows the undesired behavior.
  • Please
    attach your target Word document showing the desired behavior. You can
    use Microsoft Word to create your target Word document. I will
    investigate as to how you are expecting your final document be generated

it is difficult to say what the problem is without the Document(s) and
simplified application. We need your Document(s) 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.


Thanx for your response and sorry for my late message.
I created a very basic example that demonstrates what’s not going according to plan.
The Project consists of 2 classes. It’s self-explanatory. Nevertheless a short description:
  • Starter.java - contains main method to start the application
  • ExampleMailMergeDataSource - the MailMergeDataSource

To Test the mechanism just call Starter.java with an argument that points to the example.docx
As a result the application will create a new file example.docx.gen.docx

As you can see the leading space will be truncated.
instead of
" first line"
the result is
"first line"

How can I avoid that?

You find all the sources attached. In src/main/resource you’ll find example.docx and the
generated example.docx.gen.docx

Thanks a lot for your support
best regards

Hi Aspectra,

Thanks for sharing the detail. We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-12650. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Thanks for your answer.

We are glad to hear from you as soon as you’ll have figured out a solution.

The issues you have found earlier (filed as WORDSNET-12650) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.