Kinook Software Forum

Kinook Software Forum (https://www.kinook.com/Forum/index.php)
-   [UR] General Discussion (https://www.kinook.com/Forum/forumdisplay.php?f=23)
-   -   Code snippets being pasted as html (https://www.kinook.com/Forum/showthread.php?t=4899)

Nobodo 08-24-2011 10:15 AM

Code snippets being pasted as html
 
When I select a node in the Data Explorer tree and then CTRL-V to paste contents of the clipboard, a child item is created and auto-assigned to either the text or document template, and an icon gets added to the item according to the content.

This works great for most content, but not for code clippings that are pasted in from Visual Studio. When I copy a method, property, etc. from Visual Studio to the clipboard, then do the CTRL-V thing to auto-create an item in UR, it is created as an html document. The pasted item gets a title of 'Snippet', and that part is nice, but the fact that it gets created as a .htm document and gets a webpage icon is not useful.

When doing the same thing from other rich text editors, the item gets created as text and gets the text item icon. Is there a way I can get that behavior with source code copied from Visual Studio?

Thanks,
Mark.

kinook 08-24-2011 10:33 AM

Apparently Visual Studio (or maybe some add-in, since I don't see that w/ VS 2003, 2008 or 2010?) includes HTML when copying to the clipboard. A couple options:

1) Instead of using Ctrl+V, use Edit | Paste Special | Paste Text (or Paste Rich Text). You can also assign keyboard shortcuts for these commands (Ctrl+Shift+P is the default for paste text) at Tools | Customize | Keyboard.

2) Check Tools | Options | Import | Prefer text/rich text clipboard formats (also at Tools | Quick Options) to always prefer text/rich text over HTML format when pasting, but note that this could also affect pasting from other apps (for instance, pasting from IE will use RTF format instead of HTML).

Nobodo 08-24-2011 12:01 PM

Quote:

Originally Posted by kinook (Post 19102)
Apparently Visual Studio (or maybe some add-in, since I don't see that w/ VS 2003, 2008 or 2010?) includes HTML when copying to the clipboard..

Ahh, that got me looking....
The extension "Productivity Power Tools" (VS2010) by default changes the format of copied code to html. I turned that option off and now it is working fine.

The 'Paste Rich Text' option also works great. The 'Prefer rich text' option isn't so great because of what it does to web clippings, but you mention that. For what I do just turning off the power tools option did the trick.

Thank you for the help!

Mark.


All times are GMT -5. The time now is 12:04 AM.


Copyright © 1999-2023 Kinook Software, Inc.