Re: [perl-win32-gui] GUI and OLE Constants

2000-05-22 Thread Aldo Calpini

[EMAIL PROTECTED] wrote:
 Has anyone tried using the GUI module with imported
 OLE contants? I'm finding that if I try to use
 something like

  use Win32::GUI;
  use Win32::OLE::Const ('Microsoft Excel');

 some of my controls aren't defined.  I've only noticed
 it with RichEdit fields but it may affect other things
 as well.

there was a discussion about this on Perl-Win32-Users
some times ago; you can search for 'RichEdit' in the
mailing list archives. one workaround is to load the
OLE constants in an hash rather than in the main
namespace, something like:

use Win32::OLE::Const;
my $EX = Win32::OLE::Const-Load('Microsoft Excel');

print $EX-{xlMarkerStyleDot};

cheers,
Aldo







[perl-win32-gui] Retrieving value of an item in a ListView click

2000-05-22 Thread Jonathan Southwick

I want to get a value in a particular column when I click on the item in column 1.  
For instance:  I have a listview
with 6 columns.  This first column is of course holds the index value.  If I use:

sub DataView_ItemClick {
   my $index = shift;
}

then $index holds the value of the index of the item I clicked on.  What I want to do 
now is find out what values are in
each column of that particular index.

Am I making sense?  Is it at all possible?  I would appreciate any help on this.

Jonathan
--
Jonathan Southwick  [EMAIL PROTECTED]
Technical and Network Services
Allegheny College
Meadville, PA  16335 814-332-2755







Re: [perl-win32-gui] File conversion

2000-05-22 Thread Sudha Natarajan

No problem, I hope this is of some help to you.

Sudha

At 12:05 PM 5/18/00 -0700, you wrote:
Hi Sudha,

Thanks for the help and detailed information, now I can automate my program
to meet the whole reporting process.

Thanks again, Preethi


- Original Message -
From: "Sudha Natarajan" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, May 17, 2000 1:46 PM
Subject: [perl-win32-gui] File conversion


 Hi Preethi,

 I don't know if this is of any help to you. Just found this in the
 documentation.

 Regards
 Sudha


 How do I extract a series of cells from Microsoft Excel?
 If you have a sheet object you can extract the values of a series of cells
 through $Sheet-Range-{'Value'}, for example:

 my $array = $Sheet-Range("A8:B9")-{'Value'};

 Now $array[0][0] contains the value of cell A8, $array[0][1] the value of
 cell B8, $array[1][0] the value of cell A9 and $array[1][1] the value of
 cell B9.

 What is returned is an two-dimensional array (OK, an array with references
 to arrays) that contains the values of the requested cells.

 A complete example is here:



 use strict;
 use Win32::OLE qw(in with);
 use Win32::OLE::Const 'Microsoft Excel';
 $Win32::OLE::Warn = 3;# die on errors...
 my $Excel = Win32::OLE-GetActiveObject('Excel.Application')
 || Win32::OLE-new('Excel.Application', 'Quit');  # get already active
 Excel
   # application or
open
 new
 my $Book = $Excel-Workbooks-Open("C:\\DOCUMENTS\\test.xls"); # open
Excel
 file
 my $Sheet = $Book-Worksheets(1); # select worksheet
 number 1
 my $array = $Sheet-Range("A8:B9")-{'Value'};# get the contents
 $Book-Close;
 foreach my $ref_array (@$array) { # loop through the
array
   # referenced by
$array
 foreach my $scalar (@$ref_array) {
 print "$scalar\t";
 }
 print "\n";
 }
 To retrieve the formatted value of a cell you should use the {'Text'}
 property instead of the {'Value'} property. This returns exactly what is
 being displayed on the screen though! If the column is not wide enough,
you
 get a value of '##':

 my $array = $Sheet-Range("A8:B9")-{'Text'};


 --
--