小编Pan*_*kaj的帖子

如何在Perl中禁止Excel的密码提示?

请告诉我一个抑制密码提示excel文件的解决方案.

    use Win32::OLE;

      my $xlApp = Win32::OLE->new('Excel.Application');

      $xlApp->{Visible} = 0;

      $xlApp->{DisplayAlerts} = 0;

      # Open excel file.
      my $xlBook = $xlApp->Workbooks->Open("C:\\Documents and Settings\\username\\Desktop\\testfile.xls");
      my $Sheet1 = $xlBook->Worksheets(1);

        my $row = 1;
        my $col = 1;

       $Sheet1->Cells($row,$col)->{'Value'} = 5;

        if (Win32::OLE->LastError) 
        {
                print "File protected";
        }

      $xlBook ->Close();

  undef $xlBook;
Run Code Online (Sandbox Code Playgroud)

passwords excel perl

2
推荐指数
1
解决办法
2124
查看次数

标签 统计

excel ×1

passwords ×1

perl ×1