简体   繁体   English

perl Spreadsheet :: WriteExcel如何在合并的单元格上编写公式

[英]perl Spreadsheet::WriteExcel how to write formula on merged cells

Experts, How can I write formula on merged field? 专家,如何在合并字段上写公式? The documentation talks about writing on a single cell. 该文档讨论有关在单个单元格上编写的问题。 I have also gone through the store formula and repeat formula. 我还浏览了商店公式并重复了公式。 However, I am not able to figure out what I need. 但是,我无法弄清楚我需要什么。 My formula is simple ; 我的公式很简单; just adding a bunch of columns. 只是添加一堆列。

I have cells D31:D33 merged and I want to write formula "=SUM(D15:D30)" in it. 我合并了单元格D31:D33,我想在其中编写公式“ = SUM(D15:D30)”。 How can I do it?. 我该怎么做?。 Any help would be greatly appreciated. 任何帮助将不胜感激。 $worksheet->merge_cells('D31:D33'); $ worksheet-> merge_cells( 'D31:D33'); $worksheet->write_formula('D31', '=SUM(D15:D30)', $hformat3); $ worksheet-> write_formula('D31','= SUM(D15:D30)',$ hformat3); The code above just puts the sum on cell D31 only. 上面的代码仅将总和放在单元格D31上。 I want this to spread on the whole merged field. 我希望这能传播到整个合并领域。

The second question that I have is, how can I remove unused rows? 我的第二个问题是,如何删除未使用的行?

Thank you very much. 非常感谢你。

perldoc Spreadsheet::WriteExcel says $worksheet->write('A4', '=SIN(PI()/4)'); perldoc Spreadsheet::WriteExcel$worksheet->write('A4', '=SIN(PI()/4)');

This example (copied almost verbatim from the documentation) works for me: 此示例(从文档中几乎逐字复制)对我有用:

use Spreadsheet::WriteExcel;
my $workbook = Spreadsheet::WriteExcel->new('perl.xls');
$worksheet   = $workbook->add_worksheet();
$worksheet->write('A1', '1');
$worksheet->write('A2', '1');
$worksheet->write('A3', '=SUM(A1:A2)');

A quick web search doesn't turn up anything on using Spreadsheet::WriteExcel for removing rows. 使用Spreadsheet::WriteExcel删除行可以快速进行网络搜索。 You'll probably find some other Perl modules to do that, like Win32::OLE mentiond in http://www.perlmonks.org/?node_id=952167 您可能会找到其他一些Perl模块来执行此操作,例如http://www.perlmonks.org/?node_id=952167中提到的Win32::OLE

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM