RESPONDER UNA PREGUNTA

Si para responder la pregunta, crees necesario enviar un archivo adjunto, puedes hacerlo a traves del correo [email protected]

    Pregunta:  62067 - EXPORTAR TEXTBOX MULTILINEA A EXCEL CON C#
Autor:  Carlos Negrete Meraz
Hola quisiera ver si alguien podria ayudarme con este problema:
Estoy intentando pasar un textbox a una hija de Excel, el detalle es que el textbox es multilinea,y al intentar pasar el textbox marca un error y aparece un caracter de fin de línea y aunque lo quite con un remove aun asi sigue marcando error. Este es mi codigo:
txtDirigido.Text = txtDirigido.Text.Replace("

", " ");

Excelapp Excel = new Excelapp();
Excel.Visible = true;

Workbook libro = Excel.Workbooks.Add(Missing.Value);
Worksheet hoja = (Worksheet)Excel.ActiveSheet;

hoja.Cells[2, 1] = "Dirigido a";
hoja.Cells[2, 2] = txtDirigido.text.ToString();

try
{
hoja.SaveAs(@"C:Book1.xls", true, true, true, true, true, true, true, true, true);
Excel.Quit();
}
catch(Exception ec)
{
MessageBox.Show(ec.ToString());
}

Espero que puedan ayudarme, saludos


Nombre
Apellidos
Correo
Comentarios