![Afirmando](http://static.forosdelweb.com/fdwtheme/images/smilies/afirmar.gif)
Pd. El usuario y password es el que tienen en su maquina obviamente.
Nos Vemos!!!, espero que sirva!
Ojo. este ejemplo lo adapté de los ejemplo que proporciona la clase que se descarga de:
http://sourceforge.net/project/showf...group_id=58374 (Recomendado por RootK en las Faqs)
Código:
Chau! public class Reporte_Customers:Report { //definimos los campos de la definición de fuentes y bordes private FontDef fd; private double rPosLeft = 20; private double rPosRight= 195; private double rPosTop= 24; private double rPosBottom= 278; private string sConnectionString =@"Provider=SQLOLEDB;initial catalog=northwind;user id=sa;password='sa'"; //protected override void Save(string nombre); protected override void Create() { fd = new FontDef(this, FontDef.StandardFont.Helvetica); FontProp fp = new FontPropMM(fd, 1.9); // standard font FontProp fp_Header = new FontPropMM(fd, 1.9); // font of the table header fp_Header.bBold = true; //using1 using (TableLayoutManager tlm = new TableLayoutManager(fp_Header)) {tlm.rContainerHeightMM = rPosBottom - rPosTop; // set height of table tlm._tableHeight = TlmBase.TableHeight.AdjustLast; tlm.headerCellDef.rAlignV = RepObj.rAlignCenter; // set vertical alignment of all header cells tlm.cellDef.pp_LineBottom = new PenProp(this, 0.05, Color.LightGray); // set bottom line for all cells tlm.eNewContainer += new TableLayoutManager.NewContainerEventHandler(this.Tlm_NewContainer); TableLayoutManager.Column col; col = new TableLayoutManager.ColumnMM(tlm, "ID", 13); col = new TableLayoutManager.ColumnMM(tlm, "Company Name", 40); col.cellDef.textMode = TableLayoutManager.TextMode.MultiLine; col = new TableLayoutManager.ColumnMM(tlm, "Address", 36); col = new TableLayoutManager.ColumnMM(tlm, "City", 22); col = new TableLayoutManager.ColumnMM(tlm, "Postal Code", 16); col = new TableLayoutManager.ColumnMM(tlm, "Country", 18); // using2 using (OleDbConnection oleDbConnection = new OleDbConnection(sConnectionString)) {oleDbConnection.Open(); OleDbCommand oleDbCommand = new OleDbCommand("SELECT CustomerID, CompanyName, Address, City, PostalCode, Country, Phone FROM Customers ORDER BY CompanyName", oleDbConnection); //using3 using (OleDbDataReader oddr = oleDbCommand.ExecuteReader()) { while (oddr.Read()) { tlm.NewRow(); tlm.Add(0, new RepString(fp, oddr.GetString(0))); tlm.Add(1, new RepString(fp, oddr.GetString(1))); tlm.Add(2, new RepString(fp, oddr.GetString(2))); tlm.Add(3, new RepString(fp, oddr.GetString(3))); if (!oddr.IsDBNull(4)) { tlm.Add(4, new RepString(fp, oddr.GetString(4))); } tlm.Add(5, new RepString(fp, oddr.GetString(5))); }//while }//using3 }//using2 }//using1 // print page number and current date/time foreach (Root.Reports.Page page in enum_Page) { Double rY = rPosBottom + 1.5; page.AddLT_MM(rPosLeft, rY, new RepString(fp, DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString())); page.AddRT_MM(rPosRight, rY, new RepString(fp, page.iPageNo + " / " + iPageCount)); if (page.iPageNo==iPageCount) { page.AddCT_MM(50,200,new RepString(fp,"Hola")); } //intento hacer una linea // con esta clase ajustamos a la linea -> el reporte en donde se genera, // el grueso de la linea, el color de la linea PenProp pprop = new PenProp(this,0.5,Color.Maroon); // con esta creamos la linea en cuestion // Parámetros -> el penprop, el largo de la linea en eje x (eje y en 0) RepLineMM linea = new RepLineMM(pprop,175,0); //con esta añadimos al reporte-> Posisicion en eje X, posicion en eje Y, el objeto de linea. page.AddCT_MM(107,279,linea); //linea hecha. } /**/ } private void Tlm_NewContainer(Object oSender, TableLayoutManager.NewContainerEventArgs ea) { // only "public" for NDoc, should be "private" new Root.Reports.Page(this); // first page with caption if (page_Cur.iPageNo == 1) { FontProp fp_Title = new FontPropMM(fd, 7); fp_Title.bBold = true; page_Cur.AddCT_MM(rPosLeft + (rPosRight - rPosLeft) / 2, rPosTop, new RepString(fp_Title, "Customer List")); ea.container.rHeightMM -= fp_Title.rLineFeedMM; // reduce height of table container for the first page } // the new container must be added to the current page page_Cur.AddMM(rPosLeft, rPosBottom - ea.container.rHeightMM, ea.container); } } void Button1_Click(object sender, EventArgs e) { RT.ResponsePDF(new Reporte_Customers(),this); }
![apachar ojo](http://static.forosdelweb.com/fdwtheme/images/smilies/wink.png)