Hi, I am using Aspose Words for converting HTML into .docx document. So far so good. For this I am using InsertHtml() function. In my HTML I have mostly tables, which have some issue with cellpadding, but I got arround that in some ugly way. My question is, can I create a table in HTML, add it some HTML tag, like Id or Name, to give this table a title? I noticed that Table (Aspose Library class) has this property but I don’t know what to do in HTML so that when InsertHTML() is done I get to have Title property set in Table instances.
Your help would be really appriciated.
Best regards,
Lazar
@lcvijovic09,
We have logged your requirement in our issue tracking system. Your ticket number is WORDSNET-18494. We will further look into the details of this requirement and will keep you updated on the status of the linked issue.
Hi, thanks for a quick reply. Ok, great. Just out of curiosity, if I have 5 tables in my HTML that are being converted into Word document, how can I differentiate these tables properly? Is there a way to do this now?
Thanks.
@lcvijovic09,
You can insert a hidden bookmark inside first cell of first row in each table like this:
<a name="_bm1"></a>
// For first table
<a name="_bm2"></a>
// For second table
<a name="_bm3"></a>
// For third table and so on
See attached HTML (SampleHtml.zip (599 Bytes)) and try running the following code:
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.InsertHtml(File.ReadAllText("E:\\Temp\\SampleHtml.txt"));
Table tbl1 = (Table)doc.GetChildNodes(NodeType.Table, true)[0];
Bookmark bm1 = tbl1.FirstRow.FirstCell.Range.Bookmarks["_bm1"];
if (bm1 != null)
{
Console.WriteLine("Yes, this is first table");
}
Thank you, I will give it a try in few days.