Ask a Question related to Perl / CGI, Design and Development.
-
Brian Helterline #1
Re: OLE Variant
Hi Ken,
"Ken Brown" <ken.brown@dialwrap.co.uk> wrote in message
news:bdshcf$t60$1@news6.svr.pol.co.uk...Syntax Error - there should not be quotes around $sheet.....> Trying to get excel formatted as dd/mm/yyyy into perl variable
>
> seems to be ruturning ole::variant but i cant get any sense out of return
> date
>
> $$item = Variant(VT_DATE, "$sheet->Cells(6,$CurCol)->{Value}");
A funny coincidence, if you run this:> $$item = $$item->Date("dd/MM/yyyy");
>
> it keeps returing 30/12/1899 - not overly helpful
>
> any ideas?
>
my $item = Variant(VT_DATE, 0 );
print $item->Date( "dd/MM/yyyy" );
what value to you get? (hint: 30/12/1899)
It seems you don't have a value in Cells(6,$CurCol)
I think you may be over working the problem. The value returned from the
cell
will already be a string that looks like a date. (At least it does on my
system)
One thing to note: if Excel has the date formatted as "dd/mm/yyyy", when I
get
the value of the cell, it looks like "mm/dd/yyyy" which is my default.
E.g. On my system, if the excel cell has the format dd/mm/yyyy and contains
Jan 15, 2003, Excel displays it as 15/01/2003 but if you execute:
print $sheet->Cells(6,$CurCol)->{Value}
I get '1/15/2003'
-brian
Brian Helterline Guest
-
SELECT * variant idea, is there something like this...
Hi Often I find myself working in a query where I need to select one or two fields from source table A as renamed objects ( usually to prevent... -
variant as in parameter
Consider the following: there's a COM component that expects one parameter, the type can be either a BSTR or IDispatch *. I wanted to use a... -
passing C++ object in VARIANT
I hope I unerstand the question correctly but normally its done like this. IDispatch* pDisp VariantInit(rVal); if (SUCCEEDED(hr =... -
UDF Parameters always Variant - help!!
If I make a dataadapter containing something like "Select * from MyFunc(@a)", the parameter object is created as a Variant (even though the UDF... -
example for using sql variant
Hi! Can anyone tell me a good example where to use the datatype sql variant? Thanks Jan -
Ken Brown #2
OLE Variant
Trying to get excel formatted as dd/mm/yyyy into perl variable
seems to be ruturning ole::variant but i cant get any sense out of return
date
$$item = Variant(VT_DATE, "$sheet->Cells(6,$CurCol)->{Value}");
$$item = $$item->Date("dd/MM/yyyy");
it keeps returing 30/12/1899 - not overly helpful
any ideas?
Ken Brown Guest
-
Ken Brown #3
Re: OLE Variant
Checked it out and you were right it does return a date once I sorted things
out
But if the field has a custom date format then it returns a variant
And god only knows how excel is outputting as nothing will format it
correctly
However - simple approach - I just reformat cell before I read it so I know
what I'm reading.
Thanks for the sanity check - simple is best - I just got a bit carried away
for a while
Ken
"Brian Helterline" <brian_helterline@hp.com> wrote in message
news:3f01faba$1@usenet01.boi.hp.com...return> Hi Ken,
>
> "Ken Brown" <ken.brown@dialwrap.co.uk> wrote in message
> news:bdshcf$t60$1@news6.svr.pol.co.uk...> > Trying to get excel formatted as dd/mm/yyyy into perl variable
> >
> > seems to be ruturning ole::variant but i cant get any sense out ofcontains>> > date
> >
> > $$item = Variant(VT_DATE, "$sheet->Cells(6,$CurCol)->{Value}");
> Syntax Error - there should not be quotes around $sheet.....
>>> > $$item = $$item->Date("dd/MM/yyyy");
> >
> > it keeps returing 30/12/1899 - not overly helpful
> >
> > any ideas?
> >
> A funny coincidence, if you run this:
>
> my $item = Variant(VT_DATE, 0 );
> print $item->Date( "dd/MM/yyyy" );
>
> what value to you get? (hint: 30/12/1899)
>
> It seems you don't have a value in Cells(6,$CurCol)
>
> I think you may be over working the problem. The value returned from the
> cell
> will already be a string that looks like a date. (At least it does on my
> system)
>
> One thing to note: if Excel has the date formatted as "dd/mm/yyyy", when I
> get
> the value of the cell, it looks like "mm/dd/yyyy" which is my default.
> E.g. On my system, if the excel cell has the format dd/mm/yyyy and> Jan 15, 2003, Excel displays it as 15/01/2003 but if you execute:
>
> print $sheet->Cells(6,$CurCol)->{Value}
>
> I get '1/15/2003'
>
> -brian
>
>
Ken Brown Guest



Reply With Quote

