Dear Monks,
I was trying to use perl WIN32:OLE package to automate excel plotting pivot table, one the problem I have is after I added fields to the pivot table, I want to choose one particular value of the filter field, so everytime I plot the pivot table I don't need to choose this value by hand, I was wondering how can OLE do that, which object method or property should I change.here is the code
my @filter=("Time","Place");
my $reffilterarr=\@filter;
# Open Excel File
my $xlBook = $xlApp->Workbooks->Open("$mdir\\$tbcsv");
my $worksheet = $xlBook->Worksheets("$table");
my $rng = $worksheet->UsedRange;
my $sheet2=$xlBook->Worksheets->Add;
my $rng2 = $xlBook->ActiveSheet->Range("A1:BZ97");
my $tbl = $sheet2->PivotTableWizard(1, $rng, $rng2, "MyPivotTable");
$tbl->AddFields($refrowarr, $refcolarr, $reffilterarr);
$tbl->ActiveFilters;
I want to choose a particular value in "Time" to filter the result. I was wondering where can I set this value.
thanks in advance
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.