Hi,
I am creating document file. Here i am creating Header with one image and some text. I want to put one line after that in next line, so can you help me how to insert line(straight line which comes under shapes in word document not new line(\r\n)).
Thanks for your inquiry. Please use the following code snippet to insert the line in the Primary header of current section. The DocumentBuilder.MoveToHeaderFooter method moves the cursor to the beginning of a header or footer in the current section.
You can move the cursor to any place in Document and insert a Shape node of your choice by using the code like below:
DocumentBuilder builder = new DocumentBuilder();
builder.MoveToHeaderFooter(HeaderFooterType.HeaderPrimary);
Shape line = new Shape(builder.Document, ShapeType.Line);
line.Width = 3 * 72;
builder.InsertNode(line);
builder.Document.Save(MyDir + "Out.docx");
Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.
Hi Tahir Manzoor ,
i want to insert line in the header and footer section.
Just below the header and Just above the footer.
Can you please help me out?
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.