#!/usr/bin/perl # 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", "Title - Example 1"); # Title of document $doc->oooSet("subject", "Subject - Example 1"); # 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", "John Doe"); # 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; # Create the document and return a filename print "$filename\n"; exit;