aaronbaum2000 has asked for the wisdom of the Perl Monks concerning the following question:
Hello, I am writing a script to copy a range of cells from an Excel spreadsheet to a Word document. I want to keep the formatting of the range of Excel cells when I paste them into the word document. A simple copy and paste does not give me what I want (it seems to reformat the pasted cells in the word document to RTF and loses the cell/table structure). There is a method shown in the Word help that is called PasteExcelTable that I think may be my ticket, but I am having no luck using it through Win32::OLE. The code is shown below.
$range = $doc->Paragraphs($doc->Paragraphs->Count)->Range; $range->PasteExcelTable({'LinkedToExcel'} => 0, {'WordFormatting' => 0 +}, {'RTF' => 0}); #Gives me "Invalid number of parameter" #$range->PasteExcelTable({'LinkedToExcel' => 0, 'WordFormatting' = +> 0, 'RTF' => 0}); #Gives me "Command not available"
I'm confused about why in one instance above, it seems to find the method, but says it doesn't have the correct number of parameter, while in the other instance, it says the command is not available? I'm a total rookie on coding in any language, so be gentle... I can post more code if desired, but you'll really see the hack job I'm calling a script. Thanks in advance.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Trying to use Win32::OLE PasteExcelTable method
by dasgar (Priest) on Oct 02, 2014 at 04:58 UTC | |
by aaronbaum2000 (Initiate) on Oct 02, 2014 at 15:02 UTC | |
|
Re: Trying to use Win32::OLE PasteExcelTable method
by Anonymous Monk on Oct 01, 2014 at 23:54 UTC | |
by Anonymous Monk on Oct 02, 2014 at 00:01 UTC | |
by aaronbaum2000 (Initiate) on Oct 02, 2014 at 14:40 UTC | |
by Anonymous Monk on Oct 02, 2014 at 23:25 UTC |