the input
html example
Example code
Try
cvHTMLBody = request(“inputHTML”)
Dim cvLogo = request(“logo”)
if cvHTMLBody = “” then
cvHTMLBody = " "
end if
' ---=== 3. load the HTML ---=== '
dim stream As new MemoryStream(System.Text.Encoding.UTF8.GetBytes(cvHTMLBody))
dim options As new LoadOptions()
options.LoadFormat = LoadFormat.Html
options.Encoding = Encoding.GetEncoding(65001)
Dim doc As new Document(stream, options)
' New Start
'-----------------
if cvLogo <> "" then
Dim builder As DocumentBuilder = New DocumentBuilder(doc)
builder.MoveToHeaderFooter(HeaderFooterType.HeaderPrimary)
builder.InsertHtml(cvLogo)
'builder.InsertImage(cvLogo,ConvertUtil.PixelToPoint(350),ConvertUtil.PixelToPoint(133))
doc.UpdateFields()
end if
' New End
'-----------------
Dim dstStream As New MemoryStream()
doc.Save(dstStream, SaveFormat.Docx)
Response.Clear()
Response.AppendHeader("Content-Type","application/vnd.openxmlformats-officedocument.wordprocessingml.document")
Response.AppendHeader("Content-Disposition", string.Format("attachment; filename=cv.docx"))
dstStream.WriteTo(Response.OutputStream)
'Response.Close()
Response.End()
catch
errText = "Error: the text is empty"
response.write(errText)
Response.end
End Try
@eranlipi
We have imported the shared base64 image into document using the latest version of Aspose.Words for .NET 20.7 and have not found the shared issue. So, please use Aspose.Words for .NET 20.7.
If you still face problem, please create a standalone console application ( source code without compilation errors ) that helps us to reproduce your problem on our end and attach it here for testing. Please also share the HTML content that you want to insert into document.
@tahir.manzoor
hi i updated the version to 20.7. and this not work. i sent you the html that i try to make doc
base64Image.zip (21.4 KB)
the code
Try
cvHTMLBody = request(“inputHTML”)
Dim cvLogo = request(“logo”)
if cvHTMLBody = “” then
cvHTMLBody = " "
end if
' ---=== 3. load the HTML ---=== '
dim stream As new MemoryStream(System.Text.Encoding.UTF8.GetBytes(cvHTMLBody))
dim options As new LoadOptions()
options.LoadFormat = LoadFormat.Html
options.Encoding = Encoding.GetEncoding(65001)
Dim doc As new Document(stream, options)
' New Start
'-----------------
if cvLogo <> "" then
Dim builder As DocumentBuilder = New DocumentBuilder(doc)
builder.MoveToHeaderFooter(HeaderFooterType.HeaderPrimary)
builder.InsertHtml(cvLogo)
'builder.InsertImage(cvLogo,ConvertUtil.PixelToPoint(350),ConvertUtil.PixelToPoint(133))
doc.UpdateFields()
end if
' New End
'-----------------
Dim dstStream As New MemoryStream()
doc.Save(dstStream, SaveFormat.Docx)
Response.Clear()
Response.AppendHeader("Content-Type","application/vnd.openxmlformats-officedocument.wordprocessingml.document")
Response.AppendHeader("Content-Disposition", string.Format("attachment; filename=cv.docx"))
dstStream.WriteTo(Response.OutputStream)
'Response.Close()
Response.End()
catch
errText = "Error: the text is empty"
response.write(errText)
Response.end
End Try
@eranlipi
We have inserted the shared image into document’s header and body and have not found any issue. Please check the attached output document. out.zip (28.4 KB)
Please ZIP and attach working code example here for further testing. Please also share your problematic and expected output documents. We will investigate the issue and provide you more information on it.