本文整理汇总了C#中StiReport.LoadFromString方法的典型用法代码示例。如果您正苦于以下问题:C# StiReport.LoadFromString方法的具体用法?C# StiReport.LoadFromString怎么用?C# StiReport.LoadFromString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StiReport
的用法示例。
在下文中一共展示了StiReport.LoadFromString方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MakeReport
protected override StiReport MakeReport(System.Data.DataSet ds)
{
StiReport report = new StiReport();
AccountReportType byName = AccountReportType.GetByName("Уведомление для Грозного, без долга");
report.LoadFromString(byName.Template);
report.EngineVersion = StiEngineVersion.EngineV2;
report.ReportCacheMode = StiReportCacheMode.Off;
report.Compile();
report.RegData((System.Data.DataSet) ds);
return report;
}
示例2: CalcHouseCounterServicesReportFor354
public static void CalcHouseCounterServicesReportFor354(System.Windows.Forms.IWin32Window owner, long calcId, System.DateTime period, long serviceId)
{
ObjectList<RepReportTemplate> list = RepReportTemplate.FindByName("09.01.01 Детализация по коллективным приборам учета");
if (list.get_Count() > 0)
{
RepReportTemplate template = list.get_Item(0);
System.Data.SqlClient.SqlParameter[] parameters = new System.Data.SqlClient.SqlParameter[3];
parameters[0] = new System.Data.SqlClient.SqlParameter("@calcId", System.Data.SqlDbType.BigInt);
parameters[0].set_Value((long) calcId);
parameters[1] = new System.Data.SqlClient.SqlParameter("@period", System.Data.SqlDbType.DateTime);
parameters[1].set_Value(period);
parameters[2] = new System.Data.SqlClient.SqlParameter("@serviceId", System.Data.SqlDbType.BigInt);
if (serviceId > 0L)
{
parameters[2].set_Value((long) serviceId);
}
else
{
parameters[2].set_Value(System.DBNull.Value);
}
System.Data.DataSet set = DALSql.ExecuteDataSet("exec " + template.Sql + " @calcId, @period, @serviceId", parameters);
StiReport report = new StiReport();
report.LoadFromString(template.Template);
report.Compile();
report.RegData((System.Data.DataSet) set);
if (User.IsMemberOf(RightsEnum.ОтчетыРедактированиеШаблона))
{
report.Design(true, (System.Windows.Forms.IWin32Window) owner);
if (System.Windows.Forms.DialogResult.Yes == Messages.QuestionYesNo(owner, "Сохранить изменения в шаблоне?"))
{
template.Template = report.SaveToString();
template.SaveChanges();
}
}
else
{
report.Show((System.Windows.Forms.IWin32Window) owner);
}
}
}
示例3: AccountServicesNotificationReport
private void AccountServicesNotificationReport(AccountReportType accountReportType)
{
Account currentAccount = this.CurrentAccount;
if (currentAccount.Id != Account.Null.Id)
{
System.DateTime date = System.DateTime.Now.Date;
System.Data.DataSet set = Mappers.SimpleReportMapper.GetAccountServicesNotification(currentAccount.Id, date, 0L, 0L);
if (((set != null) && (set.Tables.get_Count() == 2)) && (set.Tables.get_Item(0).Rows.get_Count() != 0))
{
set.Tables.get_Item(0).set_TableName("dataHeader");
set.Tables.get_Item(1).set_TableName("dataServices");
StiReport report = new StiReport();
if (accountReportType.Template.get_Length() > 0)
{
report.LoadFromString(accountReportType.Template);
}
report.Compile();
report.RegData((System.Data.DataSet) set);
report.Render(true);
if (accountReportType.Name == "Уведомление для Грозного, без долга")
{
StimulsoftUtilsOptions options = new StimulsoftUtilsOptions(false);
report.Show((System.Windows.Forms.IWin32Window) this.ContentControl);
options.RestoreValues();
}
else
{
report.Show((System.Windows.Forms.IWin32Window) this.ContentControl);
}
}
}
}
示例4: tsbRunReport_Click
private void tsbRunReport_Click(object sender, System.EventArgs e)
{
if (this.m_SearchWorker.get_IsBusy())
{
if (System.Windows.Forms.MessageBox.Show("Вы хотите отменить выполнение очёта?", "Подтверждение отмены", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Exclamation) != System.Windows.Forms.DialogResult.No)
{
this.m_SearchWorker.CancelAsync();
try
{
ReportGenerator.Chancel();
}
catch (System.Exception)
{
}
this.tsbRunReport.set_Text("Выполнить");
this.m_report.Status = 3;
this.m_report.Error = "Выполнение этого отчёта было отменено пользователем";
this.tslbRunReportImageLoading.set_Visible(false);
}
}
else
{
try
{
if (this.cbWithRenderParametres.get_Checked())
{
RepReport report = this.InsertReportIntoGeneratorQueue();
if ((report != null) && (report != RepReport.Null))
{
if ((report.Status != 0) || (report.ReportTemplateId == 0L))
{
throw new System.ApplicationException("Отчет непригоден для выполнения (id=" + ((long) report.Id) + ")");
}
RepReportTemplate withTemplate = RepReportTemplate.GetWithTemplate(report.ReportTemplateId);
if ((withTemplate == null) || (withTemplate.Sql == string.Empty))
{
throw new System.ApplicationException("Отчет непригоден для выполнения (id=" + ((long) report.Id) + ")");
}
try
{
report.Status = 1;
report.SaveChanges();
System.Data.DataSet set = Mappers.RepReportMapper.GenerateReportDataSet(withTemplate.Sql, report.Id);
StiReport report2 = new StiReport();
report2.LoadFromString(withTemplate.Template);
report2.RegData((System.Data.DataSet) set);
StiOptions.Designer.DontAskSaveReport = true;
report2.Show((System.Windows.Forms.Form) this);
}
catch (System.Exception exception)
{
AIS.SN.UI.Messages.ShowException(this, exception);
}
this.UpdateBingingReports();
}
}
else
{
this.tslbRunReportImageLoading.set_Visible(true);
this.tsbRunReport.set_Text("Отменить");
this.m_report = this.InsertReportIntoGeneratorQueue();
if (this.m_report == null)
{
this.tslbRunReportImageLoading.set_Visible(false);
}
else
{
this.m_SearchWorker.RunWorkerAsync();
}
}
}
catch (System.Exception)
{
this.tsbRunReport.set_Text("Выполнить");
this.tslbRunReportImageLoading.set_Visible(false);
}
}
}
示例5: tsbDesigner_Click
private void tsbDesigner_Click(object sender, System.EventArgs e)
{
RepReport report = this.InsertReportIntoGeneratorQueue();
if ((report != null) && (report != RepReport.Null))
{
if ((report.Status != 0) || (report.ReportTemplateId == 0L))
{
throw new System.ApplicationException("Отчет непригоден для выполнения (id=" + ((long) report.Id) + ")");
}
RepReportTemplate withTemplate = RepReportTemplate.GetWithTemplate(report.ReportTemplateId);
if ((withTemplate == null) || (withTemplate.Sql == string.Empty))
{
throw new System.ApplicationException("Отчет непригоден для выполнения (id=" + ((long) report.Id) + ")");
}
try
{
report.Status = 1;
report.SaveChanges();
System.Data.DataSet set = Mappers.RepReportMapper.GenerateReportDataSet(withTemplate.Sql, report.Id);
StiReport report2 = new StiReport();
report2.LoadFromString(withTemplate.Template);
report2.RegData((System.Data.DataSet) set);
StiOptions.Designer.DontAskSaveReport = true;
report2.Design(true, (System.Windows.Forms.IWin32Window) this);
if (System.Windows.Forms.DialogResult.Yes == AIS.SN.UI.Messages.QuestionYesNo(this, "Сохранить изменения в шаблоне?"))
{
withTemplate.Template = report2.SaveToString();
withTemplate.SaveChanges();
}
}
catch (System.Exception exception)
{
AIS.SN.UI.Messages.ShowException(this, exception);
}
this.UpdateBingingReports();
}
}
示例6: m_WorkerGetNotices_RunWorkerCompleted
private void m_WorkerGetNotices_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
if (this.m_WorkerGetNoticeMode == WorkerGetNoticeMode.Извещения)
{
StiReport report = new StiReport();
report.Load(Resources.Rep_PayNotices);
report.Compile();
report.RegData((System.Data.DataSet) this.m_DataSet);
this.tsBtnShowReports.set_Image(null);
Manager.SetStiViewerPageManagement(false);
report.Show((System.Windows.Forms.Form) base.FindForm());
}
else if (this.m_WorkerGetNoticeMode == WorkerGetNoticeMode.Уведомления)
{
AccountReportType byName = AccountReportType.GetByName("Уведомление для Грозного, долг");
if (byName.IsEnabled)
{
StiReport report2 = new StiReport();
if (byName.Template.get_Length() > 0)
{
report2.LoadFromString(byName.Template);
}
report2.Compile();
report2.RegData((System.Data.DataSet) this.m_DataSet);
this.tsBtnShowReports.set_Image(null);
Manager.SetStiViewerPageManagement(false);
report2.Render(true);
report2.Show((System.Windows.Forms.Form) base.FindForm());
}
}
}
示例7: GenereateLkInformation
private void GenereateLkInformation(string url, string login, string pass)
{
StiReport report = new StiReport();
AccountReportType byName = AccountReportType.GetByName("Личный кабинет. Регистрация");
report.LoadFromString(byName.Template);
report.Compile();
report["url"] = url;
report["login"] = login;
report["pass"] = pass;
report.Show();
}
示例8: workerExportPdf_DoWork
private void workerExportPdf_DoWork(object sender, DoWorkEventArgs e)
{
char[] chArray2;
int num12;
int num13;
object obj2;
char[] invalidFileNameChars = System.IO.Path.GetInvalidFileNameChars();
BackgroundWorker worker = sender as BackgroundWorker;
NoticeExportPdfParams @params = e.get_Argument() as NoticeExportPdfParams;
ObjectList<NoticeNotice> notices = @params.Notices;
int num = 0;
if (this.rbExportAccountNotices.get_Checked())
{
foreach (NoticeNotice notice in notices)
{
if (worker.get_CancellationPending())
{
e.set_Cancel(true);
break;
}
string str2 = string.IsNullOrEmpty(notice.HouseHolderName) ? ((string) "Неизвестная УК") : notice.HouseHolderName;
chArray2 = invalidFileNameChars;
num12 = 0;
while (num12 < chArray2.Length)
{
char ch = chArray2[num12];
str2 = str2.Replace(ch, ' ');
num12 = (int) (num12 + 1);
}
str2 = str2.Trim();
System.IO.DirectoryInfo info = new System.IO.DirectoryInfo(System.IO.Path.Combine(@params.PeriodDirectory.get_FullName(), str2));
if (!info.get_Exists())
{
info.Create();
}
ObjectList<NoticeNotice> list2 = new ObjectList<NoticeNotice>();
list2.Add(notice);
try
{
using (System.Data.DataTable table = NoticeNotice.GetHeader(list2, this.cbHideClosedAccounts.get_Checked(), this.cbNoticeInformation.get_Checked()))
{
table.set_TableName("header");
using (System.Data.DataSet set = NoticeNotice.GetReport(list2, @params.NoticeTemplate.Sql))
{
if ((set.Tables.get_Count() < 2) || (set.Tables.get_Item(0).Rows.get_Count() == 0))
{
continue;
}
bool flag = false;
foreach (System.Data.DataRow row in table.Rows)
{
if (System.Convert.ToInt64(row.get_Item("id")) == notice.Id)
{
foreach (System.Data.DataRow row2 in set.Tables.get_Item(0).Rows)
{
if (System.Convert.ToInt64(row2.get_Item("id")) == notice.Id)
{
flag = true;
break;
}
}
}
}
if (!flag)
{
continue;
}
set.Tables.get_Item(0).set_TableName("pays");
set.Tables.get_Item(1).set_TableName("counter");
for (int i = 2; i < set.Tables.get_Count(); i = (int) (i + 1))
{
num13 = (int) (i - 1);
set.Tables.get_Item(i).set_TableName("data" + ((int) num13).ToString());
}
if (@params.NoticeTemplate.IdentityName == "Счет на оплату Ульяновск вариант 3")
{
if (set.Tables.get_Count() > 2)
{
set.Tables.get_Item(2).set_TableName("organizations");
}
if (set.Tables.get_Count() > 3)
{
set.Tables.get_Item(3).set_TableName("rates");
}
}
using (StiReport report = new StiReport())
{
report.LoadFromString(@params.NoticeTemplate.Template);
report.ReportCacheMode = StiReportCacheMode.Off;
report.Compile();
foreach (System.Data.DataTable table2 in set.Tables)
{
report.RegData(table2.get_TableName(), (System.Data.DataTable) table2);
}
report.RegData("header", (System.Data.DataTable) table);
string accountNumber = notice.AccountNumber;
string str5 = System.IO.Path.Combine(info.get_FullName(), accountNumber);
if (System.IO.File.Exists(str5 + ".pdf"))
{
int num5 = 1;
//.........这里部分代码省略.........
示例9: btPrint_Click
private void btPrint_Click(object sender, System.EventArgs e)
{
NoticeNoticeTemplate template = (this.bsNoticeTemplates.get_Current() as NoticeNoticeTemplate) ?? NoticeNoticeTemplate.Null;
if (this.bsNotices.get_Count() == 0)
{
Messages.ShowMessage("Для печати ничего не найдено");
}
else if (template == NoticeNoticeTemplate.Null)
{
Messages.ShowMessage("Не выбран шаблон");
}
else
{
template = ObjectWithId.FindById<NoticeNoticeTemplate>(template.Id);
System.Data.DataTable table = NoticeNotice.GetHeader((ObjectList<NoticeNotice>) this.bsNotices.get_DataSource(), this.cbHideClosedAccounts.get_Checked(), this.cbNoticeInformation.get_Checked());
table.set_TableName("header");
System.Data.DataSet set = NoticeNotice.GetReport((ObjectList<NoticeNotice>) this.bsNotices.get_DataSource(), template.Sql);
if ((set.Tables.get_Count() >= 2) && (set.Tables.get_Item(0).Rows.get_Count() != 0))
{
set.Tables.get_Item(0).set_TableName("pays");
set.Tables.get_Item(1).set_TableName("counter");
for (int i = 2; i < set.Tables.get_Count(); i = (int) (i + 1))
{
int num2 = (int) (i - 1);
set.Tables.get_Item(i).set_TableName("data" + ((int) num2).ToString());
}
if (template.IdentityName == "Счет на оплату Ульяновск вариант 3")
{
if (set.Tables.get_Count() > 2)
{
set.Tables.get_Item(2).set_TableName("organizations");
}
if (set.Tables.get_Count() > 3)
{
set.Tables.get_Item(3).set_TableName("rates");
}
}
StiReport report = new StiReport();
report.LoadFromString(template.Template);
report.ReportCacheMode = StiReportCacheMode.Off;
report.Compile();
foreach (System.Data.DataTable table2 in set.Tables)
{
report.RegData(table2.get_TableName(), (System.Data.DataTable) table2);
}
report.RegData("header", (System.Data.DataTable) table);
report.ReportCacheMode = StiReportCacheMode.Off;
report.Compile();
if (this.chbxIsDesignTemplate.get_Checked())
{
StiOptions.Designer.DontAskSaveReport = true;
report.Design(true);
if ((report.SaveToString() != template.Template) && (System.Windows.Forms.DialogResult.Yes == Messages.QuestionYesNo(this, "Сохранить изменения в шаблоне?")))
{
template.Template = report.SaveToString();
template.SaveChanges();
}
}
else
{
report.Render(true);
report.Show(true);
}
}
}
}
示例10: tsbRun_Click
private void tsbRun_Click(object sender, System.EventArgs e)
{
System.Data.DataSet set = this.m_debtDocument.GenerateReportDebtSetNotices(this.m_DebtListNotices.procedureName, this.dbPayNotices.Value, this.cbAddDebtActionNotices.get_Checked(), (int) this.MinCountDebt.Value, (int) this.ColDayPerformance.Value, this.m_DebtListNotices.Id, this.m_SelectedAccounts);
set.Tables.get_Item(0).set_TableName("data");
DebtListNotices notices = ObjectWithId.FindById<DebtListNotices>(this.m_DebtListNotices.Id);
StiReport report = new StiReport();
report.LoadFromString(notices.template);
report.RegData((System.Data.DataSet) set);
StiOptions.Designer.DontAskSaveReport = true;
report.Show((System.Windows.Forms.Form) this);
}
示例11: tsbDesigner_Click
private void tsbDesigner_Click(object sender, System.EventArgs e)
{
System.Data.DataSet set = this.m_debtDocument.GenerateReportDebtSetNotices(this.m_DebtListNotices.procedureName, this.dbPayNotices.Value, this.cbAddDebtActionNotices.get_Checked(), (int) this.MinCountDebt.Value, (int) this.ColDayPerformance.Value, this.m_DebtListNotices.Id, this.m_SelectedAccounts);
set.Tables.get_Item(0).set_TableName("data");
StiReport report = new StiReport();
DebtListNotices notices = ObjectWithId.FindById<DebtListNotices>(this.m_DebtListNotices.Id);
report.LoadFromString(notices.template);
report.RegData((System.Data.DataSet) set);
StiOptions.Designer.DontAskSaveReport = true;
report.Design(true, (System.Windows.Forms.IWin32Window) this);
if (System.Windows.Forms.DialogResult.Yes == Messages.QuestionYesNo(this, "Сохранить изменения в шаблоне?"))
{
notices.template = report.SaveToString();
notices.SaveChanges();
}
}
示例12: MakeReport
public StiReport MakeReport(System.Data.DataSet ds, bool? showSaveButtons, string watermarkText, float? watermarkSize)
{
if (this.m_UseNoticeReportGenerator)
{
ObjectList<Organization> list = new ObjectList<Organization>();
ObjectList<NoticeNoticeTemplateSetting> list2 = new ObjectList<NoticeNoticeTemplateSetting> {
this.m_NoticeNoticeTemplateSetting
};
ActionDetails details = new ActionDetails(false) {
Period = this.m_NoticePeriod,
HouseHolders = list,
AreaId = this.m_Area.Id,
NoticeNoticeTemplateSettings = list2,
FetchOnly = false,
ForceGenerate = this.m_GenerateBeforeView,
PrintTypeId = FasetItem.Null.Id,
FilterMinDebt = (decimal) System.Convert.ToInt64(this.FilterMinDebt),
FixedShowDebt = (decimal) System.Convert.ToInt64(this.FixedShowDebt),
IsGenerate = true,
IsExportPDF = false,
IsShow = true,
EditInDesign = false,
IsClearData = false,
IsClearRendered = false
};
details.Logger.UseFileLog = false;
details.Logger.ExceptionLog.UseFileLog = false;
NoticeGenerationWorker worker = new NoticeGenerationWorker {
Action = details
};
worker.DoActionSync();
if ((!worker.IsBreak && !worker.IsChancel) && (worker.Action.ReportResult != null))
{
return worker.Action.ReportResult;
}
return null;
}
StiReport report = new StiReport();
if (showSaveButtons.get_HasValue())
{
this.m_StimulsoftUtilsOptions = new StimulsoftUtilsOptions(showSaveButtons.Value);
}
report.LoadFromString(this.m_NoticeNoticeTemplateSetting.Template.Template);
report.ReportCacheMode = StiReportCacheMode.Off;
if (watermarkText != null)
{
foreach (StiPage page in report.Pages)
{
page.Watermark.Text = watermarkText;
if (watermarkSize.get_HasValue())
{
page.Watermark.Font = (System.Drawing.Font) new System.Drawing.Font("Arial", watermarkSize.Value);
}
}
}
report.Compile();
report.RegData((System.Data.DataSet) ds);
report.ReportCacheMode = StiReportCacheMode.Off;
report.Compile();
return report;
}
示例13: Generate
public static void Generate(ref RepReport report)
{
if ((((report.PlannedDate == Constants.NullDate) || (((System.DateTime.Now.get_Hour() <= 6) || (System.DateTime.Now.get_Hour() >= 20)) && (countWorkedHeavyReports <= 3))) || !RepHeavyReport.AllHeavyReports().Contains(report.ReportTemplateId)) && ((report != null) && (report != RepReport.Null)))
{
if ((report.Status != 0) || (report.ReportTemplateId == 0L))
{
throw new System.ApplicationException("Отчет непригоден для выполнения");
}
RepReportTemplate withTemplate = RepReportTemplate.GetWithTemplate(report.ReportTemplateId);
if ((withTemplate == null) || (withTemplate.Sql == string.Empty))
{
throw new System.ApplicationException("Отчет непригоден для выполнения");
}
report.Status = 1;
report.StartTime = System.DateTime.Now;
report.SaveChanges();
countWorkedHeavyReports = (int) (countWorkedHeavyReports + 1);
try
{
System.Data.DataSet set = Mappers.RepReportMapper.GenerateReportDataSet(withTemplate.Sql, report.Id);
report.FinishTime = System.DateTime.Now;
System.IO.MemoryStream stream = new System.IO.MemoryStream();
System.IO.MemoryStream stream2 = new System.IO.MemoryStream();
lock (LockRepObject)
{
try
{
if (withTemplate.IsSimpleTable || withTemplate.IsTxt)
{
report.ds = set;
if (report.PlannedDate != Constants.NullDate)
{
new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter().Serialize(stream, set);
}
}
else
{
StiReport report2 = new StiReport();
report2.LoadFromString(withTemplate.Template);
report2.ReportCacheMode = StiReportCacheMode.Off;
report2.Compile();
report2.RegData((System.Data.DataSet) set);
report2.Render(false);
stream = new System.IO.MemoryStream(report2.SaveDocumentToByteArray());
}
if (stream.get_Length() != 0L)
{
stream2 = new System.IO.MemoryStream();
GZipStream stream3 = new GZipStream(stream2, CompressionMode.Compress, true);
stream3.Write(stream.ToArray(), 0, (int) ((int) stream.get_Length()));
stream3.Close();
report.PackedResult = stream2.ToArray();
}
}
catch (System.Exception exception)
{
System.Windows.Forms.MessageBox.Show(exception.get_Message());
}
}
report.Status = 2;
report.SaveChanges();
report.PackedResult = stream2.ToArray();
}
catch (System.Exception)
{
report.Status = 0;
report.SaveChanges();
throw;
}
countWorkedHeavyReports = (int) (countWorkedHeavyReports - 1);
currentWorkedThread = null;
}
}
示例14: tsbDesigner_Click
private void tsbDesigner_Click(object sender, System.EventArgs e)
{
StiReport report = new StiReport();
AccountReportType byName = AccountReportType.GetByName("Личный кабинет. Регистрация");
report.LoadFromString(byName.Template);
StiOptions.Designer.DontAskSaveReport = true;
report.Design(true, (System.Windows.Forms.IWin32Window) this);
if (System.Windows.Forms.DialogResult.Yes == Messages.QuestionYesNo(this, "Сохранить изменения в шаблоне?"))
{
byName.Template = report.SaveToString();
byName.SaveChanges();
}
}