How to identify a table in RTF document


Author
Message
Tom Galczynski
Tom Galczynski
Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)
Group: Forum Members
Posts: 29, Visits: 87
Hello.  I am creating multiple ntables in a document, saving the document to an RTF string into a sql table. My question is, how can I identify/locate a specific table in the doc so I can remove it and create another table in its place? I would like to give my users the option of re-creating specific tables in the doc but i'm not sure how I could find the table once it's been loaded into the NRichTextView.

Thanks!

Replies
Tom Galczynski
Tom Galczynski
Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)
Group: Forum Members
Posts: 29, Visits: 87
Thanks. If the user places the cursor at a particular location in the document, or selects a table or text, can I know where that is and be able to replace the selected text/table with a new one? Or be able to insert a table/text at the cursor location in the document?

Thank you!

Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K
Hi Tom,
Please take a look at the following topic in the documentation:
http://helpopenvision.nevron.com/#WorkingWithTextDocuments_Selection.html

You can get the currently selected inline and dig your way up the tree using the following code:
   nRichTextViewWithRibbonControl1.Widget.View.SaveToFile("c:\\temp\\test.pdf", new Nevron.Nov.Text.Formats.NPdfTextFormat());

    NSelection selection = nRichTextViewWithRibbonControl1.Widget.View.Selection;
    if (selection.Mode == ENSelectionMode.Caret)
    {
      NTable table = (NTable)selection.GetSelectedInlines(false)[0].GetFirstAncestor(NTable.NTableSchema);

      table.BackgroundFill = new NColorFill(NColor.Red);
    }

The idea is to get the current inline where the cursor is located and then try to get the first table that contains it. The code specifically checks whether the selection mode is caret so that it avoids the Range selection mode in which you can have two or more tables selected simultaneously.
Hope this helps - let us know if you have any questions.

Best Regards,
Nevron Support Team


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search