
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Pixel Perfect Date Formatting when Date Field Used as a Level
Jul 6, 2021 8:39:20 AM
Jun 1, 2017 3:33:45 PM
When a date field is used for or inside a Level in Pixel Perfect, the output may not be interpreted as expected.
You expect to see something like: 2017/05/31
You actually see: yyyy/MM/dd
Environment:
This is the expected behavior of the underlying DEV Express platform upon which Pixel Perfect is designed
Resolution:
To resolve this, you need to perform some scripting on the 'date' field within the Pixel Perfect editor.
The scripting involves the following steps.
- Set up your Pixel Perfect report with a 'level'
- Drop your 'date' field into the template editor inside the level
- Click on the 'date' field
- Click the Scripts button in the Template Editor top right corner
- Next choose the 'before print' drop down option
- Insert the following code:
private void label1_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) { XRLabel label = (XRLabel)sender; double x = Convert.ToDouble(label.Text); DateTime myDate = DateTime.FromOADate(x); label.Text=myDate.ToString("dd/MM/yyyy"); }
- Click 'Validate' to accept the new line of code (note that you may need to use case sensitivity for MM and dd and or yyyy)
- Deselect the 'Scripts' button on the top left corner of the template editor
- Preview your report


- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
I'm grappling with this date issue with Levels in PixelPerfect, and the script solution isn't working, nor is wrapping the field with Text() in Sense. Hoping there's a newer solution... Using NPrinting May 2021 and Sense November 2021.

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hello @Lauri
I would recommend posting what you are having a challenge with in our NPritning Discussion forums. This way you can make use of our active community and support engineers monitoring the forums.
All the best,
Sonja