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

Free Support Forum - aspose.com

How to set date in StructuredDocumentTag

Hi,
I am trying to set the date in the date picker of header/footer of a word document.
I have used the following code to set the date in the specified format, but the value of the date is not getting updated in the generated document.

NodeCollection
sdtNodes = document.getChildNodes(NodeType.STRUCTURED_DOCUMENT_TAG, true);

for (StructuredDocumentTag sdt : sdtNodes)
{

if (sdt.getSdtType() == SdtType.DATE)
{
sdt.setFullDate(new Date());
sdt.setDateDisplayFormat("MM/DD/YYYY");
sdt.setDateStorageFormat(SdtDateStorageFormat.DATE);
sdt.isShowingPlaceholderText(false);
}
}

Kindly give a solution as soon as possible. Thank you in advance.
Regards,
Nikhil Mishra.
























Hi Nikhil,


Thanks for your inquiry. We are developing a code snippet to be able to set date in StructuredDocumentTag and will get back to you soon.

Best regards,

Hi Nikhil,


Thanks for being patient. Unfortunately, Aspose.Words does not support automatic date insertion in the Date SDT. The only case when this happens is when there is a databound custom XML that has the value. Then Aspose.Words does update this value to that of the bounded XML upon saving or rendering. If there is no data binding, then you will have to manually insert content into the SDT. The type of content to be inserted depends on the level of SDT i.e. run for inline, paragraph for block level SDT etc.

Best regards,