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();
}
.....