ParagraphFormatSpaceBeforeAuto Property

True if the amount of spacing before the paragraph is set automatically.

Namespace:  Aspose.Words
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntax
public bool SpaceBeforeAuto { get; set; }

Property Value

Type: Boolean
Remarks

When set to true, overrides the effect of SpaceBefore.

Remarks

When you set paragraph Space Before and Space After to Auto, Microsoft Word adds 14 points spacing between paragraphs automatically according to the following rules:

  • Normally, spacing is added after all paragraphs.
  • In a bulleted or numbered list, spacing is added only after the last item in the list. Spacing is not added between the list items.
  • In a nested bulleted or numbered list spacing is not added.
  • Spacing is normally added after a table.
  • Spacing is not added after a table if it is the last block in a table cell.
  • Spacing is not added after the last paragraph in a table cell.
Examples
Shows how to work with paragraph spacing.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Set the amount of white space before and after each paragraph to 12 points
builder.ParagraphFormat.SpaceBefore = 12.0f;
builder.ParagraphFormat.SpaceAfter = 12.0f;

// We can set these flags to apply default spacing, effectively ignoring the spacing in the attributes we set above
Assert.False(builder.ParagraphFormat.SpaceAfterAuto);
Assert.False(builder.ParagraphFormat.SpaceBeforeAuto);
Assert.False(builder.ParagraphFormat.NoSpaceBetweenParagraphsOfSameStyle);

// Insert two paragraphs which will have padding above and below them and save the document
builder.Writeln("Paragraph 1.");
builder.Writeln("Paragraph 2.");

doc.Save(ArtifactsDir + "Paragraph.ParagraphSpacing.docx");
See Also