OpenOffice.org CODE
2009-12-04 09:04
295 查看
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();
}
}
}
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();
}
}
}
相关文章推荐
- OpenOffice.org Code Snippets--Working with a Presentation Document in C++
- OpenOffice.org Code Snippets--Accessing document properties
- OpenOffice.org Code Snippets--Get and modify the current selection in calc (in C++)
- 仿百度文库方案[openoffice.org 3+swftools+flexpaper](一) 之 tomcat6.0+jdk1.6环境配置
- 仿百度文库方案[openoffice.org 3+swftools+flexpaper](七) 之 使用iText将jpg、jpeg、png转换为pdf
- 如何把OpenOffice.org链接到MySQL?
- 将OpenOffice.org变成一个文档格式转换工具
- 安装openoffice.org
- [导入]用openoffice.org来修复因为excel2000的bug而导致无法打开的excel文档
- [导入]深入了解OpenOffice.org(三){作者:路广}
- OpenOffice.org简介
- 仿百度文库方案[openoffice.org 3+swftools+flexpaper](五) 之 转换pdf的同时,进一步转为swf
- Openoffice.org 的writer和calc ,已经可以满足我的工作需要
- (一)安装openoffice.org
- .Net框架下的OpenOffice.org应用(转)
- 仿百度文库方案[openoffice.org 3+swftools+flexpaper](四) 之 使用swftools将pdf转换为swf
- 仿百度文库方案[openoffice.org 3+swftools+flexpaper](五) 之 转换pdf的同时,进一步转为swf
- 深入了解OpenOffice.org(一)-- OpenOffice.org简介
- OpenOffice.org技术架构
- 使用OpenOffice .org(Portable)将WORD转换为PDF