I am exporting a grid view to Excel and it works fine. My question is: Is there a property that let's me pre-define an excel column prior to export. In my case, column number 6 is numeric with 2 decimals. In case there are whole numbers, the decimal will not show. User always wants to see the decimal regardless. Thank you.
Code:Protected Sub Excel_Button_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Excel_Button.Click Export1_Clicked = True ' used to bypass switching from ASC to DESC and vice versa GridView2.AllowPaging = False GridViewSortExpression1 = Session("SortExpression") ItemDetailDataTable = Session("ItemDetailDataTable") Dim pageIndex2 As Integer = GridView2.PageIndex GridView2.DataSource = SortDataTable1(ItemDetailDataTable, False) GridView2.DataBind() GridView2.PageIndex = pageIndex2 GridViewExportUtil.Export("EquipmentHours.xls", GridView2) GridView2.AllowPaging = True Export1_Clicked = False End Sub


Reply With Quote