Thank you very much for the fast answer Juergen ... I already used the Uno Api and it worked perfectly =)...
I posted the thread because i found it as an example and i wanted to test it.. I could not make it work that is why i was looking for an answer... Thanks a lot.. Juergen Schmidt-3 wrote: > > why not using the UNO API instead of the dispatch API. Well it is also > an UNO API but i would recommend that you use it with the normal API for > text fields. The SDK should provide an example and in the DevGuide > (http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Text/Text_Fields) > > you read about the different available field types and concepts. > > Juergen > > [EMAIL PROTECTED] wrote: >> Hello, >> >> I am trying to insert through java code a userfield in the List of fields >> (Insert->Fields->Other->Variables(tab)->Userfield) but i get all the time >> when i run the program Date(Fixed) >> The code i am using is the following >> >> ///////////////////////////////////////////////// >> PropertyValue[] properties = new PropertyValue[6]; >> >> properties[0] = new PropertyValue(); >> properties[0].Name = "Type"; >> properties[0].Value = "20"; >> properties[1] = new PropertyValue(); >> properties[1].Name = "SubType"; >> properties[1].Value = "1"; >> properties[2] = new PropertyValue(); >> properties[2].Name = "Name"; >> properties[2].Value = "someName"; >> properties[3] = new PropertyValue(); >> properties[3].Name = "Content"; >> properties[3].Value = "someValue"; >> properties[4] = new PropertyValue(); >> properties[4].Name = "Seperator"; >> properties[4].Value = " "; >> properties[5] = new PropertyValue(); >> properties[5].Name = "Format"; >> properties[5].Value = "-1"; >> >> XModel xModel = (XModel)UnoRuntime.queryInterface(XModel.class, >> this.xComponent); >> XController xController = xModel.getCurrentController(); >> XDispatchProvider xDispatchProvider = >> (XDispatchProvider)UnoRuntime.queryInterface(XDispatchProvider.class, >> xController.getFrame()); >> XMultiServiceFactory xMultiServiceManager = >> (XMultiServiceFactory) >> UnoRuntime.queryInterface(XMultiServiceFactory.class, >> mxRemoteContext.getServiceManager()); >> Object oDispatchHelper = null; >> try{ >> oDispatchHelper = xMultiServiceManager.createInstance( >> "com.sun.star.frame.DispatchHelper"); >> } catch(com.sun.star.uno.Exception e) { >> if (debug > 0) System.out.println("Can't get the Dispatch Handler >> Object..."); >> if (debug > 1) System.out.println(e); >> } >> XDispatchHelper xDispatchHelper = (XDispatchHelper) >> UnoRuntime.queryInterface(XDispatchHelper.class,oDispatchHelper); >> // Executing the commandURL >> xDispatchHelper.executeDispatch(xDispatchProvider, >> ".uno:InsertField", >> "", 0, properties); >> >> >> >> ////////////////////////////////////////////////////////////////////////////// >> >> Is there something wrong with it? >> >> For the propertyValues i recorded the actions i wanted to produce and >> from >> there i have taken the values for the Type and Subtype... Is there >> somewhere >> all these values listed so i don't need to record??? >> >> Many thanks in advance.. >> Ciao >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/problem-with-.uno%3AInsertField-...-it-creates-Date%28fixed%29-tp20657945p20675714.html Sent from the openoffice - api dev mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]