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

Free Support Forum - aspose.com

Avoid Rounding UP in template for Decimal number

Hi Aspose team,

The aspose version in my code is 7.0.0 and we are using word 2007 and 2010 to generate templates.
The problem we are facing is there is a field having "Real" data type which our website has and user enter some data in it. the data user can enter is like 1.5% , 0.25% , 0.375% etc..
These are actually Rate in % , so we need to devide these % value by 100. After dividng by 100 , database view is giving proper results..
Example - if user enter 0.25 as a rate , view is giving 0.0025..

But when i try to merge this fields in the template , and generate the document , its shows value as "0.003"..
That means aspose is rounding 0.0025 UP to 0.003.

I want to merge it without applying any rounding.

Is there anyway OR any field code we can apply to this merge field in template so that we can decide the digits after decimal point without rounding .. ?

Hi there,

Thanks for your inquiry. Please note that Aspose.Words mimics the same behavior as MS Word does. If you do the mail merge with same number formatting by using MS Word, you will get the same output.

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

  • Please attach your input Word document.
  • Please

    create a standalone/runnable simple application (for example a Console
    Application Project
    ) 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

As soon as you get these pieces of information to
us we’ll start our investigation into your issue.

Thanks for your help. Issue resolved by applying #“0.######” as field code.

Hi there,

Thanks for your feedback. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.