Si usted necesita de inicio, consideran necesita datos DataGridView de impresión muestran en Crystelreport utilizando XML
**(This is very helpful if you not using any database)**
- En primer lugar hacer la tabla de datos
- A continuación, agregar datos a la tabla de datos (aquí Añadir de DataGridview)
- Crear archivo XML
- Ejecutar informe
Aquí código de ejemplo
DataTable dt = new DataTable();
dt.Columns.Add("Item_Id", typeof(string));
dt.Columns.Add("Categry", typeof(string));
dt.Columns.Add("Item_Name", typeof(string));
dt.Columns.Add("Unit_Price", typeof(double));
dt.Columns.Add("Quantity", typeof(int));
dt.Columns.Add("Discount", typeof(string));
dt.Columns.Add("Total_Payable", typeof(double));
foreach (DataGridViewRow dgr in DGVsell.Rows)
{
dt.Rows.Add(dgr.Cells[0].Value, dgr.Cells[1].Value, dgr.Cells[2].Value, dgr.Cells[3].Value, dgr.Cells[4].Value, dgr.Cells[5].Value, dgr.Cells[6].Value);
}
ds.Tables.Add(dt);
ds.WriteXmlSchema("Bill.xml");
nota Si la fabricación de error tenido el cambio de archivo XML App.config como sigue
<?xml version="1.0" encoding="utf-8"?>
<configuration>
</startup>-->
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>
Después Maqued archivo XML, puede llamar a la Informe de Crystel
frmreport obj = new frmreport(); //load report viwer form
obj.ShowDialog();
en el informe viwer
crBill cr = new crBill();
cr.SetDataSource(frmSell.ds);
crystalReportViewer1.ReportSource = cr;
crystalReportViewer1.RefreshReport();
crystalReportViewer1.Refresh();
Podría usted por favor enviar el código para cargar el informe de XML? – Urik
@Urik: no hay código. El informe está vinculado al archivo XML. –
¿Pero no está usando algo como rpt.Database.Tables [0] .SetDataSource (ds_xml); ? – Urik