Get the Header Text from Document

I want the Header Text from Word Document.

If there is any way in Aspose Please Advise me How to do?

Hello,
Thank you for your request.
To solve your problem you need to take a class HeaderFooter. Please have a look at examples use this class in our documentation. If you still have trouble feel free to ask.

hai sir/mam

I tried But There is no information related to get Header Text from word document…

Can You suggest me other way…

Hi Maha,
Thanks for your inquiry. Sorry my colleague did not explained well. In Ms Word document each section can have 3 types of headers and 3 types of footers. If you need to get text of the particular header or footer of the particular section, you should just get the HeaderFooter object of the appropriate type and get its text. For instance, the following code shows how to get text from the primary header of the first section of MS Word document:

// Open document.
Document doc = new Document("in.doc");
// Get primary header of the appropriate type and print its text.
HeaderFooter primaryHeader = doc.FirstSection.HeadersFooters[HeaderFooterType.HeaderPrimary];
if (primaryHeader != null)
    Console.WriteLine(primaryHeader.ToTxt());

Hope this helps.
Best regards,

Thank You Very much…

Its Working…

hi sir,

Thank You…for solved Header Text Issue.

I need another help from you.

Word Doc Content as Follows:

Experience performing various complex ETL
transformations in a variety of tools from Informatica to bare
PLSQL/TSQL. Good exposure to data interface design with disparate source
systems & automation.

Experience:

XXX Company Design, develop and maintain the analysis reports requested by the
marketing team and higher management for business forecasting and trend
analysis.

Analyze the transactional and analytic data and determine the individual
relationships and components for reporting.

Explanation:

I need Header Text(Experience from Word Doc)
My current Regex Picks the yellow content But i need Experience from red content

strPattern="Experience";
Regex regex = new Regex("^[^a-zA-Z0-9]*" + Regex.Escape(strPattern) + ".*$",
    RegexOptions.IgnoreCase | RegexOptions.Multiline);

I need Heading Text only like Experience
Can you provide regex or using aspose concept that match Red Content(Experience)?
Waiting For Your Favorable Reply?

Thank You in advance

Hello,
Thank you for your inquiry.
Could you please create a simple document and provide it to us. We will offer you a solution.

Ho sir here I attach one sample document.I need Yellow content and Its Index Postion

me using to get Text from word document

string documentText = doc.ToTxt();
documentText = documentText.Replace("\r", "\r\n");

I get whole document text in (documentText variable) from that i’m processing all.

In the attached document I need Yellow Content(Heading text) Not Red content.

Pls Help How to solve?i.e How to get heading Text?

Hello
Thanks for your request. As I understand what you are looking for, it is just getting specific word (phrase) form the document. Am I right?
Please see the following link to learn the article which describes how to programmatically find a particular word or a phrase in a document using Aspose.Words:
https://docs.aspose.com/words/net/find-and-replace/
What is your main goal, by the way? Maybe I will be able to help you to find a proper solution of your problem.
Best regards.

Thank You…I’l read and come back to you…

A post was split to a new topic: Get the Header Footer Text from Document