vb.net - the point disappear in excel -
i using code save dgv excel file:
if ((datagridview1.columns.count = 0) or (datagridview1.rows.count = 0)) exit sub end if 'creating dataset export dim dset new dataset 'add table dataset dset.tables.add() 'add column table integer = 0 datagridview1.columncount - 1 dset.tables(0).columns.add(datagridview1.columns(i).headertext) next 'add rows table dim dr1 datarow integer = 0 datagridview1.rowcount - 1 dr1 = dset.tables(0).newrow j integer = 0 datagridview1.columns.count - 1 dr1(j) = datagridview1.rows(i).cells(j).value next dset.tables(0).rows.add(dr1) next dim excel microsoft.office.interop.excel.application dim wbook microsoft.office.interop.excel.workbook dim wsheet microsoft.office.interop.excel.worksheet excel = new microsoft.office.interop.excel.application wbook = excel.workbooks.add() wsheet = wbook.activesheet() dim dt system.data.datatable = dset.tables(0) dim dc system.data.datacolumn dim dr system.data.datarow dim colindex integer = 0 dim rowindex integer = 0 each dc in dt.columns colindex = colindex + 1 excel.cells(1, colindex) = dc.columnname next each dr in dt.rows rowindex = rowindex + 1 colindex = 0 each dc in dt.columns colindex = colindex + 1 excel.cells(rowindex + 1, colindex) = dr(dc.columnname) next next wsheet.columns.autofit() dim strfilename string = "d:\ss.xls" dim blnfileopen boolean = false try dim filetemp system.io.filestream = system.io.file.openwrite(strfilename) filetemp.close() catch ex exception blnfileopen = false end try if system.io.file.exists(strfilename) system.io.file.delete(strfilename) end if wbook.saveas(strfilename) excel.workbooks.open(strfilename) excel.visible = true
but when excel page show up, number not have point, exemple in datagridview x = 5.76546753435677 in excel x = 576546753435677 can me plz.
the decimal mark different in pieces of software, excel , vb (vb.net?) environment. excel default using regional settings of windows number formatting (decimal mark , thousands separator), can override it. @ same time, if above code runs in web page example, use locale settings number formatting. think difference between 2 must cause issue.
Comments
Post a Comment