473,569 Members | 2,604 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Applicatio n wordApp = new Word.Applicatio n();
Word.Documents docs = wordApp.Documen ts;

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

Word.Document doc= docs.Open(ref filePathName,
ref missing, // confirmconversi ons,
ref missing, // readOnly,
ref missing, // addtoRecentFile s,
ref missing, // passworddOc,
ref missing, // passwdTemplate,
ref missing, // revert,
ref missing, // writePasswordDo c,
ref missing, // writePasswordTe mplate,
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.Sta rt;
Word.Range rng = doc.Range(ref startLocation, ref endLocation);

doc.Indexes.Add (rng,
ref missing, // HeadingSeparato r
ref missing, // RightAlignedPag eNumber
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.Mar kEntry(rng,
ref Entry,
ref missing, //EntryAutoText
ref missing, //CrossReference
ref CrossReference, // CrossReferenceA uoText
ref BookmarkName,//BookmarkName
ref missing, // Bold
ref missing, // Italic
ref missing // Reading
);
Word.Index.

wordApp.Selecti on.GoTo(ref missing,ref missing,ref missing ,ref end);
object type=2;
wordApp.Documen ts.Save(ref missing,ref missing);
wordApp.Documen ts.Close(ref missing,ref missing,ref missing);
wordApp.Quit(re f missing, ref missing, ref missing);
}

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

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

Similar topics

20
11293
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 expressions and I sure there is a lot ways, but I need realy efficient one
9
11669
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 can you determine which one? Can you think of a way to do it using little extra memory? 2. How would you find the only missing element in that...
6
2333
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 solution. My code can be downloaded from here: http://www.tprimke.net/konto/PyObject-problem.tar.bz2. There are some scripts for GNU/Linux system...
2
2117
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," and I uncheck it. Everything appears to work fine after that, however, this raises two questions in my mind. 1. Does simply unchecking the...
0
2174
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
2005
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 other....how i can fix this this run the random words for the program import javax.swing.JOptionPane; import java.util.ArrayList; import...
232
13119
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 set of examples, after decoding the HTML FORM contents, merely verifies the text within a field to make sure it is a valid representation of an...
0
1637
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 can see the text in my string builder variable, but once the page opens as a Word document, that same text is not showing. It seems to only be text...
11
1772
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. With wget, if you are more familiar with it than me, how can get it to output the crawled links (links not the actual HTML content) to a file? ...
0
7700
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7614
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7974
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6284
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3642
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1221
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.