Reading a Field from Document Footer

Hi,
We have an existing document which has an ID in the footer of the document. We wanted to make sure that using Aspose Word object we can access the Id .
Tracking Id : 2387423874238947
Can we access using the text “Tracking Id” ?

Hi Harry,

Thanks for your inquiry. Please attach your input Word document here for testing. Also, please attach a screen shot highlighting the content in Word document you want to access. I will then investigate your scenario on my side and provide you more information.

Best regards,

Please find the attached template which has the Id on the footer. We wanted to read that using Aspose Word object.

Hi Harry,

Thanks for your inquiry. Sure, this ID can be taken from the last Run node of second Paragraph of Primary Footer as follows:

Document doc = new Document(@"C:\Temp\Sample+Template.doc");
HeaderFooter pf = doc.FirstSection.HeadersFooters[HeaderFooterType.FooterPrimary];
Run run = pf.Paragraphs[1].LastChild as Run;
Console.WriteLine(run.Text);

Please let me know if I can be of any further assistance.

Best regards,

Cool. Its working. Thank you very much
Thanks,
Hari

Hi,

Thanks for your feedback. Please let us know any time you have any further queries. We are always glad to help you.

Best regards,

Hi,
I am facing a wired issue with Aspose. The POC I did to showcase Aspose to our organanization is based on your sample project using .NET 2.0. Everything worked well using .NET 2.0.
But our application is using .NET 4.0 MVC4 when I tried to move the aspose code from .NET 2.0 to .NET 4.0 I am not able to send the document back to the user browser.
Below line of code is not working for me in .NET 4.0 MVC4. This is very critical for us becasue our application is not using .NET 2.0.
Please provide me the equivalent to the below code in .NET 4.0 MVC4.

private void SendToBrowser(Document doc, string outputFormat)
{
    switch (outputFormat)
    {
        case "DOC":
            doc.Save(Response, "Aspose.Words.Demos.doc", ContentDisposition.Attachment, null);
            break;
    }
}

Hi,
Can you please respond ASAP? This is very critical for us!
Thanks,
Hari

Hi there,

Thanks for your inquiry.

Please make sure you are not using the Aspose.Words.dll from the net3.5clientprofile folder, this assembly is for use in the Client Profile and excludes the System.Web assembly. This might be the cause for this method not working in your code.

Instead please continue to use the Aspose.Words.dll from the .net2.0 folder. If you have any further problems, please let us know.

Thanks,

Nope I am not using the DLL from the net3.5clientprofile. I referred the same DLL from .NET 2.0 folder in my project which is developed using .NET 4.0 MVC4 but the response is not working. I am not able to popup the document in the user browser. We are using IE 8.0.
Are you sure that Document.Save() works the same for .NET 2.0 and .NET 4.0 projects?

Hi there,

Thanks for this additional information. Could you please clarify the issue you are facing on your side? Do you get an error or exception? Does the issue only occur with a specific document?

Thanks,

Thank you very much for your reply. Document.Save() was not working for us becasue we made a Ajax Call to download the document.
After reading some articles, we converted the ajax call to server call and after that we are able to get the response in clients browser.
We are all set for now.
Thanks,
Hari

Hi Hari,

It’s great you were able to solve the issue. Please let us know if we can help with anything else.

Thanks,