Berichte werden jetzt generiert, jedoch liegt es noch im bin datei dann

This commit is contained in:
Husky
2018-07-08 21:18:22 +02:00
parent 1a47c877b4
commit f7be4f6237
13 changed files with 232 additions and 321 deletions

View File

@@ -33,7 +33,7 @@ namespace BerichtGen
}
WordDocument wordDocument = new WordDocument("./documents/JUME/liner_einbau.docx");
/*
string[] fieldnames = null;
string[] fieldvalues = null;
@@ -57,14 +57,14 @@ namespace BerichtGen
}
counter++;
}
*/
//wordDocument.MailMerge.Execute(fieldnames, fieldvalues);
wordDocument.MailMerge.MergeImageField += new MergeImageFieldEventHandler(MailMerge_MergeImageField);
string[] fieldNames = new string[] { "UVImage" };
string[] fieldValues = new string[] { "test.png" };
wordDocument.MailMerge.Execute(fieldNames, fieldValues);
//string[] fieldNames = new string[] { "UVImage" };
//string[] fieldValues = new string[] { "test.png" };
wordDocument.MailMerge.Execute(fieldnames, fieldvalues);
wordDocument.Save("test.docx", Syncfusion.DocIO.FormatType.Docx);
wordDocument.Close();
//wordDocument.MailMerge.ExecuteGroup()
@@ -114,9 +114,10 @@ namespace BerichtGen
private void MailMerge_MergeImageField(object sender, MergeImageFieldEventArgs args)
{
if(args.FieldName == "TestImage")
if(args.FieldName == "UVImage")
{
string source = args.FieldValue.ToString();
args.Image = Image.FromFile(source);
}
}

View File

@@ -29,11 +29,17 @@
private void InitializeComponent()
{
this.btn_start = new System.Windows.Forms.Button();
this.cb_doc = new System.Windows.Forms.CheckBox();
this.cb_pdf = new System.Windows.Forms.CheckBox();
this.rb_yes = new System.Windows.Forms.RadioButton();
this.rb_no = new System.Windows.Forms.RadioButton();
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// btn_start
//
this.btn_start.Location = new System.Drawing.Point(176, 249);
this.btn_start.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btn_start.Location = new System.Drawing.Point(374, 12);
this.btn_start.Name = "btn_start";
this.btn_start.Size = new System.Drawing.Size(75, 67);
this.btn_start.TabIndex = 0;
@@ -41,20 +47,87 @@
this.btn_start.UseVisualStyleBackColor = true;
this.btn_start.Click += new System.EventHandler(this.btn_start_Click);
//
// cb_doc
//
this.cb_doc.AutoSize = true;
this.cb_doc.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.cb_doc.Location = new System.Drawing.Point(6, 12);
this.cb_doc.Name = "cb_doc";
this.cb_doc.Size = new System.Drawing.Size(173, 24);
this.cb_doc.TabIndex = 1;
this.cb_doc.Text = "DOC datei erzeugen";
this.cb_doc.UseVisualStyleBackColor = true;
//
// cb_pdf
//
this.cb_pdf.AutoSize = true;
this.cb_pdf.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.cb_pdf.Location = new System.Drawing.Point(6, 35);
this.cb_pdf.Name = "cb_pdf";
this.cb_pdf.Size = new System.Drawing.Size(131, 24);
this.cb_pdf.TabIndex = 2;
this.cb_pdf.Text = "PDF erzeugen";
this.cb_pdf.UseVisualStyleBackColor = true;
//
// rb_yes
//
this.rb_yes.AutoSize = true;
this.rb_yes.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.rb_yes.Location = new System.Drawing.Point(221, 62);
this.rb_yes.Name = "rb_yes";
this.rb_yes.Size = new System.Drawing.Size(39, 24);
this.rb_yes.TabIndex = 3;
this.rb_yes.TabStop = true;
this.rb_yes.Text = "ja";
this.rb_yes.UseVisualStyleBackColor = true;
//
// rb_no
//
this.rb_no.AutoSize = true;
this.rb_no.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.rb_no.Location = new System.Drawing.Point(266, 62);
this.rb_no.Name = "rb_no";
this.rb_no.Size = new System.Drawing.Size(57, 24);
this.rb_no.TabIndex = 4;
this.rb_no.TabStop = true;
this.rb_no.Text = "nein";
this.rb_no.UseVisualStyleBackColor = true;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.Location = new System.Drawing.Point(2, 62);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(202, 20);
this.label1.TabIndex = 5;
this.label1.Text = "Nach dem erzeugen öffnen";
//
// Options
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.ClientSize = new System.Drawing.Size(477, 113);
this.Controls.Add(this.label1);
this.Controls.Add(this.rb_no);
this.Controls.Add(this.rb_yes);
this.Controls.Add(this.cb_pdf);
this.Controls.Add(this.cb_doc);
this.Controls.Add(this.btn_start);
this.Name = "Options";
this.Text = "Options";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button btn_start;
private System.Windows.Forms.CheckBox cb_doc;
private System.Windows.Forms.CheckBox cb_pdf;
private System.Windows.Forms.RadioButton rb_yes;
private System.Windows.Forms.RadioButton rb_no;
private System.Windows.Forms.Label label1;
}
}

View File

@@ -36,7 +36,7 @@ namespace BerichtGen
void Gen()
{
Bericht bericht = new Bericht();
bericht.Erzeuge("", "", "", grundDaten,bilderObjects);
bericht.Erzeuge(firma,vorlage, speicherpfad, grundDaten,bilderObjects);
}
private void btn_start_Click(object sender, EventArgs e)
@@ -47,6 +47,11 @@ namespace BerichtGen
while (generateProtokollThread.IsAlive) ;
if(rb_yes.Checked)
{
}
this.Close();
}
}