update 20241127

This commit is contained in:
Stefan Hutter
2024-11-27 15:53:34 +01:00
parent 341ea50f06
commit 2a652c7325
11218 changed files with 1987907 additions and 362275 deletions

View File

@@ -10,6 +10,7 @@ using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Office;
using System.Threading;
namespace OnDocOffice
{
@@ -105,6 +106,7 @@ namespace OnDocOffice
{
word = new Microsoft.Office.Interop.Word.Application();
word.Run("Autoexec");
word.NormalTemplate.Saved = true;
return true;
}
catch
@@ -156,9 +158,23 @@ namespace OnDocOffice
return true; // Document is closed
}
public void run_macros()
public void run_macros(ref clsDocData docdata, string connectionstring)
{
Database.DB db = new Database.DB(connectionstring);
db.Get_Tabledata("select * from view_idv_makros where office_vorlagenr="+docdata.VorlageNr.ToString()+" order by reihenfolge asc", false, true);
foreach (DataRow dr in db.dsdaten.Tables[0].Rows)
{
if (dr[0].ToString() == "DokumentSchuetzen")
{
worddoc.Range(0, 0).Select();
worddoc.Protect(Type: Microsoft.Office.Interop.Word.WdProtectionType.wdAllowOnlyFormFields, NoReset: true, Password: "Australia");
}
try
{
word.Run(dr[0].ToString());
}
catch (Exception e) { string a = e.Message; }
}
}
public string Generate_Word_in_Office(ref clsDocData docdata, ref clsdok dok, string vorlage, string connectionstring, string tempdir, string dokumentid, string apptype)
@@ -171,7 +187,10 @@ namespace OnDocOffice
Helper.clsFileHelper fh = new Helper.clsFileHelper();
fh.SaveBase64ToFile(vorlage, filename);
Start_Application();
Thread.Sleep(500);
worddoc = word.Documents.Open(filename);
Thread.Sleep(500);
if (worddoc.ProtectionType != Microsoft.Office.Interop.Word.WdProtectionType.wdNoProtection)
@@ -284,6 +303,7 @@ namespace OnDocOffice
{
worddoc.Protect(Type: Microsoft.Office.Interop.Word.WdProtectionType.wdAllowOnlyFormFields, NoReset: true, Password: "Australia");
}
run_macros(ref docdata, connectionstring);
worddoc.Save();
worddoc.Close();
@@ -372,7 +392,7 @@ namespace OnDocOffice
word.ActiveDocument.Tables.Add(Range:word.Selection.Range, NumRows:1, NumColumns:1);
if (docdata.barcode_horizontal == 0)
if (docdata.barcode_horizontal == 1)
{
word.Selection.Tables[1].Borders[Microsoft.Office.Interop.Word.WdBorderType.wdBorderLeft].LineStyle = Microsoft.Office.Interop.Word.WdLineStyle.wdLineStyleNone;
word.Selection.Tables[1].Borders[Microsoft.Office.Interop.Word.WdBorderType.wdBorderRight].LineStyle = Microsoft.Office.Interop.Word.WdLineStyle.wdLineStyleNone;