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

Free Support Forum - aspose.com

Automatic date formatting in docx to pdf

Hi, we use Aspose to generate pdf using Docx in .Net , We are experiencing an automatic date conversion for dates and even for some other properties which have data that looks like dates. Example House number 12-12-2000 also converts to 12-12-2000 12:00, How to prevent this automatic formatting

It’s this code line that we use to bind date
reportingEngine.BuildReport(“template”, “dateJson”);

@heshjy

Can you please specify the API name that you are using at your side? We will share our feedback with you accordingly.

Aspose.Words & Aspose.Pdf
if I understood the question correctly

@heshjy

As per our understandings, you are using Aspose.Words to generate DOCX and then convert it into PDF. Can you please specify at which stage you are facing the issue of date formatting? Is it happening while generating DOCX? OR how you are using Aspose.PDF in this process? Please share a bit more details along with some sample files so that we can test the scenario in our environment and address it accordingly.

Hi Asad, what we do is we create the docx file and then generate the data JSON file to feed into the method reportingEngine like below
BuildReport(“template”, “dateJson”);
here the template is the stream of docx file and dataJson is the data that needed to bind .
The issue is any string which looks like a date (even though it can be a vehicle number or house id) still being converted to a date-time format while generating the pdf, I need to prevent this happening.
(its not happening while creating the docx file but binding the values to the docx template)

@heshjy

Your query looks more related to Aspose.Words. We are moving it to respective forum category where you will be assisted accordingly.

Thank you @asad.ali

@heshjy

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 will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.