ExcelExporter REALbasic Classes

ExcelExporterWorkbook Class

A class that represents a Excel Workbook.

This class can be used with or without the StyleGridExcelExporter class.

Example of a export that does not come from a StyleGrid:
Dim f as FolderItem
Dim workbook as ExcelExporterWorkbook
Dim sheet as ExcelExporterSheet
Dim row as ExcelExporterRow
Dim i as Integer

f = GetSaveFolderItem("Excel","Test.xls")

if f <> nil then
    workbook = new ExcelExporterWorkbook()
   
    workbook.Author = "Bjorn Eiriksson"
    workbook.LastAuthor = "Bjorn Eiriksson"
    workbook.Company = "Einhugur Software"
    workbook.CreatedDate = new Date()
   
    sheet = workbook.Sheet(1)
   
    sheet.Name = "Sheet1"
    sheet.PageLayoutView = chkViewPageLayout.Value
   
    // We define Column 1 to try to put the cells in numeric mode whenever possible
    sheet.Column(1).Width = 100
    sheet.Column(2).Width = 200
   
    for i = 1 to 15
      
       row = new ExcelExporterRow()
       row.AutoFitHeight = true
      
       row.Cell(1).Text = Str(i)
       row.Cell(1).DataType = ExcelExporterCell.DataTypeNumber
       row.Cell(2).Text = "Some text"
      
      
       // Color every other row
       if i mod 2 = 1 then
          row.Cell(1).Style.HasBackColor = true
          row.Cell(2).Style.HasBackColor = true
          row.Cell(1).Style.BackColor = &cFF0000 //&cEDEDED
          row.Cell(2).Style.BackColor = &cFF0000
       end if
      
       sheet.AppendRow(row)
    next
   
    row = new ExcelExporterRow()
    row.Height = 100
   
    row.Cell(1).Text = "Test"
    row.Cell(1).Style.VerticalAlignment = ExcelExporterStyle.VerticalAlignCenter
    row.Cell(2).Style.Rotate = 45
    row.Cell(2).Style.HorizontalAlignment = ExcelExporterStyle.HorizontalAlignCenter
    row.Cell(2).Style.VerticalAlignment = ExcelExporterStyle.VerticalAlignCenter
    row.Cell(2).Text = "Some rotated text"
   
    sheet.AppendRow(row)
   
   
    workbook.Save(f)
end if

Object
   ExcelExporterWorkbook

class ExcelExporterWorkbook

Constructors

ExcelExporterWorkbookThe default constructor.
ExcelExporterWorkbookConstructor that takes author, lastAuthor, company and createdDate.

Properties

AuthorSets the Author property of the workbook.
CompanySets the Company property of the workbook.
CreatedDateSets the CreatedDate property of the workbook.
LastAuthorSets the LastAuthor property of the workbook.

Methods

DefaultStyleReturns the default style of the workbook.
SaveSaves the workbook.
SheetReturns a sheet in the workbook at given index.
SheetCountReturns the number of sheets in the workbook.

Supported Platforms:

  • PPC - MacOS 9
  • Carbon - MacOS 9 and MacOS X (PEF)
  • MacOS X PPC - (Mach-O)
  • MacOS X Universal Binary (Mach-O)
  • Win32 - Windows
  • Linux x86