lYY Newbie

Joined: 31 Oct 2007 Posts: 1
|
Posted: Wed Oct 31, 2007 10:43 pm Post subject: CPP Builder + OOWriter, Find & Replace |
|
|
Greetings, your help is necessary to me
Code:
| Code: |
Variant ServiceManager, Desktop, Document, EmptyParam;
int OpenBounds[2] = {0,-1};
AnsiString NameFile = ExtractFilePath(Application->ExeName) + "blank.doc";
ServiceManager = Variant::CreateObject("com.sun.star.ServiceManager");
Desktop = ServiceManager.OleFunction("createInstance", "com.sun.star.frame.Desktop");
EmptyParam = VarArrayCreate(OpenBounds, 1, varVariant);
Document = Desktop.OleFunction("LoadComponentFromURL", convertToURL(NameFile), "_blank", 0, EmptyParam );
// найти и заменить
Variant MyStruct = ServiceManager.OleFunction("Bridge_GetStruct", "com.sun.star.beans.PropertyValue");
MyStruct.OlePropertySet("name", "SearchItem.StyleFamily");
MyStruct.OlePropertySet("value", 2);
MyStruct.OlePropertySet("name", "SearchItem.CellType");
MyStruct.OlePropertySet("value", 0);
MyStruct.OlePropertySet("name", "SearchItem.RowDirection");
MyStruct.OlePropertySet("value", true);
MyStruct.OlePropertySet("name", "SearchItem.AllTables");
MyStruct.OlePropertySet("value", false);
MyStruct.OlePropertySet("name", "SearchItem.Backward");
MyStruct.OlePropertySet("value", false);
MyStruct.OlePropertySet("name", "SearchItem.Pattern");
MyStruct.OlePropertySet("value", false);
MyStruct.OlePropertySet("name", "SearchItem.Content");
MyStruct.OlePropertySet("value", false);
MyStruct.OlePropertySet("name", "SearchItem.AsianOptions");
MyStruct.OlePropertySet("value", false);
MyStruct.OlePropertySet("name", "SearchItem.AlgorithmType");
MyStruct.OlePropertySet("value", 0);
MyStruct.OlePropertySet("name", "SearchItem.SearchFlags");
MyStruct.OlePropertySet("value", 65536);
MyStruct.OlePropertySet("name", "SearchItem.SearchString");
MyStruct.OlePropertySet("value", "sName");
MyStruct.OlePropertySet("name", "SearchItem.ReplaceString");
MyStruct.OlePropertySet("value", "xxx");
MyStruct.OlePropertySet("name", "SearchItem.Locale");
MyStruct.OlePropertySet("value", 255);
MyStruct.OlePropertySet("name", "SearchItem.ChangedChars");
MyStruct.OlePropertySet("value", 2);
MyStruct.OlePropertySet("name", "SearchItem.DeletedChars");
MyStruct.OlePropertySet("value", 2);
MyStruct.OlePropertySet("name", "SearchItem.InsertedChars");
MyStruct.OlePropertySet("value", 2);
MyStruct.OlePropertySet("name", "SearchItem.TransliterateFlags");
MyStruct.OlePropertySet("value", 1024);
MyStruct.OlePropertySet("name", "SearchItem.Command");
MyStruct.OlePropertySet("value", 3);
MyStruct.OlePropertySet("name", "Quiet");
MyStruct.OlePropertySet("value", true);
int Bounds[2] = {0,0};
Variant FindParam = VarArrayCreate(Bounds, 1, varVariant);
FindParam.PutElement(MyStruct, 0);
Variant Dispatcher, Frame, CurrentController;
CurrentController = Document.OleFunction("getCurrentController");
Frame = CurrentController.OleFunction("getFrame");
Dispatcher= ServiceManager.OleFunction("createInstance", "com.sun.star.frame.DispatchHelper");
Dispatcher.OleFunction("executeDispatch", Frame, ".uno:ExecuteSearch", 0, 0, FindParam);
|
Does not work, why?
During performance of a line
| Code: |
Dispatcher.OleFunction("executeDispatch", Frame, ".uno:ExecuteSearch", 0, 0, FindParam);
|
I receive a error message EOleSysError |
|