Posts

Crystal Report ToWords() Function For Crore and Lac

In order to show a number in words with 'Crore' and 'Lac' you need to create a custom function in Crystal Report. I have a function and it will convert the number with two digit decimal places. Here it is.... numbervar numberValue:=0; numbervar roundedValue:=0; numbervar decimalValue:=0; stringvar inWords:="Tk. "; numberValue :=  56080000.34;  // You have to put it the number field from database If numberValue >= 10000000  Then         (roundedValue := Truncate(numberValue/10000000);         inWords := ToWords(roundedValue,0) + " Crore";         numberValue := numberValue - (roundedValue * 10000000)); If numberValue >= 100000 Then         (roundedValue := Truncate(numberValue/100000);         If Len(inWords) > 0 Then             inWor...

Crystal Report Font Size Problem

Normally font size is smaller when we print Crystal Report  or export to PDF using any browser without IE. If font size is not what you have designed in Crystal Report, you have to change in registry. To fix the bug, just follow the steps below by adding 2 registry keys. This solution is applicable for "Crystal Report For Visual Studio 2010,2012,2013" 1. Select Start > Run. Type regedit and click OK. 2. Expand HKEY_CURRENT_USER\Software\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Crystal Reports. 3. Right-click the 'Crystal Reports' folder and select New > Key. This will create a new folder. Name the new folder 'Export' with no quotes. 4. Right-click the 'Export' folder and select New > Key. This creates a new folder. Name the new folder 'Pdf' with no quotes. 5. Right-click the 'Pdf' folder and select New > DWORD Value. 6. Name this 'ForceLargerFonts' with no quotes and note that...

Generate Auto ID With Prefix

There are several way to generate auto id. Here is a method for generating auto ID from program. By providing prefix, data table with/without data and column name from program, it will return a new ID with prefix. For example... First we need to fill a data table by selecting an sql table. Then call this method by passing the parameters --- getNewIdWithPrefix("CUS-", dataTable, "customerID"); It will return 'CUS-00001' --------------ID Generating Method--------------- public static string getNewIdWithPrefix(string prefix, DataTable dt, string columnName)     {         string newId = string.Empty;         int maxId = 0;         if (dt.Rows.Count > 0)         {             DataTable idTable = new DataTable();           ...