locked
Reading Table of contents from a word file RRS feed

  • Question

  •   Hi,
        I am Navaneeth and new to web development. I have a doubt and hope someone answers my doubt. Here it is.

    I have a first page with a file uploader and a Ok button. When I select a word file and click the OK button it displays the table of contents of the word file in the second page. I have used com object to implement this. I have used the application class as follows.

    //Creating instance of application class
    ApplicationClass WordApp = new ApplicationClass();

    //Setting file name and parameters
    object fileName = TheFile;
    object readOnly = false;
    object isVisible = true;

    //Declaring parameters that I dont care about
    object missing = System.Reflection.Missing.Value;

    //Opening the document to retrieve table of contents
    Document aDoc = WordApp.Documents.Open(ref fileName, ref missing, ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible, ref missing, ref missing, ref missing, ref missing);

    //Creating a document object for the active document
    Document doc1 = WordApp.ActiveDocument;

    //Closing the document after reading the contents
    aDoc.Close(
    ref missing, ref missing, ref missing);


    Here in the above case just before I close the document, I have to read the table of contents from the .doc file and display in the text box named resulttxt. The table of contents are present in the .doc file and was already created automatically with hyperlinks.

    Can anyone help me regarding this.?

    Thanks,
    Navaneeth

    .Net Developer
    • Moved by Figo Fei Monday, September 22, 2008 7:07 AM off topic (Moved from .NET Framework Setup to Off-Topic Posts (Do Not Post Here))
    Friday, September 19, 2008 10:25 AM

Answers