update 20260522
This commit is contained in:
@@ -37,6 +37,7 @@ using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Management.Instrumentation;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Remoting.Messaging;
|
||||
@@ -1619,9 +1620,10 @@ namespace DOCGEN.Klassen
|
||||
|
||||
}
|
||||
}
|
||||
if (apivalue.Type == "Absatz" || apivalue.Type=="Image")
|
||||
|
||||
if (apivalue.Type == "Absatz" || apivalue.Type=="Image" || apivalue.Type == "HTML" )
|
||||
{
|
||||
if (apivalue.Value != "Ja")
|
||||
if (apivalue.Value != "Ja" && apivalue.Type!="HTML")
|
||||
{
|
||||
apivalue.Value = "";
|
||||
BookmarksNavigator bookmarkNavigator = new BookmarksNavigator(document);
|
||||
@@ -1645,6 +1647,13 @@ namespace DOCGEN.Klassen
|
||||
|
||||
//Insert_Image(ref document, apivalue.Tag, apivalue.Value);
|
||||
}
|
||||
if (apivalue.Type == "HTML")
|
||||
{
|
||||
WordDocumentPart htmlDocumentPart = ConvertHTMLToWordDocumentPart(apivalue.Value);
|
||||
BookmarksNavigator bookmarkNavigator = new BookmarksNavigator(document);
|
||||
bookmarkNavigator.MoveToBookmark(apivalue.Tag);
|
||||
bookmarkNavigator.ReplaceContent(htmlDocumentPart);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2045,7 +2054,21 @@ namespace DOCGEN.Klassen
|
||||
|
||||
return Convert.ToBase64String(imageArray);
|
||||
}
|
||||
|
||||
public WordDocumentPart ConvertHTMLToWordDocumentPart(string html)
|
||||
{
|
||||
//Create a new Word document.
|
||||
WordDocument tempDocument = new WordDocument();
|
||||
//Add minimal content to the document (ensures the document structure is valid).
|
||||
tempDocument.EnsureMinimal();
|
||||
//Append the HTML string to the last paragraph of the temporary Word document.
|
||||
tempDocument.LastParagraph.AppendHTML(html);
|
||||
//Create a new WordDocumentPart instance.
|
||||
WordDocumentPart wordDocumentPart = new WordDocumentPart();
|
||||
//Load the temporary document into the WordDocumentPart.
|
||||
wordDocumentPart.Load(tempDocument);
|
||||
//Return the WordDocumentPart containing the converted HTML content.
|
||||
return wordDocumentPart;
|
||||
}
|
||||
public class tabletotext
|
||||
{
|
||||
public string TableName = "";
|
||||
|
||||
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