Hi Guys,
I felt the documentation regarding header and footer a little superficial, specially on the body content.
Can anyone help me on how to add a text as footer and page number to all pages using REST API?
Thanks!
Hi Guys,
I felt the documentation regarding header and footer a little superficial, specially on the body content.
Can anyone help me on how to add a text as footer and page number to all pages using REST API?
Thanks!
You can add Header/Footer to Word document using following steps:
The possible values of header/footer type request body are:
curl -X PUT "https://api.aspose.cloud/v4.0/words/AsposeThreeD.docx/sections%2F0/headersfooters?folder=Temp"
-H "accept: application/json"
-H "Authorization: Bearer [Access_Token]"
-H "Content-Type: application/json"
-H "x-aspose-client: Containerize.Swagger"
-d "\"HeaderFirst\""
POST /words/{name}/{paragraphPath}/runs Adds run to document, returns added paragraph’s data.
curl -X POST "https://api.aspose.cloud/v4.0/words/AsposeThreeD.docx/sections%2F0%2Fheadersfooters%2F0%2Fparagraphs%2F0/runs?folder=Temp"
-H "accept: application/json"
-H "Authorization: Bearer [Access_Token]"
-H "Content-Type: application/json"
-H "x-aspose-client: Containerize.Swagger"
-d "{"Text":"Aspose.Words Cloud"}"
Now finally set DifferentFirstPageHeaderFooter
value using following API as per your scenario.
PUT /words/{name}/sections/{sectionIndex}/pageSetup Updates page setup of section.
Please use the following API to add Page number in the Word document. It will add page numbers in the footer as per the section page setup. The Request body value can use {PAGE} and {NUMPAGES} fields.
{PAGE}
or
{PAGE} of {NUMPAGES}
PUT /words/{name}/PageNumbers Inserts document page numbers.
@tilal.ahmad, tks.
I´m still getting an error. What is wrong with this body request?
{
“HeaderFooter”: {
“link”: {
“Type”: “FooterFirst”,
“Text”: “Aspose.Words Cloud”
}
}
}
You already passed the header/footer index in paragraphpath parameter, so now only you need to pass the Text like
{
“Text”: “Aspose.Words Cloud”
}