Saving an Excel File

Introduction

To save the content of Aspose.Cells.GridDesktop control as an Excel file, Aspose.Cells.GridDesktop provides the following methods.

  1. Saving as a File
  2. Saving as a Stream

Saving File

Create a desktop application and add two buttons with a GridControl control to the form. Set the text properties of the buttons as Save as File and Save as Stream, respectively.

Saving as a File

Create the Click event of the Save as File button and paste the following code inside it.

Saving as a Stream

Sometimes it might be required by developers to save their grid contents to a stream (for example, a MemoryStream). To facilitate this task, the Aspose.Cells.GridDesktop control also supports saving grid data to a stream. Create the Click event of the Save as Stream button and paste the following code inside it.