[PerlChina] China-pm Digest, Vol 21, Issue 4

Jim Zhang jim.zhang.china at gmail.com
Tue Jan 30 01:03:47 PST 2007


采用: perl  -MCPAN -e 'install Spreadsheet::ParseExcel"' 安装CPAN的包。
如果安装有问题,直接cd /your_binary; make install就可以。
测试程序见下面: 给我发邮件付费吧。希望你是个诚实的人哦!!经过测试!!
#!/usr/bin/perl

use Spreadsheet::ParseExcel;
use Spreadsheet::ParseExcel::SaveParser;

die "please input your excel file!\n" if(@ARGV<1);
my $file = $ARGV[0];
my $excel = new Spreadsheet::ParseExcel::SaveParser;
my $oBook = $excel->Parse($file);
my @data=('jim','ford');
#format: the insert data will use this format
my $iFmt = $oBook->{Worksheet}[0]->{Cells}[0][0]->{FormatNo};
#Addcell():第几个表,行,列,数据,[格式可选]
#第一个表,第一行第二列插入数据,使用第一行第一列的格式。
$oBook->AddCell(0, 0, 1, \@data, $iFmt);
#插入的这行没有格式
$oBook->AddCell(0, 1, 0, '304');
#插入的这行用单元格第一行第一列的格式
$oBook->AddCell(0, 1, 1, 'Kawai,Takanori', $iFmt);
#1.3 Save
$excel->SaveAs($oBook, $file);  # as the same name



2007/1/30, china-pm-request at pm.org <china-pm-request at pm.org>:
>
> Send China-pm mailing list submissions to
>         china-pm at pm.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         http://mail.pm.org/mailman/listinfo/china-pm
> or, via email, send a message with subject or body 'help' to
>         china-pm-request at pm.org
>
> You can reach the person managing the list at
>         china-pm-owner at pm.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of China-pm digest..."
>
>
> Today's Topics:
>
>    1. Re:  China-pm Digest, Vol 21, Issue 3 (Jim Zhang)
>    2. Re:  China-pm Digest, Vol 21, Issue 3 (Jeff Pang)
>    3. Re:  Want to get a module (Wan)
>    4. Re:  Want to get a module (Jeff Pang)
>    5. Re:  Want to get a module (Jeff Pang)
>    6. Re:  Want to get a module (Dongxu Ma)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 30 Jan 2007 14:11:41 +0800
> From: "Jim Zhang" <jim.zhang.china at gmail.com>
> Subject: Re: [PerlChina] China-pm Digest, Vol 21, Issue 3
> To: china-pm at pm.org
> Message-ID:
>         <1f1ee1a60701292211n504c6ac9sb100da989b31ecb2 at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> please clarify your meaning:
>
> &export_to_excel($filename, $location, \@data_array);
>
> $location is, for example, "B2",which means  Column B, Row 2.
> @data_array looks like:
> @AoA = (
>            [ "fred", "barney" ],
>            [ "george", "jane", "elroy" ],
>            [ "homer", "marge", "bart" ],
>     );
>
> insert all the data in @AoA=() into "ColumnB, Row2" or insert "fred" in
> B2,
> "barney" in B3, or others?
>
> 2007/1/30, china-pm-request at pm.org <china-pm-request at pm.org>:
> >
> > Send China-pm mailing list submissions to
> >         china-pm at pm.org
> >
> > To subscribe or unsubscribe via the World Wide Web, visit
> >         http://mail.pm.org/mailman/listinfo/china-pm
> > or, via email, send a message with subject or body 'help' to
> >         china-pm-request at pm.org
> >
> > You can reach the person managing the list at
> >         china-pm-owner at pm.org
> >
> > When replying, please edit your Subject line so it is more specific
> > than "Re: Contents of China-pm digest..."
> >
> >
> > Today's Topics:
> >
> >    1.  Want to get a module (Jeff Pang)
> >
> >
> > ----------------------------------------------------------------------
> >
> > Message: 1
> > Date: Mon, 29 Jan 2007 21:41:50 +0800 (GMT+08:00)
> > From: Jeff Pang <pangj at earthlink.net>
> > Subject: [PerlChina] Want to get a module
> > To: PerlList-China  <china-pm at pm.org>
> > Message-ID:
> >         <
> > 14734423.1170078110884.JavaMail.root at elwamui-huard.atl.sa.earthlink.net>
> >
> > Content-Type: text/plain; charset=UTF-8
> >
> > Hello,
> >
> > One of my friends asked the helps from me and hope I could write a Perl
> > module for handling Excel file for him.
> >
> > He would like to call the module's function like this:
> >
> > &export_to_excel($filename, $location, \@data_array);
> >
> > $location is, for example, "B2",which means  Column B, Row 2.
> > @data_array looks like:
> > @AoA = (
> >            [ "fred", "barney" ],
> >            [ "george", "jane", "elroy" ],
> >            [ "homer", "marge", "bart" ],
> >     );
> >
> > I'm not familiar with Windows and Excel at all.So I ask the helps here.I
> 'd
> > like to pay RMB 100 for the function.
> > I think if there is some a guy who is familiar with them,he could spend
> > about 1 hour to finish it.
> > Anyone who is interested in it,please contact with me.
> >
> > Thanks!
> >
> >
> > --
> > Books below translated by me to Chinese.
> > Practical mod_perl: http://home.earthlink.net/~pangj/mod_perl/
> > Squid the Definitive Guide: http://home.earthlink.net/~pangj/squid/
> >
> >
> > ------------------------------
> >
> > _______________________________________________
> > China-pm mailing list
> > China-pm at pm.org
> > http://mail.pm.org/mailman/listinfo/china-pm
> >
> > End of China-pm Digest, Vol 21, Issue 3
> > ***************************************
> >
>
>
>
> --
> Best regards,
>
> Jim Zhang
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://mail.pm.org/pipermail/china-pm/attachments/20070130/ae3480e7/attachment-0001.html
>
> ------------------------------
>
> Message: 2
> Date: Tue, 30 Jan 2007 01:16:18 -0500 (EST)
> From: Jeff Pang <pangj at earthlink.net>
> Subject: Re: [PerlChina] China-pm Digest, Vol 21, Issue 3
> To: china-pm at pm.org
> Message-ID:
>         <
> 23182906.1170137778963.JavaMail.root at elwamui-cypress.atl.sa.earthlink.net>
>
> Content-Type: text/plain; charset="utf-8"
>
> An HTML attachment was scrubbed...
> URL:
> http://mail.pm.org/pipermail/china-pm/attachments/20070130/321084f0/attachment-0001.html
>
> ------------------------------
>
> Message: 3
> Date: Tue, 30 Jan 2007 15:19:44 +0800
> From: Wan <wanmyome at gmail.com>
> Subject: Re: [PerlChina] Want to get a module
> To: Jeff Pang <pangj at earthlink.net>,  china-pm at pm.org
> Message-ID: <45BEF190.8000006 at gmail.com>
> Content-Type: text/plain; charset=UTF-8; format=flowed
>
> #!/usr/bin/perl
> use Win32::OLE;
> my $ex = Win32::OLE->new('Excel.Application') or die "oops\n";
> #$ex->{Visible} = 1;
> my $wb = $ex->Workbooks->Open("D:/new.xls");
> my $sheet = $wb->Worksheets(1);
> $sheet->cells(1,1)->{value} = "哈哈,不到10分钟就可以挣100块钱,幸福啊";
> $sheet->cells(2,1)->{value} = "不过这样拿你钱好像有点好像有点残忍";
> $wb->Save;
> $wb->Close;
> $ex->Quit;
>
> 你在网上查一下Excel.Application
>
>
> ------------------------------
>
> Message: 4
> Date: Tue, 30 Jan 2007 02:54:06 -0500 (EST)
> From: Jeff Pang <pangj at earthlink.net>
> Subject: Re: [PerlChina] Want to get a module
> To: Wan <wanmyome at gmail.com>, china-pm at pm.org
> Message-ID:
>         <
> 16700658.1170143646645.JavaMail.root at elwamui-cypress.atl.sa.earthlink.net>
>
> Content-Type: text/plain; charset=UTF-8
>
> Thanks.
> 他的目的是要能写一个已存在的excel文件,就是说某个excel文件已存在,他可以打开,并从指定位置($location)开始追加数据(@data)。你的这个函数能做到吗?能搞定我马上给你pay
> money.:)
>
> -----Original Message-----
> >From: Wan <wanmyome at gmail.com>
> >Sent: Jan 30, 2007 2:19 AM
> >To: Jeff Pang <pangj at earthlink.net>, china-pm at pm.org
> >Subject: Re: [PerlChina] Want to get a module
> >
> >#!/usr/bin/perl
> >use Win32::OLE;
> >my $ex = Win32::OLE->new('Excel.Application') or die "oops\n";
> >#$ex->{Visible} = 1;
> >my $wb = $ex->Workbooks->Open("D:/new.xls");
> >my $sheet = $wb->Worksheets(1);
> >$sheet->cells(1,1)->{value} = "哈哈,不到10分钟就可以挣100块钱,幸福啊";
> >$sheet->cells(2,1)->{value} = "不过这样拿你钱好像有点好像有点残忍";
> >$wb->Save;
> >$wb->Close;
> >$ex->Quit;
> >
> >你在网上查一下Excel.Application
>
>
> --
> Books below translated by me to Chinese.
> Practical mod_perl: http://home.earthlink.net/~pangj/mod_perl/
> Squid the Definitive Guide: http://home.earthlink.net/~pangj/squid/
>
>
> ------------------------------
>
> Message: 5
> Date: Tue, 30 Jan 2007 02:56:04 -0500 (EST)
> From: Jeff Pang <pangj at earthlink.net>
> Subject: Re: [PerlChina] Want to get a module
> To: china-pm at pm.org
> Message-ID:
>         <
> 7733530.1170143764356.JavaMail.root at elwamui-cypress.atl.sa.earthlink.net>
>
> Content-Type: text/plain; charset=UTF-8
>
>
> 另外,非常不好意思。他要求脚本在Linux上工作,呵呵。
>
>
> -----Original Message-----
> >From: Jeff Pang <pangj at earthlink.net>
> >Sent: Jan 30, 2007 2:54 AM
> >To: Wan <wanmyome at gmail.com>, china-pm at pm.org
> >Subject: Re: [PerlChina] Want to get a module
> >
> >Thanks.
> >他的目的是要能写一个已存在的excel文件,就是说某个excel文件已存在,他可以打开,并从指定位置($location)开始追加数据(@data)。你的这个函数能做到吗?能搞定我马上给你pay
> money.:)
> >
> >-----Original Message-----
> >>From: Wan <wanmyome at gmail.com>
> >>Sent: Jan 30, 2007 2:19 AM
> >>To: Jeff Pang <pangj at earthlink.net>, china-pm at pm.org
> >>Subject: Re: [PerlChina] Want to get a module
> >>
> >>#!/usr/bin/perl
> >>use Win32::OLE;
> >>my $ex = Win32::OLE->new('Excel.Application') or die "oops\n";
> >>#$ex->{Visible} = 1;
> >>my $wb = $ex->Workbooks->Open("D:/new.xls");
> >>my $sheet = $wb->Worksheets(1);
> >>$sheet->cells(1,1)->{value} = "哈哈,不到10分钟就可以挣100块钱,幸福啊";
> >>$sheet->cells(2,1)->{value} = "不过这样拿你钱好像有点好像有点残忍";
> >>$wb->Save;
> >>$wb->Close;
> >>$ex->Quit;
> >>
> >>你在网上查一下Excel.Application
> >
> >
> >--
> >Books below translated by me to Chinese.
> >Practical mod_perl: http://home.earthlink.net/~pangj/mod_perl/
> >Squid the Definitive Guide: http://home.earthlink.net/~pangj/squid/
> >_______________________________________________
> >China-pm mailing list
> >China-pm at pm.org
> >http://mail.pm.org/mailman/listinfo/china-pm
>
>
> --
> Books below translated by me to Chinese.
> Practical mod_perl: http://home.earthlink.net/~pangj/mod_perl/
> Squid the Definitive Guide: http://home.earthlink.net/~pangj/squid/
>
>
> ------------------------------
>
> Message: 6
> Date: Tue, 30 Jan 2007 16:03:19 +0800
> From: "Dongxu Ma" <dongxu.ma at gmail.com>
> Subject: Re: [PerlChina] Want to get a module
> To: "Jeff Pang" <pangj at earthlink.net>, china-pm at pm.org
> Message-ID:
>         <9bc0d5d20701300003i7127c231md9a70762672648f4 at mail.gmail.com>
> Content-Type: text/plain; charset="gb2312"
>
> Please _DO_ check CPAN
>
> http://search.cpan.org/~scesano/Spreadsheet-TieExcel-0.75/TieExcel.pod
>
> http://search.cpan.org/~jmcnamara/Spreadsheet-WriteExcel-2.18/lib/Spreadsheet/WriteExcel.pm
> http://www-128.ibm.com/developerworks/library/l-pexcel/
>
> On 1/30/07, Jeff Pang <pangj at earthlink.net> wrote:
> >
> >
> > 另外,非常不好意思。他要求脚本在Linux上工作,呵呵。
> >
> >
> > -----Original Message-----
> > >From: Jeff Pang <pangj at earthlink.net>
> > >Sent: Jan 30, 2007 2:54 AM
> > >To: Wan <wanmyome at gmail.com>, china-pm at pm.org
> > >Subject: Re: [PerlChina] Want to get a module
> > >
> > >Thanks.
> >
> >他的目的是要能写一个已存在的excel文件,就是说某个excel文件已存在,他可以打开,并从指定位置($location)开始追加数据(@data)。你的这个函数能做到吗?能搞定我马上给你pay
> > money.:)
> > >
> > >-----Original Message-----
> > >>From: Wan <wanmyome at gmail.com>
> > >>Sent: Jan 30, 2007 2:19 AM
> > >>To: Jeff Pang <pangj at earthlink.net>, china-pm at pm.org
> > >>Subject: Re: [PerlChina] Want to get a module
> > >>
> > >>#!/usr/bin/perl
> > >>use Win32::OLE;
> > >>my $ex = Win32::OLE->new('Excel.Application') or die "oops\n";
> > >>#$ex->{Visible} = 1;
> > >>my $wb = $ex->Workbooks->Open("D:/new.xls");
> > >>my $sheet = $wb->Worksheets(1);
> > >>$sheet->cells(1,1)->{value} = "哈哈,不到10分钟就可以挣100块钱,幸福啊";
> > >>$sheet->cells(2,1)->{value} = "不过这样拿你钱好像有点好像有点残忍";
> > >>$wb->Save;
> > >>$wb->Close;
> > >>$ex->Quit;
> > >>
> > >>你在网上查一下Excel.Application
> > >
> > >
> > >--
> > >Books below translated by me to Chinese.
> > >Practical mod_perl: http://home.earthlink.net/~pangj/mod_perl/
> > >Squid the Definitive Guide: http://home.earthlink.net/~pangj/squid/
> > >_______________________________________________
> > >China-pm mailing list
> > >China-pm at pm.org
> > >http://mail.pm.org/mailman/listinfo/china-pm
> >
> >
> > --
> > Books below translated by me to Chinese.
> > Practical mod_perl: http://home.earthlink.net/~pangj/mod_perl/
> > Squid the Definitive Guide: http://home.earthlink.net/~pangj/squid/
> > _______________________________________________
> > China-pm mailing list
> > China-pm at pm.org
> > http://mail.pm.org/mailman/listinfo/china-pm
>
>
>
>
> --
> Cheers, Dongxu
> __END__
> http://search.cpan.org/~dongxu
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://mail.pm.org/pipermail/china-pm/attachments/20070130/fd49e24e/attachment.html
>
> ------------------------------
>
> _______________________________________________
> China-pm mailing list
> China-pm at pm.org
> http://mail.pm.org/mailman/listinfo/china-pm
>
> End of China-pm Digest, Vol 21, Issue 4
> ***************************************
>



-- 
Best regards,

Jim Zhang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/china-pm/attachments/20070130/b6fd1575/attachment-0001.html 


More information about the China-pm mailing list