Hi,
My data F+20-20% in Gridview when exported to Excel become F20%.
I have few ways but it is not working.
I have try to make the excel file column to be TEXT format and the coding is as below but fail.The exported result to excel is F20%
I have try to solve it by using sql but fail. The exported result to excel is F20%Code:Dim strStyle As String = "<style>.text { mso-number-format:\@; } </style>" For intTemp As Integer = 1 To ldstCompareResult.Tables(0).Rows.Count - 1 dgdResult.Items(intTemp).Cells(0).Attributes.Add("class", "text") Next lsFileName = txtModel.Text.Trim & "-" & txtRev.Text.Trim & "_" & _ txtModelTo.Text.Trim & "-" & txtRevTo.Text.Trim & ".xls" Response.ClearContent() Response.Charset = "" Response.Buffer = True Response.AddHeader("Content-Disposition", "attachment;filename=" & lsFileName) Response.ContentType = "application/vnd.ms-excel" Dim style As String style = "<style> .text { mso-number-format:\@; } </style> " Response.Write(style)
I have also try as below in sql. but the exported result is ''F20%'Code:select ' '+ convert(varchar(50),'F+20-20%' )as Data1 FROM TABLE1
F+20-20% is actually description keyed in by user which is cannot be avoided and must be allowed.Code:select ''''+ 'F+20-20%' + '''' FROM TABLE1
Does anyone has idea on why this happen and how to solve it.
Help please!!


Reply With Quote