
# IOptionsWriter interface

The `IOptionsWriter` interface writes values for options on a page in the system wide Preferences or Project options dialog to a registry storage.

```csharp
public interface IOptionsWriter
```

**Namespace:** DXP · **Assembly:** Altium.SDK.Interfaces

## Methods

| Method | Returns | Description |
| --- | --- | --- |
| [EraseSection](#erasesection) | `void` | This method removes all the option values for the section (targetted page in the system wide preferences dialog). |
| [Flush](#flush) | `void` |  |
| [WriteBoolean](#writeboolean) | `void` | This `WriteBoolean` method writes a boolean option value for the option name used by the specified server (SectionName) which is represented by the system wide Preferences dialog. |
| [WriteDouble](#writedouble) | `void` | This `WriteDouble` method writes a double value for the option name used by the specified server (SectionName) which is represented by the system wide Preferences dialog. |
| [WriteInteger](#writeinteger) | `void` | This `WriteInteger` method writes an integral value for the option name used by the specified server (SectionName) which is represented by the system wide Preferences dialog. |
| [WriteString](#writestring) | `void` | This `WriteString` method writes a string option value for the option name used by the specified server (SectionName) which is represented by the system wide Preferences dialog. |

### EraseSection

This method removes all the option values for the section (targetted page in the system wide preferences dialog).

```csharp
void EraseSection(string argSectionName);
```

| Parameter | Type | Passing |
| --- | --- | --- |
| `argSectionName` | `string` | value |

**Returns:** nothing (`void`)

### Flush

*No description yet.*

```csharp
void Flush();
```

**Returns:** nothing (`void`)

### WriteBoolean

This `WriteBoolean` method writes a boolean option value for the option name used by the specified server (SectionName) which is represented by the system wide Preferences dialog.

```csharp
void WriteBoolean(string argSectionName, string argValueName, bool argValue);
```

| Parameter | Type | Passing |
| --- | --- | --- |
| `argSectionName` | `string` | value |
| `argValueName` | `string` | value |
| `argValue` | `bool` | value |

**Returns:** nothing (`void`)

The section name is the targetted page in the system wide preferences dialog.

**Example:** Save two graphic viewer preferences as Boolean options.

```csharp
using DXP;

// Placeholders: your server's name, its preferences section and the values to store.
string serverName = "<server name>";
string preferencesSection = "<preferences section>";
bool scaleImage = true;
bool keepAspectRatio = true;

IOptionsWriter writer = DXP.GlobalVars.Client.GetOptionsManager().GetOptionsWriter(serverName);
if (writer == null)
    return;
writer.WriteBoolean(preferencesSection, "ScaleImage", scaleImage);
writer.WriteBoolean(preferencesSection, "KeepAspectRatio", keepAspectRatio);
```

**Examples:** [Extension_SchPreference](https://github.com/AltiumDeveloper/ad-sdk-examples/blob/5b144f54740a53ec578b3b6c3f902b831e0b1144/Extension_SchPreference/Source%20Code/Commands.cs#L29), [Extension_SupplierPreference](https://github.com/AltiumDeveloper/ad-sdk-examples/blob/5b144f54740a53ec578b3b6c3f902b831e0b1144/Extension_SupplierPreference/Source%20Code/Commands.cs#L52)

### WriteDouble

This `WriteDouble` method writes a double value for the option name used by the specified server (SectionName) which is represented by the system wide Preferences dialog.

```csharp
void WriteDouble(string argSectionName, string argValueName, double argValue);
```

| Parameter | Type | Passing |
| --- | --- | --- |
| `argSectionName` | `string` | value |
| `argValueName` | `string` | value |
| `argValue` | `double` | value |

**Returns:** nothing (`void`)

The section name is the targetted page in the system wide preferences dialog.

### WriteInteger

This `WriteInteger` method writes an integral value for the option name used by the specified server (SectionName) which is represented by the system wide Preferences dialog.

```csharp
void WriteInteger(string argSectionName, string argValueName, int argValue);
```

| Parameter | Type | Passing |
| --- | --- | --- |
| `argSectionName` | `string` | value |
| `argValueName` | `string` | value |
| `argValue` | `int` | value |

**Returns:** nothing (`void`)

The section name is the targetted page in the system wide preferences dialog.

### WriteString

This `WriteString` method writes a string option value for the option name used by the specified server (SectionName) which is represented by the system wide Preferences dialog.

```csharp
void WriteString(string argSectionName, string argValueName, string argValue);
```

| Parameter | Type | Passing |
| --- | --- | --- |
| `argSectionName` | `string` | value |
| `argValueName` | `string` | value |
| `argValue` | `string` | value |

**Returns:** nothing (`void`)

The section name is the targetted page in the system wide preferences dialog.

**Examples:** [Ciiva](https://github.com/AltiumDeveloper/ad-sdk-examples/blob/5b144f54740a53ec578b3b6c3f902b831e0b1144/Ciiva/Source%20Code/Preferences.cs#L36), [Extension_Preference](https://github.com/AltiumDeveloper/ad-sdk-examples/blob/5b144f54740a53ec578b3b6c3f902b831e0b1144/Extension_Preference/Source%20Code/Preferences.cs#L39), [Extension_SupplierPreference](https://github.com/AltiumDeveloper/ad-sdk-examples/blob/5b144f54740a53ec578b3b6c3f902b831e0b1144/Extension_SupplierPreference/Source%20Code/Commands.cs#L60)

## Returned by

[IOptionsManager.GetOptionsWriter](https://altiumdeveloper.github.io/ad-sdk-docs/reference/dxp/IOptionsManager.md#getoptionswriter), [IOptionsManager.GetOptionsWriter_ForIniFile](https://altiumdeveloper.github.io/ad-sdk-docs/reference/dxp/IOptionsManager.md#getoptionswriter_forinifile), [Utils.ServerOptionsWriter](https://altiumdeveloper.github.io/ad-sdk-docs/reference/dxp/Utils.md#serveroptionswriter)

## Accepted by

[IReportOutputOptions.Export_ToOptionsWriter](https://altiumdeveloper.github.io/ad-sdk-docs/reference/dxp/IReportOutputOptions.md#export_tooptionswriter), [IReportOutputTransformation.Export_ToOptionsWriter](https://altiumdeveloper.github.io/ad-sdk-docs/reference/dxp/IReportOutputTransformation.md#export_tooptionswriter), [IVcsDesignVault.SaveToIni](https://altiumdeveloper.github.io/ad-sdk-docs/reference/dxp/IVcsDesignVault.md#savetoini), [ISch_JunctionConvertSettings.Export_ToIniFile](https://altiumdeveloper.github.io/ad-sdk-docs/reference/sch/ISch_JunctionConvertSettings.md#export_toinifile)

## Examples

Used in the SDK examples: [Ciiva](https://github.com/AltiumDeveloper/ad-sdk-examples/blob/5b144f54740a53ec578b3b6c3f902b831e0b1144/Ciiva/Source%20Code/Preferences.cs#L34), [Extension_Preference](https://github.com/AltiumDeveloper/ad-sdk-examples/blob/5b144f54740a53ec578b3b6c3f902b831e0b1144/Extension_Preference/Source%20Code/Preferences.cs#L37), [Extension_SchPreference](https://github.com/AltiumDeveloper/ad-sdk-examples/blob/5b144f54740a53ec578b3b6c3f902b831e0b1144/Extension_SchPreference/Source%20Code/Commands.cs#L26), [Extension_SupplierPreference](https://github.com/AltiumDeveloper/ad-sdk-examples/blob/5b144f54740a53ec578b3b6c3f902b831e0b1144/Extension_SupplierPreference/Source%20Code/Commands.cs#L26).
