You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e5106b1
Browse filesBrowse the repository at this point in the historyBrowse files
Note that the component supports export to Excel files with the `.xlsx` extension only.
40
40
:::
41
41
42
+
Besides cell values, an exported file keeps the cell styles, the number formats, the merged cells, the frozen columns and rows, the links, the drop-down editors, and the locked state of cells. All of them are restored on [import of the file back into Spreadsheet](loading_data.md#loading-excel-file-xlsx).
43
+
42
44
:::info
43
45
DHTMLX Spreadsheet uses the WebAssembly-based library [Json2Excel](https://github.com/dhtmlx/json2excel) to export data to Excel. [Check the details](loading_data.md#exporting-data).
Copy file name to clipboardExpand all lines: docs/api/spreadsheet_serialize_method.md
+71-10Lines changed: 71 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,30 +13,91 @@ description: You can learn about the serialize method in the documentation of th
13
13
### Usage
14
14
15
15
~~~jsx
16
-
serialize(): object;
16
+
serialize(): {
17
+
sheets: [
18
+
{
19
+
name: string,
20
+
id: string,
21
+
data: [
22
+
{
23
+
cell: string,
24
+
value?: string | number,
25
+
css?: string,
26
+
format?: string,
27
+
editor?: {
28
+
type: string, // type: "select"
29
+
options: string | array
30
+
},
31
+
locked?: boolean,
32
+
link?: {
33
+
text?: string,
34
+
href: string
35
+
}
36
+
},
37
+
// more cell objects
38
+
],
39
+
cols: [
40
+
{
41
+
width: number,
42
+
hidden: boolean
43
+
},
44
+
// more column objects
45
+
],
46
+
rows: [
47
+
{
48
+
height: number,
49
+
hidden: boolean
50
+
},
51
+
// more row objects
52
+
],
53
+
merged: [
54
+
{
55
+
from: { column: number, row: number },
56
+
to: { column: number, row: number }
57
+
},
58
+
// more objects
59
+
],
60
+
freeze: {
61
+
col: number,
62
+
row: number
63
+
}
64
+
},
65
+
// more sheet objects
66
+
],
67
+
styles: object,
68
+
formats: array
69
+
};
17
70
~~~
18
71
19
72
### Returns
20
73
21
-
The method returns a serialized JSON object
22
-
23
-
The serialized data is an object with the following attributes:
74
+
The method returns a serialized JSON object with the following attributes:
24
75
25
76
-`formats` - an array of objects with number formats
26
-
-`styles` - an object with the applied CSS classes
77
+
-`styles` - an object with the applied CSS classes, where a key is the name of a class and a value is an object with its style properties
27
78
-`sheets` - an array of sheet objects. Each object contains the following attributes:
28
-
-`name` - the sheet name
29
-
-`data` - an array of data objects
30
-
-`rows` - an array of height objects
31
-
-`cols` - an array of width objects
79
+
-`name` - the sheet name
80
+
-`id` - the sheet id
81
+
-`data` - an array of cell objects. Each object contains the `cell` attribute with the cell id and the attributes that were set for the cell: `value`, `css`, `format`, `editor`, `locked`, `link`
82
+
-`cols` - an array of objects with columns configurations. Each object contains the `width` and `hidden` attributes
83
+
-`rows` - an array of objects with rows configurations. Each object contains the `height` and `hidden` attributes
84
+
-`merged` - an array of objects where each object defines a range of merged cells via the `from` and `to` attributes
85
+
-`freeze` - an object with the number of fixed columns and rows, `{ col: 0, row: 0 }` if nothing is frozen
86
+
87
+
Note that:
88
+
89
+
- the `merged` and `freeze` attributes are always present in a sheet object, as well as the `hidden` attribute in a column or row object, which is `false` when the column or row is visible
90
+
- the `cols` and `rows` arrays cover the data range of a sheet and are extended further if a column width, a row height, or a `hidden` state was changed beyond that range. Thus custom sizes of empty columns and rows are kept as well
91
+
- a cell gets into the `data` array if it has a value, a CSS class, an editor, or the `locked` state. Thus locked empty cells are kept as well
92
+
- the returned object can be passed to the [](api/spreadsheet_parse_method.md) method as is
Copy file name to clipboardExpand all lines: docs/loading_data.md
+7-1Lines changed: 7 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -136,6 +136,8 @@ const dataset = [
136
136
137
137
Check the full list of available cell properties in the [API reference](api/spreadsheet_parse_method.md#parameters).
138
138
139
+
The locked state is a part of the spreadsheet data. It is included into the object returned by the [](api/spreadsheet_serialize_method.md) method, even if a locked cell is empty, and it is kept when data is [exported into an Excel file](#export-into-excel) and [imported back](#loading-excel-file-xlsx).
{{note Note that the component supports import from Excel files with the `.xlsx` extension only.}}
241
243
244
+
Along with cell values, import restores the cell styles, the number formats, the merged cells, the links, the data validation lists (as drop-down editors), and the [locked state of cells](#setting-the-locked-state-for-a-cell).
You can also [export data from a spreadsheet into an Excel file](#exporting-data), if needed.
@@ -268,7 +272,7 @@ For details on how to load multiple sheets into the spreadsheet, see the [Work w
268
272
269
273
## Saving and restoring state
270
274
271
-
To save the current state of a spreadsheet, use the [](api/spreadsheet_serialize_method.md) method. It converts data into an array of JSON objects. Each JSON object contains the configuration of a cell.
275
+
To save the current state of a spreadsheet, use the [](api/spreadsheet_serialize_method.md) method. It converts the spreadsheet into a JSON object with the `sheets`, `styles`, and `formats` attributes. Besides cell values, the saved state includes the applied styles and number formats, the merged cells, the frozen columns and rows, the locked cells, and the custom sizes and visibility of columns and rows.
Besides cell values, an exported file keeps the styles applied to cells, the number formats, the merged cells, the frozen columns and rows, the links added into cells, the drop-down editors (as Excel data validation), and the [locked state of cells](#setting-the-locked-state-for-a-cell). All of them are restored when the file is [imported back into Spreadsheet](#loading-excel-file-xlsx).
336
+
331
337
:::note
332
338
Please note that the component supports export to Excel files with the `.xlsx` extension only.
Copy file name to clipboardExpand all lines: docs/working_with_cells.md
+9Lines changed: 9 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -208,6 +208,15 @@ var cellsLocked = spreadsheet.isLocked("A1,B5,B7,D4:D6");
208
208
209
209
The method returns `true` or `false` depending on the state of the cell. If several cells are checked at once, the method returns `true` if there is at least one locked cell among the specified cells.
210
210
211
+
### Saving the locked state
212
+
213
+
The locked state of cells is a part of the spreadsheet data, so it survives saving and restoring:
214
+
215
+
- the [](api/spreadsheet_serialize_method.md) method includes the `locked` property into the serialized cell objects, even if a locked cell has no value
216
+
-[export into an Excel file](loading_data.md#export-into-excel) keeps the locked state, and [import of such a file](loading_data.md#loading-excel-file-xlsx) restores it
217
+
218
+
You can also set the locked state right in a data set via the `locked` property of a cell. [Check the details](loading_data.md#setting-the-locked-state-for-a-cell).
Beachten Sie, dass die Komponente den Export in Excel-Dateien ausschließlich mit der Erweiterung `.xlsx` unterstützt.
40
40
:::
41
41
42
+
Neben den Zellwerten behält eine exportierte Datei die Zellstile, die Zahlenformate, die verbundenen Zellen, die fixierten Spalten und Zeilen, die Links, die Dropdown-Editoren und den gesperrten Zustand der Zellen bei. All dies wird beim [Reimport der Datei in Spreadsheet](loading_data.md#loading-excel-file-xlsx) wiederhergestellt.
43
+
42
44
:::info
43
45
DHTMLX Spreadsheet verwendet die WebAssembly-basierte Bibliothek [Json2Excel](https://github.com/dhtmlx/json2excel) für den Export von Daten nach Excel. [Weitere Details](loading_data.md#exporting-data).
Copy file name to clipboardExpand all lines: i18n/de/docusaurus-plugin-content-docs/current/api/spreadsheet_serialize_method.md
+71-10Lines changed: 71 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,30 +13,91 @@ description: In der Dokumentation der DHTMLX JavaScript Spreadsheet-Bibliothek e
13
13
### Verwendung {#usage}
14
14
15
15
~~~jsx
16
-
serialize(): object;
16
+
serialize(): {
17
+
sheets: [
18
+
{
19
+
name: string,
20
+
id: string,
21
+
data: [
22
+
{
23
+
cell: string,
24
+
value?: string | number,
25
+
css?: string,
26
+
format?: string,
27
+
editor?: {
28
+
type: string, // type: "select"
29
+
options: string | array
30
+
},
31
+
locked?: boolean,
32
+
link?: {
33
+
text?: string,
34
+
href: string
35
+
}
36
+
},
37
+
// more cell objects
38
+
],
39
+
cols: [
40
+
{
41
+
width: number,
42
+
hidden: boolean
43
+
},
44
+
// more column objects
45
+
],
46
+
rows: [
47
+
{
48
+
height: number,
49
+
hidden: boolean
50
+
},
51
+
// more row objects
52
+
],
53
+
merged: [
54
+
{
55
+
from: { column: number, row: number },
56
+
to: { column: number, row: number }
57
+
},
58
+
// more objects
59
+
],
60
+
freeze: {
61
+
col: number,
62
+
row: number
63
+
}
64
+
},
65
+
// more sheet objects
66
+
],
67
+
styles: object,
68
+
formats: array
69
+
};
17
70
~~~
18
71
19
72
### Rückgabewert {#returns}
20
73
21
-
Die Methode gibt ein serialisiertes JSON-Objekt zurück
22
-
23
-
Die serialisierten Daten sind ein Objekt mit den folgenden Attributen:
74
+
Die Methode gibt ein serialisiertes JSON-Objekt mit den folgenden Attributen zurück:
24
75
25
76
-`formats` - ein Array von Objekten mit Zahlenformaten
26
-
-`styles` - ein Objekt mit den angewendeten CSS-Klassen
77
+
-`styles` - ein Objekt mit den angewendeten CSS-Klassen, wobei ein Schlüssel der Name einer Klasse und ein Wert ein Objekt mit deren Stileigenschaften ist
27
78
-`sheets` - ein Array von Tabellenblatt-Objekten. Jedes Objekt enthält die folgenden Attribute:
28
-
-`name` - der Name des Tabellenblatts
29
-
-`data` - ein Array von Datenobjekten
30
-
-`rows` - ein Array von Höhenobjekten
31
-
-`cols` - ein Array von Breitobjekten
79
+
-`name` - der Name des Tabellenblatts
80
+
-`id` - die ID des Tabellenblatts
81
+
-`data` - ein Array von Zellobjekten. Jedes Objekt enthält das Attribut `cell` mit der Zell-ID sowie die Attribute, die für die Zelle gesetzt wurden: `value`, `css`, `format`, `editor`, `locked`, `link`
82
+
-`cols` - ein Array von Objekten mit Spaltenkonfigurationen. Jedes Objekt enthält die Attribute `width` und `hidden`
83
+
-`rows` - ein Array von Objekten mit Zeilenkonfigurationen. Jedes Objekt enthält die Attribute `height` und `hidden`
84
+
-`merged` - ein Array von Objekten, wobei jedes Objekt über die Attribute `from` und `to` einen Bereich verbundener Zellen definiert
85
+
-`freeze` - ein Objekt mit der Anzahl der fixierten Spalten und Zeilen, `{ col: 0, row: 0 }`, wenn nichts fixiert ist
86
+
87
+
Beachten Sie:
88
+
89
+
- die Attribute `merged` und `freeze` sind immer im Tabellenblatt-Objekt vorhanden, ebenso wie das Attribut `hidden` im Spalten- oder Zeilenobjekt, das `false` ist, wenn die Spalte oder Zeile sichtbar ist
90
+
- die Arrays `cols` und `rows` decken den Datenbereich eines Tabellenblatts ab und werden darüber hinaus erweitert, wenn eine Spaltenbreite, eine Zeilenhöhe oder ein `hidden`-Zustand außerhalb dieses Bereichs geändert wurde. So bleiben auch benutzerdefinierte Größen leerer Spalten und Zeilen erhalten
91
+
- eine Zelle gelangt in das Array `data`, wenn sie einen Wert, eine CSS-Klasse, einen Editor oder den Zustand `locked` hat. So bleiben auch gesperrte leere Zellen erhalten
92
+
- das zurückgegebene Objekt kann unverändert an die Methode [](api/spreadsheet_parse_method.md) übergeben werden
Copy file name to clipboardExpand all lines: i18n/de/docusaurus-plugin-content-docs/current/loading_data.md
+7-1Lines changed: 7 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -136,6 +136,8 @@ const dataset = [
136
136
137
137
Die vollständige Liste der verfügbaren Zell-Eigenschaften finden Sie in der [API-Referenz](api/spreadsheet_parse_method.md#parameters).
138
138
139
+
Der gesperrte Zustand ist Teil der Spreadsheet-Daten. Er wird in das von der Methode [](api/spreadsheet_serialize_method.md) zurückgegebene Objekt aufgenommen, auch wenn eine gesperrte Zelle leer ist, und er bleibt beim [Export der Daten in eine Excel-Datei](#export-into-excel) und beim [Reimport](#loading-excel-file-xlsx) erhalten.
{{note Beachten Sie, dass die Komponente nur den Import aus Excel-Dateien mit der Erweiterung `.xlsx` unterstützt.}}
241
243
244
+
Neben den Zellwerten stellt der Import die Zellstile, die Zahlenformate, die verbundenen Zellen, die Links, die Datenüberprüfungslisten (als Dropdown-Editoren) und den [gesperrten Zustand der Zellen](#setting-the-locked-state-for-a-cell) wieder her.
Sie können bei Bedarf auch [Daten aus einem Spreadsheet in eine Excel-Datei exportieren](#exporting-data).
@@ -268,7 +272,7 @@ Einzelheiten zum Laden mehrerer Tabellenblätter in das Spreadsheet finden Sie i
268
272
269
273
## Zustand speichern und wiederherstellen {#saving-and-restoring-state}
270
274
271
-
Um den aktuellen Zustand eines Spreadsheets zu speichern, verwenden Sie die Methode [](api/spreadsheet_serialize_method.md). Sie konvertiert Daten in ein Array von JSON-Objekten. Jedes JSON-Objekt enthält die Konfiguration einer Zelle.
275
+
Um den aktuellen Zustand eines Spreadsheets zu speichern, verwenden Sie die Methode [](api/spreadsheet_serialize_method.md). Sie konvertiert das Spreadsheet in ein JSON-Objekt mit den Attributen `sheets`, `styles` und `formats`. Neben den Zellwerten enthält der gespeicherte Zustand die angewendeten Stile und Zahlenformate, die verbundenen Zellen, die fixierten Spalten und Zeilen, die gesperrten Zellen sowie die benutzerdefinierten Größen und die Sichtbarkeit von Spalten und Zeilen.
Neben den Zellwerten behält eine exportierte Datei die auf Zellen angewendeten Stile, die Zahlenformate, die verbundenen Zellen, die fixierten Spalten und Zeilen, die in Zellen eingefügten Links, die Dropdown-Editoren (als Excel-Datenüberprüfung) und den [gesperrten Zustand der Zellen](#setting-the-locked-state-for-a-cell) bei. All dies wird wiederhergestellt, wenn die Datei [zurück in Spreadsheet importiert wird](#loading-excel-file-xlsx).
336
+
331
337
:::note
332
338
Bitte beachten Sie, dass die Komponente nur den Export in Excel-Dateien mit der Erweiterung `.xlsx` unterstützt.
0 commit comments