# DocumentsAPI

## Content

# Type Alias: DocumentsAPI

```ts
type DocumentsAPI = object;
```

## Properties

### create

```ts
create: (options?) => Promise<CreateDocumentInfo>;
```

Creates a new report to be edited in Designer using the specified **CreateReportOptions** object.

#### Parameters

##### options?

[`CreateDocumentOptions`](CreateDocumentOptions)

#### Returns

`Promise`&lt;[`CreateDocumentInfo`](CreateDocumentInfo)&gt;

#### Examples

```javascript
// ESM usage
import { arWebDesigner } from './web-designer.js';
const designer = arWebDesigner.apiOf('ar-web-designer');
var reportInfo = designer.documents.create().then(function() {
	console.log('An empty RDL report is created.');
});
```

```javascript
// UMD usage
const designer = GrapeCity.ActiveReports.Designer.apiOf('ar-web-designer');
var reportInfo = designer.documents.create().then(function() {
	console.log('An empty RDL report is created.');
});
```

```typescript
const designer = GrapeCity.ActiveReports.Designer.apiOf('ar-web-designer');
var reportInfo = designer.documents.create().then(() => {
		console.log('An empty RDL report is created.');
});
**
@param options CreateReportOptions object

***

### hasUnsavedChanges

```ts
hasUnsavedChanges: () => boolean;
```

Indicates whether report has unsaved changes.

#### Returns

`boolean`

#### Examples

```javascript
// ESM usage
import { arWebDesigner } from './web-designer.js';
const designer = arWebDesigner.apiOf('ar-web-designer');
const val = designer.documents.hasUnsavedChanges();
if (val) console.log('Currently edited report has unsaved changes.');
```

```javascript
// UMD usage
const designer = GrapeCity.ActiveReports.Designer.apiOf('ar-web-designer');
const val = designer.documents.hasUnsavedChanges();
if (val) console.log('Currently edited report has unsaved changes.');
```

```typescript
const designer = GrapeCity.ActiveReports.Designer.apiOf('ar-web-designer');
const val = designer.documents.hasUnsavedChanges();
if (val) console.log('Currently edited report has unsaved changes.');
```

***

### info

```ts
info: () => CurrentDocumentInfo;
```

Returns information about the currently edited report.

#### Returns

[`CurrentDocumentInfo`](CurrentDocumentInfo)

#### Examples

```javascript
// ESM usage
import { arWebDesigner } from './web-designer.js';
const designer = arWebDesigner.apiOf('ar-web-designer');
var reportInfo = designer.documents.info();
console.log(`Report "${reportInfo.name}" is currently edited.`);
```

```javascript
// UMD usage
const designer = GrapeCity.ActiveReports.Designer.apiOf('ar-web-designer');
var reportInfo = designer.documents.info();
console.log(`Report "${reportInfo.name}" is currently edited.`);
```

```typescript
const designer = GrapeCity.ActiveReports.Designer.apiOf('ar-web-designer');
var reportInfo = designer.documents.info();
console.log(`Report "${reportInfo.name}" is currently edited.`);
```

***

### isNew

```ts
isNew: () => boolean;
```

Indicates whether report was saved before at least once

#### Returns

`boolean`

#### Examples

```javascript
// ESM usage
import { arWebDesigner } from './web-designer.js';
const designer = arWebDesigner.apiOf('ar-web-designer');
const val = designer.documents.isNew();
if (val) console.log('New document');
```

```javascript
// UMD usage
const designer = GrapeCity.ActiveReports.Designer.apiOf('ar-web-designer');
const val = designer.documents.isNew();
if (val) console.log('New document');
```

```typescript
const designer = GrapeCity.ActiveReports.Designer.apiOf('ar-web-designer');
const val = designer.documents.isNew();
if (val) console.log('New document');
```

***

### open

```ts
open: () => void;
```

Shows open report dialog

#### Returns

`void`

#### Examples

```javascript
// ESM usage
import { arWebDesigner } from './web-designer.js';
var api = arWebDesigner.apiOf('designer-id');
api.documents.open();
```

```javascript
// UMD usage
var api = GrapeCity.ActiveReports.Designer.apiOf('designer-id');
api.documents.open();
```

```typescript
var api = GrapeCity.ActiveReports.Designer.apiOf('designer-id');
api.documents.open();
```

***

### openById

```ts
openById: (id, type, name?, content?) => Promise<OpenDocumentInfo>;
```

Opens an existing report to be edited in Designer with specified id.
Optionally you can pass name and content, else it will be loaded from server.

#### Parameters

##### id

`string`

##### type

[`SupportedDocumentType`](SupportedDocumentType)

##### name?

`string`

##### content?

`any`

#### Returns

`Promise`&lt;[`OpenDocumentInfo`](OpenDocumentInfo)&gt;

#### Examples

```javascript
// ESM usage
import { arWebDesigner } from './web-designer.js';
var api = arWebDesigner.apiOf('designer-id');
api.documents.openById('MyReport.rdlx', { platform: 'rdlx', type: 'report', subType: 'msl'}).then(() => {
  console.log('An existing report "MyReport.rdlx" is opened.');
});
var reportContent = { Width: '6.5in', ReportSections: [{ Type: 'Continuous' as any, Name: 'ContinuousSection1', Body: { ReportItems: [ {Type: 'textbox', Name: 'TextBox1', Width: '5in', Height: '1in' } ] }}]};
api.documents.openById('NewReport.rdlx', { platform: 'rdlx', type: 'report', subType: 'msl'}, 'NewReport', reportContent).then(() => {
  console.log('New report with one textbox created and opened.');
});
```

```javascript
// UMD usage
var api = GrapeCity.ActiveReports.Designer.apiOf('designer-id');
api.documents.openById('MyReport.rdlx', { platform: 'rdlx', type: 'report', subType: 'msl'}).then(() => {
  console.log('An existing report "MyReport.rdlx" is opened.');
});
var reportContent = { Width: '6.5in', ReportSections: [{ Type: 'Continuous' as any, Name: 'ContinuousSection1', Body: { ReportItems: [ {Type: 'textbox', Name: 'TextBox1', Width: '5in', Height: '1in' } ] }}]};
api.documents.openById('NewReport.rdlx', { platform: 'rdlx', type: 'report', subType: 'msl'}, 'NewReport', reportContent).then(() => {
  console.log('New report with one textbox created and opened.');
});
```

```typescript
const api = GrapeCity.ActiveReports.Designer.apiOf('designer-id');
api.documents.openById('MyReport.rdlx', { platform: 'rdlx', type: 'report', subType: 'msl'}).then(() => {
  console.log('An existing report "MyReport.rdlx" is opened.');
});
const reportContent = { Width: '6.5in', ReportSections: [{ Type: 'Continuous' as any, Name: 'ContinuousSection1', Body: { ReportItems: [ {Type: 'textbox', Name: 'TextBox1', Width: '5in', Height: '1in' } ] }}]};
api.documents.openById('NewReport.rdlx', { platform: 'rdlx', type: 'report', subType: 'msl'}, 'NewReport', reportContent).then(() => {
  console.log('New report with one textbox created and opened.');
});
```

***

### save

```ts
save: () => void;
```

Saves the report currently edited in Designer, if report is new, then "Save As" dialog will be opened.

#### Returns

`void`

#### Examples

```javascript
// ESM usage
import { arWebDesigner } from './web-designer.js';
var api = arWebDesigner.apiOf('designer-id');
api.documents.save();
```

```javascript
// UMD usage
var api = GrapeCity.ActiveReports.Designer.apiOf('designer-id');
api.documents.save();
```

```typescript
var api = GrapeCity.ActiveReports.Designer.apiOf('designer-id');
api.documents.save();
```

***

### saveAs

```ts
saveAs: () => void;
```

Opens "Save As" dialog

#### Returns

`void`

#### Examples

```javascript
// ESM usage
import { arWebDesigner } from './web-designer.js';
var api = arWebDesigner.apiOf('designer-id');
api.documents.save();
```

```javascript
// UMD usage
var api = GrapeCity.ActiveReports.Designer.apiOf('designer-id');
api.documents.save();
```

```typescript
var api = GrapeCity.ActiveReports.Designer.apiOf('designer-id');
api.documents.saveAs();
```

***

### saveById

```ts
saveById: (id?, name?) => Promise<SaveDocumentInfo>;
```

Saves the report currently edited in Designer using the specified **id**.

#### Parameters

##### id?

`string`

##### name?

`string`

#### Returns

`Promise`&lt;[`SaveDocumentInfo`](SaveDocumentInfo)&gt;

#### Examples

```javascript
// ESM usage
import { arWebDesigner } from './web-designer.js';
var api = arWebDesigner.apiOf('designer-id');
api.documents.saveById('MyReport.rdlx');
```

```javascript
// UMD usage
var api = GrapeCity.ActiveReports.Designer.apiOf('designer-id');
api.documents.saveById('MyReport.rdlx');
```

```typescript
var api = GrapeCity.ActiveReports.Designer.apiOf('designer-id');
api.documents.saveById('MyReport.rdlx');
```

***

### saveByName

```ts
saveByName: (name) => Promise<SaveDocumentInfo>;
```

Saves the report currently edited in Designer using the specified **name**.

#### Parameters

##### name

`string`

#### Returns

`Promise`&lt;[`SaveDocumentInfo`](SaveDocumentInfo)&gt;

#### Examples

```javascript
// ESM usage
import { arWebDesigner } from './web-designer.js';
var api = arWebDesigner.apiOf('designer-id');
api.documents.saveByName('MyReport.rdlx')
```

```javascript
// UMD usage
var api = GrapeCity.ActiveReports.Designer.apiOf('designer-id');
api.documents.saveByName('MyReport.rdlx')
```

```typescript
var api = GrapeCity.ActiveReports.Designer.apiOf('designer-id');
api.documents.saveByName('MyReport.rdlx')
```
