Everyone has always thought that UltraEdit is an ordinary notepad that can edit code, and that it cannot format code. In fact, this is not the case. Using special methods, the UE editor UltraEdit can also format the code. It can not only format XML files and Java, C/C++, C# source code files, but also format artistic styles.
The XML file is formatted as follows:
1. Open the XML file that needs to be formatted, click the Format-->XMLlint Tool menu item, and check the box in the pop-up dialog box.
2. "Reformat and reindent the output, where indentaion is: ", and then click the "Parse" button. The formatted result will appear in the Outpu window. If you need to obtain the formatted text, you can right-click on the Output window and select the "Copy To Clipboard" menu item to copy the text to the clipboard for processing by other programs;
If you need to format the current XML file opened by UE and directly output the result to the current file, you can do this:
1. Click the Advanced-->Tool Configuration menu item, click the "Insert" button in the pop-up dialog box, then enter the name of the command menu in the "Menu Item Name" column (for example: "Format XML File"), and then enter the following command in the "Command Line" column:
"C:/Progra~1/IDMCom~1/UltraEdit-32/GNU/XMLlint.exe --format --output %f %f"
Uncheck the "Capture Output" option in the Output tab, and finally click the "OK" button to complete the configuration.
2. Now, if you want to format the opened XML file, just select the "Format XML File" menu item under the "Advanced" menu.
The formatting methods for Java, C/C++, and C# source code files are as follows:
1. The configuration is similar to the XML formatted configuration, except that the command entered in the "Command Line" column in the "Tool Configuration" dialog box is different.
Java source code uses the following command line:
"C:/Progra~1/IDMCom~1/UltraEdit-32/GNU/astyle.exe --style=ansi --mode=java %f"
C/C++ source code uses the following command line:
"C:/Progra~1/IDMCom~1/UltraEdit-32/GNU/astyle.exe --style=ansi --mode=c %f"
The C# source code uses the following command line:
"C:/Progra~1/IDMCom~1/UltraEdit-32/GNU/astyle.exe --style=ansi --mode=cs %f"
Please remember to uncheck the "Capture Output" option in the Output tab, and finally click the "OK" button to complete the configuration.
Note: The path of the file to be formatted cannot contain spaces or Chinese characters. I have not solved this problem yet.
2. Now, you only need to select the corresponding format menu item to format the open file!