Office Namespace Examples

Description

Name
Description
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.

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: 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.

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.

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: Multiple spreadsheets

This example creates a multiple spreadsheets in a single document:

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.

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.