|
FOROS PROFESIONALES WINDEV, WEBDEV y WINDEV Mobile |
| | | | | |
| Iniciado por PeHoBe, 22,dic. 2020 09:35 - 1 respuesta |
| |
| | | |
|
| |
Miembro registrado 124 mensajes |
|
| Publicado el 22,diciembre 2020 - 09:35 |
Hi all,
As there is no HTMLtoDOC() function in WinDev (and it doesn't exist in the base DotNet libraries neither on which I guess the Word Processing in WinDev is built) I am trying to integrate the Git HTML2OpenText library in a WinDev project in order to be able to do such a transformation. https://github.com/onizet/html2openxml/tree/dev/src/Html2OpenXml
In C# it works like a charm but I would like to integrate/use it directly from WL without having to write a wrapper C# library around it.
I can translate about everything from C# except for one line. Original C# code:
generatedDocument = new System.IO.MemoryStream(); package = WordprocessingDocument.Create(generatedDocument, WordprocessingDocumentType.Document);
mainPart = package.MainDocumentPart; if (mainPart == null) { mainPart = package.AddMainDocumentPart(); new Document(new Body()).Save(mainPart); ==> Can't get this translated to WLanguage }
this.converter = new HtmlConverter(mainPart);
And the WL code:
DNetStream is MemoryStream dynamic DNetStream = new MemoryStream DNetDocx is WordprocessingDocument dynamic DNetDocx = WordprocessingDocument.Create(DNetStream,WordprocessingDocumentType.Document) DNetDocxMainPart is MainDocumentPart dynamic DNetDocxMainPart = DNetDocx.MainDocumentPart IF DNetDocxMainPart = Null THEN DNetDocxMainPart = DNetDocx.AddMainDocumentPart() new Document(new Body()).Save(mainPart); END pclDNetConv is HtmlConverter dynamic pclDNetConv = new HtmlConverter(DNetDocxMainPart) pclDNetConv.ParseHtml(EDT_RawHTML)
Has anybody got some tips? TIA
-- Peter Holemans www.mcs2.eu www.pixontri.eu |
| |
| |
| | | |
|
| | |
| |
Miembro registrado 124 mensajes |
|
| Publicado el 22,diciembre 2020 - 13:17 |
Hi all
I got an answer from mr. Jurassic Pork on the French forum. Here's the solution:
DNetStream is MemoryStream dynamic DNetStream = new MemoryStream DNetDocx is WordprocessingDocument dynamic DNetDocx = WordprocessingDocument.Create(DNetStream,WordprocessingDocumentType.Document) DNetDocxMainPart is MainDocumentPart dynamic DNetDocxMainPart = DNetDocx.MainDocumentPart IF DNetDocxMainPart = Null THEN DNetDocxMainPart = DNetDocx.AddMainDocumentPart()
MonBody est un DocumentFormat.OpenXml.WordProcessing.Body() MonDocument est un DocumentFormat.OpenXml.WordProcessing.Document(MonBody) MonDocument.Save(DNetDocxMainPart) END pclDNetConv is HtmlConverter dynamic pclDNetConv = new HtmlConverter(DNetDocxMainPart) pclDNetConv.ParseHtml(EDT_RawHTML)
Cheers !
-- Peter Holemans www.mcs2.eu www.pixontri.eu |
| |
| |
| | | |
|
| | | | |
| | |
| | |
| |
|
|
|