Hi,
On converting this file to html using aspose with the following code :
Aspose.Words.Document doc = new Aspose.Words.Document(destFileName);
using (MemoryStream pageStream = new MemoryStream())
{
HtmlFixedSaveOptions htmlFixedSaveOptions = new HtmlFixedSaveOptions();
htmlFixedSaveOptions.ExportEmbeddedCss = true;
htmlFixedSaveOptions.ExportEmbeddedFonts = true;
htmlFixedSaveOptions.ExportEmbeddedImages = true;
htmlFixedSaveOptions.ExportEmbeddedSvg = true;
htmlFixedSaveOptions.ExportFormFields = true;
//htmlFixedSaveOptions.ExportGeneratorName = true;
//string cssprefix = "aspose_doc" + page;
//htmlFixedSaveOptions.CssClassNamesPrefix = cssprefix;
htmlFixedSaveOptions.AllowEmbeddingPostScriptFonts = true;
//htmlFixedSaveOptions.Encoding = Encoding.UTF8;
//htmlFixedSaveOptions.FontFormat = ExportFontFormat.Ttf;
doc.Save(pageStream, htmlFixedSaveOptions);
File.WriteAllBytes(Path.Combine(path, "demo.html"), pageStream.ToArray());
}
and opening this demo.html in a web browser and inspect, I could see footer section coming first and then the content.
is it possible to make the sections as header, body and footer after converting with HtmlFixedSaveOptions?
@pooja.jayan
opening this demo.html in a web browser and inspect, I could see footer section coming first and then the content.
Unfortunately I can’t replicate your issue, header and footer are placed in the expected order, if you post your document and the current output I will try to replicate your issue.
is it possible to make the sections as header, body and footer after converting with HtmlFixedSaveOptions?
No it’s not possible. Convert to HTML using HtmlFixedSaveOptions
is close to convert to PDF or get the “reading mode” of the document, basically you get all the information of the document page by page. If you want a more standard web version of the document I recommend to use HtmlSaveOptions
class to define the options to save. Using this class you will get more control about how to export headers and footers.
Hi,
Thankyou for the response.
The resultant html file looks fine, Can you try to open the file in a web browser and check Inspect Window, there I can see footer texts first and then the contents.
My requirement was to search for a particular word or character for which I am using the innerHTMLproperty of html document components, since this issue is there, even if the body contains the word/character it is returning the word in footer section, as this is the first section in html document.
@pooja.jayan In MS Word documents header and footer content is under the main body content, that is why header/footer content is rendered first and then main body content is rendered on top of it. Unfortunately, there is no way to change this. We will consider writing document structure into HtmlFixed, so you can distinguish between header/footer and the main document’s body.
Hi,
Thankyou for your response.
As suggested, I tried HtmlSaveOptions
for converting the docx file. But the converted html file has a layout different than the original docx file.
Atatching the screenshot of html file converted using HtmlSaveOptions.
@pooja.jayan This is an expected behavior. When the document is saved with HtmlSaveOptions
it is exported as flow HTML and is reflowed by the browser according to it’s rules.
Hai
Any update on this issue?
@pooja.jayan The feature request about writing document structure information into HtmlFixed output has been postponed and is not yet scheduled for development. We will keep you posted and let you know once this feature is implemented or we have more information for you .
@pooja.jayan There are no news. The issue is still postponed. This means that the issue will not be revised in the nearest future.
@pooja.jayan Unfortunately, there are no news. The issue is still postponed.