# Generate an Excel file my $ workbook = Spreadsheet: writeexcel-> New ('/home/loganalysis/data/Hudong/docsosearch/statkeywordstop100.xls '); # display formats of various data: My $ normalformat = $ workbook-> add_format (border => 1, align => "center", size => 12 ); my $ titleformat = $ workbook-> add_format (bg_color => "yellow", border => 1, align => "center", size => 12 ); my $ numformat = $ workbook-> add_format (num_format => '#, #0.00', border => 1, align => "Left "); my $ percentformat = $ workbook-> add_format (num_format => '#,# 0.00%', border => 1, align => "center "); my $ urlformat = $ workbook-> add_format (border => 1, align => "Left", size => 12 );
my $normalFormat = $workbook->add_format(border => 1,align => "left",size=>12);my $titleFormat = $workbook->add_format(border => 1,align=>"center",size=>12);my $numFormat = $workbook->add_format(bg_color => "27",border => 1,align=>"right",size=>12);my $tuchuFormat = $workbook->add_format(border => 1,align=>"left",size=>12);$tuchuFormat->set_bg_color('27');$tuchuFormat->set_bold();my $normalrightFormat = $workbook->add_format(border => 1,align => "right",size=>12);
# Generating an Excel table
My $ worksheet = $ workbook-> add_worksheet (T ("Encyclopedia"); my ($ row, $ col) = (0, 0 ); # initialize the header row $ worksheet-> write ($ row, $ Col ++, T ("classification"), $ titleformat); $ worksheet-> write ($ row, $ Col ++, T ("PV"), $ titleformat); $ worksheet-> write ($ row, $ Col ++, T ("ip "), $ titleformat); $ row ++; $ Col = 0; $ worksheet-> write ($ row, $ Col ++, T (""), $ tuchuformat ); $ worksheet-> write ($ row, $ Col ++, $ A, $ numformat); $ worksheet-> write ($ row, $ Col ++, $ B, $ numformat); $ row ++; $ Col = 0;
$ Worksheet-> set_column (0th, 40); # Set the width of the list, column width 40 $ worksheet-> set_column (, 30); # Set the width of the list, column 1, 2, width 30 $ workbook-> close ();