SpreadsheetGear Namespace > IWorkbook Interface > SaveAs Method : SaveAs(String,FileFormat) Method |
'Declaration
Overloads Sub SaveAs( _ ByVal filename As System.String, _ ByVal fileFormat As FileFormat _ )
'Usage
Dim instance As IWorkbook Dim filename As System.String Dim fileFormat As FileFormat instance.SaveAs(filename, fileFormat)
void SaveAs( System.string filename, FileFormat fileFormat )
procedure SaveAs( filename: System.String; fileFormat: FileFormat );
function SaveAs( filename : System.String, fileFormat : FileFormat );
void SaveAs( System.string* filename, FileFormat fileFormat )
void SaveAs( System.String^ filename, FileFormat fileFormat )
class Program { static void Main() { // Create a new empty workbook in a new workbook set. SpreadsheetGear.IWorkbook workbook = SpreadsheetGear.Factory.GetWorkbook(); // Set Sheet1!A1 to "Hello World!". workbook.Worksheets["Sheet1"].Cells["A1"].Value = "Hello World!"; // Save to C:\MyData.xls as Excel file. workbook.SaveAs(@"C:\MyData.xls", SpreadsheetGear.FileFormat.XLS97); // Open C:\MyData.xls. workbook = SpreadsheetGear.Factory.GetWorkbook(@"C:\MyData.xls"); // Output Sheet1!A1. System.Console.WriteLine(workbook.Worksheets["Sheet1"].Cells["A1"].Value.ToString()); } }
Module Program Sub Main() ' Create a new empty workbook in a new workbook set. Dim workbook As SpreadsheetGear.IWorkbook = SpreadsheetGear.Factory.GetWorkbook() ' Set Sheet1!A1 to "Hello World!". workbook.Worksheets("Sheet1").Cells("A1").Value = "Hello World!" ' Save to C:\MyData.xls as Excel file. workbook.SaveAs("C:\\MyData.xls", SpreadsheetGear.FileFormat.XLS97) ' Open C:\MyData.xls. workbook = SpreadsheetGear.Factory.GetWorkbook("C:\\MyData.xls") ' Output Sheet1!A1. System.Console.WriteLine(workbook.Worksheets("Sheet1").Cells("A1").Value.ToString()) End Sub End Module
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2