How to change Preview window title

How can I set the window title/caption/text when Print Previewing to something other than “Preview”?
I would like the window title to include the report name, for example.

                using (ListLabel ll = new ListLabel())
                {
                    ll.DataSource = dataProvider;
                    ll.AutoProjectFile = _filePath;
                    ll.AutoShowSelectFile = false;
                    ll.AutoShowPrintOptions = _printOnly;
                    ll.AutoDestination = LlPrintMode.Preview;
                    Cursor.Current = Cursors.Default;
                    ll.Print();
                }

Hi Nick,

This can be done by setting a print option string. It’s not as elegant as it could be but does the trick:

Add this line to your code right before calling the Print() method:

ll.DefinePrintOptions += LL_DefinePrintOptions;

And make the event handler read

private void LL_DefinePrintOptions(object sender, EventArgs e)
{
    (sender as ListLabel).Core.LlPrintSetOptionString(12, "This is my preview");
}

The “12” is LL_PRNOPTSTR_PREVIEWTITLE which is what you were looking for :slight_smile: .

Thanks Jochen.
Is there a list of the other options like LL_PRNOPTSTR_PREVIEWTITLE?

1 Like

Yes, at least in the header file:

#define LL_PRNOPTSTR_PRINTDST_FILENAME (0                   ) /* print to file: default filename (LlGet/SetPrintOptionString) */
#define LL_PRNOPTSTR_EXPORTDESCR       (1                   ) /* r/o, returns the description of the export chosen */
#define LL_PRNOPTSTR_EXPORT            (2                   ) /* sets default exporter to use / returns the name of the export chosen */
#define LL_PRNOPTSTR_PRINTJOBNAME      (3                   ) /* set name to be given to StartDoc() (lpszMessage of LlPrintWithBoxStart() */
#define LL_PRNOPTSTR_PRESTARTDOCESCSTRING (4                   ) /* sent before StartDoc() */
#define LL_PRNOPTSTR_POSTENDDOCESCSTRING (5                   ) /* sent after EndDoc() */
#define LL_PRNOPTSTR_PRESTARTPAGEESCSTRING (6                   ) /* sent before StartPage() */
#define LL_PRNOPTSTR_POSTENDPAGEESCSTRING (7                   ) /* sent after EndPage() */
#define LL_PRNOPTSTR_PRESTARTPROJECTESCSTRING (8                   ) /* sent before first StartPage() of project */
#define LL_PRNOPTSTR_POSTENDPROJECTESCSTRING (9                   ) /* sent after last EndPage() of project */
#define LL_PRNOPTSTR_PAGERANGES        (10                  )
#define LL_PRNOPTSTR_ISSUERANGES       (11                  )
#define LL_PRNOPTSTR_PREVIEWTITLE      (12                  ) /* default: language dependent */

Some of those are rather exotic. The “official” ones are also documented in the programmer’s reference.

1 Like