Many thanks for you help.
The %p issue got solved after i changed "printf" to "print" as you suggested.
Below is the code snippet for my second issue (Unicode encodings)
#!/usr/bin/perl -w
use strict;
use warnings;
use Data::Dumper;
use Getopt::Long;
use Win32::OLE qw(in with);
use Win32::OLE::Const 'Microsoft Excel';
$Win32::OLE::Warn = 3; # die on errors.
+..
my $Excel = Win32::OLE->GetActiveObject('Excel.Application')
|| Win32::OLE->new('Excel.Application', 'Quit');
# open Excel file
my $Book = $Excel->Workbooks->Open("C:/Audio/perl/Project/Voice.xls");
my $Sheet = $Book->Worksheets('Feedback') ||
die( "No such worksheet gendata" );
my $row_start_tmp = 0;
my $row_end_tmp = 0;
my $eur_column = 0;
my $gom_column = 0;
my $nam_column = 0;
my $column_add = 0;
my @gm_out;
my $my_row = 0;
my $my_column = 0;
my $feedback_value = 0;
my $eur_gom_total = 0;
my $gom_nam_total = 0;
my $eur_nam_total = 0;
my $feedback_ID = 0;
#---------------------------------------------------------------------
+----------
# TR file name
my $fl = "FB_CHECK.csv";
$row_start_tmp = 2;
$row_end_tmp = 695;
$eur_column = 26;
$gom_column = 120;
my $i = 0;
open(FH, ">$fl") or die $!; # open the excel sheet for write
$feedback_ID = 3;
foreach my $row ($row_start_tmp..$row_end_tmp)
{
foreach my $col ($eur_column..$eur_column)
{
# skip empty cells
# next unless defined $Sheet->Cells($row,$column_value)->
+{'Value'};
$my_row = ($Sheet->Cells($row,$eur_column)->{'Value'});
$my_row =~ s/(^\s+|\s+$)//g;
$my_column = ($Sheet->Cells($row,$gom_column)->{'Value'});
$my_column =~ s/(^\s+|\s+$)//g;
$feedback_value = ($Sheet->Cells($row,$feedback_ID)->{'Val
+ue'});
$feedback_value =~ s/(^\s+|\s+$)//g;
if ($my_row ne $my_column)
{
printf " %s At ($row, $col) the row is %s and the colu
+mn is %s for EUR & NAM \n", $feedback_value, $my_row,$my_column;
push @gm_out, [ $feedback_value, $my_row,$my_column,0
+];
}
}
}
printf FH "\n";
$eur_gom_total = @gm_out;
printf FH "The Total mismatches between EUR & GOM is $eur_gom_tota
+l \n";
printf FH "\n";
printf FH "Below results for EUR & GOM \n";
printf FH "\n";
printf FH "Row value, EUR English Display Data, GOM English Displa
+y Data, NAM English Display Data \n";
my $out_size = @gm_out;
for($i=0;$i<$out_size;$i++)
{
print FH "$gm_out[$i][0],$gm_out[$i][1],$gm_out[$i][2],$gm_out
+[$i][3] \n";
}
In the Voice.xls sheet on a particular cell the content is some italy language (other than english) (i cant print since it prints like ???????. ???????)
When i try to print that cell contents to a CSV file it prints as ???????. ???????
I am not aware of unicode strings please help me on this
I got some idea about the issue. This is not because of unicode encodings because the string which causing the problem is not a unicode it is an mandarin language string
How do i print a mandarin language string in a spread sheet? Please help me on this........
|