You can download the example from: http://www.mitalteli.com/tmp/ootest_HelpNeededToDeleteLinksToOtherCalcDocuments-20081013.zip
2008/10/16 Ely Schoenfeld <[EMAIL PROTECTED]> > Now I get it. I have just discovered why nobody answers to my last few > mails. WRONG "FROM" ADDRESS! ha ha ha. > > This is "old", but I have just realized I sent it form the wrong email > address. > > This forwarded mail contains the answeres to the questions Andrew Douglas > Pitonyak sent me before (Oct 12, 2008 23:02), and an explanation on how to > reproduce the problem step by step. Also a little (24k) zip file with an > example and instructions. (Really easy to do) > > I just would like to add that I've already managed to delete the "Sheet > links". > Andrew: You where right, I had to use the setLinkMode() method. But in the > correct place. He he he. > > I plan to send the whole macro when its finished (in case someone else can > use it). > > My problem now is that the documentation doesn't say how to delete "left > out" DDE links. > > http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/DDE_Links > > Maybe someone has the sources installed, and maybe could take a look on how > the "break" (or whatever is called in the English version) button at Edit / > Links menu works > > Any help will be really appreciated. > > Ely. > > > ---------- Forwarded message ---------- > From: Ely Schoenfeld <xxxxxxxxxx> > Date: 2008/10/13 > Subject: Re: [users] Re: Macro to delete links to other documents > To: [email protected] > > > My answers appear bellow. > > 2008/10/12 Andrew Douglas Pitonyak <[EMAIL PROTECTED]> > > Ely Schoenfeld wrote: >> >>> First of all, thank you for taking the time to answer. >>> >>> My answers appear later on. >>> >>> 2008/10/11 Andrew Douglas Pitonyak <[EMAIL PROTECTED]> >>> >>> >>> >>>> Ely Schoenfeld wrote: >>>> >>>> >>>> >>>>> Sorry, I forgot to add the question: >>>>> >>>>> Does some one knows how to delete the links to other documents from a >>>>> macro/function/button? >>>>> >>>>> Ely. >>>>> >>>>> >>>>> >>>>> >>>> Do you mean in a Calc document? >>>> >>>> >>>> >>> >>> Yes, I'm talking about the whole calc document. >>> >>> >>> >>> >>>> Do you mean for a specific Sheet? >>>> >>>> >>> >>> >>> See previous answer. >>> >>> >>> >>> >>>> If you call getLinkUrl() on the sheet in question, does it return >>>> something? >>>> >>>> >>> >>> >>> Well, the first time it returned the current file url, I mean the file >>> where >>> the tests where done, instead of the "remote" file. Then I closed and >>> opened again the document and now it's returning just the path to "My >>> documents" (very strange) >>> >>> >>> >>> >>>> Better yet, if you call getLinkMode(), what value is returned? >>>> >>>> >>>> >>> >>> It returns 0 (com.sun.star.sheet.SheetLinkMode.NONE) >>> >>> >>> >>> >>>> What happens if you call >>>> oSheet.setLinkMode(com.sun.star.sheet.SheetLinkMode.NONE)? >>>> >>>> >>>> >>> >>> It just changes the result of getLinkMode(), nothing else. I think it >>> establishes the "mode" for future copy/paste procedures. (Am I right?) >>> >>> I present the functions I used at the end of this message, just in case >>> someone else needs them. >>> >>> While I was looking for a way to delete the links to other documents from >>> a >>> macro, I found someone who wants to do the same: "DDE Refresh and clean >>> up" >>> at >>> >>> http://user.services.openoffice.org/en/forum/viewtopic.php?f=20&t=4076&p=49673#p49673 >>> >>> Someone redirected him to "Programming actions, where macro recorder and >>> API >>> fail" at >>> >>> http://www.oooforum.org/forum/viewtopic.phtml?t=22845&postdays=0&postorder=asc&start=0 >>> >>> The author of the second thread says: >>> >>> ----- begin ------- >>> The following describes a procedure to circumvent this problem. The basic >>> steps are >>> >>> (1) Create a TopWindowListener >>> (2) execute the dispatch >>> (3) the dispatch opens a new top window >>> (4) the top window listener is called >>> (5) inside the top window listener, the accessibility interface is used >>> to >>> execute the desired user interactions >>> (6) inside the top window listener, the dispatch dialog's OK Button is >>> pressed to terminate the dispatch >>> (7) the TopWindowListener is removed >>> ------ end ------- >>> >>> That is a great thing to know. My problem is that I haven't been able to >>> understand the use of the api documentation enough, so I cant figure out >>> how to modify the examples presented there, to my benefit. >>> >>> >> >> Um, you don't understand this method for the same reason that even >> advanced macro programmers shutter when they think about using this method >> to control OOo. I would describe this method as: >> >> Write code that directly manipulates OOo's native Dialogs and controls. >> Doing this requires a lot of information about these dialogs that is not >> published anywhere. The discovery process is error prone and causes OOo to >> lock. >> > > Yes, I understood that much. :) > > >> >> In other words, this is not what you want to learn. This method is only to >> be used as a last resort if you must solve a problem for which there is no >> other solution. I consider this about the same as using OOo to write a >> document with detailed instructions written on a piece of paper because your >> computer has no monitor. >> > > Ha ha ha,,, a very good example... hahaha. > > >> >> It is better if you are able to learn the native API. Unfortunately, there >> are a few things that are not possible with the current API (such as >> obtaining a list of available printers). >> >> Based on your previous answers, I am pretty sure that I am not >> understanding what it is that you desire to do. In other words, you have not >> created a linked sheet, because clearly you do not have a linked sheet. Your >> usage of the word link, mislead me (so to speak) :-) >> >> Are you using external data links? I am not really sure what you are doing >> at this point.... >> > > When I "point to" data from other documents, changing things back and forth > over time, I get a lot of rows at menu "Edit/Links..." that are no longer > needed. > > What I want to accomplish is to press a button that copy the few (5) cells > with "foreign" data and paste them as text, and then delete all those links > at "Edit/Links..." > The first part because OO Calc becomes very slow with a bunch of open open > files that have references to each other, and the second part to keep things > clean and avoid the "update links" dialog that appears every time I open the > document > > I couldn't open the "mailing list guidelines" now so I don't know if I'm > permitted to add attachments, meanwhile I give this link to download a 3 > very small calc documents with an example and instructions.(A 24k zip file) > > > http://www.mitalteli.com/tmp/ootest_HelpNeededToDeleteLinksToOtherCalcDocuments-20081013.zip > > Thank you in advance. > > Ely. > > >> >> The examples contain: >>> >>> dispatcher.executeDispatch(oFrame, ".uno:InsertObject", "", 0, Array()) >>> or >>> dispatcher.executeDispatch(oFrame, ".uno:OptionsTreeDialog", "", 0, >>> Array()) >>> >>> >>> If I understand correctly, the "uno:InsertObject" and >>> "uno:OptionsTreeDialog" are the "names" of the objectes or windows to >>> interact with. Right? >>> How could I find the "name" of the "Modify links" window? (Menu Edit / >>> Links...) >>> >>> And that is just the beginning. >>> >>> >>> Thank you very, very much for your help. >>> >>> Ely. >>> >>> >>> >>> >>> >>>> -- >>>> Andrew Pitonyak >>>> My Macro Document: http://www.pitonyak.org/AndrewMacro.odt >>>> My Book: http://www.hentzenwerke.com/catalog/oome.htm >>>> Info: http://www.pitonyak.org/oo.php >>>> See Also: http://documentation.openoffice.org/HOW_TO/index.html >>>> >>>> >>>> --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>>> For additional commands, e-mail: [EMAIL PROTECTED] >>>> >>>> >>>> >>>> >>> >>> P.S. Here I put the functions I used for testing: >>> >>> Function fTestLinkMode >>> Dim oSheet as Object >>> oSheet = ThisComponent.Sheets.getByIndex(0) >>> fTestLinkMode = "=> " & oSheet.Name & " **LinkMode: " & >>> oSheet.getLinkMode() >>> End function >>> >>> Function fTestLinkUrl >>> Dim oSheet as Object >>> oSheet = ThisComponent.Sheets.getByIndex(0) >>> fTestLinkUrl = "=> " & oSheet.Name & " **LinkUrl: " & >>> oSheet.getLinkUrl() >>> End function >>> >>> Function fTestSetLinkMode(pMode) >>> Dim oSheet as Object >>> oSheet = ThisComponent.Sheets.getByIndex(0) >>> '#oSheet.setLinkMode(com.sun.star.sheet.SheetLinkMode.NONE) >>> oSheet.setLinkMode(pMode) >>> fTestSetLinkMode = "=> " & "done" >>> End function >>> >>> >>> >> >> -- >> Andrew Pitonyak >> My Macro Document: http://www.pitonyak.org/AndrewMacro.odt >> My Book: http://www.hentzenwerke.com/catalog/oome.htm >> Info: http://www.pitonyak.org/oo.php >> See Also: http://documentation.openoffice.org/HOW_TO/index.html >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > >
