Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Wed Nov 21, 2018 1:07 pm

Hello,
I have a paragraph which contains a text box of variable height.
The vertical paragraph position in the page is variable, too.
I want the text box not to be divided in two pages if it's too high, but that a page jump is forced in this case, to place the whole paragraph in the new page.
Is there a property of the paragraph I can set to do this?
Thank you,
Paola

paolagumi
 
Posts: 81
Joined: Tue Apr 21, 2015 11:32 am

Thu Nov 22, 2018 9:10 am

Hi Paola,

Thanks for your inquiry.
There is a property of paragraph to keep the paragraph on same page. Please refer to below code.
Code: Select all
 paragraph.Format.KeepLines = true;

If the proplem still exists, please provide your code and sample file here or via email(support@e-iceblue.com) so that we can look into the case.
Sincerely,
Mike
E-iceblue support team
User avatar

Mike.Zhang
 
Posts: 93
Joined: Thu Sep 27, 2018 7:11 am

Fri Nov 23, 2018 9:08 am

Paragraph.format.Keeplines = true
does not work.

Here is my code, thank you in advance:


SezMacroCedola.AddParagraph()

Dim ParTestaNotaGenerica As Paragraph = SezMacroCedola.Body.AddParagraph

ParTestaNotaGenerica.Format.KeepLines = True

ParTestaNotaGenerica.Format.BeforeSpacing = 0 ' era 20
ParTestaNotaGenerica.Format.LeftIndent = 10
ParTestaNotaGenerica.AppendText("NOTA GENERICA MACROCEDOLA:").ApplyCharacterFormat(fUniversBold7)

Dim ParBoxNotaGenerica As Paragraph = SezMacroCedola.Body.AddParagraph
ParBoxNotaGenerica.Format.KeepLines = True

Dim restoaltezza As Int32 = Len(LTrim(RTrim(NotaGenerica))) Mod 800
Dim AltezzaNota As Int32 = (Len(LTrim(RTrim(NotaGenerica))) / 800) +
IIf(restoaltezza = 0, 0, 1)

Dim tbNotaGenerica As TextBox = ParBoxNotaGenerica.AppendTextBox(800, AltezzaNota * 25) 'era 50 anzichè 20
ParBoxNotaGenerica.Format.LeftIndent = 15

Dim parNotaGenerica As Paragraph = tbNotaGenerica.Body.AddParagraph()
parNotaGenerica.AppendText(LTrim(RTrim(NotaGenerica))).ApplyCharacterFormat(fUniversBold6)

paolagumi
 
Posts: 81
Joined: Tue Apr 21, 2015 11:32 am

Fri Nov 23, 2018 10:21 am

Hi,

Thanks for your information.
After attempting, I regret to say that I am unable to reproduce your issue. Your code is not complete. To help us solve your issue quickly, could you please provide your full code as well as input document(if any), better to provide a sample project for showing your issue?
Sincerely,
Mike
E-iceblue support team
User avatar

Mike.Zhang
 
Posts: 93
Joined: Thu Sep 27, 2018 7:11 am

Return to Spire.Doc