updfate 20250919
This commit is contained in:
@@ -495,5 +495,65 @@ namespace ZZ_Signature_C
|
||||
document.Save(@"x:\ZDEDOFFEDK0082025000157263_1.docx");
|
||||
document.Close(); ;
|
||||
}
|
||||
|
||||
private void button7_Click(object sender, EventArgs e)
|
||||
{
|
||||
FileStream inputFileStream = new FileStream(Path.GetFullPath(txtfilename.Text), FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
|
||||
WordDocument document = new WordDocument(inputFileStream, FormatType.Automatic);
|
||||
Insert_Barcode(ref document);
|
||||
document.Save(@"y:\v2a.dotm");
|
||||
|
||||
}
|
||||
public void Insert_Barcode(ref WordDocument document)
|
||||
{
|
||||
System.Drawing.Image barcodeimage;
|
||||
barcodeimage = Image.FromFile(@"x:\gaga1.png");
|
||||
System.Drawing.Image barcodeimage2;
|
||||
barcodeimage2 = Image.FromFile(@"x:\gaga1.png");
|
||||
|
||||
|
||||
|
||||
WPicture picture = new WPicture(document);
|
||||
WPicture picture2 = new WPicture(document);
|
||||
picture.LoadImage(barcodeimage);
|
||||
picture2.LoadImage(barcodeimage);
|
||||
|
||||
|
||||
picture.Rotation = 0;
|
||||
picture.Height = 50;
|
||||
picture.Width = 170;
|
||||
picture.VerticalPosition =360; ;
|
||||
picture.HorizontalPosition =800;
|
||||
picture2.Rotation = 0;
|
||||
picture2.Height = 50;
|
||||
picture2.Width = 170;
|
||||
picture2.VerticalPosition = 200; ;
|
||||
picture2.HorizontalPosition = 800;
|
||||
|
||||
//foreach (IWSection section in document.Sections)
|
||||
//{
|
||||
|
||||
for (int i = 0; i < document.Sections.Count; i++)
|
||||
{
|
||||
IWSection section = document.Sections[i];
|
||||
if (section.PageSetup.DifferentFirstPage == true)
|
||||
{
|
||||
|
||||
WParagraph FirstfooterPar = new WParagraph(document);
|
||||
FirstfooterPar.ChildEntities.Add(picture);
|
||||
if (section.HeadersFooters.FirstPageFooter.Paragraphs.Count > 0)
|
||||
{
|
||||
section.HeadersFooters.FirstPageFooter.Paragraphs.RemoveAt(section.HeadersFooters.FirstPageFooter.Paragraphs.Count - 1);
|
||||
}
|
||||
section.HeadersFooters.FirstPageFooter.Paragraphs.Add(FirstfooterPar);
|
||||
|
||||
}
|
||||
WParagraph footerPar = new WParagraph(document);
|
||||
footerPar.ChildEntities.Add(picture2);
|
||||
if (section.HeadersFooters.Footer.Count > 0) { section.HeadersFooters.Footer.Paragraphs.RemoveAt(section.HeadersFooters.Footer.Paragraphs.Count - 1); }
|
||||
section.HeadersFooters.Footer.Paragraphs.Add(footerPar);
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user