All I could find is a simple example and a manual in VB which is not the same objects as Delphi.
Edit: So there is no manual. Where could I find the code that translates the Delphi code to access the OLE calls?
In the current state, there is a guessing game with the Delphi as , how vb is translated to the Delhpi.
I doubt which exist such manual, the official source is the Microsoft Word Object Model Reference, The samples are in VB but you can easily translate to delphi. All these objects and properties are accesible via delphi or any language which supports COM.
Deborah Pate's website may be "old" (~ Delphi 5) but still has valuable advice and examples in Delphi: http://www.djpate.freeserve.co.uk/Automation.htm
The authoritative source is the Word Object Model Reference on MSDN. There is nothing better. It's not written using Delphi syntax but you just have to live with that.
Charlie Calvert's articles on the Embarcadero Developers Network are very good as well. The articles are not linked to each other, so all url's are shown below:
Delphi 3 - Delphi and Microsoft Office: Automating Excel and Word
by Charlie Calvert, pages 1 - 5:
http://edn.embarcadero.com/article/10126
http://edn.embarcadero.com/article/10127
http://edn.embarcadero.com/article/10128
http://edn.embarcadero.com/article/10129
http://edn.embarcadero.com/article/10130
Delphi and Word Part II by Charlie Calvert, pages 1 - 3
http://edn.embarcadero.com/article/10043
http://edn.embarcadero.com/article/10382
http://edn.embarcadero.com/article/10383
Related
We have large commercial app that we want to convert from Delphi 6 to 2010. Approx 10 3rd party component sets, all with source code... I have heard warnings about Unicode with 2010 - Does anyone have experience and or suggestions?
There are many resources available that you can read and that you will assist in the migration from Delphi 6 to Delphi 2009/2010 (Unicode).
You can use these articles as a guide.
Unicode Migration Statistics Tool (This utility will hopefully assist you in collecting useful statistics
on how hard (or not) it would be to migrate your older applications to
Unicode.)
Delphi 2009 and Unicode
Delphi 2009 strings explained by example
Upgrading a major project to Delphi 2009
Delphi and Unicode
Dr. Bob Delphi 2009 Unicode
Delphi 2009 - Unicode in Type Libraries
On Strings and Unicode in Delphi 2009
Delphi in a Unicode World Part I: What is Unicode, Why do you need it, and How do you work with it in Delphi?
Delphi in a Unicode World Part II: New RTL Features and Classes to Support Unicode
Delphi in a Unicode World Part III: Unicodifying Your Code
CodeRage 4 : Using Unicode and Other Encodings in your Programs
Bye.
You'll find some useful answers in these StackOverflow questions:
Move project from Delphi 3 to Delphi 2010
When and Why Should I Use TStringBuilder?
Convert function to delphi 2009/2010 (unicode)
Unicode problems with Delphi 2009 / 2010 and windows API calls
Also, for what it is worth, I purchased Marco Cantu's Delphi 2009 Handbook. It was all I needed to make a relatively smooth converstion from Delphi 4 to Delphi 2009 in only a few weeks.
I do, however, recommend that you ensure your 3rd party packages have a Delphi 2009 upgrade, or you may have some real difficulties. Converting your own code is one thing. Converting someone else's is another.
I use two 3rd party packages, both with source code. Both had upgrades available, and the developer of one of them wrote that he had a lot of trouble upgrading his very complex component to the Unicode of Delphi 2009. It took him a few months, but he completed it. And as a result, I had little trouble with my implementation of his component when I did my upgrade.
i've been in the same circumstance recently. you mostly need to pay attention to the "edges" of the app. INI files, file I/O, log files, etc. win API calls from delphi work since they've now connected the unicode API calls instead. check each 3rd party component set to make sure they're at least ready for Delphi 2009...better yet 2010. even my use of databases simply wasn't an issue...nearly everything worked right away. it just wasn't a big deal. anything that relies on the size of a character should be reviewed.
really the transition of most concern is 2007_or_earlier --> 2009_or_later.
there are plenty of discussions/blog entries about it. you could read, read, read...or you could get started & see what happens. (i did some of both). i'm sure there are "stack overflow" issues discussing your question. i'm not pretending to give a detailed description of what could happen.
it's simply not as scary as it sounds.
Approx 10 3rd party component sets, all with source code.
One thing I'd add is if the component doesn't support Delphi 2009/2010, don't try to upgrade it by hacking the code.
Following is what I posted on How do the new string types work in Delphi 2009/2010?:
See Delphi and Unicode, a white paper written by Marco Cantù and I guess
The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!), written by Joel.
One pitfall is that the default Win32 API call has been mapped to use the W (wide string) version instead of the A (ANSI) version, for example ShellExecuteA If your code is doing tricky pointer code assuming internal layout of AnsiString, it will break. A fallback is to substitute PChar with PAnsiChar, Char with AnsiChar, string with AnsiString, and append A at the end of Win32 API call for that portion of code. After the code actually compiles and runs normally, you could refactor your code to use string (UnicodeString).
I must add this article from Carey Jensen to others mentioned. It is labeled: "Delphi Unicode Migration for Mere Mortals: Stories and Advice from the Front Lines" (in english).
http://www.danysoft.com/free/delphiunicodemigration.pdf
As you can see in the title of it, you will find many experiences and hints and tips. I think it is the answer to your question. After carefully read it, you will sure knows what to do next. :)
Found in: http://www.danysoft.com/productos/migrar-aplicaciones-a-delphi-xe-o-cbuilder-xe.html
Another point to take care of, is the usage of Variant types with strings and the VarType function testing for strings: one needs to use varUString instead of varString.
Assuming AValue is of type Variant and has being assigned a Unicode string value, the following won't work:
if VarType(AValue) = varString then ...
and needs to be changed to
if VarType(AValue) = varUString then ...
We want to automate OpenOffice, When i search on internet couldnot find a end-to-end help for that and delphi examples are too less. Our intention is to insert document variables and replace the document variable with there values and copying paragraphs etc.
Can any one help me to find an end-to-end help or a pas file like word2000.pas where i can find all the word routines.
Thanks,
Basil
I do use OpenOffice-Automation with Delphi a lot and I think there is no "wrapper" with higher functionality for Delphi.
There is a Delphi OO Project on SourceForge with helpers and examples as a starting point: http://sourceforge.net/projects/ooomacros/files/Delphi%20OOo/Version%201.2/Delphi_OOo_v12en.zip/download
Then you have to study the UNO-API and use COM to call the UNO functions.
You can find a lot of updated information here:
https://www.freepascal.org/~michael/articles/openoffice1/openoffice.pdf
A customer would like it if a spellings checker is added to an existing Delphi application. The texts that need to be checked are in multiple memo fields and the language is Dutch, which tends to limit my options.
So, what are my options for adding a dutch spellings checker to a Delphi/WIN32 application?
(Preferably something not webbased because the client has no direct Internet connection.)It doesn't have to be free! The customer will pay if it's possible. :-)Addictive Software offers an option, but I prefer to have more alternatives.
I use Addict, lots of languages (including Dutch) and good support:
AddictiveSoftware.com
Addictive software, as mentioned above, is one of the main ones.
But the TRichView component includes parsers for several spell-checkers that work out with Delphi. Check out their list and links that include:
Addict 3 and 4 by Addictive Software (shareware VCL component)
HunSpell by László Németh (DLL, open source)
ExpressSpellChecker by Developer Express Inc. (commercial VCL component)
EDSSpell 7 by OneDomain (shareware VCL component)
ASpell by Kevin Atkinson (DLL, license: LGPL)
VSSpell 8.0 by ComponentOne LLC (shareware ActiveX, discontinued)
VSSpell 3.0 by Visual Components, Inc (shipped with some versions of Delphi, ActiveX)
LS Speller by Luzius Schneider (based on former work of Alexander Obukhov) (freeware, uses ISpell and MS Office spell checkers (via CSAPI)).
Polar SpellChecker Component by Polar (shareware ActiveX)
Jedi JVCL library has a JvSpellChecker component with a demo (in jvcl\examples\JvSpellChecker fodler)
Alternate option using MS Word:
Spell Checking from Delphi code using MS Word - Office Automation in Delphi
http://delphi.about.com/od/kbcontrolole/ss/word_automation.htm
Hunspell is a great spell-checker, used in OpenOffice, with up-to-date dictionnaries.
See the corresponding download at CodeCentral.
I've implemented a self-expanding version (i.e. the library and the dictionary files are extracted from the main Delphi exe resources on request), available as part of our SynProject FOSS application.
DevExpress Spell check is the best I have found so far, but it is not free.
http://www.devexpress.com/Products/VCL/ExSpellChecker/
in C# you can easily open an assembly (just another word from an EXE) and then get reflection information from that assembly. I've been looking for something similar for Delphi where I can write a Delphi program that can point to a Delphi EXE then get me reflection information. How can I archive this? Thanks
There are a handful of programs that can extract RTTI from Delphi programs and DLLs. It's not as rich as what's available for .NET, but it can be done to a limited degree. There's a lot more RTTI available in Delphi 2010 and later versions, but as far as I know there's no program out yet that can extract info from them.
I was at the conference where this system was formally announced, and a bunch of people asked how this would affect security. Barry Kelly, who created the new RTTI, said that there would not be enough metadata available to create a "Delphi Reflector".
Well, sad news is, you probably can't. You can easily view .NET assemblies because they a) are compiled to what is called intermediate language (thus you can even get the code back using the likes of Reflector etc.), and b) contain metadata. Delphi, on the other hand, compiles to native code that and produces regular PE files that do not include rich metadata like a .NET assembly.
Delphi just doesn't work that way.
There are tools that can assist in reversing (Delphi written) executables but it will never be easy and it requires good x86 assembly knowledge.
Some examples of such tools are:
IDA Pro and/or Hex Rays
DeDe
Interactive Delphi Reconstructor
PE Explorer
The resource sections of a Delphi Executable also reveals usefull info like the form and it's components.
See also Is there a program to decompile Delphi?
If you have Delphi2010+ you can load a bpl and then use the rich rtti over it lik. e you do with c# and a .net assembly. If you need to do this in a .exe AFAIK you can't.
TestComplete seems to identify most objects in a running Delphi executable. You can extract this information with a script. A demo can be downloaded from http://www.automatedqa.com/downloads/testcomplete
This is maybe not the type of application you want as it is big and made for GUI-testing, but yes it can identify the objects.
As mentioned Remko, IDR (Interactive Delphi Reconstructor) can extract all RTTI information (if program contains it!) for Delphi version from 2 to 2009. Version 2010 will be available later. Moreover IDR can use all information that it finds in program to create a lot of comments to disassemled program code (this is a first step of analyses). You can also look forms and easy go to event hadlers associated with controls.
I'm using delphi6, and it lacks the following abilities:
a library object,
a list object(looks like TList,TStringList is good enough?)
a algorithm library(like sort,)
template library like STL
dynamic language feature or GC.
and so on.
how can I find this things?
Try Jedi Code Library. There are good replacements for container classes and sorting algorithms. I don't think there is GC or STL-like library for Delphi 6.
Delphi 6 is behind the times, check Delphi 2009 or at least Turbo Delphi
There is DeCAL, which claims to be similar to the STL. I've never really tested it, however.
There are many third party delphi libraries, components and source code examples on the net.
Just a couple off the top of my head
JEDI http://www.delphi-jedi.org/
and
a Delphi super page http://delphi.icm.edu.pl/
As an alternative to DeCAL (Which is a very good alternative to TList without generics), I will propose EZSDL by Julian M Bucknall.
List of main third party components compatible with Delphi 2007 for Win32 and RAD Studio 2007 by Andreano Lanusse at http://edn.embarcadero.com/article/37455
The first three are in the VCL, take a look in the help and the sources. Delphi 6 has no generics, so cannot be used with a template library. And no garbage collection.
If you want to program in Delphi, forget about them. If not, find another language.