Query regarding Aspose HTML format

Hi,

We are using Aspose Total Lic version 10.0.0.0 to generate word document

In this process we are taking Aspose HTML of the input word document using the following code:

string htmlText = string.Empty;
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.ImagesFolderAlias = ConfigurationManager.AppSettings["HTMLFileFolderName"].ToString();
MemoryStream htmlStream = new MemoryStream();
doc.Save(htmlStream, saveOptions);
htmlText = Encoding.UTF8.GetString(htmlStream.GetBuffer());
htmlStream.Close();

In the generated HTML we are facing problem because the data is splitted in multiple span tags.

For example:

Input Text:

switchport trunk allowed vlan <<var_global_mgmt_vlan_id>>,<<var_global_nfs_vlan_id>>

The HTML generated for this input is:

<p class="ConsoleBlockSmall">
<span>switchport trunk allowed vlan </span>
<span>&lt;&lt;var_global_mgmt_vlan_id&gt;&gt;</span>
<span>,</span>
<span>&lt;&lt;</span>
<span>var_</span>
<span>global_nfs_vlan_id&gt;&gt;</span>
</p>

Means in the output the data is splitting in multiple span tags:

<span>&lt;&lt;</span>
<span>var_</span>
<span>global_nfs_vlan_id&gt;&gt;</span>

so is there any way we can get the above data in single span tag like:

<span>&lt;&lt;var_global_nfs_vlan_id&gt;&gt;</span>

PFA file for reference
Please provide the solution asap

Thanks,
Samanvay

Hello
Thanks for your request. This can occur because text in your document consists of multiple Runs. Usually this occurs when you edit document multiple times in MS Word.
There is JoinRunsWithSameFormatting method, which concatenates runs with same formatting. So you can try just calling this method before saving document as HTML.
https://reference.aspose.com/words/net/aspose.words/document/joinrunswithsameformatting/
Best regards,

Thanks for quick response,

It helped