update 20250226
This commit is contained in:
19
ZZ_Signature_C/Form1.Designer.cs
generated
19
ZZ_Signature_C/Form1.Designer.cs
generated
@@ -47,6 +47,7 @@
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.txtunterschriftrechts = new System.Windows.Forms.TextBox();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.button5 = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// button1
|
||||
@@ -61,7 +62,7 @@
|
||||
//
|
||||
// button2
|
||||
//
|
||||
this.button2.Location = new System.Drawing.Point(241, 405);
|
||||
this.button2.Location = new System.Drawing.Point(45, 261);
|
||||
this.button2.Name = "button2";
|
||||
this.button2.Size = new System.Drawing.Size(75, 23);
|
||||
this.button2.TabIndex = 1;
|
||||
@@ -71,7 +72,7 @@
|
||||
//
|
||||
// button3
|
||||
//
|
||||
this.button3.Location = new System.Drawing.Point(45, 470);
|
||||
this.button3.Location = new System.Drawing.Point(45, 301);
|
||||
this.button3.Name = "button3";
|
||||
this.button3.Size = new System.Drawing.Size(75, 23);
|
||||
this.button3.TabIndex = 2;
|
||||
@@ -120,7 +121,7 @@
|
||||
//
|
||||
// button4
|
||||
//
|
||||
this.button4.Location = new System.Drawing.Point(26, 405);
|
||||
this.button4.Location = new System.Drawing.Point(45, 232);
|
||||
this.button4.Name = "button4";
|
||||
this.button4.Size = new System.Drawing.Size(75, 23);
|
||||
this.button4.TabIndex = 4;
|
||||
@@ -208,11 +209,22 @@
|
||||
this.label5.TabIndex = 13;
|
||||
this.label5.Text = "Unterschrift Rechts";
|
||||
//
|
||||
// button5
|
||||
//
|
||||
this.button5.Location = new System.Drawing.Point(45, 391);
|
||||
this.button5.Name = "button5";
|
||||
this.button5.Size = new System.Drawing.Size(75, 23);
|
||||
this.button5.TabIndex = 15;
|
||||
this.button5.Text = "button5";
|
||||
this.button5.UseVisualStyleBackColor = true;
|
||||
this.button5.Click += new System.EventHandler(this.button5_Click);
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1499, 837);
|
||||
this.Controls.Add(this.button5);
|
||||
this.Controls.Add(this.txtunterschriftrechts);
|
||||
this.Controls.Add(this.label5);
|
||||
this.Controls.Add(this.txtunterschriftlinks);
|
||||
@@ -253,6 +265,7 @@
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.TextBox txtunterschriftrechts;
|
||||
private System.Windows.Forms.Label label5;
|
||||
private System.Windows.Forms.Button button5;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,8 @@ using static System.Net.WebRequestMethods;
|
||||
using System.Net.WebSockets;
|
||||
using Database;
|
||||
using System.Runtime.Hosting;
|
||||
using System.Data.SqlClient;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
|
||||
namespace ZZ_Signature_C
|
||||
@@ -286,17 +288,91 @@ namespace ZZ_Signature_C
|
||||
|
||||
}
|
||||
|
||||
public string connectionstring;
|
||||
public DataSet dsdaten = new DataSet();
|
||||
private static System.Data.DataTable SP_Parameters = new System.Data.DataTable();
|
||||
|
||||
private void button3_Click(object sender, EventArgs e)
|
||||
{
|
||||
word = new Microsoft.Office.Interop.Word.Application();
|
||||
docWord = word.Documents.Open(@"E:\Software-Projekte\OnDoc\Excel_Dateien\Signature.docx");
|
||||
docWord.Activate();
|
||||
docWord = word.Documents.Open(@"x:\gaga.docx");
|
||||
word.Visible = true;
|
||||
remove_unterschriften();
|
||||
|
||||
docWord = null;
|
||||
word = null;
|
||||
connectionstring= @"data source=shu01\shu00;initial catalog=edoka_dms;;workstation id=;packet size=4096;user id=sa;password=*shu29";
|
||||
SP_Parameters.Columns.Clear();
|
||||
SP_Parameters.Rows.Clear();
|
||||
SP_Parameters.Clear();
|
||||
SP_Parameters.Columns.Add("Paramname");
|
||||
SP_Parameters.Columns.Add("Paramvalue");
|
||||
|
||||
DataRow r = SP_Parameters.NewRow();
|
||||
r[0] = "@dokumentid";
|
||||
r[1] = "'1' UNION SELECT 1 as dokumenttypnr, name as doumentname from SYSOBJECTS WHERE xtype = 'U'";
|
||||
SP_Parameters.Rows.Add(r);
|
||||
Get_Tabledata("Select * from dokument where dokumentid=@dokumentid", false, true);
|
||||
}
|
||||
public System.Data.DataTable Get_Tabledata(string Tablename, bool StoredProc = false, bool is_SQL_String = false, System.Data.DataTable sp_params = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
if (sp_params == null && SP_Parameters.Rows.Count > 0)
|
||||
{
|
||||
sp_params = SP_Parameters.Copy();
|
||||
}
|
||||
|
||||
SqlConnection sqlconnect = new SqlConnection();
|
||||
DataSet ds = new DataSet();
|
||||
ds.Tables.Clear();
|
||||
dsdaten.Tables.Clear();
|
||||
|
||||
|
||||
sqlconnect.ConnectionString = connectionstring;
|
||||
SqlDataAdapter da = new SqlDataAdapter("", sqlconnect);
|
||||
SqlCommand sqlcmd = new SqlCommand();
|
||||
sqlcmd.Connection = sqlconnect;
|
||||
|
||||
|
||||
|
||||
if (StoredProc == true)
|
||||
|
||||
{
|
||||
sqlcmd.CommandType = CommandType.StoredProcedure;
|
||||
if (Tablename.IndexOf("@@Mandantnr@@") > 0)
|
||||
Tablename = Tablename.Replace("@@Mandantnr@@", "");
|
||||
sqlcmd.CommandText = Tablename;
|
||||
try
|
||||
{
|
||||
foreach (DataRow r in sp_params.Rows)
|
||||
{
|
||||
sqlcmd.Parameters.Add(r["Paramname"].ToString(), SqlDbType.VarChar);
|
||||
sqlcmd.Parameters[sqlcmd.Parameters.Count - 1].Value = r["Paramvalue"].ToString();
|
||||
}
|
||||
}
|
||||
catch { };
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
sqlcmd.CommandType = CommandType.Text;
|
||||
sqlcmd.CommandText = "Select * from " + Tablename;
|
||||
}
|
||||
if (is_SQL_String == true)
|
||||
sqlcmd.CommandText = Tablename;
|
||||
|
||||
foreach (DataRow r in sp_params.Rows)
|
||||
{
|
||||
sqlcmd.Parameters.AddWithValue(r["Paramname"].ToString(), r["Paramvalue"].ToString());
|
||||
}
|
||||
da.SelectCommand = sqlcmd;
|
||||
sqlconnect.Open();
|
||||
da.Fill(dsdaten, "Daten1");
|
||||
sqlconnect.Close();
|
||||
|
||||
return dsdaten.Tables[0];
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private void button4_Click(object sender, EventArgs e)
|
||||
@@ -344,5 +420,68 @@ namespace ZZ_Signature_C
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void button5_Click(object sender, EventArgs e)
|
||||
{
|
||||
Lic();
|
||||
|
||||
FileStream inputFileStream = new FileStream(Path.GetFullPath(@"E:\Software-Projekte\OnDoc\Excel_Dateien\20250225074324_OFFEDK0082025000066663.docx"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
|
||||
WordDocument document = new WordDocument(inputFileStream, FormatType.Automatic);
|
||||
|
||||
|
||||
|
||||
WPicture picture = new WPicture(document);
|
||||
Image img = Image.FromFile(@"x:\gaga1.png");
|
||||
picture.LoadImage(img);
|
||||
|
||||
IWPicture pic = picture;
|
||||
foreach (WSection section in document.Sections)
|
||||
{
|
||||
|
||||
////picture.Height = docData.barcode_height;
|
||||
|
||||
////picture.Width = docData.barcode_width;
|
||||
picture.VerticalPosition = 500;
|
||||
|
||||
//picture.HorizontalPosition = 500;
|
||||
//picture.HorizontalOrigin = HorizontalOrigin.Page;
|
||||
//picture.VerticalOrigin = VerticalOrigin.Page;
|
||||
picture.TextWrappingStyle = TextWrappingStyle.InFrontOfText;
|
||||
picture.TextWrappingType = TextWrappingType.Both;
|
||||
|
||||
////picture.Width = barcodeimage.Width;
|
||||
////picture.Height = barcodeimage.Height;
|
||||
|
||||
//picture.Rotation = 0;
|
||||
//picture.Height = 40;
|
||||
//picture.Width = 120;
|
||||
WPicture picture2 = new WPicture(document);
|
||||
picture2.LoadImage(img);
|
||||
|
||||
IWParagraph footerPar = section.HeadersFooters.FirstPageFooter.Paragraphs[0];
|
||||
footerPar.ChildEntities.Add(picture);
|
||||
|
||||
IWParagraph footerPar1 = section.HeadersFooters.Footer.Paragraphs[0];
|
||||
footerPar1.ChildEntities.Add(picture2);
|
||||
|
||||
|
||||
//section.HeadersFooters.Footer.AddParagraph().ChildEntities.Add(picture);
|
||||
//section.HeadersFooters.FirstPageFooter.AddParagraph().ChildEntities.Add(picture2);
|
||||
|
||||
////if (section.HeadersFooters.FirstPageFooter.Paragraphs.Count < 1)
|
||||
////{
|
||||
//section.HeadersFooters.FirstPageFooter.AddParagraph();
|
||||
//section.HeadersFooters.FirstPageFooter.Paragraphs[0].ChildEntities.Add(picture);
|
||||
//}
|
||||
|
||||
|
||||
//Syncfusion.DocIO.DLS.IWParagraph paragraph = section.Body.LastParagraph;
|
||||
//if (paragraph != null)
|
||||
// paragraph.ChildEntities.Add(picture);
|
||||
|
||||
}
|
||||
document.Save(@"E:\Software-Projekte\OnDoc\Excel_Dateien\20250225074324_OFFEDK0082025000066663.docx.docx");
|
||||
document.Close(); ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user