Hi
I am extracting some data from my project webpage and dumping them in a excel sheet. The webpage has got a table on it showing some results and status of few job runs. It uses green to denote a 'pass' and red to denote a 'fail' like below :
<TD><FONT COLOR = "green">PASS</FONT></TD> <TD><FONT COLOR = "red">FAIL</FONT></TD>
I am able to successfully dump the content of the page in a excel sheet but not the colors of the table cells. How can I restore the colors as well when dumping the content in excel?
Below is my code
use Spreadsheet::WriteExcel; use HTML::TableExtract; require LWP::UserAgent; my $ua = new LWP::UserAgent(); my $request = HTTP::Request->new(GET=>"http://autoreport.nextgen.com") +; my $response ; $response = $ua->request($request); $response = $response->content(); # Create a new Excel file my $filename = "/home/user/result.xls"; my $workbook = Spreadsheet::WriteExcel->new($filename); # Add a worksheet my $worksheet = $workbook->add_worksheet('exec2'); # Define the format and add it to the worksheet my $format = $workbook->add_format( center_across => 1, bold => 1, size => 10, border => 4, color => 'black', bg_color => 'cyan', border_color => 'black', align => 'vcenter', ); my $te = HTML::TableExtract->new( keep_html => 0); $te->parse($response); foreach my $ts ($te->tables) { my $nrow=0; foreach my $row ($ts->rows) { my $ncol=0; foreach my $col (@$row) { $worksheet->write($nrow,$ncol++,$col) if defined $col; } $nrow++; } $nrow++; }
Thanks
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |