Exemplo n.º 1
0
        public byte[] PrepateReport(GridPreInterRegisterViewModel gridPreInterRegister)
        {
            _PreEmplists = gridPreInterRegister.PreviousEmploymentDetail;

            #region
            _document = new Document(PageSize.A4, 0f, 0f, 0f, 0f);
            _document.SetPageSize(PageSize.A4);
            _document.SetMargins(20f, 20f, 20f, 20f);
            _pdfPTable.WidthPercentage     = 100;
            _pdfPTable.HorizontalAlignment = Element.ALIGN_LEFT;
            _fontStyle = FontFactory.GetFont("Arial Rounded MT", 8f, 1);
            PdfWriter.GetInstance(_document, memoryStream);
            //PdfWriter writer = PdfWriter.GetInstance(_document, new FileStream( + "/candidate.pdf", FileMode.Create));
            _document.Open();
            //PdfPTable table = new PdfPTable(3);
            //table.TotalWidth = 144f;
            //table.LockedWidth = true;
            //PdfPCell cell = new PdfPCell(new Phrase("This is table 1"));
            //cell.Colspan = 3;
            //cell.HorizontalAlignment = 1;
            //table.AddCell(cell);
            //table.AddCell("Col 1 Row 1");
            //table.AddCell("Col 2 Row 1");
            //table.AddCell("Col 3 Row 1");
            //table.AddCell("Col 1 Row 2");
            //table.AddCell("Col 2 Row 2");
            //table.AddCell("Col 3 Row 2");
            //table.WriteSelectedRows(0, -1, _document.Left, _document.Top, writer.DirectContent);


            //table = new PdfPTable(3);
            //table.TotalWidth = 144f;
            //table.LockedWidth = true;
            //cell = new PdfPCell(new Phrase("This is table 2"));
            //cell.Colspan = 3;
            //cell.HorizontalAlignment = 1;
            //table.AddCell(cell);
            //table.AddCell("Col 1 Row 1");
            //table.AddCell("Col 2 Row 1");
            //table.AddCell("Col 3 Row 1");
            //table.AddCell("Col 1 Row 2");
            //table.AddCell("Col 2 Row 2");
            //table.AddCell("Col 3 Row 2");
            //table.WriteSelectedRows(0, -1, _document.Left + 200, _document.Top, writer.DirectContent);



            _pdfPTable.SetWidths(new float[] { 10f, 20f, 20f, 20f, 20f, 20f, 20f });
            #endregion
            this.ReportHeader();
            this.ReportBody();
            _pdfPTable.HeaderRows = 2;
            _document.Add(_pdfPTable);
            _document.Close();
            return(memoryStream.ToArray());
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            int id = (int)Session["candidateId"];

            ReportViewer1.ProcessingMode = ProcessingMode.Local;
            GridPreInterRegisterViewModel Candidate = new GridPreInterRegisterViewModel();

            ReportViewer1.LocalReport.ReportPath = Server.MapPath("Report1.rdlc");
            ApplicationDbContext db = new ApplicationDbContext();
            // Specify report's dataset name and the records it use
            var datasource = new ReportDataSource("InterPersonalInfoes", (from p in db.InterPersonalInfo where p.CandidateId == id
                                                                          select p));

            ReportViewer1.LocalReport.DataSources.Clear();
            ReportViewer1.LocalReport.DataSources.Add(datasource);
        }
Exemplo n.º 3
0
        public byte[] PrepateReport(GridPreInterRegisterViewModel gridPreInterRegister)
        {
            _PreEmplists = gridPreInterRegister.PreviousEmploymentDetail;

            #region
            _document = new Document(PageSize.A4, 0f, 0f, 0f, 0f);
            _document.SetPageSize(PageSize.A4);
            _document.SetMargins(20f, 20f, 20f, 20f);
            _pdfPTable.WidthPercentage = 100;
            _fontStyle = FontFactory.GetFont("Arial Rounded MT", 8f, 1);
            PdfWriter.GetInstance(_document, _memoryStream);
            _document.Open();
            _pdfPTable.SetWidths(new float[] { 10f, 20f, 20f, 20f, 20f, 20f, 20f });
            #endregion
            this.ReportHeader();
            this.ReportBody();
            _pdfPTable.HeaderRows = 2;
            _document.Add(_pdfPTable);
            _document.Close();
            return(_memoryStream.ToArray());
        }