7 Replies Latest reply on Jun 2, 2008 3:40 PM by kmaddox1

    Copying Visual Studio Code into Robohelp

    kitklein Level 1
      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.
        • 1. Re: Copying Visual Studio Code into Robohelp
          MergeThis Level 4
          Take a screenshot (we use SnagIt, here).


          Good luck,
          Leon
          • 2. Re: Copying Visual Studio Code into Robohelp
            kitklein Level 1
            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???

            • 3. Re: Copying Visual Studio Code into Robohelp
              Level 2
              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
              • 4. Re: Copying Visual Studio Code into Robohelp
                MergeThis Level 4
                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
                • 5. Re: Copying Visual Studio Code into Robohelp
                  kitklein Level 1
                  quote:

                  Originally posted by: MergeThis
                  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



                  I have style set up for each color/text type already. Is their a way to search through the text and apply a certain style to all occurances of a word?

                  For example: make all "if" instances in this block of text blue?

                  Applying the style to unformatted text would be a great solution as long as I don't have to manually go through, select a word, and select the style FOR EACH WORD.....I'd be selecting/formatting for weeks.

                  Also, the replace function doesn't seem to have an option to select styles for replacements (or im just not using it right).
                  • 6. Re: Copying Visual Studio Code into Robohelp
                    MergeThis Level 4
                    Keep in mind that when using the RH Multi-File Find & Replace, it cannot identify or replace text in multiple lines.

                    As to actually replacing content using a better tool such as FAR, you would need to assign the style to one instance, then copy the entire SPAN code to use as the replacement for the word only. This, of course, assumes that only specific words will need this color treatment (such as if, then, var, etc.). If actual analysis is required to determine other color instances, there's nothing for it but to step through each topic manually.


                    Good luck,
                    Leon
                    • 7. Re: Copying Visual Studio Code into Robohelp
                      kmaddox1 Level 1
                      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.