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
Copy file name to clipboardExpand all lines: introduction.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -50,7 +50,7 @@ Telerik Document Processing features the following components:
50
50
51
51
*[RadSpreadProcessing]({%slug radspreadprocessing-overview%}): A library that allows you to create, import and export XLSX (Excel Workbook), XLS (Excel 97-2003 Workbook), CSV and TXT spreadsheet documents. It also allows you to export all these formats to PDF.
52
52
53
-
*[RadSpreadStreamProcessing]({%slug radspreadstreamprocessing-overview%}): A library that allows you to export large XLSX and CSV spreadsheet documents with low memory footprint and great performance.
53
+
*[RadSpreadStreamProcessing]({%slug radspreadstreamprocessing-overview%}): A library that allows you to export and read large XLSX and CSV spreadsheet documents with low memory footprint and great performance.
54
54
55
55
*[RadWordsProcessing]({%slug radwordsprocessing-overview%}): A library that allows you to create, import and export DOCX (Word Document), DOC & DOT (import only), HTML, RTF and TXT documents. It also allows you to export all these formats to PDF.
Copy file name to clipboardExpand all lines: libraries/radspreadstreamprocessing/getting-started.md
+43-1Lines changed: 43 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -58,7 +58,7 @@ In order to use **RadSpreadStreamProcessing** in your project, you will need to
58
58
</tbody>
59
59
</table>
60
60
61
-
>note The binaries compatible with .NET Standard are distributed with the packages targeting .NET Standard and .NET Core. You can obtain the assemblies through the **UI for ASP.NET Core**, **UI for Blazor** and **UI for Xamarin** suites. There are **NuGet** packages as well that you can access if you have a license for one of the above mentioned suites.
61
+
>note The binaries compatible with .NET Standard are distributed with the packages targeting .NET Standard and .NET Core. For the full list of suites including Telerik Document Processing, check the [Installing on Your Computer]({%slug installation-installing-on-your-computer%}) help topic. There are **NuGet** packages as well that you can access if you have a license for one of the above mentioned suites.
62
62
63
63
## Create a Spreadsheet Document
64
64
@@ -143,6 +143,48 @@ When creating a document with **RadSpreadStreаmProcessing**, you should have in
When reading a document with **RadSpreadStreаmProcessing**, you should have in mind that the order of parsing the content is much important. To achieve the low resources usage, the library parses only the required by the user data and, due to the format restrictions of the way the content is presented in the structure of the file, you have to create the desired elements in a sequence keeping the following consecution:
149
+
150
+
151
+
1. Read the Workbook
152
+
153
+
2. Read a Worksheet
154
+
155
+
3. Read Columns (optional)
156
+
157
+
4. Read Rows (a worksheet must contain at least one row)
158
+
159
+
5. Read Cells (optional)
160
+
161
+
**Example 2** demonstrates how you could read the data from an existing document.
With **RadSpreadStreamProcessing** you can read spreadsheet documents from the following file formats:
13
+
14
+
* XLSX
15
+
16
+
* CSV
17
+
18
+
This functionality is introduced in R3 2022.
19
+
20
+
## Specifics
21
+
22
+
The library reads dynamically the document content. To achieve this, each of the classes responsible for importing the elements of the document implement **IDisposable** and keeps the corresponding content and settings into the memory until it is disposed.
23
+
24
+
## Read File Data
25
+
26
+
To read the data from a file, you should parse the desired elements in a sequence keeping the following consecution:
27
+
28
+
1. Read the Workbook
29
+
30
+
2. Read a Worksheet
31
+
32
+
3. Read Columns (optional)
33
+
34
+
4. Read Rows
35
+
36
+
5. Read Cells
37
+
38
+
39
+
#### [C#]**Example 1: Read data from a document**
40
+
41
+
{{region radspreadstreamprocessing-import_0}}
42
+
43
+
using (FileStream fs = new FileStream(fileName, FileMode.Open))
44
+
{
45
+
using (IWorkbookImporter workBookImporter = SpreadImporter.CreateWorkbookImporter(SpreadDocumentFormat.Xlsx, fs))
46
+
{
47
+
foreach (IWorksheetImporter worksheetImporter in workBookImporter.WorksheetImporters)
48
+
{
49
+
foreach (IRowImporter rowImporter in worksheetImporter.Rows)
50
+
{
51
+
foreach (ICellImporter cell in rowImporter.Cells)
52
+
{
53
+
string value = cell.Value;
54
+
}
55
+
}
56
+
}
57
+
}
58
+
}
59
+
60
+
{{endregion}}
61
+
62
+
Through the importer objects, you can access the properties of the different elements.
A cell is the basic data unit in a worksheet. Cells are organized in rows and columns and can also be referred as an intersection point of a column and a row. Cells are identified by a letter and number combination that indicates the letter of their column and the number of their row. For example, the top left cell is referred to as A1 and the bottom right cell is – XFD1048576.
24
18
25
-
## ICellExporter Interface
19
+
## ICellExporter and ICellImporter Interface
26
20
27
21
In **RadSpreadStreamProcessing**, a cell could be exported through the [**ICellExporter** interface](https://docs.telerik.com/devtools/document-processing/api/Telerik.Documents.SpreadsheetStreaming.ICellExporter.html). It defines several methods allowing you to set different values and formats to a cell.
28
22
23
+
If you need to read the cell data and its properties, you should use the [**ICellImporter** interface](https://docs.telerik.com/devtools/document-processing/api/Telerik.Documents.SpreadsheetStreaming.ICellImporter.html).
24
+
29
25
## Using ICellExporter
30
26
31
27
A concrete instance of ICellExporter could be created through the **CreateCellExporter()** method of [IRowExporter]({%slug radspreadstreamprocessing-model-rows%}). **Example 1** demonstrates how you can add a cell to a row.
@@ -239,6 +235,37 @@ In addition to the listed properties, the SpreadCellFormat class allows you to s
239
235
240
236
A SpreadCellFormat instance could be applied on multiple cells. However, if a property of the format changes, the new settings will be applied to the cells formatted after the modification.
241
237
238
+
## Read a Cell
239
+
240
+
### Using ICellImporter
241
+
242
+
A concrete instance of ICellImporter could be obtained through the Cells collection of [IRowImporter]({%slug radspreadstreamprocessing-model-rows%}). **Example 8** demonstrates how you can read the cells of a row.
>ICellImporter inherits from [IDisposable](https://msdn.microsoft.com/en-us/library/system.idisposable(v=vs.110).aspx). Make sure the object is disposed when you are done with it. The best way to ensure this is handled properly is to wrap it in a *using* statement.
258
+
259
+
The ICellImporter interface exposes the following properties:
260
+
261
+
***RowIndex**: Gets the index of the row the cell appears in.
262
+
***ColumnIndex**: Gets the index of the column the cell appears in.
263
+
***Format**: Gets the formatting applied to the cell. The property is of type [SpreadCellFormat](https://docs.telerik.com/devtools/document-processing/api/telerik.documents.spreadsheetstreaming.spreadcellformat).
264
+
***Value**: A string property that allows you get the value of the cell.
265
+
***ValueType**: Gets the value type of the cell. This property is enumeration of type [CellValueType](https://docs.telerik.com/devtools/document-processing/api/telerik.documents.spreadsheetstreaming.cellvaluetype)
A column is a group of cells that are vertically stacked and appear on the same vertical line. Columns are identified by a letter or a combination of letters. For example, the first column is called A, the second one – B and the last column is XFD.
24
17
25
-
## IColumnExporter Interface
18
+
## IColumnExporter and IColumnImporter Interfaces
26
19
27
20
In **RadSpreadStreamProcessing**, a column could be exported through the [**IColumnExporter** interface](https://docs.telerik.com/devtools/document-processing/api/Telerik.Documents.SpreadsheetStreaming.IColumnExporter.html). It defines several methods allowing you to change the appearance of a column.
28
21
22
+
To read a column and its properties, you should use the [**IColumnImporter** interface](https://docs.telerik.com/devtools/document-processing/api/Telerik.Documents.SpreadsheetStreaming.IColumnImporter.html).
23
+
29
24
### Using IColumnExporter
30
25
31
26
A concrete instance of IColumnExporter could be created through the CreateColumnExporter() method of [IWorksheetExporter]({%slug radspreadstreamprocessing-model-worksheet%}). **Example 1** demonstrates how you can add a column to a worksheet.
@@ -79,6 +74,32 @@ In some cases you may need to skip several columns and start filling the data in
79
74
}
80
75
{{endregion}}
81
76
77
+
## Read a Column
78
+
79
+
### Using IColumnImporter
80
+
81
+
A concrete instance of IColumnImporter could be obtained through the Columns collection of [IWorksheetImporter]({%slug radspreadstreamprocessing-model-worksheet%}). **Example 4** demonstrates how you can start reading a row from a worksheet.
foreach (IColumnImporter column in worksheetImporter.Columns)
88
+
{
89
+
}
90
+
{{endregion}}
91
+
92
+
>IColumnImporter inherits from [IDisposable](https://msdn.microsoft.com/en-us/library/system.idisposable(v=vs.110).aspx). Make sure the object is disposed when you are done with it. The best way to ensure this is handled properly is to wrap it in a *using* statement.
93
+
94
+
The IColumnImporter interface exposes the following properties:
95
+
96
+
***FromIndex**: Gets the first index of the column range with same properties.
97
+
***ToIndex**: Gets the last index of the column range with same properties.
98
+
***OutlineLevel**: Gets the outline level (used when grouping columns).
99
+
***IsCustomWidth**: Gets a value indicating whether the width applied to the current column is a custom one.
100
+
***WidthInPixels** and **WidthInCharacters**: Gets the width of the column in pixels and in characters, respectively.
101
+
***IsHidden**: Gets a value determining whether the row is hidden.
Rows in the terms of a spreadsheet document are groups of cells that are on the same horizontal line. Each row is identified by a number. For example, the first row has an index 1, the second one – 2 and the last one – 1048576.
23
17
24
18
25
-
## IRowExporter Interface
19
+
## IRowExporter and IRowImporter Interfaces
26
20
27
21
In **RadSpreadStreamProcessing**, a row could be exported through the [**IRowExporter** interface](https://docs.telerik.com/devtools/document-processing/api/Telerik.Documents.SpreadsheetStreaming.IRowExporter.html). It defines several methods allowing you to add cells to a row or change its appearance.
28
22
23
+
To read a row and its properties, you should use [**IRowImporter** interface](https://docs.telerik.com/devtools/document-processing/api/Telerik.Documents.SpreadsheetStreaming.IRowImporter.html).
24
+
29
25
### Using IRowExporter
30
26
31
27
A concrete instance of IRowExporter could be created through the CreateRowExporter() method of [IWorksheetExporter]({%slug radspreadstreamprocessing-model-worksheet%}). **Example 1** demonstrates how you can add a row to a worksheet.
@@ -79,6 +75,34 @@ In some cases you may need to skip several rows and start filling the data in th
79
75
}
80
76
{{endregion}}
81
77
78
+
## Read a Row
79
+
80
+
### Using IRowImporter
81
+
82
+
A concrete instance of IRowImporter could be obtained through the Rows collection of [IWorksheetImporter]({%slug radspreadstreamprocessing-model-worksheet%}). **Example 4** demonstrates how you can start reading a row from a worksheet.
foreach (IRowImporter rowImporter in worksheetImporter.Rows)
89
+
{
90
+
}
91
+
{{endregion}}
92
+
93
+
>IRowImporter inherits from [IDisposable](https://msdn.microsoft.com/en-us/library/system.idisposable(v=vs.110).aspx). Make sure the object is disposed when you are done with it. The best way to ensure this is handled properly is to wrap it in a *using* statement.
94
+
95
+
The IRowImporter interface exposes the following properties to allow you access its data:
96
+
97
+
***RowIndex**: Gets the index of the row in the worksheet.
98
+
***OutlineLevel**: Gets the outline level (used when grouping rows).
99
+
***IsCustomHeight**: Gets a value indicating whether the height applied to the current row is a custom one.
100
+
***HeightInPixels** and **HeightInPoints**: Gets the height of the row in pixels and in points, respectively.
101
+
***IsHidden**: Gets a value determining whether the row is hidden.
102
+
***Cells**: Collection of ICellImporter objects, enabling you to iterate the cells inside the worksheet using.
The workbook is the primary document that you use to manipulate and store data. The workbook can also be described as a collection of worksheets, where a worksheet is in turn defined as a collection of cells organized in rows and columns. Each workbook contains, at least, one worksheet and often holds several sheets with related information.
24
17
25
18
The workbook is designed to hold together multiple worksheets in order to allow efficient organization and consolidation of data. Typically, a workbook contains worksheets with related data.
26
19
27
20
28
-
## IWorkbookExporter Interface
21
+
## IWorkbookExporter and IWorkbookImporter Interfaces
29
22
30
-
In **RadSpreadStreamProcessing**, the workbook is represented by the [**IWorkbookExporter**interface](https://docs.telerik.com/devtools/document-processing/api/Telerik.Documents.SpreadsheetStreaming.IWorkbookExporter.html). This interface defines members for adding [worksheets]({%slug radspreadstreamprocessing-model-worksheet%}) and accessing the cell styles of the workbook.
23
+
In **RadSpreadStreamProcessing**, the workbook is represented by the [**IWorkbookExporter**](https://docs.telerik.com/devtools/document-processing/api/Telerik.Documents.SpreadsheetStreaming.IWorkbookExporter.html) and [**IWorkbookImporter**interface](https://docs.telerik.com/devtools/document-processing/api/Telerik.Documents.SpreadsheetStreaming.IWorkbookImporter.html) interfaces. These interfaces define members for adding [worksheets]({%slug radspreadstreamprocessing-model-worksheet%}), parsing them, and accessing the cell styles of the workbook.
31
24
32
-
**IWorkbookExporter** is responsible for exporting a workbook. Due to the specifics of the different file formats, different concrete instances of this interface take care about the creation and export of a document.
25
+
**IWorkbookExporter** is responsible for exporting a workbook. Due to the specifics of the different file formats, different concrete instances of this interface take care about the creation and export of a document. The same applies when importing with **IWorkbookImporter**.
33
26
34
27
## Using IWorkbookExporter
35
28
@@ -83,7 +76,13 @@ Since the CSV format doesn't have the concept for multiple sheets, invoking GetS
83
76
84
77
>You can find a runnable example showing how to append a worksheet to an existing workbook in the [SDK repository](https://github.com/telerik/document-processing-sdk/tree/master/SpreadStreamProcessing/AppendWorksheetToExistingWorkbook) on GitHub.
85
78
79
+
## Using IWorkbookImporter to Read a File
80
+
81
+
The **IWorkbookImporter** interface is the entry point for reading a document and allows you iterate the worksheet importers. You can get an instance of IWorkbookImporter through the **CreateWorkbookImporter()** method of [SpreadExporter](https://docs.telerik.com/devtools/document-processing/api/Telerik.Documents.SpreadsheetStreaming.SpreadExporter.html). The first parameter of the CreateWorkbookImporter() method specifies the file format of the document that will be imported and the second one represents the stream with the file data. For more information on how to read the data, check the [Import]({%slug radspreadstreamprocessing-import%}) help topic.
*[SpreadCellStyle API Reference](https://docs.telerik.com/devtools/document-processing/api/Telerik.Documents.SpreadsheetStreaming.SpreadCellStyle.html)
0 commit comments