We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

I want find cross reference tables

I want difference at cross reference link table and no link table please check below documentNew Microsoft Office Word Document.docx (644.1 KB)
please help me

@Nagasrinu Cross reference is a REF field that points to the bookmark. So you can get REF field and locate the bookmark it points to. For example see the following code:

Document doc = new Document(@"C:\Temp\in.docx");

// Get the REF field. For demonstration purposes select the first one.
FieldRef refField = doc.Range.Fields.Where(f => f.Type == FieldType.FieldRef).Cast<FieldRef>().FirstOrDefault();

// Get bookmakrk name the REF field rerrers to.
string bkName = refField.BookmarkName;

// Now we can get the paragraph where the bookmakr is located.
Paragraph para = (Paragraph)doc.Range.Bookmarks[bkName].BookmarkStart.GetAncestor(NodeType.Paragraph);

Console.WriteLine(para.ToString(SaveFormat.Text).Trim());

Hi,
cross reference location find in single and last and first fine but I want to load multiple cross reference table and right destination New Microsoft Office Word Document.docx (644.2 KB)
please help me,

New Microsoft Office Word Document.docx (644.6 KB)

@Nagasrinu The code is pretty much the same:

Document doc = new Document(@"C:\Temp\in.docx");

// Get all REF fields.
List<FieldRef> refFields = doc.Range.Fields.Where(f => f.Type == FieldType.FieldRef).Cast<FieldRef>().ToList();

foreach (FieldRef refField in refFields)
{
    // Get bookmakrk name the REF field rerrers to.
    string bkName = refField.BookmarkName;

    // Now we can get the paragraph where the bookmakr is located.
    Paragraph para = (Paragraph)doc.Range.Bookmarks[bkName].BookmarkStart.GetAncestor(NodeType.Paragraph);

    Console.WriteLine(para.ToString(SaveFormat.Text).Trim());
}