Free Support Forum - aspose.com

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:

<div>

<p style="margin: 12pt 0pt 0pt; padding-left: 18pt; text-indent: -18pt"><span style="font-family: 'Times New Roman'; font-size: 11pt">2.</span><span style="font-family: 'Times New Roman'; font-size: 7pt"> </span><span style="font-family: 'Times New Roman'; font-size: 7pt"> </span><span style="font-family: 'Times New Roman'; font-size: 7pt"> </span><span style="font-family: 'Times New Roman'; font-size: 7pt"> </span><span style="font-family: 'Times New Roman'; font-size: 7pt"> </span><span style="font-family: 'Times New Roman'; font-size: 7pt"> </span><span style="font-family: 'Times New Roman'; font-size: 7pt"> </span><span style="font-family: 'Times New Roman'; font-size: 11pt">Current employee layoffs are intended to be temporary.</span><a name="_ednref1"></a><a href="#_edn1"><span style="font-family: 'Times New Roman'; font-size: 7.33pt; vertical-align: super">[i]</span></a></p>

<p style="margin: 0pt"><span style="font-family: 'Times New Roman'; font-size: 12pt"> </span></p>

</div>

<hr style="width: 33%; height: 1px; text-align: left; -aw-footnote-numberstyle: 2; -aw-footnote-startnumber: 1; -aw-footnote-type: 1" />

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

<p style="margin: 6pt 0pt 0pt; padding-left: 18pt; text-indent: -18pt"><a href="#_ednref1"><span style="font-family: 'Times New Roman'; font-size: 7.33pt; vertical-align: super">[i]</span></a><span style="font-family: 'Times New Roman'; font-size: 10pt"> See question 20 of FASB Staff Implementation Guide (Statement 88), </span><span style="font-family: 'Times New Roman'; font-size: 10pt; font-style: italic">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</span><span style="font-family: 'Times New Roman'; font-size: 10pt">, for fur</span><span style="font-family: 'Times New Roman'; font-size: 10pt">ther discussion. </span></p>

</div>


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,