Foros del Web » Programación para mayores de 30 ;) » .NET »

Impresion de un informe en cristal report

Estas en el tema de Impresion de un informe en cristal report en el foro de .NET en Foros del Web. Hola amigos actualmente estoy trabajando con WebFors y C#, por necesidades de mi area estoy generando algunos reportes en cristal report y aunque he tenido ...
  #1 (permalink)  
Antiguo 03/12/2004, 16:51
 
Fecha de Ingreso: septiembre-2004
Mensajes: 217
Antigüedad: 19 años, 7 meses
Puntos: 0
Impresion de un informe en cristal report

Hola amigos

actualmente estoy trabajando con WebFors y C#, por necesidades de mi area estoy generando algunos reportes en cristal report y aunque he tenido
algunos problemas por fin ya tengo algunos informes listo, sin embargo no he podido mandarlos a impresion.

Solamente lo puedo imprimir mediante el navegador, sin embargo requiero
activar un boton por ejemplo y que este mande el informe a impresión.


private void Page_Load(object sender, System.EventArgs e)
{
this.reporte.PrintOptions.PaperSize =
CrystalDecisions.Shared.PaperSize.DefaultPaperSize ;
this.reporte.PrintOptions.PaperOrientation =
CrystalDecisions.Shared.PaperOrientation.Portrait;
CrystalDecisions.Shared.PageMargins margenes = new PageMargins();
margenes.leftMargin = 2;
margenes.topMargin = 2;
margenes.rightMargin = 2;
margenes.bottomMargin = 2;
reporte.PrintOptions.ApplyPageMargins(margenes);
this.CrystalReportViewer1.Visible = true;
this.CrystalReportViewer1.ReportSource = reporte;
this.CrystalReportViewer1.BestFitPage = false;
.
.
.
}

Tengo un boton que segun la documentación que he podido revisar
deberia ser así


private void Button1_Click(object sender, System.EventArgs e)
{
this.reporte.PrintToPrinter(1,false,0,0);
}

sin embargo proboca el siguiente errror


Referencia a objeto no establecida como instancia de un objeto.
Descripción: Excepción no controlada al ejecutar la solicitud Web actual. Revise el seguimiento de la pila para obtener más información acerca del error y dónde se originó en el código.

Detalles de la excepción: System.NullReferenceException: Referencia a objeto no establecida como instancia de un objeto.

Error de código fuente:


Línea 340: private void Button1_Click(object sender, System.EventArgs e)
Línea 341: {
Línea 342: this.reporte.PrintToPrinter(1,false,0,0);
Línea 343: }
Línea 344:


Archivo de origen: c:\net\catalogo\consola\tvirtual\reportes\datos_de _envio.aspx.cs Línea: 342

Seguimiento de la pila:


[NullReferenceException: Referencia a objeto no establecida como instancia de un objeto.]
consola.TVirtual.Reportes.FormatoEnvio.Button1_Cli ck(Object sender, EventArgs e) in c:\net\catalogo\consola\tvirtual\reportes\datos_de _envio.aspx.cs:342
System.Web.UI.WebControls.Button.OnClick(EventArgs e)
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData)
System.Web.UI.Page.ProcessRequestMain()



QUE PUEDO HACER ... ALGUIEN TIENE IDEA DE COMO SE IMPRIME
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 07:48.