Hi, |
Re: Find a word usind DXL script in the microsoft word document attached as OLE I have the exact same need as you, and previous posted here in the following thread. http://www.ibm.com/developerworks/forums/thread.jspa?threadID=313869&tstart=0 If the above link doesn't work, email me and I will send you a summary. I got some really useful replies, but didn't follow up due to lack of resources to work on it. I am not sure what the output of this search tool would be: would it output the Word paragraph that the string it was found in (ideally with the string highlighted), or just the module and object ID (and maybe number of hits). Let me know if you make any progress on this. Ken. |
Re: Find a word usind DXL script in the microsoft word document attached as OLE mcnairk - Tue Apr 26 10:47:50 EDT 2011 Thanks for your reply. I couldn't able to find any search tool which you mentioned in your reply. I am new to DXL. Please let me know step by step procedure to find a string in Word OLE object. Thanks You |
Re: Find a word usind DXL script in the microsoft word document attached as OLE Elamkumaran - Tue Apr 26 11:45:25 EDT 2011 Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |
Re: Find a word usind DXL script in the microsoft word document attached as OLE Elamkumaran - Tue Apr 26 11:45:25 EDT 2011 In document management systems, lots of content is OCRed (imported with optical character recognition). For each record, the image itself (or proprietary document) is stored plus some search meta-data is stored. If you add a text "Search Meta-Data" attribute to your DOORS module schema, you can store the "plain text" content of your OLE objects. This way search is fast and the user does not necessarily need Word to search. The user will need Word to open the OLE object to see inside. For OLE Word.Document you can store the "plain text" of the Word document. I'm talking about content that you would get if (from Word) you did from the menu File \ Save As With Save As Type = Plain Text (*.txt) For other OLE objects (e.g., pictures) you can store some useful search keywords so users can find a given picture. An example would be "ABC Company Organizational Chart". The "Search Meta-Data" attribute gets populated at insert or update time so search is fast. |
Re: Find a word usind DXL script in the microsoft word document attached as OLE SystemAdmin - Wed Apr 27 12:10:09 EDT 2011 |
Re: Find a word usind DXL script in the microsoft word document attached as OLE SystemAdmin - Wed Apr 27 12:10:09 EDT 2011 I cannot do it but surely someone here can export the embedded OLE to a temp text file, open the temp file and store in an attribute.
|
Re: Find a word usind DXL script in the microsoft word document attached as OLE llandale - Wed Apr 27 13:24:23 EDT 2011
I'd make the policy: If you insert an OLE Word.Document, you insert the plain text at that time. If you change the Word doc, you fix the Search Metadata as well. I suppose some exist already in DOORS. Just open them. Select All. Copy to clipboard. Save somewhere like a text editor (or notepad). Reselect and copy to clipboard. Paste into "Search Metadata" attribute. For automation you could paste clipboard into the "Search Metadata" attribute and then run a DXL script to remove OLE Rich Text and undo Rich Text formatting. You'll have to decide if the automation is worth it. If the word documents exist externally, there are loads of options to start Winword via batch and specify a macro to run to save a copy as a text file. Search the web for "word command line run macro" and you'll get lots of help. |
Re: Find a word usind DXL script in the microsoft word document attached as OLE SystemAdmin - Wed Apr 27 14:36:06 EDT 2011
If you really do only have OLEs that are word documents, the following function should work. I hacked it down from a more complex version. bool searchOleInObject(Object o, string sKeyword) { OleAutoObj objDoc = null, objApp = null, objSelection = null, objFind = null bool bIsStatic bool bFoundKeyword = false bool bIsActivated = false string sErr, sName if (containsStaticOle(o."Object Text")) return(bFoundKeyword) if (containsUnregisteredOle(o."Object Text")) return(bFoundKeyword) if (oleCount(o."Object Text") < 1) return(bFoundKeyword) bIsActivated = oleActivate(o) if (!bIsActivated) return(bFoundKeyword) objDoc = oleGetAutoObject(o) if (null(objDoc)) { oleDeactivate(o) return(bFoundKeyword) } oleGet(objDoc, "Application", objApp) if (null(objApp)) { if (!null(objDoc)) oleCloseAutoObject(objDoc) oleDeactivate(o) return(bFoundKeyword) } oleGet(objApp, "Name", sName) if (!matches("Word", sName)) { // not a word application, so close out and return oleDeactivate(o) return(bFoundKeyword) } oleGet(objApp, "Selection", objSelection) oleGet(objSelection, "Find", objFind) oleMethod(objFind, "ClearFormatting") olePut(objFind, "Text", sKeyword) olePut(objFind, "MatchWholeWord", true) olePut(objFind, "Format", false) oleMethod(objFind, "Execute") oleGet(objFind, "Found", bFoundKeyword) oleDeactivate(o) if (!null(objDoc)) oleCloseAutoObject(objDoc) if (!null(objApp)) oleCloseAutoObject(objApp) if (!null(objSelection)) oleCloseAutoObject(objSelection) if (!null(objFind)) oleCloseAutoObject(objFind) return(bFoundKeyword) }
|
Re: Find a word usind DXL script in the microsoft word document attached as OLE David_G_Bond - Wed Apr 27 15:12:50 EDT 2011
If you really do only have OLEs that are word documents, the following function should work. I hacked it down from a more complex version. bool searchOleInObject(Object o, string sKeyword) { OleAutoObj objDoc = null, objApp = null, objSelection = null, objFind = null bool bIsStatic bool bFoundKeyword = false bool bIsActivated = false string sErr, sName if (containsStaticOle(o."Object Text")) return(bFoundKeyword) if (containsUnregisteredOle(o."Object Text")) return(bFoundKeyword) if (oleCount(o."Object Text") < 1) return(bFoundKeyword) bIsActivated = oleActivate(o) if (!bIsActivated) return(bFoundKeyword) objDoc = oleGetAutoObject(o) if (null(objDoc)) { oleDeactivate(o) return(bFoundKeyword) } oleGet(objDoc, "Application", objApp) if (null(objApp)) { if (!null(objDoc)) oleCloseAutoObject(objDoc) oleDeactivate(o) return(bFoundKeyword) } oleGet(objApp, "Name", sName) if (!matches("Word", sName)) { // not a word application, so close out and return oleDeactivate(o) return(bFoundKeyword) } oleGet(objApp, "Selection", objSelection) oleGet(objSelection, "Find", objFind) oleMethod(objFind, "ClearFormatting") olePut(objFind, "Text", sKeyword) olePut(objFind, "MatchWholeWord", true) olePut(objFind, "Format", false) oleMethod(objFind, "Execute") oleGet(objFind, "Found", bFoundKeyword) oleDeactivate(o) if (!null(objDoc)) oleCloseAutoObject(objDoc) if (!null(objApp)) oleCloseAutoObject(objApp) if (!null(objSelection)) oleCloseAutoObject(objSelection) if (!null(objFind)) oleCloseAutoObject(objFind) return(bFoundKeyword) }
David_G_Bond. it is working... :) |
Re: Find a word usind DXL script in the microsoft word document attached as OLE Elamkumaran - Sun May 01 11:54:06 EDT 2011 Example: DOORS_OBJ_ID: OLE word table --> contains following words --> "Find Word1", "Find Word2", "Find Word3" --> in attribute column{Find Word1 Find Word3 } I want to search both Find Word1 and Find Word3 using one DXL script. If these words are found then both "Find Word1" and "Find Word3" should be pasted in attribute column. Please let me know what are the API calls i should use. Thanks Regards, Elam |
Re: Find a word usind DXL script in the microsoft word document attached as OLE |
Re: Find a word usind DXL script in the microsoft word document attached as OLE Elamkumaran - Wed May 04 08:26:28 EDT 2011
|
Re: Find a word usind DXL script in the microsoft word document attached as OLE David_G_Bond - Wed May 04 13:05:28 EDT 2011
ID || Object Text || Text type attribute ID_1 Text.... Text1, Text2 |
Re: Find a word usind DXL script in the microsoft word document attached as OLE Elamkumaran - Wed May 04 13:49:33 EDT 2011 ID || Object Text || Text type attribute ID_1 || Text.... || Text1, Text2 Text1 and Text2 in same object ID |
Re: Find a word usind DXL script in the microsoft word document attached as OLE Elamkumaran - Wed May 04 13:53:40 EDT 2011 ID_1 || Text.... || Text1, Text2 Text1 and Text2 in same object ID
|
Re: Find a word usind DXL script in the microsoft word document attached as OLE David_G_Bond - Thu May 05 14:28:17 EDT 2011
Batch run for update would be perhaps best, but I'd check the Last Modified Date of the object, and don't bother doing the Word update if the object hasn't changed since last update.
|
Re: Find a word usind DXL script in the microsoft word document attached as OLE David_G_Bond - Wed Apr 27 15:12:50 EDT 2011
If you really do only have OLEs that are word documents, the following function should work. I hacked it down from a more complex version. bool searchOleInObject(Object o, string sKeyword) { OleAutoObj objDoc = null, objApp = null, objSelection = null, objFind = null bool bIsStatic bool bFoundKeyword = false bool bIsActivated = false string sErr, sName if (containsStaticOle(o."Object Text")) return(bFoundKeyword) if (containsUnregisteredOle(o."Object Text")) return(bFoundKeyword) if (oleCount(o."Object Text") < 1) return(bFoundKeyword) bIsActivated = oleActivate(o) if (!bIsActivated) return(bFoundKeyword) objDoc = oleGetAutoObject(o) if (null(objDoc)) { oleDeactivate(o) return(bFoundKeyword) } oleGet(objDoc, "Application", objApp) if (null(objApp)) { if (!null(objDoc)) oleCloseAutoObject(objDoc) oleDeactivate(o) return(bFoundKeyword) } oleGet(objApp, "Name", sName) if (!matches("Word", sName)) { // not a word application, so close out and return oleDeactivate(o) return(bFoundKeyword) } oleGet(objApp, "Selection", objSelection) oleGet(objSelection, "Find", objFind) oleMethod(objFind, "ClearFormatting") olePut(objFind, "Text", sKeyword) olePut(objFind, "MatchWholeWord", true) olePut(objFind, "Format", false) oleMethod(objFind, "Execute") oleGet(objFind, "Found", bFoundKeyword) oleDeactivate(o) if (!null(objDoc)) oleCloseAutoObject(objDoc) if (!null(objApp)) oleCloseAutoObject(objApp) if (!null(objSelection)) oleCloseAutoObject(objSelection) if (!null(objFind)) oleCloseAutoObject(objFind) return(bFoundKeyword) }
|