ورود

View Full Version : سوال: خروجی گرفتن مستقیم فایل PDF از Stimulsoft



vbblog
جمعه 04 مرداد 1392, 17:10 عصر
سلام به دوستان عزیز
سوال: چطور میتونم از داخل برنامه بدون این که گزارش رو نشون بدم خروجی PDF ازش بگیرم (از Stimulsoft) برنامه به زبان vb.net هست
از کمک شما ممنونم.

javad.nic63
شنبه 05 مرداد 1392, 09:11 صبح
string ReportPath = HttpContext.Current.Server.MapPath("Reports/Report.mrt");
Stimulsoft.Report.StiReport rpt = new Stimulsoft.Report.StiReport();
rpt.Load(ReportPath);
DataSet Ds = SetDataSet();
rpt.RegData(Ds);
rpt.Dictionary.Synchronize();
rpt.Compile();
rpt.Render();
Random Rnd = new Random();
string FilePdf = "PdfOut/BillPdf" + Rnd.Next(100) + ".pdf";
if (File.Exists(HttpContext.Current.Server.MapPath(Fi lePdf)))
File.Delete(HttpContext.Current.Server.MapPath(Fil ePdf));

rpt.ExportDocument(StiExportFormat.Pdf,FilePdf);

تابع SetDataSet دیتاستمون را درست می کنه. من c#برات نوشتم. خودت کانورتش کن.

monilin
شنبه 05 مرداد 1392, 10:11 صبح
StiReport rpt = new StiReport();
rpt.Load("FacktorForoshRpt.mrt");
string constr = System.Configuration.ConfigurationSettings.AppSett ings["ConnectionString"].ToString();
Stimulsoft.Report.Dictionary.StiSqlDatabase sti = new Stimulsoft.Report.Dictionary.StiSqlDatabase("DB", constr);
rpt.Dictionary.Databases[0] = sti;
rpt.Dictionary.Variables["today"].Value = pc.GetYear(DateTime.Now) + "/" + pc.GetMonth(DateTime.Now).ToString("0,0") + "/" + pc.GetDayOfMonth(DateTime.Now).ToString("0,0");
rpt.Compile();
rpt.CompiledReport.DataSources["Report_Facktor"].Parameters["@ID"].ParameterValue = Convert.ToInt32(txtFactorNum.Text);
rpt.Render();
string date = pc.GetYear(DateTime.Now) + "-" + pc.GetMonth(DateTime.Now).ToString("0,0") + "-" + pc.GetDayOfMonth(DateTime.Now).ToString("0,0");
rpt.ExportDocument(StiExportFormat.Pdf, Application.StartupPath + "\\Factor\\" + txtFactorNum.Text + "_(" + date + ").pdf");