A table in our Word document is connected to a Custom XML Part. A date that is bound to a Text Content Control is one of the fields. MMM/DD/ YYYY is the formatting style. How can the date format be changed to another one, like MM/DD/YYYY?
The following defines the above-mentioned report column:
column(DateName, Format("Date Name", 0, 4)
{
}
The full month name is returned by format, which is annoying because long month names may require a lot of unnecessary wrapping.
What I have so far tried is as follows:
1. Created a Report extension and added 2 additional columns
a. Formatted column used with Text Content Control
works as expected
b. Date column used with Date Picker Content Control
Report does NOT honor formatting properties set in Content Control
Always displays with the time component
add(DatasetName)
{
column(DateName_Formatted; Format("Date Name", 0, '<Month,2>/<Day,2>/<Year4>')
{
}
column(DateName_Date; "Date name")
{
}
}
I find it absurd that we must create a Report Extension simply to display a formatted date.
Possibly, this will improve in later iterations. After all, not that long ago, adding a new column to the dataset required creating a completely new report.
You might find this link to be helpful-
https://learn.microsoft.com/en-us/visualstudio/vsto/walkthrough-binding-content-controls-to-custom-xml-parts?view=vs-2022&tabs=csharp