ExcelExporter REALbasic Classes |
|
StyleGridExcelExporter.Export Method
Exports from the StyleGrid to a new Excel file. This is the quick way to export a single Grid to a single worksheet.
Export(
inGrid as StyleGrid,
destination as FolderItem)
Parameters
- inGrid
- The StyleGrid instance to export from.
- destination
- A FolderItem pointing to where the Excel document should be written.
Remarks
Example
Dim f as FolderItem
Dim exporter as StyleGridExcelExporter
Dim workbook as ExcelExporterWorkbook
f = GetSaveFolderItem("Excel","Test.xls")
if f <> nil then
exporter = new StyleGridExcelExporter()
workbook = exporter.Workbook
workbook.Author = "Bjorn Eiriksson"
workbook.LastAuthor = "Bjorn Eiriksson"
workbook.Company = "Einhugur Software"
workbook.CreatedDate = new Date()
exporter.ExportHeader = chkIncludeHeader.Value
workbook.Sheet(1).Name = "Sheet1"
workbook.Sheet(1).PageLayoutView = chkViewPageLayout.Value
// We define Column 1 to try to put the cells in numeric mode whenever possible
workbook.Sheet(1).Column(1).DefineNumeric()
exporter.Export(StyleGrid1,f)
end if
For learning purposes then the Export function does internally the same as the other and more flexible way does:
Sub Export(inGrid as StyleGrid,destination as FolderItem)
Dim worksheet as ExcelExporterSheet
worksheet = Workbook.Sheet(1)
if worksheet.Name = "" then
worksheet.Name = "Sheet 1"
end if
PopulateSheet(worksheet,inGrid)
Save(destination)
End Sub
See Also
StyleGridExcelExporter Class