Xbasic

Office Namespace

IN THIS PAGE

Description

Classes to read and write Excel documents and example Pages.

Name
Description
Generate Excel Spreadsheets Programmatically

The Office class can read and write Excel files. It doesn't require Microsoft Excel. Use it to

"Hello, World" Spreadsheet

Copy the code below into an Alpha Anywhere Xbasic script and run it. The code assumes that you have a version of Excel that can handle .XLSX files installed. If you have an older version of Excel, change ExcelDocument to Excel2003Document, and .xlsx to .xls. If you don't have Excel or a compatible spreadsheet program installed, remove the line that starts with sys_open.

Office Example: Multiple spreadsheets

This example creates a multiple spreadsheets in a single document:

Performing Common Excel Spreadsheet Operations

This page includes basic, intermediate, and advanced points on performing spreadsheet operations, from getting and setting simple values to adjusting printer properties.

Office Example: Spreadsheet from DBF tables

This example creates a workbook with three sheets from DBF tables using AlphaSports. After the spreadsheet is populated, it is opened in Microsoft Excel.

Office Example: Spreadsheet from SQL query

An example of a simple spreadsheet from a SQL Query using Alpha's Northwind.mdb.

Example: Spreadsheets from SQL schema

This example creates a multiple spreadsheets from the tables in a SQL::Schema. After the spreadsheet is populated, it is opened in Microsoft Excel.

Office Example: Spreadsheet with picture

This example creates a simple spreadsheet and adds a picture to the workbook, then sets the picture into a cell of the spreadsheet

Office Example: Update a spreadsheet

This example demonstrates opening an existing spreadsheet and updating one or more values. First, we generate the same spreadsheet as seen in the simple weekly sales sample. Then we open the spreadsheet and update the Sales and Expense columns.After the spreadsheet is updated, it is opened in Microsoft Excel.

Office Example: Simple Weekly sales spreadsheet

This example creates a simple spreadsheet with summarized sales and expense data for a single week. The spreadsheet is populated with a title, column headings, labels, and formulas to calculate the daily gross profit, summarize the weeks sales and expenses and the week's gross profit. After the spreadsheet is populated, it is opened in Microsoft Excel.

Classes

Name
Description
Office::ExcelDocument Class

The Office::ExcelDocument class is the parent class for creation and editing of Excel 2007 documents.

Office::Excel2003Document Class

The Office::Excel2003Document class is the parent class for creation and editing of Excel 2003 documents.

Office::Font Class

The Office::Font class contains properties for defining Fonts for formatting text in Excel spreadsheets.

Office::Format Class

The Office::Format class contains properties for formatting cells in Excel spreadsheets.

Office::Spreadsheet Class

The Office::Spreadsheet class creates and edits Excel spreadsheets. The spreadsheets can be attached to Office::ExcelDocument or Office::Excel2003Document instances.

Enumerations

The Office namespace uses several enumerations (integer values with symbolic names) to represent styles and properties, listed below.

Name
Description
Office::BorderDiagonal Enumeration

Available options for defining a diagonal border for an Office::Format.

Office::BorderStyle Enumeration

Defines the styles available when defining borders for an Office::Format.

Office::CellType Enumeration

Data types for a cell in an Office::Spreadsheet.

Office::Color Enumeration

Available colors for styling fonts, cells, etc in a document.

Office::ErrorType Enumeration

List of Office error types that can be set in Office::Spreadsheet cells.

Office::FillPattern Enumeration

Available fill patterns. Used with the Office::Format object.

Office::HorizontalAlignment Enumeration

Available horizontal alignment options for an Office::Format object.

Office::NumericFormat Enumeration

Numeric formatting options for cells containing numeric values.

Office::Paper Enumeration

Available paper sizes for an Excel document.

Office::Script Enumeration

Defines where the font is rendered relative to the normal line of type.

Office::Underline Enumeration

Options for defining the underline style for an Office::Font object.

Office::VerticalAlignment Enumeration

Options for specifying the vertical alignment of the contents for a cell in an Office::Spreadsheet.