Loading a Form from Resource
Our sample projects and report templates can help you learn the basics of working with our products.Load an embedded MRT form with LoadFromResource, export it to PDF, and open the generated document.
Resolving the embedded template. Instead of relying on an external file, the application reads the MRT definition from the assembly resource collection.
Loading and exporting it. The sequence in
Resource names. The namespace and embedded file name must match the manifest resource name generated by the project.
Resolving the embedded template. Instead of relying on an external file, the application reads the MRT definition from the assembly resource collection.
Loading and exporting it. The sequence in
Loading a Form from Resource/Program.cs identifies the resource, loads it into StiForm, and produces the PDF:var form = new StiForm();
form.LoadFromResource(
Type.GetType("Loading_a_Form_from_Resource.Program").Assembly,
"Loading a Form from Resource.Data.SoftwareEvaluationSurvey.mrt");
var exporter = new StiPdfExporter();
var pdf = exporter.ExportForm(form);
string path = "form.pdf";
File.WriteAllBytes(path, pdf);
Process.Start(new ProcessStartInfo(path) { UseShellExecute = true });Resource names. The namespace and embedded file name must match the manifest resource name generated by the project.