Tips for great documents with GetPublished

By: John Kaster

Abstract: Read this for tips on writing richly formatted documents with GetPublished, our content management system

We designed GetPublished for rapidly producing rich, browser-friendly technical documents with minimal effort. One of the core technologies we developed for this purpose is our "Document Adapters" which transform a variety of document formats into html.

Here are some easy document formatting tips for getting great output with minimal formatting effort on your part.

    Tips for Microsoft Word

For most of the in-depth documents I write, I use our support for Microsoft Word. This section of the document is for Word formatting tips.

    Start with our document template

We have a custom Word template that includes support for special styles our Document Adapters understand. You can download it from http://gp.codegear.com/files/CodeGear.dot. (This link is available on the bottom left of the GetPublished home page.) After downloading it, make sure the file extension is .dot.

    Create your document

I have a desktop shortcut to our document template. Whenever I want to create a new document, I just double-click that shortcut and start writing.

    Formatting source code

We have support for automatic syntax highlighting via our document adapters. Paste your source code into your document, select Format|Styles and Formatting and click on the appropriate source code style. All the selected text becomes highlighted in gray, with a monospaced font. If you are documenting an unsupported "source code" language, use the default "SourceCode" style.

To show how easy it is, I've put in some samples of source code style selection.

Here's a Delphi hello world app:

program HelloWorld;
{$APPTYPE CONSOLE}
uses
  SysUtils;
begin
  WriteLn('Hello World!');
 end.

And C#:

using System;
namespace HelloWorld
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
        }
    }
}

And Java:

public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello World!");
    }
}

And PHP:

<?php
echo( "Hello World!\r\n" );
?>

And C++:

#include <iostream>
 
int main()
{
    cout << "Hello World!\r\n";
}

And JavaScript:

alert("Hello World!");

And Ruby:

    # The Greeter class
    class Greeter
      def initialize(name)
        @name = name.capitalize
      end

      def salute
        puts "Hello #{@name}!"
      end
    end

    # Create a new object
    g = Greeter.new("world")

    # Output "Hello World!"
    g.salute

And SQL:

select 'hello world' from rdb$database

I can even put in a Visual Basic example for Bruce McGee, but we don't have automatic syntax highlighting support for it, so I'll have to mark it as "generic" source code:

Module HelloWorld
    Sub Main()
        Console.WriteLine("Hello World")
    End Sub
End Module

I would like to thank Jonathan Benedicto, David Clegg, and Wayne Niddery for some quick representative "Hello world!" examples when I nagged them on Skype. It saved me from having to actually think.

    Embedding images

It is also very easy to embed images as long as you embed an actual image rather than an OLE reference to something that renders an image. We automatically convert images that are "too large" to thumbnails and link to the full-size image.

My personal favorite for capturing screens is SnagIt. I have the PrintScreen key set as my capture hotkey. I display whatever it is I want to capture, hit the capture hotkey, and the SnagIt editor appears with whatever I've captured. I hit the "Copy All" button, go back to Word, and paste the clipboard image right into my document.

This is a screenshot of this document I'm writing, courtesy of the method I describe above:

Hide image
Click to see full-sized image

Figure 1 Embedding images

Note that this image has a thumbnail and a link to the full size image. That's because it's larger than our configured maximum for height or width of an image for this type of document, so it's automatically converted into a thumbnail and link.

We also support captions for images. You can right mouse click on the pasted image, select "Caption …" and put in a caption.

Hide image

Figure 2 Putting in the caption for my image

Because this image is small enough, it is not converted to a thumbnail.

    Automatic Table of Contents

By setting your heading levels appropriately in your document, we can automatically generate the table of contents links and collapsible sections for your document. So, have your outline in mind, or review your finished document with an "outline" perspective and set your topic titles and levels.

You'll end up with a nice Table of Contents link like the one you see on this page that supports direct jumping to various sections of your document. We also support collapsible sections of the document, all from automatically converting it to html.

    Inserting Hyperlinks

By default, word usually creates hyperlinks for you automatically. If you have turned off this feature, you can create a hyperlink by highlighting the text you want to convert to a link and pressing Ctrl+K, or by right mouse clicking on the highlighted text and selecting "Hyperlink …".

    Learn more about GetPublished

We have similar document adaptation support for the other formats we support, such HTML and Wiki. To learn more about what you can do with GetPublished, see our online Help section.

Server Response from: ETNASC03