473,386 Members | 1,752 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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)
{
try
{
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);

doc.Indexes.Add(rng,
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" ;
doc.Indexes.MarkEntry(rng,
ref Entry,
ref missing, //EntryAutoText
ref missing, //CrossReference
ref CrossReference, // CrossReferenceAuoText
ref BookmarkName,//BookmarkName
ref missing, // Bold
ref missing, // Italic
ref missing // Reading
);
Word.Index.

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 3058

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

20
by: hagai26 | last post by:
I am looking for the best and efficient way to replace the first word in a str, like this: "aa to become" -> "/aa/ to become" I know I can use spilt and than join them but I can also use regular...
9
by: Harsha Srinath | last post by:
Athough this might not be directly relayed to C syntax, I thought some of you may find this an interesting problem :- 1.One number, in an array integers from 1 to 1,000,000 is present twice. How...
6
by: TPJ | last post by:
Help me please, because I really don't get it. I think it's some stupid mistake I make, but I just can't find it. I have been thinking about it for three days so far and I still haven't found any...
2
by: jodyblau | last post by:
I have noticed that when I move my database onto a different computer, I often get a message about some reference missing. So I go into the reference list, and find the one that says "Missing,"...
0
by: noobcprogrammer | last post by:
#include "IndexADT.h" int IndexInit(IndexADT* word) { word->head = NULL; word->wordCount = 0; return 1; } int IndexCreate(IndexADT* wordList,char* argv)
0
by: xavier vazquez | last post by:
have a problem with a program that does not working properly...when the program run is suppose to generate a cross word puzzle , when the outcome show the letter of the words overlap one intop of the...
232
by: robert maas, see http://tinyurl.com/uh3t | last post by:
I'm working on examples of programming in several languages, all (except PHP) running under CGI so that I can show both the source files and the actually running of the examples online. The first...
0
by: =?Utf-8?B?V2FubmFiZQ==?= | last post by:
I am creating a webpage and opening it as a Word document. Problem is that as I create one of the questions, some of the text is not appearing in the document as it should. As I step through it, I...
11
by: ymic8 | last post by:
Hi everyone, this is my first thread coz I just joined. Does anyone know how to crawl a particular URL using Python? I tried to build a breadth-first sort of crawler but have little success. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.