Locate table in docment given a WPAragraph or TextSelection

Hello,

I am trying the following. Given a WParagraph or TextSelection instance, is it possible to locate the first table in the document after the paragraph or textselection?
The document may contain multiple tables and I do not know how many tables there will be.
I have a TextSelection (or WParagraph) object based on a Find action an I need the table (if one exists) from that point onwards.

Is this possible?

Thank you,


3 Replies 1 reply marked as answer

SB Suriya Balamurugan Syncfusion Team July 10, 2020 02:24 PM UTC

Hi Peter,

Thank you for contacting Syncfusion support.

We have prepared a sample application to get the first table after the selected paragraph text in the Word document as per your requirement and it can be downloaded from the below link:
https://www.syncfusion.com/downloads/support/forum/155889/ze/CreateWordSample-195368568

Note: Please find the template Word document in the “App_Data” folder of above sample.

We have done the following things in the sample:
  1. Loads the template Word document.
  2. Finds the text want to select.
  3. Gets the paragraph of the selected text.
  4. Iterates through the body items from selected paragraph onwards.
  5. Gets the first table after the selected paragraph text as per your requirement.
  6. Saves the Word document.

If we misunderstood any of your requirement, then kindly provide us sample or modified sample of above along with input template, and screenshot/output Word document of the expected result which will helpful to provide you the appropriate solution at the earliest

Please let us know if you have any other questions.

Regards,
Suriya Balamurugan.


Marked as answer

PM Peter meulendijks July 10, 2020 07:19 PM UTC

Hi Suriya,

Great, this was exactly what I was looking for.
Thanks for the excellent support!
regards
Peter


PN Preethi Nesakkan Gnanadurai Syncfusion Team July 13, 2020 06:50 AM UTC

Hi Peter, 
  
Most welcome.  
  
Regards, 
Preethi 


Loader.
Up arrow icon