BaccS Support Center
            Help Center BaccS Invoice templates and custom reports Task based help

            How to use different formatting culture

            When you print invoice, all numbers are formatted using locale settings of your operating system (decimal and group separators). But sometimes it is needed to use locale culture of your target customer from a different country. To achieve this, it will be needed to use scripting functionality in your custom template.

            1. Open your custom template in the designer.
            2. Click on empty space or select XtraReport in the properties panel:

            3. Click Scripts button on the ribbon.
            4. Insert the following string in the editor (after all other script rows, if any):
            System.Globalization.CultureInfo culture;
            5. Press Enter to move cursor to the next row and then expand list of functions and select Before print:

            6. A new function will be created. Insert the following line inside it to get the following result:

            private void XtraReport_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) {
            System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
            Replace en-US here with the localization culture you'd like to use in your invoice.

            7. Move cursor down and create After print procedure in the similar manner. It should look as following:

            private void XtraReport_AfterPrint(object sender, System.EventArgs e) {
            System.Threading.Thread.CurrentThread.CurrentCulture = culture;
            8. Final result:

            In simple words, we have create two scripts, which are executed before and after printing an invoice. First script saves current culture to the culture variable, and then sets another desired culture, which will be used to format values in an invoice. After printing an invoice it reverts default system culture, because otherwise en-US culture will be used throughout the program until it will be restarted.

            Help us to make this article better
            0 0