Thanks a lot H.L.Mencken
I'm able to format my table now, and Yes I used Win32 to create a presentation.
Now can I add a chart in PPT like creating a table, I have the data for the chart in a array.
Just the command to cerate a chart in ppt would be very useful..
I have given the code that I'm using now, Please say how I can create a chart in the same slide which has a table
my $PptApp = Win32::OLE->GetActiveObject('PowerPoint.Application')||
+Win32::OLE->new('PowerPoint.Application', 'Quit');
$PptApp->{Visible} = 1;
#my $Presentation = $PptApp->Presentations->Add();
my $Presentation = $PptApp->Presentations->Open({FileName=>'C:\Users\n
+1013784\Desktop\New folder\weeklytemplate1.pptx',ReadOnly=>0});
my $value = 0;
my $AfterSlide = "Agenda";
my $SlideIndex = 1;
my $slides = Win32::OLE::Enum->new( $Presentation->Slides );
while ( my $slide = $slides->Next ) {
print "Slide_Name : " . $slide->Name . "\n";
my $shapes = Win32::OLE::Enum->new( $slide->Shapes );
SHAPE:
while ( my $shape = $shapes->Next ) {
my $type = $shape->PlaceholderFormat->Type;
if ( $type == ppPlaceholderTitle or $type == ppPlaceholderCent
+erTitle or $type == ppPlaceholderVerticalTitle) {
print "Title : |" . $shape->TextFrame->TextRange->text . "
+|\n";
if($shape->TextFrame->TextRange->text eq $AfterSlide){
$value = $SlideIndex + 1;
print "Put it on $SlideIndex\n";
} $SlideIndex++;
last SHAPE;
}
}
for (my $dev =0; $dev < $check ; $dev++){
my $Slide = $Presentation->Slides->Add({Index=>$value , Layout=>ppLayo
+utText});
$Slide->{Name} = "111 + $dev";
my $Title=$Slide->Shapes->{Title};
$Title->TextFrame->TextRange->{Text} ="Weekly Metrics - Closed Tick
+ets";
print( "Adding a 4 wide by 3 high table\n" );
my $table = $Slide->Shapes->AddTable( "$use", # Rows
8, # Cols
00, # X-axis
100 # Y-axis
);
$table->Table->Columns(4)->{'Width'} = 300;
$table->{'Left'} = 0;
$table->{'Top'} = 100;
my $columns = $table->Table->Columns->Count;
my $rows = $table->Table->Rows->Count;
my $cell = $table->Table->Rows(1)->Cells(2);
my $textframe = $cell->Shape->TextFrame;
$textframe->TextRange->{Text} = "$ticketno[0]";
$textframe->TextRange->Font->{Name} = "Arial";
$textframe->TextRange->Font->{Size} = "10";
my $cell = $table->Table->Rows(1)->Cells(4);
my $textframe = $cell->Shape->TextFrame;
$textframe->TextRange->{Text} = "$title[0]";
$textframe->TextRange->Font->{Name} = "Arial";
$textframe->TextRange->Font->{Size} = "10";
my $cell = $table->Table->Rows(1)->Cells(1);
my $textframe = $cell->Shape->TextFrame;
$textframe->TextRange->{Text} = "$cdate[0]";
$textframe->TextRange->Font->{Name} = "Arial";
$textframe->TextRange->Font->{Size} = "10";
my $cell = $table->Table->Rows(1)->Cells(3);
my $textframe = $cell->Shape->TextFrame;
$textframe->TextRange->{Text} = "$comp[0]";
$textframe->TextRange->Font->{Name} = "Arial";
$textframe->TextRange->Font->{Size} = "10";
my $cell = $table->Table->Rows(1)->Cells(6);
my $textframe = $cell->Shape->TextFrame;
$textframe->TextRange->{Text} = "$priority[0]";
$textframe->TextRange->Font->{Name} = "Arial";
$textframe->TextRange->Font->{Size} = "10";
my $cell = $table->Table->Rows(1)->Cells(7);
my $textframe = $cell->Shape->TextFrame;
$textframe->TextRange->{Text} = "$status[0]";
$textframe->TextRange->Font->{Name} = "Arial";
$textframe->TextRange->Font->{Size} = "10";
my $cell = $table->Table->Rows(1)->Cells(8);
my $textframe = $cell->Shape->TextFrame;
$textframe->TextRange->{Text} = "$mdate[0]";
$textframe->TextRange->Font->{Name} = "Arial";
$textframe->TextRange->Font->{Size} = "10";
my $cell = $table->Table->Rows(1)->Cells(5);
my $textframe = $cell->Shape->TextFrame;
$textframe->TextRange->{Text} = "$assigned[0]";
$textframe->TextRange->Font->{Name} = "Arial";
$textframe->TextRange->Font->{Size} = "10";
if ($dev == 0){
;
}
else {
$rows = $row + 11;
}
print $row;
for ( my $arun = 1; $row < $rows; $row++ ) {
######################################################
if ($row == $count) {last;}
if ($status[$row] eq "Closed" or $status[$row] eq "Resolved" o
+r $status[$row] eq "Status"){
my $cell = $table->Table->Rows($arun+1)->Cells(2);
my $textframe = $cell->Shape->TextFrame;
$textframe->TextRange->{Text} = "$ticketno[$row]";
$textframe->TextRange->Font->{Name} = "Arial";
$textframe->TextRange->Font->{Size} = "10";
######################################################
my $cell1 = $table->Table->Rows($arun+1)->Cells(4);
my $textframe1 = $cell1->Shape->TextFrame;
$textframe1->TextRange->{Text} = "$title[$row]";
$textframe1->TextRange->Font->{Name} = "Arial";
$textframe1->TextRange->Font->{Size} = "10";
######################################################
my $cell5 = $table->Table->Rows($arun+1)->Cells(1);
my $textframe1 = $cell5->Shape->TextFrame;
$textframe1->TextRange->{Text} = "$cdate[$row]";
$textframe1->TextRange->Font->{Name} = "Arial";
$textframe1->TextRange->Font->{Size} = "8";
######################################################
my $cell6 = $table->Table->Rows($arun+1)->Cells(3);
my $textframe1 = $cell6->Shape->TextFrame;
$textframe1->TextRange->{Text} = "$comp[$row]";
$textframe1->TextRange->Font->{Name} = "Arial";
$textframe1->TextRange->Font->{Size} = "10";
######################################################
my $cell7 = $table->Table->Rows($arun+1)->Cells(6);
my $textframe1 = $cell7->Shape->TextFrame;
$textframe1->TextRange->{Text} = "$priority[$row]";
$textframe1->TextRange->Font->{Name} = "Arial";
$textframe1->TextRange->Font->{Size} = "10";
######################################################
my $cell8 = $table->Table->Rows($arun+1)->Cells(7);
my $textframe1 = $cell8->Shape->TextFrame;
$textframe1->TextRange->{Text} = "$status[$row]";
$textframe1->TextRange->Font->{Name} = "Arial";
$textframe1->TextRange->Font->{Size} = "10";
######################################################
my $cell9 = $table->Table->Rows($arun+1)->Cells(8);
my $textframe1 = $cell9->Shape->TextFrame;
$textframe1->TextRange->{Text} = "$mdate[$row]";
$textframe1->TextRange->Font->{Name} = "Arial";
$textframe1->TextRange->Font->{Size} = "8";
######################################################
my $cell19 = $table->Table->Rows($arun+1)->Cells(5);
my $textframe1 = $cell19->Shape->TextFrame;
$textframe1->TextRange->{Text} = "$assigned[$row]";
$textframe1->TextRange->Font->{Name} = "Arial";
$textframe1->TextRange->Font->{Size} = "8";
######################################################
$arun++;
}
else{
$rows = $rows+1;
}
}
$value++;
if ($dev == ($check-2)){
$use = ($cl % 11)+1;
}
if ($dev == ($check-1)){
my $TextBox=$Slide->Shapes->AddTextbox({ Orientation=>1,
Left=>200,
Top=>500,
Width=>250,
Height=>250,});
$TextBox->TextFrame->TextRange->{Text} ="Total Tickets Closed = $cl
+";
}
}
|