Convert html to Doc or Docx

Hi ,

I have a text file in attachment. If you run with html extension then we will get an output where by hovering on letter 1, you can get a popup text.

So the same thing i want to get in doc or docx file means if i hover in doc also it should give popup text as like in html output.

below my code for html to doc,

private void HTMLtoDocx()
{
    string dataDir = Path.GetFullPath(ConfigurationSettings.AppSettings["DocPath"].ToString());
    System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
    System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
    dvReadMe.RenderControl(oHtmlTextWriter);

    Document doc = new Document();
    DocumentBuilder builder = new DocumentBuilder(doc);
    builder.Writeln(oStringWriter.ToString());

    string responseFromServer = oStringWriter.ToString();
    MemoryStream stream = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(responseFromServer));
    LoadOptions options = new LoadOptions();
    options.LoadFormat = LoadFormat.Html;
    doc = new Document(stream, options);

    doc.Save(dataDir + "HTMLtoDocx.docx");
}

Hi,

Thanks for your inquiry. But when you save this html to Word format using Microsoft Word 2013, you’ll observe the same behavior. Please see attached Microsoft Word 2013 generated .docx document. So, this seems to be an expected behavior as Aspose.Words mimics Microsoft Word in this case. If we can help you with anything else, please feel free to ask.

Best regards,

Thanks for your reply.

But Can’t I get the same behavior i.e. on hovering to letter 1 should give a text popup in doc or docx file.

In your attachment, I didn’t get any popup by hovering on.

Thank You.

Hi,

By using Footnote or Endnote concept, I am able to get that thing. But the issue is I am not getting at exact position where I want to get that hover popup.

Please help me on the positioning of footnotes.

Thank You.

Hi,

Thanks for your inquiry. Could you please attach your expected Word document here for our reference. We will investigate the structure of your expected Word document as to how you want your final output be generated like. You can create expected Word document using Microsoft Word. We will investigate the scenario on our end and provide you more information.

Best regards,

Thanks for your reply.

Please find in attachment the word document. where by hovering the symbol “i”; of first line near word “temporary” am getting a popup.

So exactly same output I need as a doc file from html.

Thank You.

Hi ,

Thanks for your inquiry. You can use the following HTML to produce expected output in Word document:

Current employee layoffs are intended to be temporary.<a name="_ednref1"></a><a href="#_edn1">[i]</a>

<hr />

<div id="_edn1" style="-aw-footnote-isauto: 1">

    <a href="#_ednref1">[i]</a> See question 20 of FASB Staff Implementation Guide
(Statement 88), A Guide
to Implementation of Statement 88 on Employers’ Accounting for Settlements and
Curtailments of Defined Benefit Pension Plans and for Termination Benefits:
Questions and Answers, for
further discussion. 

I hope, this helps.

Best regards,

Hi,

Thanks for being patient. Regarding WORDSNET-12028, please check below the analysis of this issue:

  1. MS Word doesn’t have an analogue for ABBR tag, but it is possible to import ABBR tags as footnotes. I have attached documents that reproduce using of footnotes. I hope, this solution works for you.
  2. Aspose.Words preserves the superscript formatting but exports superscripts using CSS declarations (vertical-align:super) but not with sup tags. I am afraid, we don’t want to change this behaviour because formatting is preserved and using of CSS is more flexible solution.

Best regards,