I tried to test creating an report by c#-Code.
Code: Select all
using System;
using System.Drawing;
using System.Drawing.Text;
using System.Windows;
using Stimulsoft.Base.Drawing;
using Stimulsoft.Report;
using Stimulsoft.Report.Components;
using Stimulsoft.Report.Events;
namespace ReportTest
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
StiReport report = new StiReport
{
ReportName = "ZV",
ReportCreated = DateTime.Now,
ReportUnit = StiReportUnitType.Millimeters,
ScriptLanguage = StiReportLanguageType.CSharp
};
StiPage page = new StiPage
{
Name = "Page1",
Height = 297,
Width = 210,
Guid = new Guid().ToString(),
Border =
new StiBorder(StiBorderSides.None, Color.Black, 4, StiPenStyle.Solid, false, 4,
new StiSolidBrush(Color.Black), false),
Brush = new StiSolidBrush(Color.Transparent),
ExcelSheetValue = null,
Margins = new StiMargins(1, 1, 1, 1),
Report = report
};
StiText header = new StiText
{
Name = "HeaderText",
ClientRectangle = new RectangleD(new PointD(22.5, 18), new SizeD(152.5, 6)),
HorAlignment = StiTextHorAlignment.Left,
VertAlignment = StiVertAlignment.Center,
Type = StiSystemTextType.Expression,
Font = new Font("Arial", 13f, System.Drawing.FontStyle.Bold),
Margins = new StiMargins(0, 0, 0, 0),
TextBrush = new StiSolidBrush(Color.Black),
TextOptions = new StiTextOptions(false, false, true, 0f, HotkeyPrefix.None, StringTrimming.Word),
Page = page,
Parent = page,
Printable = true,
PrintOn = StiPrintOnType.AllPages,
Border =
new StiBorder(StiBorderSides.None, Color.Black, 1, StiPenStyle.Solid, false, 4,
new StiSolidBrush(Color.Black), false),
Brush = new StiSolidBrush(Color.Transparent),
Guid = null,
Indicator = null,
Interaction = null
};
header.GetValue += new StiGetValueEventHandler(GetHeaderTextValue);
page.Components.AddRange(new StiComponent[] {header});
report.Pages.Clear();
report.Pages.AddRange(new StiPage[] {page});
report.Render(true);
stiWpfViewerControl1.Report = report;
}
private void GetHeaderTextValue(object sender, StiGetValueEventArgs e)
{
e.Value = "Vollstreckungsauftrag an die Ferichtsvollzieherin/den Gerichtsvollzieher";
}
}
}
Thanks for help.