Man kann jetzt einen Ausrduck erzeugen für das ausgeben einer Kalibrierliste
This commit is contained in:
@@ -3,6 +3,7 @@ using Syncfusion.DocIO.DLS;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
@@ -23,17 +24,20 @@ namespace BerichtGen
|
||||
/// <param name="daten">Inhalt vom Dokument </param>
|
||||
/// <param name="erzeugeDoc">Ein doc datei soll erzeugt werden</param>
|
||||
/// <param name="erzeugePDF">Ein Pdf datei soll erzeugt werden</param>
|
||||
public void Erzeuge(string firma, string vorlage, string savepath, Hashtable daten,List<BilderObject> bilderObjects, bool erzeugeDOC = false , bool erzeugePDF = true)
|
||||
public void Erzeuge(string source, string savepath, Hashtable daten,List<BilderObject> bilderObjects,DataTable tableContents, bool erzeugeDOC = false , bool erzeugePDF = true)
|
||||
{
|
||||
_listImages = new List<Image>();
|
||||
foreach(BilderObject current in bilderObjects)
|
||||
if (bilderObjects != null)
|
||||
{
|
||||
Image image = Image.FromFile(current.Path);
|
||||
_listImages.Add(ResizeImage(image, CalculateImageSizeForDocument(image.Height, image.Width)));
|
||||
image.Dispose();
|
||||
_listImages = new List<Image>();
|
||||
foreach (BilderObject current in bilderObjects)
|
||||
{
|
||||
Image image = Image.FromFile(current.Path);
|
||||
_listImages.Add(ResizeImage(image, CalculateImageSizeForDocument(image.Height, image.Width)));
|
||||
image.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
WordDocument wordDocument = new WordDocument("./documents/JUME/liner_einbau.docx");
|
||||
WordDocument wordDocument = new WordDocument(source);
|
||||
|
||||
string[] fieldnames = null;
|
||||
string[] fieldvalues = null;
|
||||
@@ -66,6 +70,10 @@ namespace BerichtGen
|
||||
|
||||
//string[] fieldNames = new string[] { "UVImage" };
|
||||
//string[] fieldValues = new string[] { "test.png" };
|
||||
|
||||
if (tableContents != null)
|
||||
wordDocument.MailMerge.ExecuteGroup(tableContents);
|
||||
|
||||
wordDocument.MailMerge.Execute(fieldnames, fieldvalues);
|
||||
wordDocument.Save("test.docx", Syncfusion.DocIO.FormatType.Docx);
|
||||
//wordDocument.Close();
|
||||
|
||||
@@ -6,6 +6,7 @@ using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
@@ -21,10 +22,12 @@ namespace BerichtGen
|
||||
string firma;
|
||||
string vorlage;
|
||||
string speicherpfad;
|
||||
string source;
|
||||
List<BilderObject> bilderObjects;
|
||||
DataTable tableContent = null;
|
||||
|
||||
|
||||
public Options(string firma, string vorlage, string speicherpfad, Hashtable grunddaten, List<BilderObject> bilderObjects)
|
||||
public Options(string firma, string vorlage, string speicherpfad, Hashtable grunddaten, List<BilderObject> bilderObjects, DataTable tableContent = null)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.firma = firma;
|
||||
@@ -32,12 +35,14 @@ namespace BerichtGen
|
||||
this.speicherpfad = speicherpfad;
|
||||
this.grundDaten = grunddaten;
|
||||
this.bilderObjects = bilderObjects;
|
||||
this.tableContent = tableContent;
|
||||
this.source = Path.Combine("documents",firma, vorlage);
|
||||
}
|
||||
|
||||
void Gen()
|
||||
{
|
||||
Bericht bericht = new Bericht();
|
||||
bericht.Erzeuge(firma,vorlage, speicherpfad, grundDaten,bilderObjects);
|
||||
bericht.Erzeuge(source, speicherpfad, grundDaten,bilderObjects,tableContent);
|
||||
}
|
||||
|
||||
private void btn_start_Click(object sender, EventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user