Show string in excel without showing single quotation mark [duplicate]

1

I have a routine that generates an excel. There is a field in the DB (Oracle) that is varchar. This means that in the database it is formatted with leading zeros. Well, what happens is that when it is loaded into excel, excel ignores the zeros on the left and shows only the absolute numeric value. In the assembly for display in excel, I tried to include a single quotation mark, but when it opens in excel, the quotation mark also appears, type like: '0000023654' and not 0000023654 . This is the code that exports to excel: .....

foreach (var item in listaItensMatMed)
                {
                    StringBuilder itens = new StringBuilder();
                    itens.Append(item.DataInclusao + ";");
                    itens.Append(item.TipoTabela + ";");
                    itens.Append(item.Tabela + ";");
                    itens.Append(item.Codigo + ";");
                    itens.Append(item.TUSS + ";");
                    itens.Append(item.Descricao + ";");
                    itens.Append(item.Fabricante + ";");
                    itens.Append(item.ReferenciaFabricante + ";");
                    itens.Append(item.RegistroAnvisa + ";");
                    itens.Append(item.ClassificacaoSimpro + ";");
                    itens.Append(item.GrupoMatMed + ";");
                    itens.Append(item.GrupoEstatistico + ";");
                    itens.Append(item.AutorizacaoPrevisa + ";");
                    itens.Append(item.UltimaVigencia + ";");
                    itens.Append(item.Valor + ";");
                    itens.Append(item.PrestadorTabelaPropria + ";");

                    Response.Write(itens.ToString());

                    Response.Write("\r");
                    //Response.Flush();
                }
.....
    
asked by anonymous 15.01.2016 / 17:17

1 answer

0

Try to send the simple apostrophe at the beginning of the string.

    
15.01.2016 / 17:27