public void SaveWorkbook(){ String folderPath = C:\\My Files\\+ this.folder ; My path attached here
My path(string reportFileName = @"C:\Bondreg\" + l + ".pdf";) while exporting time data saving to server system only . If possible to save data in local system . protected void Button2_Click(object sender, EventArgs e) { List l = new List(); sc.Open(); SqlCommand cmd = new SqlCommand("select Fliono from BOND_REG where status='A'", sc); SqlDataReader SDR = cmd.ExecuteReader(); while (SDR.Read() == true) { var item1 = SDR.GetValue(0).ToString(); l.Add(item1); } SDR.Close(); sc.Close(); for (int i = 0; i < l.Count; i++) { fileexport(l[i].ToString()); updatestaus(l[i].ToString()); } SDR.Close(); sc.Close(); Response.Write("<Script> alert('Data Exported Succesfully')</Script>"); DropDownList1.SelectedIndex = 0; } public void updatestaus(string s) { sc.Open(); SqlCommand cmd = new SqlCommand("update BOND_REG set status='P' where fliono ='" + s.ToString() + "'", sc); cmd.ExecuteNonQuery(); sc.Close(); } public void fileexport(string l) { SqlCommand cmd1 = new SqlCommand("select * from BOND_REG where status='A' and Fliono ='" + l + "'", sc); SqlDataAdapter da = new SqlDataAdapter(); da.SelectCommand = cmd1; DataTable datatable = new DataTable(); da.Fill(datatable); ReportDocument crystalReport = new ReportDocument(); crystalReport.Load(Server.MapPath("~/bond.rpt")); crystalReport.SetDataSource(datatable); ExportOptions rptExportOption; DiskFileDestinationOptions rptFileDestOption = new DiskFileDestinationOptions(); PdfRtfWordFormatOptions rptFormatOption = new PdfRtfWordFormatOptions(); string reportFileName = @"C:\Bondreg\" + l + ".pdf"; rptFileDestOption.DiskFileName = reportFileName; rptExportOption = crystalReport.ExportOptions; { rptExportOption.ExportDestinationType = ExportDestinationType.DiskFile; rptExportOption.ExportFormatType = ExportFormatType.PortableDocFormat; rptExportOption.ExportDestinationOptions = rptFileDestOption; rptExportOption.ExportFormatOptions = rptFormatOption; } crystalReport.Export(); crystalReport.Close(); crystalReport.Dispose();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)