PDA

View Full Version : ساخت چاپ سفارشی در استیمول



hamid_massaelly
یک شنبه 06 مرداد 1392, 18:48 عصر
سلام بر همه دوستان می خواستم بدانم چطور می شود یک چاپ در استیمول را براساس select ی که می سازیم فیلدها را نمایش دهد مثلا یک select من 3 ستون دارد و یکی دیگه 10 تا من می خواهم فقط تعداد ستون آن بر اساس select ی باشد که براش ارسال می کنم پویا باشد لطفا یک منبع یا مثال یا سره نخی به من معرفی کنید.
ممنونم.

hamid_massaelly
سه شنبه 08 مرداد 1392, 12:31 عصر
سلام من با راهنمایی پشتیبانی خود سایت استیمول حل کردم چون خودم دردسر خیلی کشیدم برای دوستان میگذارم به صورت یک تابع تا راحت از آن استفاده کنید البته بانک اطلاعاتی من اوراکل است ولی فرقی نمی کنه

using Oracle.DataAccess.Client;
using System.Data;
using System.Web.UI.WebControls;
using Stimulsoft.Report;
using Stimulsoft.Report.Web;
using Stimulsoft.Report.Components;
using Stimulsoft.Base.Drawing;
using Stimulsoft.Base;
using Oracle.DataAccess.Client;
using System.Drawing;
public StiReport set_stimul_print(StiWebReport report_web, string query)
{
StiReport report = new StiReport();
StiPage page = report.Pages[0];

OracleDataAdapter adapter = new OracleDataAdapter("select * from TBL_System_User where 1=1", vconnection_string);
OracleCommandBuilder builder = new OracleCommandBuilder(adapter);
DataSet dataset = new DataSet("Demo");
adapter.Fill(dataset, "TBL_System_User");
DataTable dt = dataset.Tables["TBL_System_User"];
report.RegData(dataset);
report.Dictionary.Synchronize();
//Create TitleBand
StiHeaderBand TitleBand = new StiHeaderBand();
TitleBand.Height = 0.85;
TitleBand.Name = "TitleBand";
page.Components.Add(TitleBand);

//Create Title text on header
StiText headerText = new StiText(new RectangleD(0, 0, page.Width, 0.85));
headerText.HorAlignment = StiTextHorAlignment.Left;
headerText.Name = "TitleHeader";
headerText.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold);
TitleBand.Components.Add(headerText);

//Create HeaderBand
StiHeaderBand headerBand = new StiHeaderBand();
headerBand.Height = 0.5;
headerBand.Name = "HeaderBand";
page.Components.Add(headerBand);

//Create Databand
StiDataBand dataBand = new StiDataBand();
dataBand.DataSourceName = "TBL_System_User";
dataBand.Height = 0.5;
dataBand.Name = "DataBand";
page.Components.Add(dataBand);


double pos = 0;
double columnWidth = page.Width / dt.Columns.Count;
int nameIndex = 1;
foreach (DataColumn dataColumn in dt.Columns)
{
//Create text on header
StiText hText = new StiText(new RectangleD(pos, 0, columnWidth, 0.5));
hText = new StiText(new RectangleD(pos, 0, columnWidth, 0.5));

hText.Text.Value = dataColumn.Caption;
hText.HorAlignment = StiTextHorAlignment.Center;
hText.Name = "HeaderText" + nameIndex.ToString();
hText.Brush = new StiSolidBrush(Color.Orange);
hText.Border.Side = StiBorderSides.All;
//hText.Text.Font.Name = Font.";
//hText.Font.Size = 15;
headerBand.Components.Add(hText);

StiText dataText = new StiText(new RectangleD(pos, 0, columnWidth, 0.5));

dataText.Text = "{TBL_System_User." + Stimulsoft.Report.CodeDom.StiCodeDomSerializator.R eplaceSymbols(dataColumn.ColumnName) + "}";
dataText.Name = "DataText" + nameIndex.ToString();
dataText.Border.Side = StiBorderSides.All;

dataBand.Components.Add(dataText);
pos = pos + columnWidth;
nameIndex++;
}


report.Compile();
//StiWebViewer1.Report = report;//For win app
return report;
}