View Full Version : مبتدی: سوال در مورد دسترسی خاصیت text سلول های جداول در stimulsoft reports از طریق کد c#
hmdhamed
جمعه 20 آبان 1390, 13:16 عصر
سلام میخواستم بپرسم میشه مستقیم از کد سی شارپ به سلول های یک table تو گزارش stimul دسترسی پیدا کرد و مقدار بهش داد یا مقدارش رو خوند؟ این سوال رو در تاپیک مشکلات stimulreports مطرح کردم کسی جوابمو نداد یبه همین خاطر تاپیک جدید ایجاد کردم. برای توضیح مثلا
stiReport1.load("report1"); stiReport.Compile(); بعد یه جوری stiReport.Something.table1.cell59.value یا یه چیزی مثل این هست؟ اینجوری نوشتم تا منظورمو برسونم! چون اینو تو help دیده بودم
StiReport report = new StiReport();
rreport.Load("Variables.mrt");
report.Compile();
//Set Variable
report["myvariable"] = 123;
report.Render();
iman_22a
جمعه 20 آبان 1390, 14:53 عصر
با کد نویسی میشه به اشیاء موجود در فایل گزارش استیمول دسترسی پیدا کرد . من خودم گروه بندی اطلاعات را هم با کد نویسی تغییر می دم ( مثلا خاصیت Condition از GroupHeaderBand تغییر می دم یا اگر مثلا شیء لیبلی یا ... وجود داشت به متن اون دسترسی پیدا می کنم و عوضش می کنم ) . برای اینکار شما باید به نسبت قرارگیری اشیاء موجود در گزارش در درخت Report Tree ، برای هر شی نمونه سازی کنین تا به شی مورد نظر خودتون برسین ( با Ctype )
hmdhamed
جمعه 20 آبان 1390, 17:05 عصر
خیلی ممنون از راهنماییت. میشه نمونه کدش رو هم بنویسی چون من تازه شروع به کار با stimulreports کردم.
stiReport1.Load("stiReport1.mrt");
stiReport1.Compile();
stiReport1.Pages[1].Components["Table1_Cell1"].?
یا
stiReport1.Pages[1].Components["Table1"].Table1_Cell1.text البته کداش درست نیست همینجوری مثال زدم. معادل درست این کدها برای دسترسی به خاصیت text یک cell چیه؟
77729
iman_22a
جمعه 20 آبان 1390, 18:16 عصر
StiReport1.Reset()
Dim databand As New StiDataBand
If tbl.Rows.Count > 0 Then
If rbNone.Checked = True Then
StiReport1.Load("mrt/frmSReport.mrt")
ElseIf Me.rbNone2.Checked = True Then
StiReport1.Load("mrt/frmSReport_grouped.mrt")
Else
StiReport1.Load("mrt/frmSReport_grouped2.mrt")
End If
databand = CType(StiReport1.Pages(0).Components.Item("DataOxinBar"), StiDataBand)
Dim rtb2 As StiReportTitleBand = CType(StiReport1.Pages(0).Components.Item("ReportTitle1"), StiReportTitleBand)
Dim Text_Date As StiText = CType(rtb2.Components.Item("Text_Date"), StiText)
Text_Date.Text = clsfunctions.Reverse(fdt.To_Hejri(Now))
Dim Text_Desc As StiText = CType(rtb2.Components.Item("Text_Desc"), StiText)
If rbNone.Checked = False Then
Dim checked_rb As String = ""
If rbAlloy.Checked = True Then
checked_rb = "Alloy"
ElseIf rbSender.Checked = True Then
checked_rb = "Sender"
ElseIf rbReciever.Checked = True Then
checked_rb = "Reciever"
ElseIf rbRecieveDate.Checked = True Then
checked_rb = "RecieveDate"
ElseIf rbTransporter.Checked = True Then
checked_rb = "Transporter"
ElseIf rbDastoor_Haml.Checked = True Then
checked_rb = "Dastoor_Haml"
ElseIf rbDriverName.Checked = True Then
checked_rb = "DriverName"
ElseIf rbTrailerPelak.Checked = True Then
checked_rb = "TrailerPelak"
ElseIf rbOrderNo.Checked = True Then
checked_rb = "OrderNo"
End If
Dim ghb1 As StiGroupHeaderBand = CType(StiReport1.Pages(0).Components.Item("GroupHeaderBand1"), StiGroupHeaderBand)
Dim cond As New StiCondition
Dim expr As New StiExpression
expr.Value = "{OxinReport." & checked_rb & "}"
cond.Expression = expr
ghb1.Condition.Value = expr.Value
Dim txt_Group As StiText = CType(ghb1.Components.Item("txt_Group"), StiText)
txt_Group.Text = expr.Value
Dim lbl_Group As StiText = CType(ghb1.Components.Item("lbl_Group"), StiText)
lbl_Group.Text = DirectCast(FindControl("rb" + checked_rb, Me), RadioButton).Text
If Me.rbNone2.Checked = False Then
Dim checked_rb1 As String = ""
If rbAlloy1.Checked = True Then
checked_rb1 = "Alloy"
ElseIf rbReciever1.Checked = True Then
checked_rb1 = "Reciever"
ElseIf rbSender1.Checked = True Then
checked_rb1 = "Sender"
ElseIf rbRecieveDate1.Checked = True Then
checked_rb1 = "RecieveDate"
ElseIf rbTransporter1.Checked = True Then
checked_rb1 = "Transporter"
ElseIf rbDastoor_Haml1.Checked = True Then
checked_rb1 = "Dastoor_Haml"
ElseIf rbDriverName1.Checked = True Then
checked_rb1 = "DriverName"
ElseIf rbTrailerPelak1.Checked = True Then
checked_rb1 = "TrailerPelak"
ElseIf rbOrderNo1.Checked = True Then
checked_rb1 = "OrderNo"
End If
Dim ghb2 As StiGroupHeaderBand = CType(StiReport1.Pages(0).Components.Item("GroupHeaderBand2"), StiGroupHeaderBand)
Dim cond1 As New StiCondition
Dim expr1 As New StiExpression
expr1.Value = "{OxinReport." & checked_rb1 & "}"
cond1.Column = checked_rb1
ghb2.Condition.Value = expr1.Value
Dim txt_Group1 As StiText = CType(ghb2.Components.Item("txt_Group2"), StiText)
txt_Group1.Text = expr1.Value
Dim lbl_Group1 As StiText = CType(ghb2.Components.Item("lbl_Group2"), StiText)
lbl_Group1.Text = DirectCast(FindControl("rb" & checked_rb1 & "1", Me), RadioButton).Text
End If
End If
End If
این قطعه کدیه که من نوشتم . کمی طولانیه روشش ، ممکنه با روشی که انجام دادین هم به نتیجه برسین .
stiReport1.Pages[1].Components["Table1"].Table1_Cell1.text
کد من VB هستش اگر بدرد بخور بود تبدیلش کنین به #C
hmdhamed
جمعه 20 آبان 1390, 18:39 عصر
الان میشه با همین VB دسترسی به مقدار text رو با توجه به شکلی که نوشتم بنویسید و اگه ممکنه ساده تر باشه :لبخندساده:
iman_22a
شنبه 21 آبان 1390, 02:10 صبح
الان میشه با همین VB دسترسی به مقدار text رو با توجه به شکلی که نوشتم بنویسید و اگه ممکنه ساده تر باشه :لبخندساده:
بیا دوست عزیز :
Dim stiTable As Stimulsoft.Report.Components.Table.StiTable = CType(StiReport1.Pages(0).Components.Item("Table1"), Table.StiTable)
Dim tc1 As Table.StiTableCell = CType(stiTable.Components("Table1_Cell1"), Table.StiTableCell)
tc1.Text = "Iman"
امیدوارم بدردت بخوره .
البته یادت نره :
Imports Stimulsoft.Report.Components
Imports Stimulsoft.Report
زحمت تبدیلش با شما ، البته راحت هم هست .
esialex
دوشنبه 29 اسفند 1390, 19:09 عصر
سلام
اگر از text box داخل stimul استفاده می کنی ابتدا باید از شی داخل کد نویسی سی شارپ نمونه بسازی بدین صورت
StiText Rtxttel = sr.GetComponents()["txtTel"] as StiText;
Rtxttel.Text = txttel.Text;
اما اگر از text box در data Band استفاده می کنی و می خواهی که از بانک پر شود باید بدونی که از کدام ستون جدول استفاده کنی مثلا نام در بانک Name
داخل text box که در stimul هست به اینصورت می نویسی({dt.Name})
حالا باید با کد نویسی پرش کنی
نکته:dt یک نام دلخواست
کد کامل
DataTable dt5 =new DataTable ();
Stimulsoft.Report.StiReport sr = new Stimulsoft.Report.StiReport();
sr.Load("mojavez.mrt");
dt5.TableName = "dt";
StiDataBand band = sr.GetComponents()["DataBand1"] as StiDataBand;
band.DataSourceName = "dt";
StiText txtid1 = sr.GetComponents()["txtid1"] as StiText;
StiText txtid2 = sr.GetComponents()["txtid2"] as StiText;
StiText txtid3 = sr.GetComponents()["txtid3"] as StiText;
StiText txtfather = sr.GetComponents()["txtfather"] as StiText;
StiText txtname = sr.GetComponents()["txtName"] as StiText;
StiText txtdSadere = sr.GetComponents()["txtsadre"] as StiText;
StiText txtShsh = sr.GetComponents()["txtshsh"] as StiText;
StiText txtname2 = sr.GetComponents()["txtname2"] as StiText;
StiText txtaAddress = sr.GetComponents()["txtAddress"] as StiText;
StiText Rtxtdate = sr.GetComponents()["txtdate"] as StiText;
StiText Rtxttel = sr.GetComponents()["txtTel"] as StiText;
Rtxttel.Text = txttel.Text;
txtid1.Text = txtid2.Text = txtid3.Text = txtmozayede.Text;
txtfather.Text = txtFather.Text;
txtname.Text = txtname2.Text = txtName.Text + " " + txtFamily.Text;
txtdSadere.Text = txtsadere.Text;
txtShsh.Text = txtshsh.Text;
txtaAddress.Text = txtaddress.Text;
Rtxtdate.Text = txtdate.Text;
sr.RegData(dt5);
sr.Dictionary.Synchronize();
sr.Show();
امیدوارم تونسته باشم کمکی کنم
robat7
سه شنبه 08 فروردین 1391, 22:43 عصر
امیدوارم مشکلت تا حالا حل شده باشد
من اینطور مقدار Textbox را مقدار دهی می نمایم
crystalReportViewer1.ReportSource = ReportPath;
CrystalDecisions.CrystalReports.Engine.ReportDocum ent r = new CrystalDecisions.CrystalReports.Engine.ReportDocum ent();
r.Load(ReportPath);
//((CrystalDecisions.CrystalReports.Engine.TextObjec t)rd.ReportDefinition.ReportObjects["text1"]).Text = "Italy Wins!!";
((CrystalDecisions.CrystalReports.Engine.TextObjec t)r.ReportDefinition.ReportObjects["Requester"]).Text = ID_Requester;
vBulletin® v4.2.5, Copyright ©2000-1404, Jelsoft Enterprises Ltd.