OpenOffice.org

来源:互联网 发布:lol mac美服鼠标乱动 编辑:程序博客网 时间:2024/04/29 02:50

http://hi.baidu.com/%E3%C6%CE%C4%B7%E5/blog/item/638576affd46defdfbed50b3.html

OpenOffice.org API介绍(一)

 

http://www.vbafan.com/2009/08/14/learn-oos-macro-ide-window/

OpenOffice.org宏学习笔记

 

http://blog.csdn.net/mrdangdong/archive/2009/01/08/3732485.aspx

让Java与OpenOffice调情

 

http://frankie.cnblogs.com/

OOo on ready—C#篇

 

using System;
using System.Collections.Generic;
using System.Text;
using unoidl.com.sun.star.lang;
using unoidl.com.sun.star.uno;
using unoidl.com.sun.star.bridge;
using unoidl.com.sun.star.frame;

using unoidl.com.sun.star.beans;
using unoidl.com.sun.star.sheet;
using unoidl.com.sun.star.table;


namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            unoidl.com.sun.star.uno.XComponentContext m_xContext;
            unoidl.com.sun.star.lang.XMultiServiceFactory mxMSFactory;
            unoidl.com.sun.star.sheet.XSpreadsheetDocument mxDocument;
            unoidl.com.sun.star.container.XIndexAccess xSheetsIA;
            unoidl.com.sun.star.sheet.XSpreadsheets xSheets;
            unoidl.com.sun.star.sheet.XSpreadsheet xSheet;
            unoidl.com.sun.star.table.XCell xCell;

            try
   {
    // get the remote office component context
     m_xContext = uno.util.Bootstrap.bootstrap();
    Console.WriteLine("Connected to a running office ...");
    mxMSFactory = (XMultiServiceFactory) m_xContext.getServiceManager();
    String available = (mxMSFactory != null ? "available" : "not available");
    Console.WriteLine( "remote ServiceManager is " + available );

                //myFileProp(0) = new unoidl.com.sun.star.beans.PropertyValue[0];
                //myFileProp.Name="Hidden";
                //myFileProp.Value =true  ;
                unoidl.com.sun.star.beans.PropertyValue[] myArgs=new unoidl.com.sun.star.beans.PropertyValue[3];
                myArgs[0] = new unoidl.com.sun.star.beans.PropertyValue();
                myArgs[0].Name = "Hidden";
                myArgs[0].Value = new uno.Any(true);

    XComponentLoader aLoader =(XComponentLoader) mxMSFactory.createInstance("com.sun.star.frame.Desktop" );
                XComponent xComponent = aLoader.loadComponentFromURL("file:///C:/x.ods",
                                                                    "_hidden",
                                                                    0,
                                                                    myArgs);
                                                     //new unoidl.com.sun.star.beans.PropertyValue[0]);
    mxDocument =(unoidl.com.sun.star.sheet.XSpreadsheetDocument) xComponent;
    xSheets = mxDocument.getSheets();       
    xSheetsIA =(unoidl.com.sun.star.container.XIndexAccess) xSheets;       
    //xSheet =(unoidl.com.sun.star.sheet.XSpreadsheet) xSheetsIA.getByIndex( 1 ).Value;

                //xSheets.insertByName("Project", new uno.Any("Project"));
                xSheet = (unoidl.com.sun.star.sheet.XSpreadsheet)xSheets.getByName("Project").Value;

    xCell = xSheet.getCellByPosition( 0, 1 );
    Console.WriteLine("Cell value   = '" +xCell.getValue() + "'");
                Console.WriteLine("Cell Type1   = '" +xCell.getType() + "'");
    Console.WriteLine("Cell Type2   = '" +xCell.GetType() + "'");
    Console.WriteLine("Cell Formula = '" +xCell.getFormula() + "'");
    Console.WriteLine("Cell Error   = '" +xCell.getError() + "'");
    xCell.setValue(999999);
    Console.WriteLine("Cell value   = '" +xCell.getValue() + "'");
    Console.WriteLine("Cell Type1   = '" +xCell.getType() + "'");
    Console.WriteLine("Cell Type2   = '" +xCell.GetType() + "'");
    Console.WriteLine("Cell Formula = '" +xCell.getFormula() + "'");
    Console.WriteLine("Cell Error   = '" +xCell.getError() + "'");

    //xSheets.insertNewByName("NewTabCDI", 0);
    //xSheets.moveByName("NewTabCDI", 2);


    Console.ReadLine();

    xComponent.dispose();

   }
            catch (System.Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
            Console.ReadLine();


        }
    }
}