Formating Decimal Numbers to two or more decimal places in dotnet
FormatNumber(convert.ToDouble("100.22"), 2, , , TriState.False)
using Case statmenet in sql server query
select [Disti Name], [Product Group],
CASE FQ
WHEN 'Q1' THEN 'Feb-Jul'
WHEN 'Q2'THEN 'March-Aug'
WHEN 'Q3' THEN 'April-Sept'
WHEN 'Q4' THEN ' May-Oct'
ELSE 'NULL'
END
,SUM([Extended Resale]) as [Total Post Extended Resale],SUM([Extended Cost]) AS [Total Pos Extended Cost],CONVERT(varchar,
(CONVERT(decimal(18, 2), (1.0 * ((SUM([Extended Resale])-SUM([Extended Cost]))/(nullif(SUM([Extended Resale]),0)))) * 100))) AS [Margin]
from dbo.POS_Details_FY09M10_FY10M05
group by [Disti Name],[product group],FQ
order by [Disti Name],[Product Group],FQ
Thursday, November 26, 2009
Monday, November 23, 2009
Formating Excell Cells When Exporting Gridview To Excel
Add the style sheet with the below styles to the stream writer as below
Dim tw As New System.IO.StringWriter
Dim hw As New System.Web.UI.HtmlTextWriter(tw)
Dim styleInfo As String = ""
Dim styleInfo1 As String = ""
There are many other style you can apply to get correct date and number decimal points amount.
mso-number-format:"0" No Decimals
mso-number-format:"0\.00" 2 Decimals
mso-number-format:"mm\/dd\/yy" Date format
mso-number-format:"m\/d\/yy\ h\:mm\ AM\/PM" D -T AMPM
mso-number-format:"Short Date" 03/07/2009
mso-number-format:"Medium Date" 05-jan-2008
mso-number-format:"Short Time" 8:67
mso-number-format:"Medium Time" 8:67 am
mso-number-format:"Long Time" 8:67:25:00
mso-number-format:"Percent" Percent - two decimals
mso-number-format:"0\.E+00" Scientific Notation
mso-number-format:"\@" Text
mso-number-format:"\#\ ???\/???" Fractions - up to 3 digits (312/943)
mso-number-format:"\0022£\0022\#\,\#\#0\.00" £12.76
mso-number-format:"\#\,\#\#0\.00_ \;\[Red\]\-\#\,\#\#0\.00\ " 2 decimals, negative numbers in red and signed
(1.86 -1.66)
mso-number-format:"\\#\\,\\#\\#0\\.00_\\)\\;\\[Black\\]\\\\(\\#\\,\\#\\#0\\.00\\\\)" Accounting Format –5,(5)
Dim tw As New System.IO.StringWriter
Dim hw As New System.Web.UI.HtmlTextWriter(tw)
Dim styleInfo As String = ""
Dim styleInfo1 As String = ""
There are many other style you can apply to get correct date and number decimal points amount.
mso-number-format:"0" No Decimals
mso-number-format:"0\.00" 2 Decimals
mso-number-format:"mm\/dd\/yy" Date format
mso-number-format:"m\/d\/yy\ h\:mm\ AM\/PM" D -T AMPM
mso-number-format:"Short Date" 03/07/2009
mso-number-format:"Medium Date" 05-jan-2008
mso-number-format:"Short Time" 8:67
mso-number-format:"Medium Time" 8:67 am
mso-number-format:"Long Time" 8:67:25:00
mso-number-format:"Percent" Percent - two decimals
mso-number-format:"0\.E+00" Scientific Notation
mso-number-format:"\@" Text
mso-number-format:"\#\ ???\/???" Fractions - up to 3 digits (312/943)
mso-number-format:"\0022£\0022\#\,\#\#0\.00" £12.76
mso-number-format:"\#\,\#\#0\.00_ \;\[Red\]\-\#\,\#\#0\.00\ " 2 decimals, negative numbers in red and signed
(1.86 -1.66)
mso-number-format:"\\#\\,\\#\\#0\\.00_\\)\\;\\[Black\\]\\\\(\\#\\,\\#\\#0\\.00\\\\)" Accounting Format –5,(5)
Subscribe to:
Posts (Atom)
