update 20250319
This commit is contained in:
@@ -68,11 +68,31 @@ namespace OnDocOffice
|
||||
}
|
||||
}
|
||||
|
||||
public void Edit_Document()
|
||||
public void Edit_Document(bool runmacros)
|
||||
{
|
||||
Start_Application();
|
||||
workBook = excel.Workbooks.Open(filename);
|
||||
excel.Visible = true;
|
||||
if (runmacros == true)
|
||||
{
|
||||
Logging.Logging.Debug("Makros auslesen", "Edit_Document", dokumentid);
|
||||
Database.DB db = new Database.DB(connectstring);
|
||||
db.Get_Tabledata("Select * from ondoc_macros where dokumentid='" + dokumentid + "' order by reihenfolge", false, true);
|
||||
foreach (DataRow dr in db.dsdaten.Tables[0].Rows)
|
||||
{
|
||||
try
|
||||
{
|
||||
Logging.Logging.Debug("Makro ", "Edit_Document", dr[0].ToString());
|
||||
excel.Run(dr[0].ToString());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logging.Logging.Debug("MakroError ", "Edit_Document", e.Message);
|
||||
string a = e.Message;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//clsProcessWatch.AddToList(dokumentid, filename, "Word");
|
||||
bool isClosed = IsDocumentClosed(excel, workBook);
|
||||
workBook = null;
|
||||
@@ -192,7 +212,8 @@ namespace OnDocOffice
|
||||
Helper.clsFileHelper fh = new Helper.clsFileHelper();
|
||||
fh.SaveBase64ToFile(vorlage, filename);
|
||||
Start_Application();
|
||||
workBook = excel.Workbooks.Open(filename);
|
||||
workBook = excel.Workbooks.Add(filename);
|
||||
//workBook = excel.Workbooks.Open(filename);
|
||||
foreach (Worksheet ws in workBook.Sheets)
|
||||
{
|
||||
ws.Activate();
|
||||
@@ -200,6 +221,7 @@ namespace OnDocOffice
|
||||
{
|
||||
try
|
||||
{
|
||||
Logging.Logging.Debug("Excel: "+dv.FieldName+" / "+dv.Value,"OnDocOffice","");
|
||||
if (dv.TMBeginn == "TGEDKCursor" || dv.TMBeginn == "TGEDKCursorB" || dv.FieldName == "TGEDKCursor" || dv.FieldName == "TGEDKCursorB")
|
||||
{
|
||||
try
|
||||
@@ -253,6 +275,24 @@ namespace OnDocOffice
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Database.DB db = new Database.DB(connectstring);
|
||||
db.Get_Tabledata("Select * from ondoc_macros where dokumentid='" + dokumentid + "' order by reihenfolge", false, true);
|
||||
foreach (DataRow dr in db.dsdaten.Tables[0].Rows)
|
||||
{
|
||||
try
|
||||
{
|
||||
Logging.Logging.Debug("Makro ", "Create", dr[0].ToString());
|
||||
excel.Run(dr[0].ToString());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logging.Logging.Debug("MakroError ", "Create", e.Message);
|
||||
string a = e.Message;
|
||||
}
|
||||
}
|
||||
db = null;
|
||||
|
||||
workBook.Save();
|
||||
workBook.Close();
|
||||
workBook = null;
|
||||
|
||||
Reference in New Issue
Block a user