Hi
Thanks for your inquiry. You can use the DocumentBuilder.InsertHtml method to insert HTML into the document. I think that you can try to use the following code.
Document doc = new Document(@"346_101920_Subeesh\in.doc");
Table table = new Aspose.Words.Table(doc);
Row row = new Row(doc);
Cell cell1 = new Cell(doc);
cell1.CellFormat.Width = 30;
row.Cells.Add(cell1);
table.Rows.Add(row);
doc.FirstSection.Body.AppendChild(table);
int tableIndex = doc.FirstSection.Body.Tables.IndexOf(table);
int rowIndex = doc.FirstSection.Body.Tables[tableIndex].Rows.IndexOf(row);
int cellIndex = doc.FirstSection.Body.Tables[tableIndex].Rows[rowIndex].Cells.IndexOf(cell1);
DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToCell(tableIndex, rowIndex, cellIndex, 0);
builder.InsertHtml("<b>Aspose.Words</b>");
doc.Save(@"346_101920_Subeesh\out.doc");
Hi Alexey,
Thanks for the quick reply,
The example code you have given is working correctly . But i am trying to create a table according to the data pulled from a database . This is the code snippet .
Aspose.Words.Table table = new Aspose.Words.Table(doc);
foreach (DataRow dr in dt.Rows)
{
Row row = new Row(doc);
Cell cell1 = new Cell(doc);
cell1.CellFormat.Width = 30;
Paragraph p1 = new Paragraph(doc);
Run r1 = new Run(doc, "some html text from database");
p1.AppendChild(r1);
cell1.AppendChild(p1);
row.Cells.Add(cell1);
table.Rows.Add(row);
}
doc.FirstSection.Body.AppendChild(table);
I am getting some error when trying to find the index of the row and cell from the loop , is there any other way to insert the html content , other than using the document builder.
Hi,
Thanks for the reply , but i couldnt check the result because , the output was truncated as i am using the evaluation version .
Is there any way that i can test the features of the product before i purchase it . We are now using another product from Aspose , it is Aspose PDF . We could test all the features of the product before we buy it with a watermark from aspose.
Subeesh
Hi
Thanks for your inquiry. If you want to test Aspose.Words without evaluation version limitations, you can also request a 30-Day Temporary License. Please refer to How to get a Temporary License?
Best regards.