Home     Products      Support      Corporate     Sign In 

Support Knowledge Base, Article 1270

Product
WordWriter
Title
HOW TO: Create a Hanging indentation for a paragraph
Solution

In MS Word you can create a paragraph that has a Hanging Indentation.

A hanging indentation means that the entire paragraph is indented except for the first line:

In Word it is created through:
Format menu -> Paragraph
under Indentation set Special to Hanging and By to the number of inches:

Though there isn't a property for hanging indentation in the current version of WordWriter, if a hanging indentation is set in an input file or template the hanging indentation will be preserved.

It is also possible to create a Hanging Indentation using WordApplication by setting the Indent property of the ParagraphFormatting object twice:

  • Set IndentLocation.Left to the desired indentation.
  • Set IndentLocation.FirstLine with the same value only negative so it will "jump" back to the beginning of the page
Note: The indentation is set using the Twips measurement unit (Twip = 1/1440 Inch). To simplify the use of Twips WordWriter provides a TwipsConverter object that allows you to convert twips to or from inches, centimeters and points.

The code below creates a 1 inch hanging indentation. Notice the negative value given to the FirstLine indentation:

[C#] [VB.NET]  

    ParagraphFormatting pFormat = doc.CreateParagraphFormatting();
         
    //using the TwipsConverter to convert the inches into Twips
    int TwipIndentVal = TwipsConverter.FromInches(1);
		        
    //setting the paragraph to be indented 1 inch left
    pFormat.set_Indent(TwipIndentVal, 
      		      ParagraphFormatting.IndentLocation.Left);

    //The negative value takes back the first line by 1 inch, to the left margin
    pFormat.set_Indent(-TwipIndentVal, 
		      ParagraphFormatting.IndentLocation.FirstLine);    
        
    Paragraph par = doc.InsertParagraphAfter(null, pFormat);

Created : 1/29/2008 6:25:24 PM (last modified : 4/14/2008 6:38:49 PM)

Rate this article!

 
Comments



Copyright 2006 © SoftArtisans, Inc. All Rights Reserved.

Site Map     |     Privacy Policy     |     Contact Us