Introduction
Aspose.Form for .NET allows its users to change the text information displayed inside a control’s interface through resources.xml file. For example, if you have placed a repeating section on your form, you can use the context menu to insert or remove a section in XmlFormView control. Aspose.Form for .NET allows you to change the text property of menu items of the context menu. Similarly, you can change the text displayed in a calendar control. You can display “Jan” instead of “January” and “Feb” instead of “February” and so on. You can also change the text information displayed in the other controls.
How to Change resources.xml File
You can find the resources.xml file in the same directory where Aspose.Form.dll file is placed inside the installation directory. You can open resources.xml using Notepad.
The resources.xml file contains tags, tags’ attributes and tags’ values. If you want to change the text, just change the values of tags and not the attributes. For example, “ContextMenu” control has the following tags
[XML]
<control name="ContextMenu">
<resource name="Remove">Remove</resource>
<resource name="Replace">Replace with</resource>
<resource name="Insert">Insert after</resource>
</control>
If you want to change the text from “Remove” to Delete then just change the value “Remove” and do not change the “name” attribute because system finds a resource by its “name” attribute and if “name” attribute will be changed, system will be unable to find the resource.
After making necessary text changes, place resources.xml file in the bin directory of your project where Aspose.Form.dll is placed.
By default, system loads the resources.xml file from the location specified by the user through “ResourceFilePath” property. If this property is not set or the path is incorrect then system tries to find this file from the bin directory of the project. If resource file is not present at these locations then system uses the resource file embedded in the Aspose.Form.dll and displays the default text information.
Changing date format through resources.xml File
Aspose.Form for .NET allows you to change the date format of a date picker control. Follow the below instructions to set a custom date format.
- Date format can be set in the resource.xml file. Now resource.xml file contains the new tag ‘<resource name="DateFormat">mm/dd/yy</resource>’ in the section ‘<control name="DatePicker">’.
- Use any delimiter for date format e.g. ‘-’ or ‘/’ etc.
- Change the order of month, day and year e.g. ‘mm-dd-yy’ or ‘dd-mm-yy’ etc.
- Supported templates include the following:
m/d/y
mm/dd/yy
mmm/ddd/yyy
mmmm/dddd/yyyy
Check the last (DateFormat) tag in the following example.
[XML]
<control name="DatePicker">
<resource name="January">January</resource>
<resource name="February">February</resource>
<resource name="March">March</resource>
<resource name="April">April</resource>
<resource name="May">May</resource>
<resource name="June">June</resource>
<resource name="July">July</resource>
<resource name="August">August</resource>
<resource name="September">September</resource>
<resource name="October">October</resource>
<resource name="November">November</resource>
<resource name="December">December</resource>
<resource name="S">S</resource>
<resource name="M">M</resource>
<resource name="Tu">T</resource>
<resource name="W">W</resource>
<resource name="T">T</resource>
<resource name="F">F</resource>
<resource name="Sa">S</resource>
<resource name="Today">Today</resource>
<resource name="Hide">Hide</resource>
<resource name="DateFormat">mm/dd/yy</resource>
</control>