woland99 has asked for the wisdom of the Perl Monks concerning the following question:
Then I loop through tab names, add new tab and copy the header: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_r +ow_from_OLE, $last_col_from_OLE) ); $range->Copy(); my $xlPasteColumnWidths = 8; $range->PasteSpecial({Paste => $xlPasteColumnWidths});
The header is pasted in but without preserving column widths.foreach my $tab_name (@tab_names[1..(scalar @tab_names - 1)]){ my $wsheet2 = $wbook->Worksheets->Add( {after => $wbook->Worksheets +($wbook->Worksheets->{count})} ); $wsheet2->{Name} = $tab_name; $wsheet2->Paste(); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Win32::OLE PasteSpecial - why does xlPasteColumnWidths do not work
by Gangabass (Vicar) on Apr 05, 2016 at 05:38 UTC | |
by woland99 (Beadle) on Apr 07, 2016 at 17:31 UTC |