Get text from Footer

Hi There,

We have been using Aspose for Document service, we now have a requirement to get the document name from the document which is in the footer, could you please suggest how?

Hi Vinod,

Thanks for your inquiry. The shared document have 0kb file size. Could you please attach your input Word document again here for our reference? We will then provide you more information about your query along with code.

Please find the sample Document

Hi Vinod,

Thanks
for sharing the document. Please use following code example to achieve your requirements. Hope this helps you. Please let us know if you have any more queries.

Document doc = new Document(MyDir + "Sample.doc");
if (doc.FirstSection.PageSetup.DifferentFirstPageHeaderFooter)
 Console.WriteLine(doc.FirstSection.HeadersFooters[HeaderFooterType.FooterFirst].ToString(SaveFormat.Text));
else
 Console.WriteLine(doc.FirstSection.HeadersFooters[HeaderFooterType.FooterPrimary].ToString(SaveFormat.Text));

Hello There,

Thanks for your Response:

When I get the values from a document I see some added traces in the result as bellow:

{"PaAccNum":" \t\t123456789\t\t\r\n","PatientName":"Re:\t \t\t JACOB BOSS\t\t\t \r\n","TemplateName":"1.A.BIC.041515\r\n\r\n","FacilityName":" \t\tABC MEDICAL CENTER\t\r\n","HasErrors":false,"StatusMessage":"Successs"}

Those \t\t \t\t\r\n are auto generated, can you please help us in resolving and omitting these in the result.

Thanks

I think I fixed it with .Trim()

Thank You Anyways

Hi Vinod,

It is nice to hear from you that you have fixed your issue. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.