We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

HTML code containing embedded base64 images

Dear Aspose Team,

Based on your recommendation, we've purchased a Developer OEM license on 7/14/2016.

have a look on below code...

var doc1 = new Aspose.Words.Document();

var builder = new Aspose.Words.DocumentBuilder(doc1);

builder.InsertHtml('check attachment for HTML');

InsertHeaderFooter(builder.CurrentSection, HeaderFooterType.FooterPrimary);

InsertHeaderFooter(builder.CurrentSection, HeaderFooterType.HeaderFirst);

builder.MoveToHeaderFooter(HeaderFooterType.FooterPrimary);

builder.PageSetup.PageStartingNumber = 1;

builder.PageSetup.RestartPageNumbering = true;

builder.MoveToHeaderFooter(HeaderFooterType.FooterPrimary);

builder.Write("Page ");

builder.InsertField("PAGE", string.Empty);

builder.MoveToDocumentEnd();

foreach (Aspose.Words.Tables.Row row in doc1.GetChildNodes(NodeType.Row, true))

{

row.RowFormat.AllowBreakAcrossPages = true;

}


HttpResponse resp = HttpContext.Current.Response;

resp.Clear();

resp.ClearHeaders();

resp.ContentType = "application/word";

try

{

doc1.Save(resp.OutputStream, Aspose.Words.SaveFormat.Docx);

}

Because of embedded base64 the image in not appearing in generated word document.

Please get us back ASAP as some live activity is going on.

Hi Sanjay,

Thanks for your inquiry. We have tested the scenario using latest version of Aspose.Words for .NET 16.12.0 and have not found the shared issue. Please use Aspose.Words for .NET 16.12.0. We have attached the output document with this post for your kind reference.

If you still face problem, please share your output document and code of InsertHeaderFooter method here for further testing. We will investigate the issue and provide you more information on this.

Dear Tahir,


After the updating the aspose.dll with the latest one ,still I am facing the same issue of Image base 64 embedded.
Please find code below and find two documents of input html and output word file as an attachment.


Aspose.Words.License license = new Aspose.Words.License();
license.SetLicense(“Aspose.Words.lic”);
var doc1 = new Aspose.Words.Document(“D:/test.htm”);
foreach (Aspose.Words.Tables.Row row in doc1.GetChildNodes(NodeType.Row, true))
{
row.RowFormat.AllowBreakAcrossPages = true;
}
foreach (Paragraph para in doc1.GetChildNodes(NodeType.Paragraph, true))
{
para.ParagraphFormat.Borders.ClearFormatting();
}
var builder = new Aspose.Words.DocumentBuilder(doc1);
builder.MoveToHeaderFooter(HeaderFooterType.FooterPrimary);
builder.PageSetup.PageStartingNumber = 1;
builder.PageSetup.RestartPageNumbering = true;
builder.MoveToHeaderFooter(HeaderFooterType.FooterPrimary);
builder.Write("Page ");
builder.InsertField(“PAGE”, string.Empty);
builder.MoveToDocumentEnd();
doc1.Save(“D:/doctest.docx”, Aspose.Words.SaveFormat.Docx);
Hi Sanjay,

Thanks for your inquiry. Please use the following modified code to get the desired output.

HtmlLoadOptions options = new HtmlLoadOptions();

options.LoadFormat = LoadFormat.Html;

var doc1 = new Aspose.Words.Document(MyDir + "test.htm", options);

foreach (Aspose.Words.Tables.Row row in doc1.GetChildNodes(NodeType.Row, true))

{

row.RowFormat.AllowBreakAcrossPages = true;

}

foreach (Paragraph para in doc1.GetChildNodes(NodeType.Paragraph, true))

{

para.ParagraphFormat.Borders.ClearFormatting();

}

var builder = new Aspose.Words.DocumentBuilder(doc1);

builder.MoveToHeaderFooter(HeaderFooterType.FooterPrimary);

builder.PageSetup.PageStartingNumber = 1;

builder.PageSetup.RestartPageNumbering = true;

builder.MoveToHeaderFooter(HeaderFooterType.FooterPrimary);

builder.Write("Page ");

builder.InsertField("PAGE", string.Empty);

builder.MoveToDocumentEnd();

doc1.Save(MyDir + " Out v16.12.0.docx");