Excel not only lets you load files from various formats but also allows you to save data to files with different formats such text, excel, XML or macro files. Let us discuss how you can save files to different formats using Excel.
You can use the Save method to save the file in various formats. The Save method provides the following overloads which lets you save an Excel file in different formats:
Overloads | Descriptions |
---|---|
Save(string fileName) | Saves the worksheet to a file. |
Save(string fileName, C1.C1Excel.FileFormat format) | Saves the worksheet to a file and lets you set the fillSheets parameter. |
Save(System.IO.Stream stream) | Saves the worksheet to a file and lets you set the fillSheets parameter. |
Save(System.IO.Stream stream, C1.C1Excel.FileFormat format) | Saves the worksheet to a file and lets you set the fillSheets and FileFormat parameters. |
To save a file in Excel, use the following code. In this example, we save the workbook to a file named "book".
C# |
Copy Code
|
---|---|
c1XLBook1.Save("book.xlsx");
|
Besides this, Excel enables you to save a specific sheet to csv file using SaveCsv method of the XLSheet class.