469,889 Members | 1,394 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,889 developers. It's quick & easy.

missing code in Word Index

hi can any one help me out,
i have written a code for Word Indexing using Dll's
i think this is an incomplete code for WORD INDEX.

I had encountered this error
"Error! No index entries found" when i opened word document

can any one fill out the missing code with this.

public static void Index(string filePath)
Word.Application wordApp = new Word.Application();
Word.Documents docs = wordApp.Documents;

object filePathName = filePath;
object missing = Type.Missing;
object saveChanges = "true";

Word.Document doc= docs.Open(ref filePathName,
ref missing, // confirmconversions,
ref missing, // readOnly,
ref missing, // addtoRecentFiles,
ref missing, // passworddOc,
ref missing, // passwdTemplate,
ref missing, // revert,
ref missing, // writePasswordDoc,
ref missing, // writePasswordTemplate,
ref missing, // format,
ref missing, // encoding,
ref missing // visible,

//wordApp.Visible = true;
object end = "\\endofdoc";

//indexes of the object
object endLocation = doc.Content.End;
object startLocation = doc.Content.Start;
Word.Range rng = doc.Range(ref startLocation, ref endLocation);

ref missing, // HeadingSeparator
ref missing, // RightAlignedPageNumber
ref missing, // object Type
ref missing, // NumberOfColumns
ref missing, // AccentedLetters
ref missing, // Sort By
ref missing // IndexLanguage
// Adding a Index to Indexes
object Entry = "Comments" ;
object CrossReference = "Comments" ;
object BookmarkName = "Comments" ;
object Bold = "True" ;
ref Entry,
ref missing, //EntryAutoText
ref missing, //CrossReference
ref CrossReference, // CrossReferenceAuoText
ref BookmarkName,//BookmarkName
ref missing, // Bold
ref missing, // Italic
ref missing // Reading

wordApp.Selection.GoTo(ref missing,ref missing,ref missing ,ref end);
object type=2;
wordApp.Documents.Save(ref missing,ref missing);
wordApp.Documents.Close(ref missing,ref missing,ref missing);
wordApp.Quit(ref missing, ref missing, ref missing);

catch(Exception ex)
MessageBox.Show("Converted documents into the Existing Document."+ex);
Nov 16 '05 #1
0 2876

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

20 posts views Thread by hagai26 | last post: by
9 posts views Thread by Harsha Srinath | last post: by
6 posts views Thread by TPJ | last post: by
232 posts views Thread by robert maas, see http://tinyurl.com/uh3t | last post: by
reply views Thread by =?Utf-8?B?V2FubmFiZQ==?= | last post: by
11 posts views Thread by ymic8 | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.