#!/usr/bin/perl -I.
# calc-example1 - This program creates a SXC Calc file with 25 cells and a formula.

use ooolib;

# Set variables
$doc = new ooolib("sxc");
$doc->oooSet("builddir", ".");                   # Directory to create document in
$doc->oooSet("title", "Calc 25 Cells");          # Title of document
$doc->oooSet("subject", "Calc Example");         # Subject of document
$doc->oooSet("comments", "Who needs comments?"); # Comments for document
$doc->oooSet("keyword", "keyword1");             # Add a keyword for the document
$doc->oooSet("keyword", "keyword2");             # Add a keyword for the document
$doc->oooSet("author", "ooolib example");        # Set the author of the document

# User defined variables
$doc->oooSet("meta1-name", "Programmer");        # 1-4 user defined variables
$doc->oooSet("meta1-value", "Joseph Colton");    # 1-4 user defined variables

# Write the spreadsheet data
# It is in x, y cords.
for($x=1;$x<=5;$x++) {
    for($y=1;$y<=5;$y++) {
	$doc->oooSet("cell-loc", $x, $y);
	$doc->oooData("cell-float", $x*$y);
    }
}
$doc->oooSet("cell-loc", 1 ,6);
$doc->oooData("cell-formula", "=SUM(B2:C2)");

$filename = $doc->oooGenerate("calc-example1.sxc"); # Create the document and return a filename

exit;
