Reply to topic  [ 2 posts ] 
Creating new styles in macros 
Author Message

Joined: 2007-08-06 06:56:05
Posts: 4

I often have to include source code (e.g. Java, C#,...) in my documents and usually want to have the code syntax highlighted.

Currently, I'm always defining some new styles for keywords, expressions, comments, etc. and then apply the styles manually. Now, I would like to automate this task using a macro, but I can't find a sample NWP macro (or some hints in the documentation) that shows me how to create a new style and how to configure it (e.g. the character style for "keywords" should set the character's attribute to "blue").

Where can I find some documentation?


2007-08-06 07:13:20
Official Nisus Person
User avatar

Joined: 2002-07-11 17:14:10
Posts: 4251
Location: San Diego, CA
The easiest way to accomplish this is to simply define the styles in the macro using the stylesheet as usual. If you apply these styles to text you insert via a macro then the destination document will automatically import the styles. Eg: apply your "keyword" style to the text "whatever" in the command:

Set Selection 1, 0
Insert Attributed Text 'whatever'

Deleting the inserted text will not remove the imported style, so the above code should only add in the style.

2007-08-06 12:49:18
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software