Hi,
I'm trying to update input fields in a writer document using C#. I'm
planning on using the hint property when the field is created to
indicate that this is a field that needs updating. (I tried using user
variables, but they are removed when the document is converted to MS
Word format, which is no good for me). I can iterate through the fields
using the following code, but can't seem to get at the Hint property.
Input fields do not seem to be exposed in the API. How can I do this?
TIA,
Adam
XComponent xComponent = componentLoader.loadComponentFromURL(
PathConverter("C:\\dev\\ootest3.doc"),
"_blank", 0, //into a blank frame use no searchflag
args
);
XEnumeration enumFields = ((XTextFieldsSupplier)
xComponent).getTextFields().createEnumeration();
while (enumFields.hasMoreElements()) {
Any field = enumFields.nextElement();
XTextField xtf = (XTextField) field.Value;
System.Console.WriteLine("TextField Type: " +
xtf.getPresentation(true) + " text: " +
xtf.getPresentation(false) +
"\r\n");
if
(((XServiceInfo)xtf).supportsService("com.sun.star.text.TextField.Input")) {
Any[] inParams = new Any[0];
Any[] outParams;
short[] outIndices;
//need to get at the input field hint here..how?
// XComponentContext xcc = (XComponentContext) xtf;
// outIndices[0] = 0;
// object hint = xtf.GetType().InvokeMember("Hint",
BindingFlags.InvokeMethod, null, xComponent, new object[] {});
// Any retVal = ((XInvocation) xtf).invoke("Hint",
inParams, out outIndices, out outParams);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]