update 20250129
This commit is contained in:
22
OnDocOffice/DialogGenerate.Designer.cs
generated
22
OnDocOffice/DialogGenerate.Designer.cs
generated
@@ -32,6 +32,7 @@
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.progressBar1 = new System.Windows.Forms.ProgressBar();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
@@ -45,9 +46,9 @@
|
||||
//
|
||||
// progressBar1
|
||||
//
|
||||
this.progressBar1.Location = new System.Drawing.Point(12, 76);
|
||||
this.progressBar1.Location = new System.Drawing.Point(15, 97);
|
||||
this.progressBar1.Name = "progressBar1";
|
||||
this.progressBar1.Size = new System.Drawing.Size(390, 23);
|
||||
this.progressBar1.Size = new System.Drawing.Size(419, 23);
|
||||
this.progressBar1.TabIndex = 1;
|
||||
//
|
||||
// label2
|
||||
@@ -55,19 +56,31 @@
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(12, 49);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(0, 13);
|
||||
this.label2.Size = new System.Drawing.Size(28, 13);
|
||||
this.label2.TabIndex = 2;
|
||||
this.label2.Text = "Text";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(12, 67);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(34, 13);
|
||||
this.label3.TabIndex = 3;
|
||||
this.label3.Text = "Detail";
|
||||
//
|
||||
// DialogGenerate
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(440, 111);
|
||||
this.ClientSize = new System.Drawing.Size(440, 132);
|
||||
this.Controls.Add(this.label3);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.progressBar1);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.Name = "DialogGenerate";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "Dokumenterstellung mit Office";
|
||||
this.Load += new System.EventHandler(this.DialogGenerate_Load);
|
||||
this.ResumeLayout(false);
|
||||
@@ -80,5 +93,6 @@
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.ProgressBar progressBar1;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label label3;
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,7 @@ namespace OnDocOffice
|
||||
{
|
||||
InitializeComponent();
|
||||
this.label2.Text = bez;
|
||||
this.label3.Text = "";
|
||||
}
|
||||
private void DialogGenerate_Load(object sender, EventArgs e)
|
||||
{
|
||||
@@ -29,15 +30,25 @@ namespace OnDocOffice
|
||||
progressBar1.Value = 0;
|
||||
}
|
||||
|
||||
public void set_progress(int value)
|
||||
public void set_progress(int value, string text)
|
||||
{
|
||||
progressBar1.Value = value;
|
||||
this.label3.Text=text;
|
||||
try
|
||||
{
|
||||
progressBar1.Value = value;
|
||||
}
|
||||
catch { }
|
||||
Application.DoEvents();
|
||||
}
|
||||
|
||||
public void add_progress(int value)
|
||||
public void add_progress(int value, string text)
|
||||
{
|
||||
progressBar1.Value += value;
|
||||
this.label3.Text = text;
|
||||
try
|
||||
{
|
||||
progressBar1.Value += value;
|
||||
}
|
||||
catch { }
|
||||
Application.DoEvents();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,6 +83,9 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\VBFileManagement\bin\Debug\VBFileManagement.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="VBOffice">
|
||||
<HintPath>..\VBOffice\bin\Debug\VBOffice.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="clsoffice.cs" />
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
OnDocOffice/bin/Debug/VBOffice.dll
Normal file
BIN
OnDocOffice/bin/Debug/VBOffice.dll
Normal file
Binary file not shown.
BIN
OnDocOffice/bin/Debug/VBOffice.pdb
Normal file
BIN
OnDocOffice/bin/Debug/VBOffice.pdb
Normal file
Binary file not shown.
26
OnDocOffice/bin/Debug/VBOffice.xml
Normal file
26
OnDocOffice/bin/Debug/VBOffice.xml
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>
|
||||
VBOffice
|
||||
</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="T:VBOffice.My.Resources.Resources">
|
||||
<summary>
|
||||
A strongly-typed resource class, for looking up localized strings, etc.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:VBOffice.My.Resources.Resources.ResourceManager">
|
||||
<summary>
|
||||
Returns the cached ResourceManager instance used by this class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:VBOffice.My.Resources.Resources.Culture">
|
||||
<summary>
|
||||
Overrides the current thread's CurrentUICulture property for all
|
||||
resource lookups using this strongly typed resource class.
|
||||
</summary>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
Binary file not shown.
Binary file not shown.
@@ -22,6 +22,7 @@ using System.IO;
|
||||
using Microsoft.VisualBasic;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Net;
|
||||
using Microsoft.VisualBasic.CompilerServices;
|
||||
|
||||
|
||||
namespace OnDocOffice
|
||||
@@ -408,8 +409,9 @@ namespace OnDocOffice
|
||||
dv.used = 0;
|
||||
foreach (Syncfusion.DocIO.DLS.Bookmark bm in bookmarks)
|
||||
{
|
||||
dv.used = 1;
|
||||
break;
|
||||
if (bm.Name == dv.TMBeginn.ToString()) { dv.used = 1;break; }
|
||||
//dv.used = 1;
|
||||
//break;
|
||||
}
|
||||
}
|
||||
//foreach (Syncfusion.DocIO.DLS.Bookmark bm in bookmarks)
|
||||
@@ -454,13 +456,46 @@ namespace OnDocOffice
|
||||
|
||||
return Convert.ToBase64String(imageArray);
|
||||
}
|
||||
|
||||
public string convert_wordfelder(string x)
|
||||
{
|
||||
|
||||
string convert_wordfelderRet = default;
|
||||
|
||||
|
||||
string s;
|
||||
string s1;
|
||||
int i;
|
||||
s = x;
|
||||
i = Strings.InStr(s, Conversions.ToString('\r'));
|
||||
while (i > 0)
|
||||
{
|
||||
s = Strings.Left(s, i - 1) + "#" + Strings.Right(s, Strings.Len(s) - i);
|
||||
if (Strings.Mid(s, i + 1, 1) == Conversions.ToString('\n'))
|
||||
{
|
||||
s = Strings.Left(s, i) + Strings.Right(s, Strings.Len(s) - (i + 1));
|
||||
}
|
||||
i = Strings.InStr(s, Conversions.ToString('\r'));
|
||||
}
|
||||
i = Strings.InStr(s, "#");
|
||||
while (i > 0)
|
||||
{
|
||||
s = Strings.Left(s, i - 1) + '\v' + Strings.Right(s, Strings.Len(s) - i);
|
||||
i = Strings.InStr(s, "#");
|
||||
}
|
||||
convert_wordfelderRet = s;
|
||||
return convert_wordfelderRet;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public string Generate_Word_in_Office(ref clsDocData docdata, ref clsdok dok, string vorlage, string connectionstring, string tempdir, string dokumentid, string apptype, string extension, int OfficeSleep, int bookmarks_docio, bool vbfilemanagment, bool editdoc)
|
||||
{
|
||||
connectstring = connectionstring;
|
||||
DialogGenerate dialogGenerate = new DialogGenerate(docdata.Bezeichnung.ToString());
|
||||
dialogGenerate.Show();
|
||||
System.Windows.Forms.Application.DoEvents();
|
||||
dialogGenerate.set_progress(10);
|
||||
dialogGenerate.set_progress(10,"Datei bereit stellen");
|
||||
|
||||
this.dokumentid = docdata.Dokumentid;
|
||||
string filename = tempdir + dokumentid + "." + extension;
|
||||
@@ -484,10 +519,9 @@ namespace OnDocOffice
|
||||
fh.SaveBase64ToFile(vorlage, filename);
|
||||
get_bookmakrs(fh.Base64FromFile(filename), ref docdata);
|
||||
Logging.Logging.Debug("Generate_Word_in_Office", "clsOffice", dokumentid);
|
||||
dialogGenerate.set_progress(20);
|
||||
dialogGenerate.set_progress(20,"Datei öffnen");
|
||||
Start_Application();
|
||||
|
||||
|
||||
// Thread.Sleep(OfficeSleep);
|
||||
worddoc = word.Documents.Open(filename);
|
||||
Thread.Sleep(OfficeSleep);
|
||||
@@ -581,7 +615,7 @@ namespace OnDocOffice
|
||||
worddoc = word.ActiveDocument;
|
||||
worddoc.Save();
|
||||
word.NormalTemplate.Saved = true;
|
||||
dialogGenerate.set_progress(30);
|
||||
dialogGenerate.set_progress(30, "Datei konvertiert und geöffnet");
|
||||
//word.ActiveDocument.Close(false);
|
||||
Thread.Sleep(OfficeSleep);
|
||||
//worddoc = word.Documents.Open(filename);
|
||||
@@ -592,187 +626,254 @@ namespace OnDocOffice
|
||||
worddoc.Unprotect(Password: "Australia");
|
||||
is_protected = true;
|
||||
}
|
||||
int usecount = 0;
|
||||
Logging.Logging.Debug("VB Fill","OnDoc",dokumentid);
|
||||
foreach (clsDocValue dv in docdata.DocValues)
|
||||
{
|
||||
//dv.used = 0;
|
||||
if (dv.TMBeginn.Contains("CompanyBBEB99")) { dv.used = 1; };
|
||||
if (dv.TMBeginn.Contains("EDKCursor"))
|
||||
{
|
||||
dv.used = 1;
|
||||
cursortm = dv.TMBeginn;
|
||||
}
|
||||
if (dv.FieldName.Contains("TGEDKCursor"))
|
||||
{
|
||||
dv.used = 1;
|
||||
cursorfeld = dv.FieldName;
|
||||
}
|
||||
|
||||
|
||||
if (dv.FieldName.ToString() != "") { dv.used = 1; };
|
||||
if (dv.used == 1) { usecount++; }
|
||||
|
||||
}
|
||||
float progressstep = 1;
|
||||
try
|
||||
{
|
||||
float b = 50;
|
||||
progressstep = b / (float)usecount;
|
||||
progressstep = progressstep + 1;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
|
||||
VBOffice.VBOffice vbo = new VBOffice.VBOffice();
|
||||
|
||||
vbo.Fill_Word(ref word, ref docdata, editdoc, dialogGenerate,(float)progressstep);
|
||||
vbo = null;
|
||||
Logging.Logging.Debug("VB Fill Ende", "OnDoc", dokumentid);
|
||||
|
||||
|
||||
bool cursorpositionieren = false;
|
||||
if (docdata.Kopfzeile_generieren == true)
|
||||
{
|
||||
Kopfzeile_generieren();
|
||||
}
|
||||
//word.Visible = false;
|
||||
dialogGenerate.set_progress(40);
|
||||
//if (docdata.Kopfzeile_generieren == true)
|
||||
//{
|
||||
// Kopfzeile_generieren();
|
||||
//}
|
||||
////word.Visible = false;
|
||||
//dialogGenerate.set_progress(40);
|
||||
//word.ScreenUpdating = false;
|
||||
if (bookmarks_docio == 1)
|
||||
{
|
||||
worddoc.Save();
|
||||
worddoc.Close();
|
||||
Fill_Bookmarks_from_Word(filename, docdata, "", "");
|
||||
worddoc = word.Documents.Open(filename);
|
||||
}
|
||||
else
|
||||
{
|
||||
//if (bookmarks_docio == 1)
|
||||
//{
|
||||
// worddoc.Save();
|
||||
// worddoc.Close();
|
||||
// Fill_Bookmarks_from_Word(filename, docdata, "", "");
|
||||
// worddoc = word.Documents.Open(filename);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
|
||||
|
||||
float progressstep = 1;
|
||||
try
|
||||
{
|
||||
float b = 60;
|
||||
progressstep = b / (float)docdata.DocValues.Count();
|
||||
}
|
||||
catch
|
||||
{
|
||||
// //float progressstep = 1;
|
||||
// //try
|
||||
// //{
|
||||
// // float b = 60;
|
||||
// // progressstep = b / (float)docdata.DocValues.Count();
|
||||
// //}
|
||||
// //catch
|
||||
// //{
|
||||
|
||||
}
|
||||
cursortm = "";
|
||||
foreach (clsDocValue dv in docdata.DocValues)
|
||||
{
|
||||
dv.used = 0;
|
||||
if (dv.TMBeginn.Contains("CompanyBBEB99")) { dv.used = 1; };
|
||||
if (dv.TMBeginn.Contains("EDKCursor"))
|
||||
{
|
||||
dv.used = 1;
|
||||
cursortm = dv.TMBeginn;
|
||||
}
|
||||
if (dv.FieldName.Contains("TGEDKCursor"))
|
||||
{
|
||||
dv.used = 1;
|
||||
cursorfeld = dv.FieldName;
|
||||
}
|
||||
// //}
|
||||
// int usecount = 0;
|
||||
// cursortm = "";
|
||||
// Logging.Logging.Debug("Festlegung Used", "OnDoc", dokumentid);
|
||||
// foreach (clsDocValue dv in docdata.DocValues)
|
||||
// {
|
||||
// //dv.used = 0;
|
||||
// if (dv.TMBeginn.Contains("CompanyBBEB99")) { dv.used = 1; };
|
||||
// if (dv.TMBeginn.Contains("EDKCursor"))
|
||||
// {
|
||||
// dv.used = 1;
|
||||
// cursortm = dv.TMBeginn;
|
||||
// }
|
||||
// if (dv.FieldName.Contains("TGEDKCursor"))
|
||||
// {
|
||||
// dv.used = 1;
|
||||
// cursorfeld = dv.FieldName;
|
||||
// }
|
||||
|
||||
|
||||
if (dv.FieldName.ToString() != "") { dv.used = 1; };
|
||||
// if (dv.FieldName.ToString() != "") { dv.used = 1; };
|
||||
// if (dv.used == 1) { usecount++; }
|
||||
|
||||
}
|
||||
// }
|
||||
// float progressstep = 1;
|
||||
// try
|
||||
// {
|
||||
// float b = 40;
|
||||
// progressstep = b / (float)usecount;
|
||||
// }
|
||||
// catch
|
||||
// {
|
||||
|
||||
foreach (Microsoft.Office.Interop.Word.Bookmark bm in worddoc.Bookmarks)
|
||||
{
|
||||
clsDocValue dv = docdata.DocValues.Find(x => x.TMBeginn == bm.Name);
|
||||
if (dv != null) { dv.used = 1; }
|
||||
}
|
||||
foreach (clsDocValue dv in docdata.DocValues)
|
||||
{
|
||||
if (dv.used == 0) { continue; }
|
||||
try
|
||||
{
|
||||
if (dv.TMBeginn.ToString().Contains("TGEDKCursor"))
|
||||
{
|
||||
cursorpositionieren = true;
|
||||
cursortm = dv.TMBeginn.ToString();
|
||||
}
|
||||
if (dv.FieldName.ToString().Contains("TGEDKCursor"))
|
||||
{
|
||||
cursorpositionieren = true;
|
||||
cursorfeld = dv.FieldName.ToString();
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
// Logging.Logging.Debug(dv.TMBeginn.ToString() + " / " + dv.TMEnd.ToString(), dv.Value.ToString(), dokumentid);
|
||||
dialogGenerate.add_progress((int)progressstep);
|
||||
// }
|
||||
// Logging.Logging.Debug("Used 1 Ende", "OnDoc", dokumentid);
|
||||
|
||||
//20250119 - nur befüllte werte übermitteln'
|
||||
if (dv.Value.ToString().Trim() != "")
|
||||
{
|
||||
if (dv.TMBeginn.ToString() != "" && dv.TMEnd.ToString() == "" && !dv.TMBeginn.ToString().Contains("TGEDKCurosr"))
|
||||
{
|
||||
if (dv.TMBeginn.Contains("Zustel"))
|
||||
{
|
||||
int a = 1;
|
||||
}
|
||||
// foreach (clsDocValue dv in docdata.DocValues)
|
||||
// {
|
||||
// dialogGenerate.add_progress((int)progressstep);
|
||||
// if (dv.used == 0) { continue; }
|
||||
// try
|
||||
// {
|
||||
// if (dv.TMBeginn.ToString().Contains("TGEDKCursor"))
|
||||
// {
|
||||
// cursorpositionieren = true;
|
||||
// cursortm = dv.TMBeginn.ToString();
|
||||
// }
|
||||
// if (dv.FieldName.ToString().Contains("TGEDKCursor"))
|
||||
// {
|
||||
// cursorpositionieren = true;
|
||||
// cursorfeld = dv.FieldName.ToString();
|
||||
// }
|
||||
// }
|
||||
// catch { }
|
||||
// // Logging.Logging.Debug(dv.TMBeginn.ToString() + " / " + dv.TMEnd.ToString(), dv.Value.ToString(), dokumentid);
|
||||
// dialogGenerate.add_progress((int)progressstep);
|
||||
|
||||
try
|
||||
{
|
||||
worddoc.Bookmarks[dv.TMBeginn.ToString()].Select();
|
||||
pos = worddoc.Bookmarks[dv.TMBeginn.ToString()].Start;
|
||||
word.Selection.Text = dv.Value.ToString();
|
||||
pos2 = word.Selection.End;
|
||||
// //20250119 - nur befüllte werte übermitteln'
|
||||
|
||||
// // if (dv.Value.ToString().Trim() != "")
|
||||
// //{
|
||||
// Logging.Logging.Debug(dv.TMBeginn.ToString() + " / " + dv.TMEnd.ToString() + " / " + dv.FieldName.ToString() + " => " + dv.Value.ToString(), "OnDoc", dokumentid);
|
||||
// if (dv.TMBeginn.ToString() != "" && dv.TMEnd.ToString() == "" && !dv.TMBeginn.ToString().Contains("TGEDKCurosr"))
|
||||
// {
|
||||
|
||||
// try
|
||||
// {
|
||||
// worddoc.Bookmarks[dv.TMBeginn.ToString()].Select();
|
||||
// pos = worddoc.Bookmarks[dv.TMBeginn.ToString()].Start;
|
||||
// word.Selection.Text = dv.Value.ToString();
|
||||
// pos2 = word.Selection.End;
|
||||
|
||||
// if (dv.TMBeginn.Contains("TGEDKDirektTelefonB") || dv.TMBeginn.Contains("TGEDKVornameNameBetreue") || dv.TMBeginn.Contains("TGEDKDirektTelefonZ"))
|
||||
// {
|
||||
// Logging.Logging.Debug("1S - " + dv.TMBeginn.ToString(), "", dokumentid);
|
||||
|
||||
// word.Selection.MoveLeft(Unit: Microsoft.Office.Interop.Word.WdUnits.wdCharacter, Count: 1);
|
||||
// if (editdoc) word.Selection.TypeText(Text: " ");
|
||||
// word.Selection.SetRange(pos + 1, pos2 + 1);
|
||||
// //var withBlock = worddoc.Bookmarks;
|
||||
// //withBlock.Add(Range: word.Selection.Range, Name: dv.TMBeginn.ToString());
|
||||
// //withBlock.DefaultSorting = Microsoft.Office.Interop.Word.WdBookmarkSortBy.wdSortByName;
|
||||
// //withBlock.ShowHidden = false;
|
||||
// worddoc.Bookmarks.Add(Range: word.Selection.Range, Name: dv.TMBeginn.ToString());
|
||||
// Logging.Logging.Debug("1E - " + dv.TMBeginn.ToString(), "", dokumentid);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (dv.TMBeginn.Contains("TGEDKDirektTelefonDokZ") || dv.TMBeginn.Contains("TGEDKVornameNameDokZ"))
|
||||
// {
|
||||
// Logging.Logging.Debug("2S - " + dv.TMBeginn.ToString(), "", dokumentid);
|
||||
|
||||
// word.Selection.Text = dv.Value.ToString();
|
||||
// word.Selection.MoveLeft(Unit: Microsoft.Office.Interop.Word.WdUnits.wdCharacter, Count: 1);
|
||||
// word.Selection.TypeText(Text: " ");
|
||||
// word.Selection.SetRange(Start: pos + 1, End: pos2 + 1);
|
||||
|
||||
// //var withBlock = worddoc.Bookmarks;
|
||||
// //withBlock.Add(Range: word.Selection.Range, Name: dv.TMBeginn.ToString());
|
||||
// //withBlock.DefaultSorting = Microsoft.Office.Interop.Word.WdBookmarkSortBy.wdSortByName;
|
||||
// //withBlock.ShowHidden = false;
|
||||
// worddoc.Bookmarks.Add(Range: word.Selection.Range, Name: dv.TMBeginn.ToString());
|
||||
// Logging.Logging.Debug("2E - " + dv.TMBeginn.ToString(), "", dokumentid);
|
||||
|
||||
if (dv.TMBeginn.Contains("TGEDKDirektTelefonB") || dv.TMBeginn.Contains("TGEDKVornameNameBetreue") || dv.TMBeginn.Contains("TGEDKDirektTelefonZ"))
|
||||
{
|
||||
word.Selection.MoveLeft(Unit: Microsoft.Office.Interop.Word.WdUnits.wdCharacter, Count: 1);
|
||||
if (editdoc) word.Selection.TypeText(Text: " ");
|
||||
word.Selection.SetRange(pos + 1, pos2 + 1);
|
||||
var withBlock = worddoc.Bookmarks;
|
||||
withBlock.Add(Range: word.Selection.Range, Name: dv.TMBeginn.ToString());
|
||||
withBlock.DefaultSorting = Microsoft.Office.Interop.Word.WdBookmarkSortBy.wdSortByName;
|
||||
withBlock.ShowHidden = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dv.TMBeginn.Contains("TGEDKDirektTelefonDokZ") || dv.TMBeginn.Contains("TGEDKVornameNameDokZ"))
|
||||
{
|
||||
word.Selection.Text = dv.Value.ToString();
|
||||
word.Selection.MoveLeft(Unit: Microsoft.Office.Interop.Word.WdUnits.wdCharacter, Count: 1);
|
||||
word.Selection.TypeText(Text: " ");
|
||||
word.Selection.SetRange(Start: pos + 1, End: pos2 + 1);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Logging.Logging.Debug("3S - " + dv.TMBeginn.ToString(), "", dokumentid);
|
||||
|
||||
var withBlock = worddoc.Bookmarks;
|
||||
withBlock.Add(Range: word.Selection.Range, Name: dv.TMBeginn.ToString());
|
||||
withBlock.DefaultSorting = Microsoft.Office.Interop.Word.WdBookmarkSortBy.wdSortByName;
|
||||
withBlock.ShowHidden = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
word.Selection.SetRange(pos, pos2);
|
||||
var withBlock = worddoc.Bookmarks;
|
||||
withBlock.Add(Range: word.Selection.Range, Name: dv.TMBeginn.ToString());
|
||||
withBlock.DefaultSorting = Microsoft.Office.Interop.Word.WdBookmarkSortBy.wdSortByName;
|
||||
withBlock.ShowHidden = false;
|
||||
}
|
||||
}
|
||||
word.Selection.MoveLeft(Unit: Microsoft.Office.Interop.Word.WdUnits.wdCharacter, Count: 1);
|
||||
word.Selection.MoveLeft(Unit: Microsoft.Office.Interop.Word.WdUnits.wdCharacter, Count: 2, Extend: Microsoft.Office.Interop.Word.WdMovementType.wdExtend);
|
||||
if (word.Selection.Text == " ")
|
||||
{
|
||||
word.Selection.MoveRight(Unit: Microsoft.Office.Interop.Word.WdUnits.wdCharacter, Count: 1);
|
||||
word.Selection.MoveLeft(Unit: Microsoft.Office.Interop.Word.WdUnits.wdCharacter, Count: 1, Extend: Microsoft.Office.Interop.Word.WdMovementType.wdExtend);
|
||||
word.Selection.Delete(Unit: Microsoft.Office.Interop.Word.WdUnits.wdCharacter, Count: 1);
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
if (dv.TMBeginn.ToString() != "" && dv.TMEnd.ToString() != "" && !dv.TMBeginn.ToString().Contains("TGEDKCursor"))
|
||||
{
|
||||
try
|
||||
{
|
||||
worddoc.Bookmarks[dv.TMBeginn.ToString()].Select();
|
||||
pos = worddoc.Bookmarks[dv.TMBeginn.ToString()].Start;
|
||||
worddoc.Bookmarks[dv.TMEnd.ToString()].Select();
|
||||
pos2 = worddoc.Bookmarks[dv.TMEnd.ToString()].Start;
|
||||
word.Selection.SetRange(pos, pos2);
|
||||
word.Selection.TypeText(Text: dv.Value.ToString());
|
||||
var withBlock = worddoc.Bookmarks;
|
||||
withBlock.Add(Range: word.Selection.Range, Name: dv.TMBeginn.ToString());
|
||||
withBlock.DefaultSorting = Microsoft.Office.Interop.Word.WdBookmarkSortBy.wdSortByName;
|
||||
withBlock.ShowHidden = false;
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
if (dv.FieldName.ToString() != "" && !dv.FieldName.Contains("TGEDKCursor"))
|
||||
{
|
||||
try
|
||||
{
|
||||
if (dv.FieldName.Contains("cc_"))
|
||||
{
|
||||
word.ActiveDocument.SelectContentControlsByTag(dv.FieldName)[1].Range.Text = dv.Value;
|
||||
}
|
||||
if (worddoc.FormFields[dv.FieldName].TextInput.Width != 0)
|
||||
{
|
||||
int fieldlen = worddoc.FormFields[dv.FieldName].TextInput.Width;
|
||||
worddoc.FormFields[dv.FieldName].TextInput.Width = fieldlen + 5;
|
||||
}
|
||||
worddoc.FormFields[dv.FieldName.ToString()].Result = dv.Value;
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//word.ScreenUpdating = true;
|
||||
// word.Selection.SetRange(Start: pos, End: pos2);
|
||||
// //var withBlock = worddoc.Bookmarks;
|
||||
// //withBlock.Add(Range: word.Selection.Range, Name: dv.TMBeginn.ToString());
|
||||
// //withBlock.DefaultSorting = Microsoft.Office.Interop.Word.WdBookmarkSortBy.wdSortByName;
|
||||
// //withBlock.ShowHidden = false;
|
||||
// worddoc.Bookmarks.Add(Range: word.Selection.Range, Name: dv.TMBeginn.ToString());
|
||||
|
||||
// Logging.Logging.Debug("3E - " + dv.TMBeginn.ToString(), "", dokumentid);
|
||||
|
||||
// }
|
||||
// }
|
||||
// Logging.Logging.Debug("4S - " + dv.TMBeginn.ToString(), "", dokumentid);
|
||||
|
||||
// word.Selection.MoveLeft(Unit: Microsoft.Office.Interop.Word.WdUnits.wdCharacter, Count: 1);
|
||||
// word.Selection.MoveLeft(Unit: Microsoft.Office.Interop.Word.WdUnits.wdCharacter, Count: 2, Extend: Microsoft.Office.Interop.Word.WdMovementType.wdExtend);
|
||||
// if (word.Selection.Text == " ")
|
||||
// {
|
||||
// word.Selection.MoveRight(Unit: Microsoft.Office.Interop.Word.WdUnits.wdCharacter, Count: 1);
|
||||
// word.Selection.MoveLeft(Unit: Microsoft.Office.Interop.Word.WdUnits.wdCharacter, Count: 1, Extend: Microsoft.Office.Interop.Word.WdMovementType.wdExtend);
|
||||
// word.Selection.Delete(Unit: Microsoft.Office.Interop.Word.WdUnits.wdCharacter, Count: 1);
|
||||
// }
|
||||
// Logging.Logging.Debug("4E - " + dv.TMBeginn.ToString(), "", dokumentid);
|
||||
|
||||
// }
|
||||
// catch { }
|
||||
// }
|
||||
// if (dv.TMBeginn.ToString() != "" && dv.TMEnd.ToString() != "" && !dv.TMBeginn.ToString().Contains("TGEDKCursor"))
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// Logging.Logging.Debug("5S - " + dv.TMBeginn.ToString(), "", dokumentid);
|
||||
|
||||
// worddoc.Bookmarks[dv.TMBeginn.ToString()].Select();
|
||||
// pos = worddoc.Bookmarks[dv.TMBeginn.ToString()].Start;
|
||||
// worddoc.Bookmarks[dv.TMEnd.ToString()].Select();
|
||||
// pos2 = worddoc.Bookmarks[dv.TMEnd.ToString()].Start;
|
||||
// word.Selection.SetRange(pos, pos2);
|
||||
// word.Selection.TypeText(Text: dv.Value.ToString());
|
||||
// var withBlock = worddoc.Bookmarks;
|
||||
// withBlock.Add(Range: word.Selection.Range, Name: dv.TMBeginn.ToString());
|
||||
// withBlock.DefaultSorting = Microsoft.Office.Interop.Word.WdBookmarkSortBy.wdSortByName;
|
||||
// withBlock.ShowHidden = false;
|
||||
// Logging.Logging.Debug("5E - " + dv.TMBeginn.ToString(), "", dokumentid);
|
||||
|
||||
// }
|
||||
// catch { }
|
||||
// }
|
||||
// if (dv.FieldName.ToString() != "" && !dv.FieldName.Contains("TGEDKCursor"))
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// Logging.Logging.Debug("6S - " + dv.TMBeginn.ToString(), "", dokumentid);
|
||||
|
||||
// if (dv.FieldName.Contains("cc_"))
|
||||
// {
|
||||
// word.ActiveDocument.SelectContentControlsByTag(dv.FieldName)[1].Range.Text = dv.Value;
|
||||
// }
|
||||
// if (worddoc.FormFields[dv.FieldName].TextInput.Width != 0)
|
||||
// {
|
||||
// int fieldlen = worddoc.FormFields[dv.FieldName].TextInput.Width;
|
||||
// worddoc.FormFields[dv.FieldName].TextInput.Width = fieldlen + 5;
|
||||
// }
|
||||
// worddoc.FormFields[dv.FieldName.ToString()].Result = convert_wordfelder(dv.Value);
|
||||
// Logging.Logging.Debug("6E - " + dv.TMBeginn.ToString(), "", dokumentid);
|
||||
|
||||
// }
|
||||
// catch { }
|
||||
// }
|
||||
// //}
|
||||
// }
|
||||
//}
|
||||
word.ScreenUpdating = true;
|
||||
Logging.Logging.Debug("Word Befüllen Ende", "clsOffice", dokumentid);
|
||||
|
||||
if (docdata.Barcode == true) { Generate_Barcodes(ref docdata, tempdir); }
|
||||
@@ -788,9 +889,10 @@ namespace OnDocOffice
|
||||
}
|
||||
word.Visible = true;
|
||||
word.Activate();
|
||||
dialogGenerate.set_progress(90,"Macros ausführen");
|
||||
Logging.Logging.Debug("Start Macros", "clsOffice", dokumentid);
|
||||
|
||||
if(!editdoc) run_macros(ref docdata, connectionstring);
|
||||
if (!editdoc) run_macros(ref docdata, connectionstring);
|
||||
|
||||
if (cursorpositionieren)
|
||||
{
|
||||
@@ -810,10 +912,11 @@ namespace OnDocOffice
|
||||
|
||||
Thread.Sleep(OfficeSleep);
|
||||
string b64 = fh.Base64FromFile(filename);
|
||||
|
||||
word.Documents.Open(filename);
|
||||
word.Activate();
|
||||
Logging.Logging.Debug("Word geöffnet", "clsOffice", dokumentid);
|
||||
|
||||
word.Documents.Open(filename);
|
||||
word.Activate();
|
||||
dialogGenerate.set_progress(100,"Generierung beendet");
|
||||
Logging.Logging.Debug("Word geöffnet", "clsOffice", dokumentid);
|
||||
|
||||
word = null;
|
||||
Logging.Logging.Debug("Generierung abgeschlossen", "clsOffice", dokumentid);
|
||||
@@ -826,6 +929,7 @@ namespace OnDocOffice
|
||||
|
||||
private void Kopfzeile_generieren()
|
||||
{
|
||||
Logging.Logging.Debug("Kopfzeile", "OnDoc", dokumentid);
|
||||
word.Selection.HomeKey(Unit: Microsoft.Office.Interop.Word.WdUnits.wdStory);
|
||||
if (word.ActiveWindow.View.SplitSpecial != Microsoft.Office.Interop.Word.WdSpecialPane.wdPaneNone)
|
||||
{
|
||||
@@ -1338,7 +1442,7 @@ namespace OnDocOffice
|
||||
//TextBodyPart bookmarkContent = bookmarkNavigator.GetBookmarkContent();
|
||||
//string bookmarkText = ((Syncfusion.DocIO.DLS.WParagraph)bookmarkContent.BodyItems.FirstItem).Text;
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1 +1 @@
|
||||
c5101a36c8fddf8e12fe66879b3f3cfcf71f4a32fa59c9ab8791bdea561115f3
|
||||
a3b1708a192291b2c2e876acac3f1b51e683a976d7596dfaa1794f125f3a970e
|
||||
|
||||
@@ -43,3 +43,6 @@ E:\Software-Projekte\OnDoc\OnDoc\OnDocOffice\bin\Debug\vbBarcodes.dll
|
||||
E:\Software-Projekte\OnDoc\OnDoc\OnDocOffice\bin\Debug\vbBarcodes.pdb
|
||||
E:\Software-Projekte\OnDoc\OnDoc\OnDocOffice\bin\Debug\vbBarcodes.xml
|
||||
E:\Software-Projekte\OnDoc\OnDoc\OnDocOffice\bin\Debug\MW6.SDK.dll
|
||||
E:\Software-Projekte\OnDoc\OnDoc\OnDocOffice\bin\Debug\VBOffice.dll
|
||||
E:\Software-Projekte\OnDoc\OnDoc\OnDocOffice\bin\Debug\VBOffice.pdb
|
||||
E:\Software-Projekte\OnDoc\OnDoc\OnDocOffice\bin\Debug\VBOffice.xml
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user