Textbox and HTML size problems

Dear Aspose support:
Two questions for you:

  1. How to insert a textbox with a bookmark (the bookmark is inside the textbox) by code?
  2. In my project, I called
InsertHTML("...some multiple rows of HTML text with table etc...");

Are there anyway to calculate how many rows (or vertical height in inch) the client html will take after the insertion?
Thanks in advance,

Hi David,

Thanks for your inquiry.

  1. Please use the following code to insert a TextBox Shape with a bookmark in document.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Shape textBox = new Shape(doc, ShapeType.TextBox);
textBox.Width = 300;
textBox.Height = 100;
Paragraph textBoxPara = new Paragraph(doc);
builder.Write("Text inside a bookmark.");
  1. I think, you can implement the following work flow to achieve this:
    a) Create an intermediate empty Word document using Aspose.Words programmatically.
    b) Insert HTML fragment into this document using DocumentBuilder.InsertHtml method.
    c) Use LayoutEnumerator class to calculate number of Lines or heights/widths of those Lines present in this temp document…
    d) Finally, insert this temp document into your main Document at a Bookmark position. Please see the following article:

I hope, this helps.

Best regards,

That really helps, thank you so much!