Skip to main content
Participating Frequently
May 2, 2008
Question

Copying Visual Studio Code into Robohelp

Hi,
I'm using Robohelp HTML 6 and I'm trying to transfer example code from visual studio into my robohelp project. However, when I copy/paste the code, all of the formatting is lost (mainly colors).

The project I'm working on was done years ago by another individual (whom I no longer have contact with) and contains code examples in the format I'm going for. I can't imagine he went through each example, and indivdually selected a style for each word/line. I've tried editing pages in microsft word (which retains the styles of the copied code) but once I save the file....Robohelp never lets me edit the file in Robohelp again (complains about the file being edited by a third party editor and launches it in MS word). Can anyone tell me how to retain styles when importing the code? Is it possible to develop macros to search my examples and reformat them? Any help would be greatly appreciated.
This topic is closed to new replies. Start a new post to keep the conversation going.

7 replies

Inspiring
June 2, 2008
Hi kitklein,

I dont' know if you've found a workable solution, but you can show Visual Studio code in color in RH7 (webhelp) without having to reformat anything. Here's how I just did it (quite accidentally):
1. Copy the Visual Studio code to Word (I'm using Visual Studio 2008 and Word 2007). The colors should remain intact.
2. Save the Word file as a doc or docx (don't think it matters).
3. Import the Word file into RH7. The colors are still shown in the example code with the appropriate <span> tags defining each one.
4. Cut and paste the code you want into your topics.

Appears to work like a charm in RH7, not sure if it would for RH6.
Translate
kitkleinAuthor
Participating Frequently
May 2, 2008
Hi Leon,
Thanks for the quick reply, but words in the code examples need to serve as links to other pages of the manual. I don't think a screenshot would allow for this ability???

Translate
Inspiring
May 2, 2008
I suspect that the colors in visual studio are created internally (i.e. they are not adding formatting tags, but the software is looking for keywords on the fly) and that when you copy to the clipboard only the text is copied. I know that is the way my V+ editor works.

I can't think of an easy way around this. My only idea is to try to print from VS to a document as it might then insert print codes. You would then need to do a search and replace to get those into style sheet or HTML format before you could load them into a topic. It might be as much work as taking Leon's advice and creating image maps for your links.

John
Translate
MergeThis
Inspiring
May 2, 2008
Apply the different colors either by:

- Creating character styles (p.red, p.blue, etc.) for the different colors
- Creating hyperlink pseudo-classes (a.red:link, a.red:visited, a.red:hover)
- Inserting image maps on the screenshots as John suggested


Good luck,
Leon
Translate
MergeThis
Inspiring
May 2, 2008
Take a screenshot (we use SnagIt, here).


Good luck,
Leon
Translate