Skip to content
80 changes: 48 additions & 32 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,53 @@
[![](https://img.shields.io/badge/Open_in_DevExpress_Support_Center-FF7200?style=flat-square&logo=DevExpress&logoColor=white)](https://supportcenter.devexpress.com/ticket/details/E4339)
[![](https://img.shields.io/badge/📖_How_to_use_DevExpress_Examples-e9f6fc?style=flat-square)](https://docs.devexpress.com/GeneralInformation/403183)
<!-- default badges end -->
# Spreadsheet Document API – How to Process Excel Workbooks in Code (Part 1)

The [DevExpress Spreadsheet Document API](https://docs.devexpress.com/OfficeFileAPI/14912/spreadsheet-document-api) is a non-visual library that allows you to generate, import, export, modify, and print Microsoft Excel workbooks in code.

> You need an active license for the [DevExpress Office File API Subscription](https://www.devexpress.com/products/net/office-file-api/) or [DevExpress Universal Subscription](https://www.devexpress.com/subscriptions/universal.xml) to use this library in production code.

This example demonstrates how to use the Spreadsheet Document API to execute the following actions:

- Manage spreadsheet document elements (worksheets, cells, rows, and columns)
- Create formulas
- Format cells
- Import data from different data sources
- Export a workbook to PDF
- Print a workbook
- Specify the built-in and custom document properties

The application’s form contains the list of supported operations. A user can select an operation and click the **Run** button to view the resulting spreadsheet document in Microsoft Excel.

![Spreadsheet Document API - List of Supported Operations](./images/spreadsheet-document-api-part-1.png)

<!-- default file list -->
*Files to look at*:

* [CellActions.cs](./CS/SpreadsheetExamples/SpreadsheetActions/CellActions.cs) (VB: [CellActions.vb](./VB/SpreadsheetExamples/SpreadsheetActions/CellActions.vb))
* [DocumentPropertiesActions.cs](./CS/SpreadsheetExamples/SpreadsheetActions/DocumentPropertiesActions.cs) (VB: [DocumentPropertiesActions.vb](./VB/SpreadsheetExamples/SpreadsheetActions/DocumentPropertiesActions.vb))
* [ExportActions.cs](./CS/SpreadsheetExamples/SpreadsheetActions/ExportActions.cs) (VB: [ExportActions.vb](./VB/SpreadsheetExamples/SpreadsheetActions/ExportActions.vb))
* [FormattingActions.cs](./CS/SpreadsheetExamples/SpreadsheetActions/FormattingActions.cs) (VB: [FormattingActions.vb](./VB/SpreadsheetExamples/SpreadsheetActions/FormattingActions.vb))
* [FormulaActions.cs](./CS/SpreadsheetExamples/SpreadsheetActions/FormulaActions.cs) (VB: [FormulaActions.vb](./VB/SpreadsheetExamples/SpreadsheetActions/FormulaActions.vb))
* [ImportActions.cs](./CS/SpreadsheetExamples/SpreadsheetActions/ImportActions.cs) (VB: [ImportActions.vb](./VB/SpreadsheetExamples/SpreadsheetActions/ImportActions.vb))
* [PrintingActions.cs](./CS/SpreadsheetExamples/SpreadsheetActions/PrintingActions.cs) (VB: [PrintingActions.vb](./VB/SpreadsheetExamples/SpreadsheetActions/PrintingActions.vb))
* [RowAndColumnActions.cs](./CS/SpreadsheetExamples/SpreadsheetActions/RowAndColumnActions.cs) (VB: [RowAndColumnActions.vb](./VB/SpreadsheetExamples/SpreadsheetActions/RowAndColumnActions.vb))
* [WorksheetActions.cs](./CS/SpreadsheetExamples/SpreadsheetActions/WorksheetActions.cs) (VB: [WorksheetActions.vb](./VB/SpreadsheetExamples/SpreadsheetActions/WorksheetActions.vb))
## Files to Look At

- [CellActions.cs](./CS/SpreadsheetExamples/SpreadsheetActions/CellActions.cs) ([CellActions.vb](./VB/SpreadsheetExamples/SpreadsheetActions/CellActions.vb))
- [DocumentPropertiesActions.cs](./CS/SpreadsheetExamples/SpreadsheetActions/DocumentPropertiesActions.cs) ([DocumentPropertiesActions.vb](./VB/SpreadsheetExamples/SpreadsheetActions/DocumentPropertiesActions.vb))
- [ExportActions.cs](./CS/SpreadsheetExamples/SpreadsheetActions/ExportActions.cs) ([ExportActions.vb](./VB/SpreadsheetExamples/SpreadsheetActions/ExportActions.vb))
- [FormattingActions.cs](./CS/SpreadsheetExamples/SpreadsheetActions/FormattingActions.cs) ([FormattingActions.vb](./VB/SpreadsheetExamples/SpreadsheetActions/FormattingActions.vb))
- [FormulaActions.cs](./CS/SpreadsheetExamples/SpreadsheetActions/FormulaActions.cs) ([FormulaActions.vb](./VB/SpreadsheetExamples/SpreadsheetActions/FormulaActions.vb))
- [ImportActions.cs](./CS/SpreadsheetExamples/SpreadsheetActions/ImportActions.cs) ([ImportActions.vb](./VB/SpreadsheetExamples/SpreadsheetActions/ImportActions.vb))
- [PrintingActions.cs](./CS/SpreadsheetExamples/SpreadsheetActions/PrintingActions.cs) ([PrintingActions.vb](./VB/SpreadsheetExamples/SpreadsheetActions/PrintingActions.vb))
- [RowAndColumnActions.cs](./CS/SpreadsheetExamples/SpreadsheetActions/RowAndColumnActions.cs) ([RowAndColumnActions.vb](./VB/SpreadsheetExamples/SpreadsheetActions/RowAndColumnActions.vb))
- [WorksheetActions.cs](./CS/SpreadsheetExamples/SpreadsheetActions/WorksheetActions.cs) ([WorksheetActions.vb](./VB/SpreadsheetExamples/SpreadsheetActions/WorksheetActions.vb))

<!-- default file list end -->
# Spreadsheet Document API


<p>This example demonstrates how to use the Spreadsheet Document API to programmatically manage spreadsheet documents, without the need for Microsoft Excel to be installed.</p>
<p>In particular, this sample introduces API properties and methods used to perform the following operations:</p>
<p>- Manage worksheets (activate, create, delete, rename, move, copy, show/hide worksheets, adjust worksheet view, etc.)</p>
<p>- Manipulate rows and columns (insert, delete, copy, show/hide, group rows and columns, adjust row height and column width, etc.)</p>
<p>- Manipulate cells and cell ranges (set cell values, add hyperlinks to cells, name, copy and merge cells)</p>
<p>- Create formulas (use various functions and cell references in formulas, name formulas and use names in formulas, create shared and array formulas, etc.)</p>
<p>- Format cells (create, modify and apply styles, set cell font, colors, alignment, borders, number format, etc.)</p>
<p>- Import data from different sources</p>
<p>- Export the workbook to PDF</p>
<p>- Print the workbook</p>
<p>For more information, review the <a href="https://documentation.devexpress.com/OfficeFileAPI/12074/Spreadsheet-Document-API/Examples"><u>Examples</u></a> section in the documentation.<br><br>The<strong> Universal Subscription</strong> or an additional <strong>Office File API Subscription</strong> is required to use this example in production code. Please refer to the <a href="https://www.devexpress.com/Buy/NET/">DevExpress Subscription</a> page for pricing information.</p>

<br/>
See also:
<br/>
<a href="https://github.com/DevExpress-Examples/spreadsheet-document-api-examples-part-2-t217615">Spreadsheet Document API - Part 2</a>
<br/>
<a href="https://github.com/DevExpress-Examples/spreadsheet-document-api-part-3">Spreadsheet Document API - Part 3</a>

## Documentation

- [Worksheets](https://docs.devexpress.com/OfficeFileAPI/14930/spreadsheet-document-api/examples/worksheets)
- [Rows and Columns](https://docs.devexpress.com/OfficeFileAPI/14938/spreadsheet-document-api/examples/rows-and-columns)
- [Cells](https://docs.devexpress.com/OfficeFileAPI/14944/spreadsheet-document-api/examples/cells)
- [Formulas](https://docs.devexpress.com/OfficeFileAPI/14928/spreadsheet-document-api/spreadsheet-formulas)
- [Cell Formatting](https://docs.devexpress.com/OfficeFileAPI/14915/spreadsheet-document-api/cell-basics/formatting-cells)
- [Import and Export Data](https://docs.devexpress.com/OfficeFileAPI/118182/spreadsheet-document-api/examples/import-and-export-data)
- [Printing](https://docs.devexpress.com/OfficeFileAPI/15532/spreadsheet-document-api/examples/printing)
- [Specify Document Properties](https://docs.devexpress.com/OfficeFileAPI/117097/spreadsheet-document-api/examples/workbooks/how-to-specify-document-properties)

## More Examples

- [Spreadsheet Document API - Part 2](https://github.com/DevExpress-Examples/spreadsheet-document-api-examples-part-2-t217615)
- [Spreadsheet Document API - Part 3](https://github.com/DevExpress-Examples/spreadsheet-document-api-part-3)
Binary file added images/spreadsheet-document-api-part-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.