How can we add line after header and before footer


#1

Hi Team,

We need to add line after header and before footer. How can we achieve that using Aspose.Words cloud api.

Regards,
Nipun Jain


#2

@nipunjain1964

Please use SpaceBefore and SpaceAfter properties of following API:

POST /words/{name}/{nodePath}/paragraphs/{index}/format

Following is an example:

name = SampleDocument.docx
dto = { “SpaceBefore”: 30, “SpaceAfter”: 30 }
nodePath = sections/0/headersfooters/0
index = 0
destFileName = SampleDocument_Result.docx

Input Document: SampleDocument.docx
Output Document: SampleDocument_Result.docx

The complete list of properties is given below:

Property Name Type Description
AddSpaceBetweenFarEastAndAlpha bool Gets or sets a flag indicating whether inter-character spacing is automatically adjusted between regions of Latin text and regions of East Asian text in the current paragraph.
AddSpaceBetweenFarEastAndDigit bool Gets or sets a flag indicating whether inter-character spacing is automatically adjusted between regions of numbers and regions of East Asian text in the current paragraph.
Alignment Aspose.Words.ParagraphAlignment Gets or sets text alignment for the paragraph.
Bidi bool Gets or sets whether this is a right-to-left paragraph.
DropCapPosition Aspose.Words.DropCapPosition Gets or sets the position for a drop cap text.
FirstLineIndent double Gets or sets the value (in points) for a first line or hanging indent. Use a positive value to set a first-line indent, and use a negative value to set a hanging indent.
KeepTogether bool True if all lines in the paragraph are to remain on the same page.
KeepWithNext bool True if the paragraph is to remains on the same page as the paragraph that follows it.
LeftIndent double Gets or sets the value (in points) that represents the left indent for paragraph.
LineSpacing double Gets or sets the line spacing (in points) for the paragraph.
LineSpacingRule Aspose.Words.LineSpacingRule Gets or sets the line spacing for the paragraph.
LinesToDrop int Gets or sets the number of lines of the paragraph text used to calculate the drop cap height.
NoSpaceBetweenParagraphsOfSameStyle bool When true, “SpaceBefore” and “SpaceAfter” will be ignored between the paragraphs of the same style.
OutlineLevel Aspose.Words.OutlineLevel Specifies the outline level of the paragraph in the document.
PageBreakBefore bool True if a page break is forced before the paragraph.
RightIndent bool Gets or sets the value (in points) that represents the right indent for paragraph.
SpaceAfter double Gets or sets the amount of spacing (in points) after the paragraph.
SpaceAfterAuto bool True if the amount of spacing after the paragraph is set automatically.
SpaceBefore double Gets or sets the amount of spacing (in points) before the paragraph.
SpaceBeforeAuto bool True if the amount of spacing before the paragraph is set automatically.
StyleIdentifier Aspose.Words.StyleIdentifier Gets or sets the locale independent style identifier of the paragraph style applied to this formatting.
StyleName string Gets or sets the name of the paragraph style applied to this formatting.
SuppressAutoHyphens bool Specifies whether the current paragraph should be exempted from any hyphenation which is applied in the document settings.
SuppressLineNumbers bool Specifies whether the current paragraph’s lines should be exempted from line numbering which is applied in the parent section.
WidowControl bool True if the first and last lines in the paragraph are to remain on the same page as the rest of the paragraph.

We hope this helps!


#3

Hi team,

Thanks for the reply.

We want to add lines (with a color and a width) after header and before footer.

The same can be done using shape via Aspose.Words dll. How can we achieve the same using Aspose.Words cloud api.

Regards,
Nipun Jain


#4

Hi team,

Can you look into this asap.

Regards,
Nipun Jain


#6

@nipunjain1964

You can add line shape after the header and before footer using the following API:

PUT /words/{name}/{nodePath}/drawingObjects

Description of DrawingObject parameters is given below:

  1. Name: RelativeHorizontalPosition
    Description: Specifies where the distance to the image is measured from.
    Type: https://apireference.aspose.com/net/words/aspose.words.drawing/relativehorizontalposition/

  2. Name: RelativeVerticalPosition
    Description: Specifies where the distance to the image is measured from.
    Type: https://apireference.aspose.com/net/words/aspose.words.drawing/relativeverticalposition/

  3. Name: Left
    Description: Distance in points from the origin to the left side of the image.
    Type: double

  4. Name: Top
    Description: Distance in points from the origin to the top side of the image.
    Type: double

  5. Name: Width
    Description: Width of the drawing objects in points.
    Type: double

  6. Name: Height
    Description: Height of the drawing object in points.
    Type: double

  7. Name: WrapType
    Description: Specifies how to wrap text around the image.
    Type: https://apireference.aspose.com/net/words/aspose.words.drawing/wraptype/

Following is an API example:

name = SampleDocument_Result.docx
drawingObject = { “RelativeHorizontalPosition”: “Margin”, “Left”: 100, “RelativeVerticalPosition”: “Margin”, “Top”: 0, “Width”: 300, “Height”: 1, “WrapType”: “None” }
imageFile = line.png
nodePath = sections/0/headersfooters/0/paragraphs/0

Input Document: SampleDocument_Result.docx.zip
Output Document: SampleDocument_Output.docx.zip