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

Free Support Forum - aspose.com

Issue with date format in page shape data

Hi all,
I’m trying to fill date value in Page shape data. Format in Visio (in Define Shape Data) is: Type = Date, Format = {{dd/MM/yyyy HH:mm:ss}} and Calendar = Gregorian. My code:

indent preformatted text by 4 spaces
	Diagram diagram = new Diagram("c:\\tmp\\Template.vstx");
	try {
		Page page = diagram.getPages().get(0);
		PropCollection pagePropCollection = page.getPageSheet().getProps();
		for (int i = 0; i < pagePropCollection.getCount(); i++) {
			Prop prop = pagePropCollection.get(i);
			String name = prop.getName();
			String value = "";
			if (name.equals("ARIS_GUID")) {
				value = "6fc48f98-9763-11e9-09a3-000d3a2af140";
			} else if (name.equals("AT_CREAT_TIME_STMP")) {
				value = "08/04/2019 17:12:20";
			}
			if (!value.equals("")) {
				prop.getValue().getUfev().setF("");
				prop.getValue().setVal(value);
			}
		}
		DiagramSaveOptions diagramSaveOptions = new DiagramSaveOptions(SaveFileFormat.VSDX);
		diagram.save(outputFileName, diagramSaveOptions);

Unfortunately, it is not displayed correctly. I can see value “07/01/1900 00:00:00” in Visio.
Can you help me, please?
See attached code, template, result and screenshot.
I’m using:
aspose-diagram-22.10.0.jar
Microsoft® Visio® Plan 2 MSO (Version 2210 Build 16.0.15726.20188) 64-bit

BR
Attachments.zip (57.8 KB)

@rdocekal

An investigation ticket as DIAGRAMJAVA-51054 has been logged in our issue tracking system for further analysis on this case. We will look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.

@rdocekal
Please set the time format to the default mode, and set the unit to date:
else if (name.equals(“AT_CREAT_TIME_STMP”)) {
value = “2019-04-08T17:12:20”;
prop.getValue().getUfev().setUnit(MeasureConst.DATE);
}
Thanks.

@philip.zhou
Thanks a lot! Your solution works well. No more question.