openoffice 转化 文档至 pdf 执行失败
帮我看下下面这个程序, 关于 调用openoffice 将文档转化为 pdf的
namespace ConsoleApplication12
{
class Program
{
private static Mutex _openOfficeLock = new Mutex(false, "OpenOfficeMutexLock-MiloradCavic");
static void Main(string[] args)
{
bool obtained = _openOfficeLock.WaitOne(60 * 1000, false);
try
{
if (!obtained)
{
throw new
System.Exception(string.Format("Request for using OpenOffice wasn't served after {0} seconds. Aborting...", 30));
}
string filename =PathConverter("E:/test.doc");
PropertyValue[] propertyValues = new PropertyValue[1];
propertyValues[0] = new unoidl.com.sun.star.beans.PropertyValue();
propertyValues[0].Name = "Hidden";
propertyValues[0].Value = new uno.Any(true);
//我们打开并连接一个OOo程序,这需要创建一个XComponentContext对象:
XComponentContext xContext = uno.util.Bootstrap.bootstrap();
// 创建 xFactory
XMultiServiceFactory xFactory = (XMultiServiceFactory)xContext.getServiceManager();
//创建XComponentLoader对象:
XComponentLoader xLoader = (XComponentLoader)xFactory.createInstance("com.sun.star.frame.Desktop");
// 准备开始加载文档
// Preparing properties for loading the document