[問題] Perl 寫入 Excel 的問題

看板Perl作者 (里歐)時間8年前 (2015/12/02 14:23), 編輯推噓0(008)
留言8則, 3人參與, 最新討論串1/1
#!/usr/bin/perl use Win32::OLE; $xlApp = Win32::OLE->new('Excel.Application'); $xlApp->{Visible} = 1; # Create a new workbook $xlBook = $xlApp->Workbooks->Add; $col = $row = 1; $xlBook->write($row, $col, 'aa'); $xlBook->write(1, $col, 'bb'); $xlBook->write('A3', 123); exit; # Wait for user input... print "Press <return> to continue..."; $x = <STDIN>; # Clean up $xlBook->{Saved} = 1; $xlApp->Quit; $xlBook = 0; $xlApp = 0; print "All done."; 程式碼如上,不知道為何只能開啟Excel後,卻沒有在相對應位置輸入字 是語法有錯還是少安裝了什麼嗎?? -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 211.75.12.108 ※ 文章網址: https://www.ptt.cc/bbs/Perl/M.1449037415.A.5E0.html

12/02 16:01, , 1F
沒有用過 Win32::OLE.. QQ 不過我看說明裡面的範例
12/02 16:01, 1F

12/02 16:01, , 2F
儲存格的寫法是 $sheet->Cells(1,1)->{Value} = "foo";
12/02 16:01, 2F

12/02 16:01, , 3F
這樣欸?
12/02 16:01, 3F

12/02 16:01, , 4F

12/02 16:02, , 5F
$sheet = $xlBook->Worksheets(1);
12/02 16:02, 5F

12/02 16:33, , 6F
嗯?不然還有什麼其他的可以輸入Excel嘛!?
12/02 16:33, 6F

12/02 16:48, , 7F
看看 Spreadsheet::WriteExcel 或 Data::Table::Excel
12/02 16:48, 7F

12/02 21:34, , 8F
你的寫法和 sample 不一樣啊? 不試試 sample 的寫法嗎?
12/02 21:34, 8F
文章代碼(AID): #1MNevdNW (Perl)
文章代碼(AID): #1MNevdNW (Perl)