I have one more question about this MHT file today. Please look at my code below.
It seems, that I cannot add line on top of loaded document, because “nde” is Nothing.
Could you please give me an advice?
Dim sFile = "E:\test files kit\mht\3 files an attachment.mht"
Dim sOutDir = "D:\out\_Aspose test"
Dim sOutFile = IO.Path.Combine(sOutDir, GetFileName(sFile) + ".pdf")
Dim sSrcFileExt = GetFileExt(sFile)?.ToLower()
Select Case sSrcFileExt
Case ".mht", ".mhtml", ".htm", ".html"
Net.ServicePointManager.SecurityProtocol = Net.SecurityProtocolType.Tls Or Net.SecurityProtocolType.Ssl3 Or CType(3072, Net.SecurityProtocolType)
End Select
Dim myDoc As New Aspose.Words.Document(sFile)
Dim nde = myDoc.FirstSection.Body.Paragraphs(0).Runs(0) ' it is NOTHING for this MHT file !!
If Not IsNothing(nde) Then
Dim bldr = New Words.DocumentBuilder(myDoc)
bldr.MoveTo(nde)
bldr.Writeln("A whole paragraph.")
End If
myDoc.Save(sOutFile, Words.SaveFormat.Pdf)