Emma Dove

Hi all,

I'm new to C#. After 7 years developing lotus notes solutions in LotusScript, JS and VBS I decided if I couldn't beat them I'd join them and I'm now creating Sharepoint solutions amongst other things.

After false starts with VBS and JS Infopath I have come to realise that C# is the way forward.

I've re-rwitten my biggest form using C# and it's let me do everything I needed. One thing I am struggling with though is pasting into a Rich Text field.

I am using ExecuteAction("Copy") to copy a section on the form and I want to paste that section into the relevant field. ExecuteAction("Paste") doesn't seem to work no matter what I try. I keep getting the error: "The specified bstrAction value for the View.ExecuteAction call is not applicable for the current selection."

I was thinking there must be some way to simply paste the contents of the clipboard into the field but can't seem to find the right way to do it. Very simple to you guys I'm sure but I'd appreciate the help.

Thanks



Re: Visual Studio Tools for Office Please help with pasting clipboard into Rich Text Field

nobugz

I've never heard of (and can't find) ExecuteAction(). Are you sure you are using C# You'd paste the clipboard contents into an RTB with its Paste() method.





Re: Visual Studio Tools for Office Please help with pasting clipboard into Rich Text Field

Emma Dove

Yes definitely!

This is some of the code..

// Select nodes in specified XPathNavigator.

CurrentView.SelectNodes(FS1);

// Get selected nodes.

XPathNodeIterator selectedNodes = CurrentView.GetSelectedNodes();

this.CurrentView.ExecuteAction(ActionType.Copy);

The Copy works perfectly.

ExecuteAction = Executes a Microsoft Office InfoPath 2007 editing command against a form's underlying XML document, based on the data selected in the view.

How do I actually grab the rich text field in order to use the paste function

I am using selectsinglenode to get and set the values of fields on the form but this doens't work for this problem





Re: Visual Studio Tools for Office Please help with pasting clipboard into Rich Text Field

nobugz

Okay, found it after updating my MSDN library version. You are using Microsoft.Office.InfoPath. RTB.Paste() still sounds like the proper method. I'll move your thread to the VSTO forum for a better answer.





Re: Visual Studio Tools for Office Please help with pasting clipboard into Rich Text Field

Emma Dove

Thanks.

I can use -

string str = (String)iData.GetData(DataFormats.Text);

and XPathNavigator.SetValue to paste the text version of what I've copied but I need to copy it as rich text and SetValue only allows you to set a string value.

Is there any other way to set the value of an infopath field





Re: Visual Studio Tools for Office Please help with pasting clipboard into Rich Text Field

Cindy Meister

Hi Emma

Unfortunately, your question is also off-topic here, as the VSTO forum is targeted more at the VSTO technology than "how-to-use Office" topics. InfoPath is supported in the newsgroup interface, try addressing your question there.






Re: Visual Studio Tools for Office Please help with pasting clipboard into Rich Text Field

nobugz

Hi Cindy,
Would you mind posting in the Moderator's forum and explain what the VSTO forum covers I'm lost and get it wrong too often.





Re: Visual Studio Tools for Office Please help with pasting clipboard into Rich Text Field

Emma Dove

"One forum fits all" would be nice.. I seem to spend more time wondering where to ask the question than trying to solve it.

Thanks anyway





Re: Visual Studio Tools for Office Please help with pasting clipboard into Rich Text Field

Cindy Meister

<<"One forum fits all" would be nice.. I seem to spend more time wondering where to ask the question than trying to solve it.>>

I quite understand :-) And it's even worse when the answer is "it's in a newsgroup", since we can't move you there directly. It's just that the Office technologies and teams are quite seperate from those in the forums... I can give you a link through which you can access ALL the newsgroups, which might make searching a bit easier when you can't find what you're looking for in a forum

http://www.microsoft.com/communities/newsgroups/default.mspx

While "one forum fits all" might seem simpler to the person asking the question, it would probably result in few questions getting answered. Those answering questions are usually specialized, to a certain extent, and many help out in their free time. It would be almost impossible to wade through thousands of questions - DAILY - to find those one is competent to answer Question of administration.

Hope you can find what you need in the InfoPath newsgroup.