Is possible to count the amount of line that has a paragraph?

I have a textbox with unlimited paragraphs (the paragraphs insert with a htmleditor) but when the amount of paragraph is superior to the size of the textbox, they hide paragraph following.
any solution?

Hi
Thanks for your interest in Aspose products. I think that you can solve this problem using FitShapeToText property.

shape.TextBox.FitShapeToText = true;

Also see the following link.
https://reference.aspose.com/words/net/aspose.words.drawing/textbox/fitshapetotext/
I hope that this will help you.
Best regards.

Hi, thanks for you answer, but no found the solution, because textbox has the same size of height that the page, and noncontinues in the next page…
I need to know when a paragraph is hidden, to add another one textbox in a new page and to continue with the same text.
I think that count each line approximately when hidden a paragraph, and insert a break page. I can send to you the file generated and how i need

Hi
Please attach files here. Also, tell me please can you use a table cell instead a textbox?
Best regards.

This is a file generated by my application

This is a file as i want

Hi

Thank you for additional information. I think that you can try using a table to achieve this. Set “Repeat as header on each page” for two header rows. I created example document for you. See the attachment

Please let me know if you would like to know something else.

Best regards.

Hi, one question… can you see the file, and will say me if is posible take a control of the behavior? and can you give me the example code that you use for you solution?.. thanks !!

Hi
I created this document using MsWord. You can try using this document as template to generate result document. You can try using mail merge or DocumentBuilder to achieve this. Please provide me information how you generate you document.
Best regards.

I use DocumentBuilder to generate the document, I’m use a class InfoWord and it has many procedures that call other class… if this serves to you, I can put the file here

Hi
Here is code that you can use to generate this document.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToHeaderFooter(HeaderFooterType.HeaderPrimary);
builder.CurrentParagraph.ParagraphFormat.Alignment = ParagraphAlignment.Center;
builder.Write("My Header");
PageSetup setup = builder.CurrentSection.PageSetup;
setup.Orientation = Aspose.Words.Orientation.Landscape;
double width = setup.PageWidth - setup.LeftMargin - setup.RightMargin;
double height = setup.PageHeight - setup.BottomMargin - setup.TopMargin - setup.HeaderDistance;
builder.MoveToHeaderFooter(HeaderFooterType.FooterPrimary);
builder.CellFormat.Width = width / 2;
builder.InsertCell();
builder.InsertCell();
builder.CurrentParagraph.ParagraphFormat.Alignment = ParagraphAlignment.Right;
builder.InsertField("PAGE", "");
builder.Write(" / ");
builder.InsertField("NUMPAGES", "");
builder.EndRow();
builder.EndTable();
builder.MoveToDocumentStart();
builder.RowFormat.Height = 30;
builder.RowFormat.HeadingFormat = true;
builder.InsertCell();
builder.CellFormat.Width = width / 2;
builder.CellFormat.Borders.LineStyle = LineStyle.Single;
builder.CellFormat.Borders.LineWidth = 1;
builder.CellFormat.HorizontalMerge = CellMerge.First;
builder.Write("Some text in header");
builder.InsertCell();
builder.CellFormat.Width = 5;
builder.CellFormat.HorizontalMerge = CellMerge.Previous;
builder.InsertCell();
builder.CellFormat.Width = width / 2;
builder.EndRow();
builder.RowFormat.Height = 5;
builder.InsertCell();
builder.CellFormat.Width = width / 2;
builder.CellFormat.Borders.LineStyle = LineStyle.None;
builder.CellFormat.HorizontalMerge = CellMerge.First;
builder.InsertCell();
builder.CellFormat.Width = 5;
builder.CellFormat.HorizontalMerge = CellMerge.Previous;
builder.InsertCell();
builder.CellFormat.Width = width / 2;
builder.EndRow();
builder.RowFormat.Height = 30;
builder.CellFormat.HorizontalMerge = CellMerge.None;
builder.InsertCell();
builder.CellFormat.Width = width / 2;
builder.CellFormat.Borders.LineStyle = LineStyle.Single;
builder.CellFormat.Borders.LineWidth = 1;
builder.Write("Some text in header");
builder.InsertCell();
builder.CellFormat.Width = 5;
builder.CellFormat.Borders.LineStyle = LineStyle.None;
builder.InsertCell();
builder.CellFormat.Width = width / 2;
builder.CellFormat.Borders.LineStyle = LineStyle.Single;
builder.CellFormat.Borders.LineWidth = 1;
builder.Write("Some text in header");
builder.EndRow();
builder.RowFormat.Height = 5;
builder.InsertCell();
builder.CellFormat.Width = width / 2;
builder.CellFormat.Borders.LineStyle = LineStyle.None;
builder.CellFormat.HorizontalMerge = CellMerge.First;
builder.InsertCell();
builder.CellFormat.Width = 5;
builder.CellFormat.HorizontalMerge = CellMerge.Previous;
builder.InsertCell();
builder.CellFormat.Width = width / 2;
builder.EndRow();
builder.RowFormat.Height = height - 75;
builder.RowFormat.HeadingFormat = false;
builder.CellFormat.HorizontalMerge = CellMerge.None;
builder.InsertCell();
builder.CellFormat.Width = width / 2;
builder.CellFormat.Borders.LineStyle = LineStyle.Single;
builder.CellFormat.Borders.LineWidth = 1;
for (int i = 0; i < 100; i++)
{
     builder.Write("Some text in body");
}
builder.InsertCell();
builder.CellFormat.Width = 5;
builder.CellFormat.Borders.LineStyle = LineStyle.None;
builder.InsertCell();
builder.CellFormat.Width = width / 2;
builder.CellFormat.Borders.LineStyle = LineStyle.Single;
builder.CellFormat.Borders.LineWidth = 1;
builder.Write("Some text");
builder.EndRow();
builder.EndTable();
doc.Save(@"388_104103_Miguelati\out.doc");

I hope that this will help you.
Best regards.