Incorrect date format after PDF conversion

Hi,

I’m evaluating Aspose Words for custom XML binding and PDF conversion.

I have a custom XML with a date field that binds to a date control. While debugging I can see that the SDT properties are correct:

fullDate: Mon Jan 01 01:00:00 CET 2018
dateDisplayFormat: d’ de ‘MMMM’ de 'yyyy
dateStorageFormat: 0

But, when I convert the document to PDF, y get “2018-01-01” as the output instead of “1 de enero de 2018” (locale is Spanish).

I have tried changing the property isShowingPlaceholderText of the SDT and the fieldUpdateCultureSource option of the document to no avail.

How can I get Aspose to honor the date format stored in the Word document during the PDF conversion?

Here is the stored SDT:

<w:sdt>
	<w:sdtPr>
		<w:id w:val="-807625765"/>
		<w:placeholder>
			<w:docPart w:val="DefaultPlaceholder_-1854013438"/>
		</w:placeholder>
		<w:dataBinding w:prefixMappings="xmlns:ns0='http://www.codeoscopic.com/avant/2018/sign/XMLSchema' " w:storeItemID="{768CE43E-33AA-40B7-AC18-BBB8F02BD3A0}" w:xpath="/ns0:contract[1]/ns0:date[1]"/>
		<w:date w:fullDate="2018-01-01T00:00:00Z">
			<w:dateFormat w:val="d' de 'MMMM' de 'yyyy"/>
			<w:lid w:val="es-ES"/>
			<w:storeMappedDataAs w:val="date"/>
			<w:calendar w:val="gregorian"/>
		</w:date>
	</w:sdtPr>
	<w:sdtEndPr/>
	<w:sdtContent>
		<w:p w:rsidR="007F2F09" w:rsidRDefault="005B13C3">
			<w:r>
				<w:t>1 de enero de 2018</w:t>
			</w:r>
		</w:p>
	</w:sdtContent>
</w:sdt>

Thanks in advance,
Alex

@alex.albericio,

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 PDF file that shows the undesired 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 and upload them.

Hy Tahir,

While I was preparing a sample app to reproduce the issue I noticed that my custom XML had a date only format: <xs:date>2018-01-14</xs:date>

The date control seems to expect a date and time value such as: <xs:date>2018-01-14T00:00:00</xs:date>

Now the output is the expected (“14 de enero de 2018”).

Thanks for yout interest.

Regards,
Alex

@alex.albericio,

Thanks for your feedback. It is nice to hear from you that your problem has been solved. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.