1
I’m performing a select in an excel where I have an observation column (open text). The problem is that in some lines it truncates the content of this column bringing only a part.
try
{
conn = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + Path.Combine(Environment.ExpandEnvironmentVariables("%userprofile%"), "Downloads") + @"\RelPosicaoGeralPendencias.xls;Extended Properties='Excel 8.0;HDR=Yes;'");
conn.Open();
cmd = new OleDbCommand("SELECT * FROM [RelPosicaoGeralPendencias$]", conn);
reader = cmd.ExecuteReader();
listaPendenciaNassau = new List<Pendencia>();
while (reader.Read())
{
if (!(reader[6] is DBNull))
{
Pendencia pendencia = new Pendencia();
pendencia.Contrato = reader[2] is DBNull ? null : reader[2].ToString().Replace("'", "").Trim();
pendencia.Tipo = reader[3] is DBNull ? null : reader[3].ToString().Trim();
pendencia.PendenciaNivel = reader[5] is DBNull ? null : reader[5].ToString().Trim();
pendencia.PendenciaId = reader[6] is DBNull ? 0 : Convert.ToInt32(reader[6]);
pendencia.PendenciaTipo = reader[8] is DBNull ? null : reader[8].ToString().Trim();
pendencia.GarantiaDescricao = reader[9] is DBNull ? null : reader[9].ToString().Trim();
pendencia.Observacao = reader[10] is DBNull ? null : reader[10].ToString().Replace("'", "").Trim();
}
}
}
Text example:
In excel:
Pending pending. The forwarded permits are 2012 won and are not in accordance with the current rules so we can comply.
COMPANY IMPORT AND EXPORT LTD .
Assinatura Fulano.
Pending: Send authorization of the majority of the share capital.
COMPANY EXPORT AND IMPORT LTDA.
Signature: Beltrano.
Pending: Send authorization of 3/4 of the share capital. EMPRESA DE HORTIFRUTIGRANJEIROS LTDA
Signature: Cicrano.
Pending: Send minutes of authorization of the majority of the share capital PROD. COMPANY AND AGRICULTURAL DISTRIBUTION LTDA.
Subscription: Fulano de Beltrano.
Pending: Send existing social contract and power of attorney assigning endorsement to third parties in isolation. Please forward the corporate documentation to the area of power.
No c#:
The pending ones remain. The forwarded authorizations are 2012 won and are not in accordance with the current rules so that we can comply. IMPORT AND EXPORT LTDA . n nFulano. n nPendência: Send aut