in reply to Win32::OLE PasteSpecial - why does xlPasteColumnWidths do not work
This code works for me:
my $wsheet = $wbook->Worksheets(1); my $last_row_from_OLE = $wsheet->{UsedRange}->Rows()->Count(); my $last_col_from_OLE = $wsheet->{UsedRange}->Columns()->Count(); my $range = $wsheet->Range( $wsheet->Cells( 1, 1 ), $wsheet->Cells( $last_row_from_OLE, $last_col_from_OLE ) ); $range->Copy(); my $xlPasteColumnWidths = 8; foreach my $tab_name ( 1 .. 3 ) { my $wsheet2 = $wbook->Worksheets->Add( { after => $wbook->Worksheets( $wbook->Worksheets->{count} ) } + ); $wsheet2->{Name} = $tab_name; my $range2 = $wsheet2->Range( $wsheet2->Cells( 1, 1 ), $wsheet2->Cells( 1, 1 +) ); $range2->PasteSpecial( { Paste => $xlPasteColumnWidths } ); $wsheet2->Paste( ); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Win32::OLE PasteSpecial - why does xlPasteColumnWidths do not work
by woland99 (Beadle) on Apr 07, 2016 at 17:31 UTC |
In Section
Seekers of Perl Wisdom