

using( var doc = Workbook.Load( "test.xlsx") ) // Loads an existing Workbook named “test.xlsx”. { var worksheet = doc.Worksheets[ 1 ]; // Gets the second worksheet. worksheet.Cells[ “A2” ].Value = 12; // Sets a value in “A2”. var stream = new MemoryStream(); doc.SaveAs( stream); // Saves the result in a stream. } var stream = new MemoryStream(); using( var doc = Workbook.Create( stream ) ) // Creates a workbook in a stream. { var worksheet = doc.Worksheets[ 1 ]; // Gets the second worksheet. worksheet.Cells[ “A2” ].Value = 12; // Sets a value in “A2”. worksheet.Columns[ 1 ].Cells[ 0 ].Formula = “=SUM(A1:A2)”; //Sets a formula in “B1”. doc.CalculateFormulas(); // Calculate the Value of “B1”, which contains a formula and for all other Worksheets containing cells with formulas. doc.Save(); // Saves the Workbook in the stream. }
System.Object
Xceed.Workbooks.NET.Workbook
| Name | Description | |
|---|---|---|
![]() | IsProtected | Gets if the Workbook is currently protected. The default value is false. |
![]() | Name | Gets the name of the Workbook. |
![]() | Protection | Gets the WorkbookProtection as a read-only object. |
![]() | Theme | Gets the Workbook's Theme. |
![]() | WorkbookViews | Gets the list of all the WorkbookViews. |
![]() | Worksheets | Gets the collection of Worksheet that is part of this Workbook. A Workbook always have at least one Worksheet. |
| Name | Description | |
|---|---|---|
![]() | CalculateFormulas | Starts the calculation process for all the Cells containing a formula and update their Value properties once the process is done. |
![]() | Clear | Clears specific elements in the Workbook. |
![]() ![]() | Create | Overloaded. Creates a new Workbook. |
![]() | Dispose | |
![]() ![]() | Load | Overloaded. Loads an existing Workbook. |
![]() | Protect | Protects a Workbook by enabling or disabling specific actions. This can be done with or without a password. |
![]() | ReplaceContent | Searches into the content of the Workbook and replaces all occurences of a specific value with a new value. |
![]() | ReplaceContents<TSearch,TNew> | Searches into the content of the Workbook and replaces all instances of the SearchValues with their corresponding NewValues. |
![]() | Save | Saves the Workbook. |
![]() | SaveAs | Overloaded. Saves the Workbook as a stream or as a new document. |
![]() | Unprotect | Removes the protection that was added on the Workbook. |
.NET: net5.0, net5.0-windows, net6.0, net6.0-macos, net6.0-windows, net7.0, net7.0-macos, net7.0-windows, net8.0, net8.0-browser, net8.0-macos, net8.0-windows, net9.0, net9.0-browser, net9.0-macos, net9.0-windows, net10.0, net10.0-browser, net10.0-macos, net10.0-windows.
.NET Framework: net40, net403, net45, net451, net452, net46, net461, net462, net463, net47, net471, net472, net48, net481.