20240627
This commit is contained in:
@@ -130,9 +130,9 @@
|
||||
<Project>{6a997047-30bb-4ed3-8c13-f95aa6a88f82}</Project>
|
||||
<Name>EDOKA_BarcodeLib</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Helper\Helper.csproj">
|
||||
<ProjectReference Include="..\Helper\EDOKA_Helper.csproj">
|
||||
<Project>{216c1660-5ad5-4a5e-80e4-150ccf673cbc}</Project>
|
||||
<Name>Helper</Name>
|
||||
<Name>EDOKA_Helper</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Model\Model.csproj">
|
||||
<Project>{a1fd0973-89a7-4588-877d-373835d6e00c}</Project>
|
||||
|
||||
@@ -37,19 +37,21 @@ namespace DOCGEN.Generator
|
||||
DataTable dt = new DataTable();
|
||||
DataTable dt2 = new DataTable();
|
||||
string Apptype = "";
|
||||
dt = db.Get_Vorlage_By_DokumentID(DokumentID);
|
||||
dt = db.Get_Vorlage_By_DokumentID(dokumentid);
|
||||
db.dsdaten.Tables.Clear();
|
||||
dt2 = db.Get_ApplicationType_from_Vorlage(Convert.ToInt32(dt.Rows[0]["nr"].ToString()));
|
||||
Apptype = dt2.Rows[0][0].ToString();
|
||||
switch (Apptype.ToUpper())
|
||||
{
|
||||
case "DOCX": case "DOCM": case "DOC": case "DOT": case "Word":
|
||||
case "DOCX": case "DOCM": case "DOC": case "DOT":
|
||||
case "WORD": case "DOTM":
|
||||
SynFWord sfword = new SynFWord();
|
||||
generate_docdata(dokumentid, ref docdata);
|
||||
clsdok dok = new clsdok("", "", "");
|
||||
dok.dokument= sfword.Generate_Word(dt.Rows[0][0].ToString(), docdata);
|
||||
dok.doktype = "D";
|
||||
dok.extension = dt2.Rows[0][1].ToString();
|
||||
//if (dok.extension.ToUpper()=="DOTM") { dok.extension = "docm"; }
|
||||
return dok;
|
||||
case "XLSM": case "XLSX": case "XLST": case "XLS": case "XLT":
|
||||
clsdok dokexcel = new clsdok("", "", "");
|
||||
@@ -85,14 +87,19 @@ namespace DOCGEN.Generator
|
||||
docValues.Add(dv);
|
||||
}
|
||||
clsDocValue dv1 = new clsDocValue();
|
||||
//dv1.TMBeginn = "";
|
||||
//dv1.TMEnd = "";
|
||||
//dv1.FieldName = "Text1";
|
||||
//dv1.Value = "Das ist der Text, welcher automatisch in die Briefvorlage kopiert wird. " + "\r\n"+
|
||||
// "Mit einem Zeilenumbruch";
|
||||
//docValues.Add(dv1);
|
||||
//docdata.As_Faksimile = "True";
|
||||
|
||||
docdata.DocValues = docValues;
|
||||
|
||||
db.Get_Tabledata("Select * from view_ER_Makros where dokumentid='" + dokumentid + "' order by reihenfolge",false,true);
|
||||
List<clsDocMacro>docMacros = new List<clsDocMacro>();
|
||||
foreach (DataRow r in db.dsdaten.Tables[0].Rows)
|
||||
{
|
||||
clsDocMacro dm = new clsDocMacro();
|
||||
dm.Name = r["makro"].ToString().Trim();
|
||||
dm.BookMark = r["BookMark"].ToString().Trim();
|
||||
docMacros.Add(dm);
|
||||
}
|
||||
docdata.DocMacros = docMacros;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ using SkiaSharp;
|
||||
using Syncfusion.DocToPDFConverter;
|
||||
using Syncfusion.Pdf;
|
||||
using System.Management.Instrumentation;
|
||||
using Syncfusion.XlsIO.FormatParser.FormatTokens;
|
||||
|
||||
namespace DOCGEN.Klassen
|
||||
{
|
||||
@@ -129,16 +130,58 @@ namespace DOCGEN.Klassen
|
||||
}
|
||||
}
|
||||
}
|
||||
if (docdata.Barcode==true)
|
||||
|
||||
foreach (clsDocMacro dm in docdata.DocMacros)
|
||||
{
|
||||
switch (dm.Name.ToUpper())
|
||||
{
|
||||
case "DOKUMENTSCHUETZEN":
|
||||
document.Protect(ProtectionType.AllowOnlyFormFields, "Australia");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (dm.BookMark != "")
|
||||
{
|
||||
if (document.ProtectionType == ProtectionType.NoProtection)
|
||||
{
|
||||
WParagraph paragraph = document.Sections[0].Paragraphs[0] as WParagraph;
|
||||
BookmarkStart bookmarkStart = new BookmarkStart(document, dm.BookMark);
|
||||
paragraph.Items.Insert(0, bookmarkStart);
|
||||
}
|
||||
else
|
||||
{
|
||||
document.Protect(ProtectionType.NoProtection, "Australia");
|
||||
WParagraph paragraph = document.Sections[0].Paragraphs[0] as WParagraph;
|
||||
BookmarkStart bookmarkStart = new BookmarkStart(document, dm.BookMark);
|
||||
BookmarkEnd bookmarkEnd = new BookmarkEnd(document, dm.BookMark);
|
||||
paragraph.Items.Insert(0, bookmarkStart);
|
||||
paragraph.Items.Insert(2, bookmarkEnd);
|
||||
document.Protect(ProtectionType.AllowOnlyFormFields, "Australia");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (docdata.Barcode==true)
|
||||
{
|
||||
Insert_Barcode(document, docdata);
|
||||
}
|
||||
|
||||
//document.Save(@"x:\docdemo\unterschriften\gaga.docx");
|
||||
//document.UpdateDocumentFields();
|
||||
//document.UpdateAlternateChunks();
|
||||
|
||||
|
||||
MemoryStream destms = new MemoryStream();
|
||||
document.Save(destms, formattype_original);
|
||||
|
||||
if (formattype_original.ToString().ToUpper() == "DOTMXXX")
|
||||
{
|
||||
document.Save(destms, FormatType.Docm);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
document.Save(destms, formattype_original);
|
||||
}
|
||||
|
||||
document.Close();
|
||||
document.Dispose();
|
||||
byte[] imageArray = destms.ToArray();
|
||||
@@ -155,7 +198,7 @@ namespace DOCGEN.Klassen
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static void ReplaceBookmarkText(WordDocument document, string bookmarkName, string textToFind, string textToReplace)
|
||||
{
|
||||
//Check whether the bookmark name is valid.
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user