Using myDoc As WordprocessingDocument = WordprocessingDocument.Open("C:\Users\admin\Documents\Visual Studio 2015\Projects\WebApplication6\WebApplication6\temp\FTANJS2.docx", True) Dim html As String = "< html ><head/><body> <h1>Html Heading</h1> <p>This Is an html document In a String literal.</p> </body> </html>" Dim altChunkId As String = "AltChunkId1" Dim mainPart As MainDocumentPart = myDoc.MainDocumentPart Dim chunk As AlternativeFormatImportPart = mainPart.AddAlternativeFormatImportPart("application/xhtml+xml", altChunkId) Dim chunkStream As Stream = chunk.GetStream(FileMode.Create, FileAccess.Write) Dim stringStream As StreamWriter = New StreamWriter(chunkStream) stringStream.Write(html) Dim altChunk As AltChunk = New AltChunk altChunk.Id = altChunkId mainPart.Document.Body.InsertAfter(altChunk, mainPart.Document.Body.Elements(Of Paragraph).Last) mainPart.Document.Save() End Using
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)