Aspose Word Tech Questions

Hi Support,

Hope you are doing well.

Currently, I am actually evaluating and done unit tests to your demo product called Aspose Words. I use it to hyperlink specific texts in word document content.

I am wondering do you have solutions for the following scenario before I can confirm to purchase your product for commercial used:-

Question 1:

I have few paragraph items in the content, I would like to find what is the paragraph number for “TEST.333”

  1. ABC.001
  2. TEST.333

Expected Result: From paragraph.ListLabel.LabelString, it should show “2.”

Actual Result: It shows me “1.” It worked for first time, thereafter it not work now.

Question 2:

Can I able to detect line number and page number for the specific text in word document content?

Question 3:

Please find the attached Test1.docx, you will find a string with yellow highlighted: MGR.002.002.3404, it looks perfectly on word document.

But when you convert it into xml format, it splits apart like this:-

<w:t>MGR.002.002.</w:t></w:r><w:r w:rsidR="00AA6937" w:rsidRPr="00347F12"><w:rPr><w:highlight w:val="yellow"/></w:rPr><w:t>3404</w:t>

If I want to hyperlink MGR.002.002.3404 with highlighted, how your system can work for me?

Question 4:

I know your system has feature to allow me insert or append a hyperlink in word document.

If my system find the string likes Question 3, and it will be split after converted to xml format. How your API can help me to insert hyperlink in complete string: “MGR.002.002.3404”?

Please let me know if you need further clarifications.

Looking forward to hear from you soon.

Regards,
Angie

@angieng

Thanks for your inquiry.

Please call Document.UpdateListLabels method after importing the document into Aspose.Words’ DOM. If you still face problem, please ZIP and attach your document here for testing.

The Aspose.Words.Layout namespace provides classes that allow to access information such as on what page and where on a page particular document elements are positioned, when the document is formatted into pages.

Please use LayoutCollector.GetStartPageIndex method to get 1-based index of the page where node begins.

Unfortunately, we have not found the “Test1.docx” in your post. Please ZIP and attach your input and expected output documents here for testing.

In your case, we suggest you please implement the IReplacingCallback interface to find the desired text and insert the hyperlink. Please read the following articles.
Find and Replace
Inserting a Hyperlink

Hi Tahir,

Sorry for missing the attached and please find it for your perusal.

Cheers,
AngieTest1.zip (15.2 KB)

@angieng

Thanks for sharing the document. Please use the following code to get the list labels.

Document doc = new Document(MyDir + "Test1.docx");
doc.UpdateListLabels();

foreach (Paragraph paragraph in doc.GetChildNodes(NodeType.Paragraph, true))
{
    if (paragraph.IsListItem)
    {
        ListLabel label = paragraph.ListLabel;
        Console.WriteLine("List label combined with text: " + label.LabelString);
    }
}

Hi Tahir,

It helped. Thank you your assist.

Cheers,
Angie