Talk:Documentation/Calc Functions/DDE

More examples are needed
Please include more examples to answer other questions, such as:
 * is it possible to use to copy ranges from one sheet to another in the same Calc book?
 * is it possible to use relative paths, in case I want to use the same files (or same file, if I use the function within the same book) in two different computers?
 * what other servers are possible?

LobaLuna 2020-11-07T01:22:38 (UTC)

In response to comments from LobaLuna on 2020-11-07:
 * I have just tried to create a DDE link to a location within the same spreadsheet and it seemed to work okay. However, DDE is intended for interprocess communication, not for copying data within a spreadsheet. Data can be copied around within a spreadsheet file easily enough without involving a legacy technology like DDE. Therefore I do not feel it would be beneficial to include an example on this page to demonstrate this "feature".
 * Regarding relative paths, the answer is currently no. See https://bugs.documentfoundation.org/show_bug.cgi?id=47223 for more information.
 * The availability of other servers will depend on your computer system, its setup and its contents. Such a discussion is beyond the scope of this wiki page.

I am also preparing a list of detailed comments and suggestions about the material currently contained in this page - hopefully these will shed some more light on the function's behaviours. --Stevefanning (talk) 2020-12-08T23:14:02 (UTC)

SF Comments

 * (1) Summary. Suggest replacing with the following – “Creates a link to, and returns the contents of, an external data item, so that any change to that item is mirrored by the result. The function uses the Dynamic Data Exchange (DDE) protocol to share data.”.
 * (2) Arguments, Server. Suggest replacing second sentence with – “The server name for LibreOffice is “soffice”; other DDE servers may be present on your system (for example, "excel" for Microsoft Excel and "winword" for Microsoft Word), but these are beyond the scope of this wiki page.”.
 * (3) Arguments, File. Suggest adding “This argument is called “topic” in the ODF.”.
 * (4) Arguments, Range. Update to reflect that it is either a string or a reference to a cell containing that string. Also mention that it is referred to as “item” in the ODF. Suggest changing the second sentence to the following – “For example, this may be a named area or a reference to a range of cells for a Calc spreadsheet, or the name of a section or bookmark for a Writer document.”
 * (5) Arguments, Mode. Update to reflect that it is either a number or a reference to a cell containing that number.
 * (6) Arguments, 3rd bullet. Change “either” to “any of” (either is used when referring to a choice between two options). Change “is” to “are”. Delete “value”. Insert “the” after “returns”.
 * (7) Arguments, new bullet. If you open a Calc spreadsheet containing a DDE function call and Calc cannot access the linked file, then a warning is displayed to explain which external file could not be loaded. Data linked from this file is not updated.
 * (8) Arguments, new bullet. If you open a Calc spreadsheet containing a DDE function call and Calc cannot find the linked item within the linked file, then a warning is displayed identifying the item that cannot be found. The relevant data is not updated.
 * (9) Additional details, existing bullet. Please delete first sentence.
 * (10) Additional details. Please insert - “DDE stands for "Dynamic Data Exchange", which is a predecessor of OLE, "Object Linking and Embedding". With DDE, objects are linked through file reference, but not embedded.”. Also, add a sentence that includes a link to the Wikipedia page entitled “Dynamic Data Exchange”. Also, add a note (pin) saying that Calc provides alternative ways to link to external data.
 * (11) Additional details. Please insert – “The LibreOffice DDE server is called soffice and it enables data to be shared between Writer and Calc files. However more generally, the DDE function is non-portable because it depends on the availability of external DDE servers and their interpretation of the File and Range parameters. If you open a Calc spreadsheet containing calls to the DDE function in Microsoft Excel, the DDE function calls will be replaced by static data because Excel does not provide an equivalent function.”
 * (12) Additional details. Please insert – “When you open a Calc spreadsheet that contains DDE links, you may be warned that automatic update of external links has been disabled. Press the Allow updating button to enable the links”.
 * (13) Additional details. Please insert – “The command Edit > Links to External files in the Menu bar lists DDE links, and allows them to be modified, manually updated or broken. When a DDE link is initially created, the Update setting on the Edit Links dialog defaults to Automatic. This setting means that if you have both files open and you make a change to the linked data, that change will be reflected automatically in the file containing the DDE function call, without any further interaction. For an individual DDE link, you can change the Update setting on the Edit Links dialog to Manual. With this setting, any changes to the linked data will not be reflected in the file containing the DDE function call until you manually update the link.”
 * (14) Additional details. Please insert – “The DDE function is especially powerful when entered as an array formula. To create an array formula, type the formula in the Input line in the upper part of the Calc window and on completion press Shift+Control+Enter rather than the more usual Enter. Alternatively, use the Function Wizard to construct the call to the DDE function and tick the Array toggle button before pressing OK. If you click on a cell that contains an array formula and view the formula in the Input line, then the content of that cell will be surrounded by curly brackets, for example {=DDE("soffice","C:\My Files\league tables.ods","Division1")}. It is not possible to create an array formula by simply typing the curly brackets around a non-array formula.

An example of using DDE in an array formula might arise when a DDE link is to be created so that a section of text in a Writer document (comprising multiple paragraphs) can be copied into a Calc spreadsheet. You might enter a non-array formula such as =DDE("soffice","C:\report.odt","Introduction") to create this link and import text from the Writer section named “Introduction” located in the file “C:\report.odt”. However, this formula will only provide the first paragraph of the section; to include all paragraphs of the section, enter the DDE link as an array formula. It should be noted that once you have created the DDE link using an array formula, the maximum number of paragraphs is limited to the number returned initially. Additional paragraphs added to the end of the section in the Writer document will not appear in the Calc spreadsheet. Similarly, if you use an array formula to create a DDE link to a table in a Writer file, then the maximum dimensions of the table in the Calc spreadsheet would be limited to its original size.”.
 * (15) Additional details. When the above comments have been implemented, please re-read the section to make sure it flows well.
 * (16) Examples, general. Given the context of this page, I think that all mentions of “LibreOffice” can be removed from the Descriptions.
 * (17) Examples, general. Please review all comments above to determine whether, in the light of the new information, any extra examples are warranted. Certainly, I think it would be worth giving examples of DDE links created from array formulas to access a multi-paragraph Word section and a multi-row, multi-column Word table. Also, it would be worth including examples to demonstrate the effects of the various values of the Mode argument.
 * (18) Equivalent Excel functions. Please change “DDE” to “None”.

--Stevefanning (talk) 2020-12-09T11:53:41 (UTC)

Thank you very much, Steve! This is truly enlightening. All you explanations were very much needed to understand this kind of obscure function. LobaLuna (talk) 2022-03-05T23:50:20 (UTC)