# Scripts

Learn about using expressions in PrintDocument from this documentation helpfile.

## Content



**Scripts** or **expressions** (the two terms are used interchangeably here) can be used in various places throughout the document. An expression can be marked by surrounding it with square brackets.

This is depicted in the following code:

```csharp
C1PrintDocument doc = new C1PrintDocument();
doc.Body.Children.Add(new RenderText("2 + 2 = [2+2]"));
```

In this case, the "[2+2\]" is interpreted as an expression, and calculated to produce the resulting text.

## Scripting Language

The language used in expressions is determined by the [C1PrintDocument.ScriptingOptions.Language](/componentone/docs/win/online-printdocument/) property. It can have one of two possible values:

*   VB. This is the default value, and indicates that the standard VB.NET will be used as the scripting language.
*   CSharp. This value indicates that the standard C# will be used as the scripting language.

The [ScriptLanguageEnum](/componentone/docs/win/online-printdocument/) enumeration enumerates the languages which can be used in C1.C1Preview.C1PrintDocument scripts.

This code snippet below depicts adding CSharp language used in expressions in the document.

```csharp
C1PrintDocument doc = new C1PrintDocument();
doc.ScriptingOptions.Language = ScriptLanguageEnum.CSharp;
RenderText rt = new RenderText("[PageNo == 1 ? \"First\" : \"Not first\"]");
doc.Body.Children.Add(rt);
```

## Assemblies and Namespaces

By default, the following assemblies are available for scripts:

*   System
*   System.Drawing

To add another system or custom assembly to the list of assemblies referenced in the scripts, use the [C1PrintDocument.ScriptingOptions.ExternalAssemblies](/componentone/docs/win/online-printdocument/) property. For instance, the following will add a reference to the System.Data assembly to the document's scripts:

```csharp
C1PrintDocument doc = new C1PrintDocument();
doc.ScriptingOptions.ExternalAssemblies.Add("System.Data.dll");
```

The following namespaces are by default available (imported) for use in scripts:

*   System
*   System.Collections
*   System.Collections.Generic
*   System.Text
*   Microsoft.VisualBasic
*   System.Drawing

To add another namespace, use the [C1PrintDocument.ScriptingOptions.Namespaces](/componentone/docs/win/online-printdocument/) property. For instance, this will allow the use of types declared in System.Data namespace in the document's scripts without fully qualifying them with the namespace:

```csharp
C1PrintDocument doc = new C1PrintDocument();
doc.ScriptingOptions. Namespaces.Add("System.Data");
```