BTW, when using the C# you can use the CLI-UNO bridge. Look here:
http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/ProUNO/CLI/CLI_Language_Binding

On cause of error is often a wrong formatted file URL. What is yours exactly?

Joachim


Radhika Godugu schrieb:
I am getting One Problem When I was trying to  Export the Spread Sheet Data
to open Office org 3.0,.My Code is shown below.





public void ExportSpreadDataToOpenoffice(FarPoint.Win.Spread.FpSpreadSpread,
string strTitle, long lngStartRow, long lngEndRow, long lngStartCol,
longlngEndCol)

        {



            //Create a new ServiceManager Type object

            Type tServiceManager = Type.GetTypeFromProgID(
"com.sun.star.ServiceManager", true);

            //Create a new ServiceManager Com object using our

            //ServiceManager type object

            object oServiceManager = System.Activator
.CreateInstance(tServiceManager);

            //Create our Desktop Com object

            object oDesktop = Invoke(oServiceManager, "createinstance",
BindingFlags.InvokeMethod, "com.sun.star.frame.Desktop");

            //Create an array for our load parameter

            Object[] arg = new Object[4];

            arg[0] = "private:factory/swriter";

            arg[1] = "_blank";

            arg[2] = 0;

            arg[3] = new Object[] { };

            //Create our new blank document

            object oComponent = Invoke(oDesktop, "loadComponentFromUrl",
BindingFlags.InvokeMethod, arg);

            //Create an empty array for the getText method



            arg = new Object[0];



            //Get our Text Com object

            Object oText = Invoke(oComponent, "getText",
BindingFlags.InvokeMethod,
arg);



            //Write the text to the document

            Invoke(oComponent, "getText", BindingFlags.InvokeMethod, new
Object[1] { "Hello I'm In Fisrt Application" });



            //Create an array for the storeToUrl method

            arg = new Object[2];

            arg[0] = PathConverter(FileName);

            arg[1] = new Object[0] { };

            //Save our document

            Invoke(oComponent, "storeToUrl", BindingFlags.InvokeMethod,
arg);

            //object oSheet = oComponent..getByIndex(0);

            Console.WriteLine("Our first document created via Reflection is
done!");

        }





The Error is “Exception has been thrown by the target of an invocation.”.

So Plz help me .



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org

Reply via email to