update 20250113

This commit is contained in:
Stefan Hutter
2025-01-13 21:00:23 +01:00
parent 1e3c169d49
commit 3e36dd541b
107 changed files with 366 additions and 79 deletions

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Office.Interop.Word;
@@ -20,6 +21,7 @@ namespace OfficePrinter
Microsoft.Office.Interop.Word.Document wordDocument = new Microsoft.Office.Interop.Word.Document();
wordDocument = appWord.Documents.Open(filename);
appWord.Visible = true;
wordDocument.PrintOut(
OutputFileName: pdfname,
PrintToFile: true);
@@ -30,13 +32,15 @@ namespace OfficePrinter
return;
}
public void PrintInWord(string Filename, string printmacro)
public void PrintInWord(string Filename, string printmacro, int OfficeSleep)
{
Application appWord = new Application();
appWord.NormalTemplate.Saved = true;
Microsoft.Office.Interop.Word.Document wordDocument = new Microsoft.Office.Interop.Word.Document();
wordDocument = appWord.Documents.Open(Filename);
Thread.Sleep(OfficeSleep);
appWord.Visible = true;
if (printmacro == "") return;
try
{
@@ -45,6 +49,7 @@ namespace OfficePrinter
catch
{
}
Thread.Sleep(OfficeSleep);
wordDocument.Close();
wordDocument = null;
appWord.Quit(SaveChanges: false);