Re: [Lazarus] Interact with M$ Word

2009-01-31 Thread Thierry Coq
I agree with Phil. Automation is completely independent of the language.

There are currently three solutions to do what you want, in FPC/Lazarus.
a - wait for the next full version of FPC. Automation is scheduled to be 
included. COM is already available.
b - based on the COM layer, build a Word Interface unit to insert your 
data into the word tables.
c - use Excel as an intermediate. Generate your tables there, and ask 
your user or do a little VB code to load the Excel tables into the Word 
document.

As a help, I am doing a port of Excel Automation of which a very 
preliminary version is available here:
http://tcoq.free.fr/composants.html.
It uses the COM layer to provide an easier access to Excel Automation, 
from FPC/Lazarus.
You can use it either as an example to do the b) option, or as a means 
to do c) option.

Good luck,
Thierry

Mac Programmer wrote:
 Automation has nothing to do with VBA. That's the whole point of 
 Automation, that it's language independent.

 As Felipe rightly points out, many Laz users could profit from a 
 library for creating office documents. Ideally it would have 3 notable 
 characteristics:

 (1) Can create any type of office document programmatically without a 
 particular office app or version being present. For word processing 
 documents, RTF is perfect since it's a text format that is well 
 supported by all word processors. FPC includes a unit for working with 
 RTF documents. I created a thin wrapper for it that allows you to 
 create RTF documents:

 http://wiki.lazarus.freepascal.org/XDev_Toolkit

 (2) Can manipulate the resulting RTF file with the office app. On 
 Windows, Automation works great for that purpose. Your only real 
 challenges here are: (a) Figuring out a way to mark the place in the 
 document where the table should be inserted. You can do this in a 
 number of ways, for example if your app or your users create documents 
 based on a template that you provide, you could insert a hidden 
 bookmark in the template and look for this in the document's Fields 
 collection via Automation. (b) FPC 2.2.2 does not fully support 
 Automation yet, it appears.

 You can insert text into a Word document from the clipboard via 
 Automation with something like this:

 worddoc.ActiveWindow.Selection.Paste;

 To insert an RTF file into the document:

 worddoc.ActiveWindow.Selection.InsertFile(rtffilename, 
 ConfirmConversions:=False); 

 (3) Can do (2) across a variety of word processors in a 
 cross-platform, cross-app way. This includes Word, OO and Apple's 
 Pages. On Windows you can use Automation to manipulate both Word and 
 OO. On OS X you can use AppleScript to manipulate word processors that 
 include a dictionary of classes:

 http://wiki.lazarus.freepascal.org/Multiplatform_Programming_Guide#Making_do_without_Windows_COM_Automation

 Thanks.

 -Phil

 

 ___
 Lazarus mailing list
 Lazarus@lazarus.freepascal.org
 http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
   

___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Interact with M$ Word

2009-01-31 Thread Bart
Thanks all for your suggestions, I'll look int it.

Bart
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Loading icon from Application.Icon

2009-01-31 Thread Guionardo Furlan
Hello lazarentos,

I've an TTrayIcon instance and need to use the same icon defined in
the Application.Icon.
I've tried:
* TrayIcon.Assign(Application.Icon)
* TrayIcon.LoadFromResourceName(HInstance, 'trayicon'); // Included an
resource file with the icon i want

Both don't worked. No errors, but the TrayIcon.icon is empty.

* TrayIcon.LoadFromFile('icon.ico');

This worked. But I don't want to send an icon file with the installation.

Any sugestion?

Thank's for any help.

-- 
Timeo hominem unius libri
Cogito ergo sum - Carpe diem

[]s
Guionardo Furlan
http://guionardo.blogspot.com
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Interact with M$ Word

2009-01-31 Thread Mac Programmer

Bart,

If you want to see some info on how this sort of Automation document  
manipulation is used with actual production software, grab the  
SmartDoc.doc document that's pointed to by the Creating a 'Smart'  
Document link on this page:


http://www.agry.purdue.edu/mmp/MmpDocs.htm

This document covers template and field basics. Note that a template  
file (.dot) can go anywhere, for example in the same folder as your  
app. If you want your users to select your template in Word's File |  
New, then it should go somewhere that Word can find it, like under C: 
\Program Files\Microsoft Office\Templates\1033. If you're creating a  
document programmatically, it doesn't have to go there, though.


Thanks.

-Phil


___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Loading icon from Application.Icon

2009-01-31 Thread Felipe Monteiro de Carvalho
Which operating system, fpc and lazarus versions?

Does the example application work for you? It's in examples/trayicon
and it loads the icon from the LFM (inside the executable)

-- 
Felipe Monteiro de Carvalho
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus