Click here to Skip to main content
15,896,118 members
Home / Discussions / C#
   

C#

 
GeneralRe: creating cross reference with c# and office.interop Pin
shinboxe18-Jan-12 4:24
shinboxe18-Jan-12 4:24 
GeneralRe: creating cross reference with c# and office.interop Pin
Paramu197318-Jan-12 4:31
Paramu197318-Jan-12 4:31 
GeneralRe: creating cross reference with c# and office.interop Pin
shinboxe18-Jan-12 4:39
shinboxe18-Jan-12 4:39 
AnswerRe: creating cross reference with c# and office.interop Pin
Pete O'Hanlon18-Jan-12 4:54
mvePete O'Hanlon18-Jan-12 4:54 
GeneralRe: creating cross reference with c# and office.interop Pin
shinboxe18-Jan-12 5:18
shinboxe18-Jan-12 5:18 
GeneralRe: creating cross reference with c# and office.interop Pin
Pete O'Hanlon18-Jan-12 5:24
mvePete O'Hanlon18-Jan-12 5:24 
GeneralRe: creating cross reference with c# and office.interop Pin
shinboxe18-Jan-12 5:28
shinboxe18-Jan-12 5:28 
GeneralRe: creating cross reference with c# and office.interop Pin
Pete O'Hanlon18-Jan-12 5:26
mvePete O'Hanlon18-Jan-12 5:26 
OK, try this:
C#
object file = @"c:\somefile.docx";
 
object oRefHyperlink = true;
object oRefType = WdReferenceType.wdRefTypeHeading;
object arr_r = doc.GetCrossReferenceItems(ref oRefType);
Array arr = ((Array)(arr_r));
 
Microsoft.Office.Interop.Word.Application document = new Microsoft.Office.Interop.Word.Application();
Document doc = document.Documents.Open(ref file, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj);
int i = arr.Length;

while (i > 0)
{
  object oRefItem = arr.GetValue(i--);
  doc.Application.Selection.InsertCrossReference(ref oRefType, WdReferenceKind.wdContentText, ref oRefItem, ref   oRefHyperlink, ref InsertPosition, ref SeperateNumbers, ref nullobj);
}

Forgive your enemies - it messes with their heads

"Mind bleach! Send me mind bleach!" - Nagy Vilmos


My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility


GeneralRe: creating cross reference with c# and office.interop Pin
shinboxe18-Jan-12 5:45
shinboxe18-Jan-12 5:45 
GeneralRe: creating cross reference with c# and office.interop Pin
Pete O'Hanlon18-Jan-12 5:57
mvePete O'Hanlon18-Jan-12 5:57 
GeneralRe: creating cross reference with c# and office.interop Pin
shinboxe18-Jan-12 21:16
shinboxe18-Jan-12 21:16 
QuestionHow to find the Selected Column Name of ListView Control ? Pin
Paramu197318-Jan-12 1:01
Paramu197318-Jan-12 1:01 
AnswerRe: How to find the Selected Column Name of ListView Control ? Pin
Eddy Vluggen18-Jan-12 7:08
professionalEddy Vluggen18-Jan-12 7:08 
GeneralRe: How to find the Selected Column Name of ListView Control ? Pin
Paramu197318-Jan-12 19:52
Paramu197318-Jan-12 19:52 
GeneralRe: How to find the Selected Column Name of ListView Control ? Pin
Eddy Vluggen18-Jan-12 20:17
professionalEddy Vluggen18-Jan-12 20:17 
AnswerRe: How to find the Selected Column Name of ListView Control ? Pin
BillWoodruff18-Jan-12 11:36
professionalBillWoodruff18-Jan-12 11:36 
GeneralRe: How to find the Selected Column Name of ListView Control ? Pin
Paramu197318-Jan-12 19:22
Paramu197318-Jan-12 19:22 
QuestionTeam Foundation server ???? Pin
Pierre besquent17-Jan-12 22:01
Pierre besquent17-Jan-12 22:01 
AnswerRe: Team Foundation server ???? Pin
Pete O'Hanlon17-Jan-12 22:28
mvePete O'Hanlon17-Jan-12 22:28 
GeneralunRe: Team Foundation server ???? Pin
Pierre besquent17-Jan-12 22:58
Pierre besquent17-Jan-12 22:58 
AnswerRe: Team Foundation server ???? Pin
RobCroll18-Jan-12 15:15
RobCroll18-Jan-12 15:15 
QuestionError while compile a default C# template grid Pin
alex_petrov17-Jan-12 13:02
alex_petrov17-Jan-12 13:02 
AnswerRe: Error while compile a default C# template grid Pin
Richard MacCutchan17-Jan-12 23:06
mveRichard MacCutchan17-Jan-12 23:06 
QuestionSpeech recognition and drawing Pin
momo.pomo17-Jan-12 9:15
momo.pomo17-Jan-12 9:15 
AnswerRe: Speech recognition and drawing Pin
Not Active17-Jan-12 9:58
mentorNot Active17-Jan-12 9:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.