|
Forum Statistics |
Total user: 89 Total message: 179
|
|
|
|
|
|
|
Bug with Writer User Field replacement in C#
|
|
Date: 2008/07/11 22:22
|
By: Dave
|
Status: User
|
|
|
Karma: 0  
|
|
Fresh Boarder  | Posts: 1 |   | |
|
Hi,
I am very nearly there with a field replacement but I have a compile error.
I am converting some example Java code from the forum and wondered if there is anything obvious that I am doing wrong here....
I'm using the DLL's supplied with OpenOfficeLib.
| Code: |
using unoidl.com.sun.star.lang;
using unoidl.com.sun.star.uno;
using unoidl.com.sun.star.beans;
using unoidl.com.sun.star.bridge;
using unoidl.com.sun.star.frame;
using unoidl.com.sun.star.text;
using unoidl.com.sun.star.container;
...
XComponentContext localContext = uno.util.Bootstrap.bootstrap();
XMultiServiceFactory multiServiceFactory = (XMultiServiceFactory)localContext.getServiceManager();
XComponentLoader componentLoader = (XComponentLoader)multiServiceFactory.createInstance("com.sun.star.frame.Desktop");
// PathConverter swaps the slashes and makes a url.
string filename = Component.PathConverter(path);
// // Hide Open Office
// PropertyValue[] propertyValue = new PropertyValue[1];
// PropertyValue aProperty = new PropertyValue();
// aProperty.Name = "Hidden";
// aProperty.Value = new uno.Any(true);
// propertyValue[0] = aProperty;
PropertyValue[] propertyValue = new PropertyValue[0];
XComponent xComponent = componentLoader.loadComponentFromURL(filename, "_blank", 0, propertyValue);
// get XTextFieldsSupplier, XBookmarksSupplier interfaces
XTextFieldsSupplier xTextFieldsSupplier = (XTextFieldsSupplier)xComponent;
XNameAccess xNamedFieldMasters = xTextFieldsSupplier.getTextFieldMasters();
XEnumerationAccess xEnumeratedFields = xTextFieldsSupplier.getTextFields();
// Compile Error here.
// error CS0029: Cannot implicitly convert type 'uno.Any' to '
unoidl.com.sun.star.beans.XPropertySet'
XPropertySet propertySet = xNamedFieldMasters.getByName("com.sun.star.text.FieldMaster.User.Company");
|
error CS0029: Cannot implicitly convert type 'uno.Any' to 'unoidl.com.sun.star.beans.XPropertySet'
Any takers ?
Dave.
|
|
|
The administrator has disabled public write access. |
|
|
|
|
Who's Online |
|
We have 28 guests online |
|