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,