dc96e1e341c388e37b709eaf7a0d486d399b83ef
FAQ/Questions/Add-Formatting-Options.md
| ... | ... | @@ -6,6 +6,12 @@ |
| 6 | 6 | |
| 7 | 7 | Here we will show you how to easily add a new formatting option to the "Formats" dropdown menu on the Fields tab of the Report Designer. These should be handled in your ``InitializeReporting()`` method in your global.asax. |
| 8 | 8 | |
| 9 | +##Exporting to Excel |
|
| 10 | + |
|
| 11 | +Excel uses internal formatting and attempts to 'guess' what the proper format for a value should be. This means that sometimes, Excel guesses incorrectly and while the correct value might be exported to Excel, the format will be wrong - for example, .623 instead of 62.3%. In this case, it is necessary to specify the data type group exactly using the full constructor to specify data type: |
|
| 12 | + |
|
| 13 | +`AdHocSettings.Formats.Add("{0:P2}", new SimpleFormat("Percent", "{0:P2}", new SqlTypeGroup[] { SqlTypeGroup.Numeric, SqlTypeGroup.Money, SqlTypeGroup.Real }));` |
|
| 14 | + |
|
| 9 | 15 | ##Example 1 - Bold |
| 10 | 16 | |
| 11 | 17 | In this example, we will quickly add a new format option to the list called "Bold". New formats added this way will be available for every type of data and will not override the existing built-in formats for each type of data. The symbol {0} acts as a token to represent the data that is returned by the query. |