Hi All,
I have an accordion in my application created in ASP.NET 3.5.
I want to convert the active accordion data to pdf on button click.
For Example there are 04 panes in that accordion. And the user clicks the 2nd pane and then click on button, the data of Accortion Pane Index#01 should be converted to PDF.
Inshort how can I get that data from Accordion.
Data is being populated in DataTable and then to HTML table inside Accordion Pane.
Here is the code:
protected void Page_Load(object sender, EventArgs e)
{
AccordionPane pane = new AccordionPane();
pane.HeaderContainer.Controls.Add(new LiteralControl("From " + fr.ToString("dd-MMM-yyyy") + " To " + to.ToString("dd-MMM-yyyy")));
pane.ContentContainer.Controls.Add(new LiteralControl(gen_table(loc, dept, fr.ToString("dd-MMM-yyyy"), to.ToString("dd-MMM-yyyy"))));
MyAccordion.Controls.Add(pane);
MyAccordion.SelectedIndex = i;
fr = to.AddDays(1);
GeneratePDF(pane.ToString());
}
public void GeneratePDF(string pane)
{
Document doc = new Document(PageSize.A4.Rotate(), 10, 10, 10, 10);
PdfWriter.GetInstance(doc, new FileStream(Request.PhysicalApplicationPath + "\\" + Session["ecd"] + " - Attendance_Sheet.pdf", FileMode.Create));
HeaderFooter footer = new HeaderFooter(new Phrase("Page: ", FontFactory.GetFont(FontFactory.HELVETICA, 6, Font.NORMAL)), true);
footer.Border = Rectangle.TOP_BORDER;
doc.Footer = footer;
doc.Open();
Paragraph ho = new Paragraph("ORIX LEASING PAKISTAN LIMITED", FontFactory.GetFont(FontFactory.HELVETICA, 10, Font.UNDERLINE));
ho.SetAlignment("CENTER");
doc.Add(ho);
Paragraph ha = new Paragraph("Attendance Sheet", FontFactory.GetFont(FontFactory.HELVETICA, 10, Font.UNDERLINE));
ha.SetAlignment("CENTER");
doc.Add(ha);
Paragraph myParagraph = new Paragraph(Lbl_Frm.Text +" TO "+ Lbl_To.Text, FontFactory.GetFont(FontFactory.HELVETICA, 10, Font.UNDERLINE));
myParagraph.SetAlignment("CENTER");
doc.Add(myParagraph);
Paragraph locp = new Paragraph("KARACHI - INFORMATION SYSTEMS", FontFactory.GetFont(FontFactory.HELVETICA, 10, Font.UNDERLINE));
myParagraph.SetAlignment("CENTER");
doc.Add(locp);
iTextSharp.text.Table tableh = new iTextSharp.text.Table(11);
tableh.Width = 100;
tableh.Border = 0;
tableh.Cellpadding = 1;
Paragraph srr = new Paragraph(pane, FontFactory.GetFont(FontFactory.HELVETICA, 7, Font.NORMAL));
Cell csrr = new Cell(srr);
csrr.HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER;
csrr.VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE;
csrr.Header = true;
tableh.AddCell(csrr);
tableh.EndHeaders();
doc.Add(tableh);
doc.Close();
}
Please Help.
Thanks,
AR.