update 20250209
This commit is contained in:
@@ -13,6 +13,13 @@ using Syncfusion.DocIO;
|
||||
using Syncfusion.DocIO.DLS;
|
||||
using Shape = Syncfusion.DocIO.DLS.Shape;
|
||||
using Syncfusion.DocIO.ReaderWriter;
|
||||
using System.IO;
|
||||
using Syncfusion.Pdf;
|
||||
using Syncfusion.OfficeChart;
|
||||
using Syncfusion.DocToPDFConverter;
|
||||
using Syncfusion.OfficeChartToImageConverter;
|
||||
using static System.Net.WebRequestMethods;
|
||||
|
||||
|
||||
namespace ZZ_Signature_C
|
||||
{
|
||||
@@ -40,7 +47,7 @@ namespace ZZ_Signature_C
|
||||
|
||||
word.Visible = true;
|
||||
|
||||
|
||||
word.ActiveDocument.SaveAs2(@"E:\Software-Projekte\OnDoc\Excel_Dateien\SignatureSigned.docx");
|
||||
|
||||
docWord = null;
|
||||
word = null;
|
||||
@@ -81,16 +88,33 @@ namespace ZZ_Signature_C
|
||||
|
||||
float vertical = bm.Range.Information[Microsoft.Office.Interop.Word.WdInformation.wdVerticalPositionRelativeToPage];
|
||||
float horizontal = bm.Range.Information[Microsoft.Office.Interop.Word.WdInformation.wdHorizontalPositionRelativeToPage];
|
||||
vertical = vertical - 50;
|
||||
//vertical = vertical - 50;
|
||||
|
||||
word.ActiveDocument.Bookmarks[tmn].Select();
|
||||
//word.ActiveDocument.Bookmarks[tmn].Select();
|
||||
|
||||
Microsoft.Office.Interop.Word.Shape myshape1 = docWord.Shapes.AddShape(1, horizontal, vertical, 120, 50);
|
||||
myshape1.Fill.UserPicture(@"E:\Software-Projekte\OnDoc\Unterschriften\1.jpg");
|
||||
//myshape1.Line.Weight = -2;
|
||||
myshape1.Name = "Unterschrift" + "_" + tmn;
|
||||
myshape1.Line.Visible= Microsoft.Office.Core.MsoTriState.msoFalse;
|
||||
|
||||
//Microsoft.Office.Interop.Word.Shape myshape1 = docWord.Shapes.AddShape(1, horizontal, vertical, 120, 50);
|
||||
//myshape1.Fill.UserPicture(@"E:\Software-Projekte\OnDoc\Unterschriften\1.jpg");
|
||||
////myshape1.Line.Weight = -2;
|
||||
//myshape1.Name = "Unterschrift" + "_" + tmn;
|
||||
//myshape1.Line.Visible= Microsoft.Office.Core.MsoTriState.msoFalse;
|
||||
|
||||
////Microsoft.Office.Interop.Word.InlineShape myshape3 = word.Selection.InlineShapes.AddPicture(@"E:\Software-Projekte\OnDoc\Unterschriften\1.jpg",false,true,myRange,);
|
||||
|
||||
|
||||
docWord.Activate();
|
||||
Microsoft.Office.Interop.Word.Range myRange3 = bm.Range;
|
||||
Microsoft.Office.Interop.Word.Range myRange4 = bm.Range.GoTo();
|
||||
|
||||
Microsoft.Office.Interop.Word.Shape myShape = docWord.Shapes.AddPicture(@"E:\Software-Projekte\OnDoc\Unterschriften\1.jpg", false, true, 0, 0, 120, 50, myRange);
|
||||
myShape.WrapFormat.Type = Microsoft.Office.Interop.Word.WdWrapType.wdWrapTight;
|
||||
myShape.RelativeHorizontalPosition = Microsoft.Office.Interop.Word.WdRelativeHorizontalPosition.wdRelativeHorizontalPositionPage;
|
||||
myShape.Left = horizontal;
|
||||
myShape.RelativeVerticalPosition = Microsoft.Office.Interop.Word.WdRelativeVerticalPosition.wdRelativeVerticalPositionPage;
|
||||
myShape.Top = vertical - myShape.Height;
|
||||
//myShape.LockAspectRatio = Microsoft.Office.Core.MsoTriState.msoTrue;
|
||||
myShape.WrapFormat.Type = Microsoft.Office.Interop.Word.WdWrapType.wdWrapBehind;
|
||||
myShape.ZOrder(Microsoft.Office.Core.MsoZOrderCmd.msoSendBackward);
|
||||
myShape.Select();
|
||||
return;
|
||||
|
||||
Microsoft.Office.Interop.Word.Shape myshape = docWord.Shapes.AddTextbox(Microsoft.Office.Core
|
||||
@@ -104,8 +128,7 @@ namespace ZZ_Signature_C
|
||||
myshape.WrapFormat.Type = Microsoft.Office.Interop.Word.WdWrapType.wdWrapSquare;
|
||||
myshape.Line.Visible = Microsoft.Office.Core.MsoTriState.msoFalse;
|
||||
|
||||
//Microsoft.Office.Interop.Word.InlineShape myshape1 = word.Selection.InlineShapes.AddPicture(@"E:\Software-Projekte\OnDoc\Unterschriften\1.jpg", false, true, ref missing);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -271,5 +294,29 @@ namespace ZZ_Signature_C
|
||||
docWord = null;
|
||||
word = null;
|
||||
}
|
||||
|
||||
private void button4_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
|
||||
WordDocument wordDocument = new WordDocument(@"E:\Software-Projekte\OnDoc\Excel_Dateien\SignatureSigned.docx", Syncfusion.DocIO.FormatType.Automatic);
|
||||
wordDocument.ChartToImageConverter = new ChartToImageConverter();
|
||||
wordDocument.ChartToImageConverter.ScalingMode = ScalingMode.Normal;
|
||||
Syncfusion.DocToPDFConverter.DocToPDFConverter converter = new Syncfusion.DocToPDFConverter.DocToPDFConverter();
|
||||
|
||||
converter.Settings.EmbedFonts = true;
|
||||
converter.Settings.UpdateDocumentFields = false;
|
||||
converter.Settings.EnableAlternateChunks = true;
|
||||
converter.Settings.AutoDetectComplexScript = true;
|
||||
converter.Settings.ImageResolution = 1280;
|
||||
converter.Settings.ImageQuality = 100;
|
||||
using (PdfDocument pdfDocument = converter.ConvertToPDF(wordDocument))
|
||||
{
|
||||
pdfDocument.Save(Path.GetFullPath(@"E:\Software-Projekte\OnDoc\Excel_Dateien\SignatureSigned.pdf"));
|
||||
this.pdfViewerControl1.Load(@"E:\Software-Projekte\OnDoc\Excel_Dateien\SignatureSigned.pdf");
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user