Regarding Cross refernce in input HTML

Hi,

We are using Aspose.Words.dll version 10.5.0.0 to generate word document by taking Aspose HTML from the input document. The input document may have cross-references to figures and tables.

Now the Aspose HTML of the input document (PFA Input.docx) there are named anchor tags in the Figure and Table but the links to these items have lost their anchors and are now just text (PFA Input_HTML).

Please let us know how we can get anchors in the links.

please find the below code for your reference which we have used to get input html using ASPOSE

string htmlText = string.Empty;

Aspose.Words.Document doc = new Aspose.Words.Document(InputFilePath);

if (doc.Sections != null && doc.Sections.Count > 1)
{
    doc.Sections.RemoveAt(0);
    string lStrImageFolder = string.Empty;
    lStrImageFolder = FolderPath + "/" + ConfigurationManager.AppSettings["HTMLFileFolderName"].ToString();
    string tempDir = Path.Combine(Server.MapPath(lStrImageFolder));
    if (!Directory.Exists(tempDir))
        Directory.CreateDirectory(tempDir);

    Aspose.Words.Saving.HtmlSaveOptions saveOptions = new Aspose.Words.Saving.HtmlSaveOptions();
    saveOptions.ImagesFolder = tempDir;
    saveOptions.CssStyleSheetType = Aspose.Words.Saving.CssStyleSheetType.Embedded;
    saveOptions.SaveFormat = SaveFormat.Html;
    saveOptions.PrettyFormat = true;
    saveOptions.ImagesFolderAlias = ConfigurationManager.AppSettings["HTMLFileFolderName"].ToString();
    MemoryStream htmlStream = new MemoryStream();
    doc.JoinRunsWithSameFormatting();
    doc.ExpandTableStylesToDirectFormatting();
    doc.Save(htmlStream, saveOptions);
    htmlText = Encoding.UTF8.GetString(htmlStream.GetBuffer());
    htmlStream.Close();
    this.HTMLFilePath = FolderPath + "/" + ConfigurationManager.AppSettings["HTMLFileName"].ToString();
    StreamWriter sr = new System.IO.StreamWriter(Server.MapPath(this.HTMLFilePath), false, Encoding.Default);
    StringBuilder strStylePath = new StringBuilder();
    strStylePath.Append(htmlText);
    sr.Write(strStylePath.ToString());
    sr.Close();
}

Thanks,

Hi
Thanks for your request. I managed to reproduce the problem you request has been linked to the appropriate issue. We will let you know once it is resolved.
As a temporary workaround, you can simply replace REF fields in your document with HYPERLINK field as suggested here:
https://forum.aspose.com/t/102957
Hope this helps.
Best regards,

Hi

Thanks for your quick replay.

The solution provided by you is on code side, which we cannot use as per our requirement. Is it possible we can get REF id in html when convert word document to html .if it’s possible. It is very helpful for us.

So please let us know if is there any way to get the clue at HTML side for identify cross reference.

Thanks
Samanvay.

Hi
Thanks for your request. No, unfortunately, currently Aspose.Words does not support REF fields upon converting to HTML. So the only way to work the problem around is using the code I suggested in my previous answer.
Best regards,

@samanvay,
The issues you have found earlier (filed as WORDSNET-1814) have been fixed in this Aspose.Words for .NET 17.7 update and this Aspose.Words for Java 17.7 update.

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan